Merge branch 'linus' into core/generic-dma-coherent
authorIngo Molnar <mingo@elte.hu>
Fri, 18 Jul 2008 19:13:20 +0000 (21:13 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 18 Jul 2008 19:13:20 +0000 (21:13 +0200)
Conflicts:

kernel/Makefile

Signed-off-by: Ingo Molnar <mingo@elte.hu>
1  2 
arch/x86/Kconfig
arch/x86/kernel/pci-dma.c
kernel/Makefile

diff --combined arch/x86/Kconfig
@@@ -23,9 -23,10 +23,11 @@@ config X8
        select HAVE_OPROFILE
        select HAVE_KPROBES
        select HAVE_KRETPROBES
+       select HAVE_DYNAMIC_FTRACE
+       select HAVE_FTRACE
        select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
        select HAVE_ARCH_KGDB if !X86_VOYAGER
 +      select HAVE_GENERIC_DMA_COHERENT if X86_32
  
  config ARCH_DEFCONFIG
        string
@@@ -122,7 -123,7 +124,7 @@@ config ARCH_HAS_CACHE_LINE_SIZ
        def_bool y
  
  config HAVE_SETUP_PER_CPU_AREA
-       def_bool X86_64 || (X86_SMP && !X86_VOYAGER)
+       def_bool X86_64_SMP || (X86_SMP && !X86_VOYAGER)
  
  config HAVE_CPUMASK_OF_CPU_MAP
        def_bool X86_64_SMP
@@@ -169,6 -170,7 +171,7 @@@ config GENERIC_PENDING_IR
  config X86_SMP
        bool
        depends on SMP && ((X86_32 && !X86_VOYAGER) || X86_64)
+       select USE_GENERIC_SMP_HELPERS
        default y
  
  config X86_32_SMP
@@@ -182,12 -184,12 +185,12 @@@ config X86_64_SM
  config X86_HT
        bool
        depends on SMP
-       depends on (X86_32 && !(X86_VISWS || X86_VOYAGER)) || X86_64
+       depends on (X86_32 && !X86_VOYAGER) || X86_64
        default y
  
  config X86_BIOS_REBOOT
        bool
-       depends on !X86_VISWS && !X86_VOYAGER
+       depends on !X86_VOYAGER
        default y
  
  config X86_TRAMPOLINE
@@@ -231,6 -233,26 +234,26 @@@ config SM
  
          If you don't know what to do here, say N.
  
+ config X86_FIND_SMP_CONFIG
+       def_bool y
+       depends on X86_MPPARSE || X86_VOYAGER
+ if ACPI
+ config X86_MPPARSE
+       def_bool y
+       bool "Enable MPS table"
+       depends on X86_LOCAL_APIC
+       help
+         For old smp systems that do not have proper acpi support. Newer systems
+         (esp with 64bit cpus) with acpi support, MADT and DSDT will override it
+ endif
+ if !ACPI
+ config X86_MPPARSE
+       def_bool y
+       depends on X86_LOCAL_APIC
+ endif
  choice
        prompt "Subarchitecture Type"
        default X86_PC
@@@ -252,7 -274,7 +275,7 @@@ config X86_ELA
  
  config X86_VOYAGER
        bool "Voyager (NCR)"
-       depends on X86_32 && (SMP || BROKEN)
+       depends on X86_32 && (SMP || BROKEN) && !PCI
        help
          Voyager is an MCA-based 32-way capable SMP architecture proprietary
          to NCR Corp.  Machine classes 345x/35xx/4100/51xx are Voyager-based.
          If you do not specifically know you have a Voyager based machine,
          say N here, otherwise the kernel you build will not be bootable.
  
+ config X86_GENERICARCH
+        bool "Generic architecture"
+       depends on X86_32
+        help
+           This option compiles in the NUMAQ, Summit, bigsmp, ES7000, default
+         subarchitectures.  It is intended for a generic binary kernel.
+         if you select them all, kernel will probe it one by one. and will
+         fallback to default.
+ if X86_GENERICARCH
  config X86_NUMAQ
        bool "NUMAQ (IBM/Sequent)"
-       depends on SMP && X86_32
+       depends on SMP && X86_32 && PCI && X86_MPPARSE
        select NUMA
        help
-         This option is used for getting Linux to run on a (IBM/Sequent) NUMA
-         multiquad box. This changes the way that processors are bootstrapped,
-         and uses Clustered Logical APIC addressing mode instead of Flat Logical.
-         You will need a new lynxer.elf file to flash your firmware with - send
-         email to <Martin.Bligh@us.ibm.com>.
+         This option is used for getting Linux to run on a NUMAQ (IBM/Sequent)
+         NUMA multiquad box. This changes the way that processors are
+         bootstrapped, and uses Clustered Logical APIC addressing mode instead
+         of Flat Logical.  You will need a new lynxer.elf file to flash your
+         firmware with - send email to <Martin.Bligh@us.ibm.com>.
  
  config X86_SUMMIT
        bool "Summit/EXA (IBM x440)"
          This option is needed for IBM systems that use the Summit/EXA chipset.
          In particular, it is needed for the x440.
  
-         If you don't have one of these computers, you should say N here.
-         If you want to build a NUMA kernel, you must select ACPI.
+ config X86_ES7000
+       bool "Support for Unisys ES7000 IA32 series"
+       depends on X86_32 && SMP
+       help
+         Support for Unisys ES7000 systems.  Say 'Y' here if this kernel is
+         supposed to run on an IA32-based Unisys ES7000 system.
  
  config X86_BIGSMP
-       bool "Support for other sub-arch SMP systems with more than 8 CPUs"
+       bool "Support for big SMP systems with more than 8 CPUs"
        depends on X86_32 && SMP
        help
          This option is needed for the systems that have more than 8 CPUs
          and if the system is not of any sub-arch type above.
  
-         If you don't have such a system, you should say N here.
- config X86_VISWS
-       bool "SGI 320/540 (Visual Workstation)"
-       depends on X86_32
-       help
-         The SGI Visual Workstation series is an IA32-based workstation
-         based on SGI systems chips with some legacy PC hardware attached.
-         Say Y here to create a kernel to run on the SGI 320 or 540.
-         A kernel compiled for the Visual Workstation will not run on PCs
-         and vice versa. See <file:Documentation/sgi-visws.txt> for details.
- config X86_GENERICARCH
-        bool "Generic architecture (Summit, bigsmp, ES7000, default)"
-       depends on X86_32
-        help
-           This option compiles in the Summit, bigsmp, ES7000, default subarchitectures.
-         It is intended for a generic binary kernel.
-         If you want a NUMA kernel, select ACPI.   We need SRAT for NUMA.
- config X86_ES7000
-       bool "Support for Unisys ES7000 IA32 series"
-       depends on X86_32 && SMP
-       help
-         Support for Unisys ES7000 systems.  Say 'Y' here if this kernel is
-         supposed to run on an IA32-based Unisys ES7000 system.
-         Only choose this option if you have such a system, otherwise you
-         should say N here.
+ endif
  
  config X86_RDC321X
        bool "RDC R-321x SoC"
  config X86_VSMP
        bool "Support for ScaleMP vSMP"
        select PARAVIRT
-       depends on X86_64
+       depends on X86_64 && PCI
        help
          Support for ScaleMP vSMP systems.  Say 'Y' here if this kernel is
          supposed to run on these EM64T-based machines.  Only choose this option
  
  endchoice
  
+ config X86_VISWS
+       bool "SGI 320/540 (Visual Workstation)"
+       depends on X86_32 && PCI && !X86_VOYAGER && X86_MPPARSE && PCI_GODIRECT
+       help
+         The SGI Visual Workstation series is an IA32-based workstation
+         based on SGI systems chips with some legacy PC hardware attached.
+         Say Y here to create a kernel to run on the SGI 320 or 540.
+         A kernel compiled for the Visual Workstation will run on general
+         PCs as well. See <file:Documentation/sgi-visws.txt> for details.
  config SCHED_NO_NO_OMIT_FRAME_POINTER
        def_bool y
        prompt "Single-depth WCHAN output"
@@@ -374,7 -394,7 +395,7 @@@ config VM
        bool "VMI Guest support"
        select PARAVIRT
        depends on X86_32
-       depends on !(X86_VISWS || X86_VOYAGER)
+       depends on !X86_VOYAGER
        help
          VMI provides a paravirtualized interface to the VMware ESX server
          (it could be used by other hypervisors in theory too, but is not
@@@ -385,7 -405,7 +406,7 @@@ config KVM_CLOC
        bool "KVM paravirtualized clock"
        select PARAVIRT
        select PARAVIRT_CLOCK
-       depends on !(X86_VISWS || X86_VOYAGER)
+       depends on !X86_VOYAGER
        help
          Turning on this option will allow you to run a paravirtualized clock
          when running over the KVM hypervisor. Instead of relying on a PIT
  config KVM_GUEST
        bool "KVM Guest support"
        select PARAVIRT
-       depends on !(X86_VISWS || X86_VOYAGER)
+       depends on !X86_VOYAGER
        help
         This option enables various optimizations for running under the KVM
         hypervisor.
@@@ -405,7 -425,7 +426,7 @@@ source "arch/x86/lguest/Kconfig
  
  config PARAVIRT
        bool "Enable paravirtualization code"
-       depends on !(X86_VISWS || X86_VOYAGER)
+       depends on !X86_VOYAGER
        help
          This changes the kernel so it can modify itself when it is run
          under a hypervisor, potentially improving performance significantly
@@@ -418,51 -438,32 +439,32 @@@ config PARAVIRT_CLOC
  
  endif
  
- config MEMTEST_BOOTPARAM
-       bool "Memtest boot parameter"
+ config PARAVIRT_DEBUG
+        bool "paravirt-ops debugging"
+        depends on PARAVIRT && DEBUG_KERNEL
+        help
+          Enable to debug paravirt_ops internals.  Specifically, BUG if
+        a paravirt_op is missing when it is called.
+ config MEMTEST
+       bool "Memtest"
        depends on X86_64
-       default y
        help
          This option adds a kernel parameter 'memtest', which allows memtest
-         to be disabled at boot.  If this option is selected, memtest
-         functionality can be disabled with memtest=0 on the kernel
-         command line.  The purpose of this option is to allow a single
-         kernel image to be distributed with memtest built in, but not
-         necessarily enabled.
-         If you are unsure how to answer this question, answer Y.
- config MEMTEST_BOOTPARAM_VALUE
-       int "Memtest boot parameter default value (0-4)"
-       depends on MEMTEST_BOOTPARAM
-       range 0 4
-       default 0
-       help
-         This option sets the default value for the kernel parameter
-         'memtest', which allows memtest to be disabled at boot.  If this
-         option is set to 0 (zero), the memtest kernel parameter will
-         default to 0, disabling memtest at bootup.  If this option is
-         set to 4, the memtest kernel parameter will default to 4,
-         enabling memtest at bootup, and use that as pattern number.
-         If you are unsure how to answer this question, answer 0.
- config ACPI_SRAT
-       def_bool y
-       depends on X86_32 && ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH)
-       select ACPI_NUMA
- config HAVE_ARCH_PARSE_SRAT
-       def_bool y
-       depends on ACPI_SRAT
+         to be set.
+               memtest=0, mean disabled; -- default
+               memtest=1, mean do 1 test pattern;
+               ...
+               memtest=4, mean do 4 test patterns.
+         If you are unsure how to answer this question, answer N.
  
  config X86_SUMMIT_NUMA
        def_bool y
-       depends on X86_32 && NUMA && (X86_SUMMIT || X86_GENERICARCH)
+       depends on X86_32 && NUMA && X86_GENERICARCH
  
  config X86_CYCLONE_TIMER
        def_bool y
-       depends on X86_32 && X86_SUMMIT || X86_GENERICARCH
+       depends on X86_GENERICARCH
  
  config ES7000_CLUSTERED_APIC
        def_bool y
@@@ -550,6 -551,21 +552,21 @@@ config CALGARY_IOMMU_ENABLED_BY_DEFAUL
          Calgary anyway, pass 'iommu=calgary' on the kernel command line.
          If unsure, say Y.
  
+ config AMD_IOMMU
+       bool "AMD IOMMU support"
+       select SWIOTLB
+       depends on X86_64 && PCI && ACPI
+       help
+         With this option you can enable support for AMD IOMMU hardware in
+         your system. An IOMMU is a hardware component which provides
+         remapping of DMA memory accesses from devices. With an AMD IOMMU you
+         can isolate the the DMA memory of different devices and protect the
+         system from misbehaving device drivers or hardware.
+         You can find out if your system has an AMD IOMMU if you look into
+         your BIOS for an option to enable it or if you have an IVRS ACPI
+         table.
  # need this always selected by IOMMU for the VIA workaround
  config SWIOTLB
        bool
          3 GB of memory. If unsure, say Y.
  
  config IOMMU_HELPER
-       def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB)
+       def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU)
+ config MAXSMP
+       bool "Configure Maximum number of SMP Processors and NUMA Nodes"
+       depends on X86_64 && SMP
+       default n
+       help
+         Configure maximum number of CPUS and NUMA Nodes for this architecture.
+         If unsure, say N.
  
+ if MAXSMP
  config NR_CPUS
-       int "Maximum number of CPUs (2-255)"
-       range 2 255
+       int
+       default "4096"
+ endif
+ if !MAXSMP
+ config NR_CPUS
+       int "Maximum number of CPUs (2-4096)"
+       range 2 4096
        depends on SMP
        default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
        default "8"
        help
          This allows you to specify the maximum number of CPUs which this
-         kernel will support.  The maximum supported value is 255 and the
+         kernel will support.  The maximum supported value is 4096 and the
          minimum value which makes sense is 2.
  
          This is purely to save memory - each supported CPU adds
          approximately eight kilobytes to the kernel image.
+ endif
  
  config SCHED_SMT
        bool "SMT (Hyperthreading) scheduler support"
@@@ -599,7 -630,7 +631,7 @@@ source "kernel/Kconfig.preempt
  
  config X86_UP_APIC
        bool "Local APIC support on uniprocessors"
-       depends on X86_32 && !SMP && !(X86_VISWS || X86_VOYAGER || X86_GENERICARCH)
+       depends on X86_32 && !SMP && !(X86_VOYAGER || X86_GENERICARCH)
        help
          A local APIC (Advanced Programmable Interrupt Controller) is an
          integrated interrupt controller in the CPU. If you have a single-CPU
@@@ -624,11 -655,11 +656,11 @@@ config X86_UP_IOAPI
  
  config X86_LOCAL_APIC
        def_bool y
-       depends on X86_64 || (X86_32 && (X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH))
+       depends on X86_64 || (X86_32 && (X86_UP_APIC || (SMP && !X86_VOYAGER) || X86_GENERICARCH))
  
  config X86_IO_APIC
        def_bool y
-       depends on X86_64 || (X86_32 && (X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH))
+       depends on X86_64 || (X86_32 && (X86_UP_IOAPIC || (SMP && !X86_VOYAGER) || X86_GENERICARCH))
  
  config X86_VISWS_APIC
        def_bool y
@@@ -682,7 -713,7 +714,7 @@@ config X86_MCE_NONFATA
  
  config X86_MCE_P4THERMAL
        bool "check for P4 thermal throttling interrupt."
-       depends on X86_32 && X86_MCE && (X86_UP_APIC || SMP) && !X86_VISWS
+       depends on X86_32 && X86_MCE && (X86_UP_APIC || SMP)
        help
          Enabling this feature will cause a message to be printed when the P4
          enters thermal throttling.
@@@ -912,9 -943,9 +944,9 @@@ config X86_PA
  config NUMA
        bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)"
        depends on SMP
-       depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) && EXPERIMENTAL)
+       depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI) && EXPERIMENTAL)
        default n if X86_PC
-       default y if (X86_NUMAQ || X86_SUMMIT)
+       default y if (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP)
        help
          Enable NUMA (Non Uniform Memory Access) support.
          The kernel will try to allocate memory used by a CPU on the
@@@ -966,13 -997,25 +998,25 @@@ config NUMA_EM
          into virtual nodes when booted with "numa=fake=N", where N is the
          number of nodes. This is only useful for debugging.
  
+ if MAXSMP
  config NODES_SHIFT
-       int "Max num nodes shift(1-15)"
-       range 1 15  if X86_64
+       int
+       default "9"
+ endif
+ if !MAXSMP
+ config NODES_SHIFT
+       int "Maximum NUMA Nodes (as a power of 2)"
+       range 1 9   if X86_64
        default "6" if X86_64
        default "4" if X86_NUMAQ
        default "3"
        depends on NEED_MULTIPLE_NODES
+       help
+         Specify the maximum number of NUMA Nodes available on the target
+         system.  Increases memory reserved to accomodate various tables.
+ endif
  
  config HAVE_ARCH_BOOTMEM_NODE
        def_bool y
@@@ -1091,6 -1134,37 +1135,37 @@@ config MTR
  
          See <file:Documentation/mtrr.txt> for more information.
  
+ config MTRR_SANITIZER
+       bool
+       prompt "MTRR cleanup support"
+       depends on MTRR
+       help
+         Convert MTRR layout from continuous to discrete, so X drivers can
+         add writeback entries.
+         Can be disabled with disable_mtrr_cleanup on the kernel command line.
+         The largest mtrr entry size for a continous block can be set with
+         mtrr_chunk_size.
+         If unsure, say N.
+ config MTRR_SANITIZER_ENABLE_DEFAULT
+       int "MTRR cleanup enable value (0-1)"
+       range 0 1
+       default "0"
+       depends on MTRR_SANITIZER
+       help
+         Enable mtrr cleanup default value
+ config MTRR_SANITIZER_SPARE_REG_NR_DEFAULT
+       int "MTRR cleanup spare reg num (0-7)"
+       range 0 7
+       default "1"
+       depends on MTRR_SANITIZER
+       help
+         mtrr cleanup spare entries default, it can be changed via
+         mtrr_spare_reg_nr=N on the kernel command line.
  config X86_PAT
        bool
        prompt "x86 PAT support"
@@@ -1191,7 -1265,6 +1266,6 @@@ config KEXE
  
  config CRASH_DUMP
        bool "kernel crash dumps (EXPERIMENTAL)"
-       depends on EXPERIMENTAL
        depends on X86_64 || (X86_32 && HIGHMEM)
        help
          Generate crash dump after being started by kexec.
@@@ -1340,7 -1413,7 +1414,7 @@@ config X86_APM_BOO
  
  menuconfig APM
        tristate "APM (Advanced Power Management) BIOS support"
-       depends on X86_32 && PM_SLEEP && !X86_VISWS
+       depends on X86_32 && PM_SLEEP
        ---help---
          APM is a BIOS specification for saving power using several different
          techniques. This is mostly useful for battery powered laptops with
@@@ -1476,8 -1549,7 +1550,7 @@@ endmen
  menu "Bus options (PCI etc.)"
  
  config PCI
-       bool "PCI support" if !X86_VISWS && !X86_VSMP
-       depends on !X86_VOYAGER
+       bool "PCI support"
        default y
        select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC)
        help
  
  choice
        prompt "PCI access mode"
-       depends on X86_32 && PCI && !X86_VISWS
+       depends on X86_32 && PCI
        default PCI_GOANY
        ---help---
          On PCI systems, the BIOS can be used to detect the PCI devices and
@@@ -1525,12 -1597,12 +1598,12 @@@ endchoic
  
  config PCI_BIOS
        def_bool y
-       depends on X86_32 && !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY)
+       depends on X86_32 && PCI && (PCI_GOBIOS || PCI_GOANY)
  
  # x86-64 doesn't support PCI BIOS access from long mode so always go direct.
  config PCI_DIRECT
        def_bool y
-       depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC) || X86_VISWS)
+       depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC))
  
  config PCI_MMCONFIG
        def_bool y
@@@ -1590,7 -1662,7 +1663,7 @@@ if X86_3
  
  config ISA
        bool "ISA support"
-       depends on !(X86_VOYAGER || X86_VISWS)
+       depends on !X86_VOYAGER
        help
          Find out whether you have ISA slots on your motherboard.  ISA is the
          name of a bus system, i.e. the way the CPU talks to the other stuff
@@@ -1617,7 -1689,7 +1690,7 @@@ config EIS
  source "drivers/eisa/Kconfig"
  
  config MCA
-       bool "MCA support" if !(X86_VISWS || X86_VOYAGER)
+       bool "MCA support" if !X86_VOYAGER
        default y if X86_VOYAGER
        help
          MicroChannel Architecture is found in some IBM PS/2 machines and
@@@ -7,6 -7,7 +7,7 @@@
  #include <asm/dma.h>
  #include <asm/gart.h>
  #include <asm/calgary.h>
+ #include <asm/amd_iommu.h>
  
  int forbid_dac __read_mostly;
  EXPORT_SYMBOL(forbid_dac);
@@@ -74,13 -75,17 +75,17 @@@ early_param("dma32_size", parse_dma32_s
  void __init dma32_reserve_bootmem(void)
  {
        unsigned long size, align;
-       if (end_pfn <= MAX_DMA32_PFN)
+       if (max_pfn <= MAX_DMA32_PFN)
                return;
  
+       /*
+        * check aperture_64.c allocate_aperture() for reason about
+        * using 512M as goal
+        */
        align = 64ULL<<20;
        size = round_up(dma32_bootmem_size, align);
        dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align,
-                                __pa(MAX_DMA_ADDRESS));
+                                512ULL<<20);
        if (dma32_bootmem_ptr)
                dma32_bootmem_size = size;
        else
  }
  static void __init dma32_free_bootmem(void)
  {
-       int node;
  
-       if (end_pfn <= MAX_DMA32_PFN)
+       if (max_pfn <= MAX_DMA32_PFN)
                return;
  
        if (!dma32_bootmem_ptr)
                return;
  
-       for_each_online_node(node)
-               free_bootmem_node(NODE_DATA(node), __pa(dma32_bootmem_ptr),
-                                 dma32_bootmem_size);
+       free_bootmem(__pa(dma32_bootmem_ptr), dma32_bootmem_size);
  
        dma32_bootmem_ptr = NULL;
        dma32_bootmem_size = 0;
@@@ -122,6 -124,8 +124,8 @@@ void __init pci_iommu_alloc(void
  
        detect_intel_iommu();
  
+       amd_iommu_detect();
  #ifdef CONFIG_SWIOTLB
        pci_swiotlb_init();
  #endif
@@@ -197,6 -201,124 +201,6 @@@ static __init int iommu_setup(char *p
  }
  early_param("iommu", iommu_setup);
  
 -#ifdef CONFIG_X86_32
 -int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
 -                              dma_addr_t device_addr, size_t size, int flags)
 -{
 -      void __iomem *mem_base = NULL;
 -      int pages = size >> PAGE_SHIFT;
 -      int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);
 -
 -      if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0)
 -              goto out;
 -      if (!size)
 -              goto out;
 -      if (dev->dma_mem)
 -              goto out;
 -
 -      /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
 -
 -      mem_base = ioremap(bus_addr, size);
 -      if (!mem_base)
 -              goto out;
 -
 -      dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
 -      if (!dev->dma_mem)
 -              goto out;
 -      dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
 -      if (!dev->dma_mem->bitmap)
 -              goto free1_out;
 -
 -      dev->dma_mem->virt_base = mem_base;
 -      dev->dma_mem->device_base = device_addr;
 -      dev->dma_mem->size = pages;
 -      dev->dma_mem->flags = flags;
 -
 -      if (flags & DMA_MEMORY_MAP)
 -              return DMA_MEMORY_MAP;
 -
 -      return DMA_MEMORY_IO;
 -
 - free1_out:
 -      kfree(dev->dma_mem);
 - out:
 -      if (mem_base)
 -              iounmap(mem_base);
 -      return 0;
 -}
 -EXPORT_SYMBOL(dma_declare_coherent_memory);
 -
 -void dma_release_declared_memory(struct device *dev)
 -{
 -      struct dma_coherent_mem *mem = dev->dma_mem;
 -
 -      if (!mem)
 -              return;
 -      dev->dma_mem = NULL;
 -      iounmap(mem->virt_base);
 -      kfree(mem->bitmap);
 -      kfree(mem);
 -}
 -EXPORT_SYMBOL(dma_release_declared_memory);
 -
 -void *dma_mark_declared_memory_occupied(struct device *dev,
 -                                      dma_addr_t device_addr, size_t size)
 -{
 -      struct dma_coherent_mem *mem = dev->dma_mem;
 -      int pos, err;
 -      int pages = (size + (device_addr & ~PAGE_MASK) + PAGE_SIZE - 1);
 -
 -      pages >>= PAGE_SHIFT;
 -
 -      if (!mem)
 -              return ERR_PTR(-EINVAL);
 -
 -      pos = (device_addr - mem->device_base) >> PAGE_SHIFT;
 -      err = bitmap_allocate_region(mem->bitmap, pos, get_order(pages));
 -      if (err != 0)
 -              return ERR_PTR(err);
 -      return mem->virt_base + (pos << PAGE_SHIFT);
 -}
 -EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
 -
 -static int dma_alloc_from_coherent_mem(struct device *dev, ssize_t size,
 -                                     dma_addr_t *dma_handle, void **ret)
 -{
 -      struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
 -      int order = get_order(size);
 -
 -      if (mem) {
 -              int page = bitmap_find_free_region(mem->bitmap, mem->size,
 -                                                   order);
 -              if (page >= 0) {
 -                      *dma_handle = mem->device_base + (page << PAGE_SHIFT);
 -                      *ret = mem->virt_base + (page << PAGE_SHIFT);
 -                      memset(*ret, 0, size);
 -              }
 -              if (mem->flags & DMA_MEMORY_EXCLUSIVE)
 -                      *ret = NULL;
 -      }
 -      return (mem != NULL);
 -}
 -
 -static int dma_release_coherent(struct device *dev, int order, void *vaddr)
 -{
 -      struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
 -
 -      if (mem && vaddr >= mem->virt_base && vaddr <
 -                 (mem->virt_base + (mem->size << PAGE_SHIFT))) {
 -              int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
 -
 -              bitmap_release_region(mem->bitmap, page, order);
 -              return 1;
 -      }
 -      return 0;
 -}
 -#else
 -#define dma_alloc_from_coherent_mem(dev, size, handle, ret) (0)
 -#define dma_release_coherent(dev, order, vaddr) (0)
 -#endif /* CONFIG_X86_32 */
 -
  int dma_supported(struct device *dev, u64 mask)
  {
  #ifdef CONFIG_PCI
  EXPORT_SYMBOL(dma_supported);
  
  /* Allocate DMA memory on node near device */
- noinline struct page *
static noinline struct page *
  dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
  {
        int node;
@@@ -265,7 -387,7 +269,7 @@@ dma_alloc_coherent(struct device *dev, 
        /* ignore region specifiers */
        gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
  
 -      if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory))
 +      if (dma_alloc_from_coherent(dev, size, dma_handle, &memory))
                return memory;
  
        if (!dev) {
@@@ -368,7 -490,7 +372,7 @@@ void dma_free_coherent(struct device *d
  {
        int order = get_order(size);
        WARN_ON(irqs_disabled());       /* for portability */
 -      if (dma_release_coherent(dev, order, vaddr))
 +      if (dma_release_from_coherent(dev, order, vaddr))
                return;
        if (dma_ops->unmap_single)
                dma_ops->unmap_single(dev, bus, size, 0);
@@@ -384,6 -506,8 +388,8 @@@ static int __init pci_iommu_init(void
  
        intel_iommu_init();
  
+       amd_iommu_init();
  #ifdef CONFIG_GART_IOMMU
        gart_iommu_init();
  #endif
diff --combined kernel/Makefile
@@@ -3,7 -3,7 +3,7 @@@
  #
  
  obj-y     = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
-           exit.o itimer.o time.o softirq.o resource.o \
+           cpu.o exit.o itimer.o time.o softirq.o resource.o \
            sysctl.o capability.o ptrace.o timer.o user.o \
            signal.o sys.o kmod.o workqueue.o pid.o \
            rcupdate.o extable.o params.o posix-timers.o \
            hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \
            notifier.o ksysfs.o pm_qos_params.o sched_clock.o
  
+ ifdef CONFIG_FTRACE
+ # Do not trace debug files and internal ftrace files
+ CFLAGS_REMOVE_lockdep.o = -pg
+ CFLAGS_REMOVE_lockdep_proc.o = -pg
+ CFLAGS_REMOVE_mutex-debug.o = -pg
+ CFLAGS_REMOVE_rtmutex-debug.o = -pg
+ CFLAGS_REMOVE_cgroup-debug.o = -pg
+ CFLAGS_REMOVE_sched_clock.o = -pg
+ CFLAGS_REMOVE_sched.o = -mno-spe -pg
+ endif
  obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o
  obj-$(CONFIG_STACKTRACE) += stacktrace.o
  obj-y += time/
@@@ -27,7 -38,8 +38,8 @@@ obj-$(CONFIG_RT_MUTEXES) += rtmutex.
  obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
  obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
  obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
- obj-$(CONFIG_SMP) += cpu.o spinlock.o
+ obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
+ obj-$(CONFIG_SMP) += spinlock.o
  obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
  obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
  obj-$(CONFIG_UID16) += uid16.o
@@@ -69,7 -81,9 +81,10 @@@ obj-$(CONFIG_TASK_DELAY_ACCT) += delaya
  obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
  obj-$(CONFIG_MARKERS) += marker.o
  obj-$(CONFIG_LATENCYTOP) += latencytop.o
 +obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
+ obj-$(CONFIG_FTRACE) += trace/
+ obj-$(CONFIG_TRACING) += trace/
+ obj-$(CONFIG_SMP) += sched_cpupri.o
  
  ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
  # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is