Merge branch 'iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 30 Mar 2009 20:41:00 +0000 (13:41 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 30 Mar 2009 20:41:00 +0000 (13:41 -0700)
* 'iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (60 commits)
  dma-debug: make memory range checks more consistent
  dma-debug: warn of unmapping an invalid dma address
  dma-debug: fix dma_debug_add_bus() definition for !CONFIG_DMA_API_DEBUG
  dma-debug/x86: register pci bus for dma-debug leak detection
  dma-debug: add a check dma memory leaks
  dma-debug: add checks for kernel text and rodata
  dma-debug: print stacktrace of mapping path on unmap error
  dma-debug: Documentation update
  dma-debug: x86 architecture bindings
  dma-debug: add function to dump dma mappings
  dma-debug: add checks for sync_single_sg_*
  dma-debug: add checks for sync_single_range_*
  dma-debug: add checks for sync_single_*
  dma-debug: add checking for [alloc|free]_coherent
  dma-debug: add add checking for map/unmap_sg
  dma-debug: add checking for map/unmap_page/single
  dma-debug: add core checking functions
  dma-debug: add debugfs interface
  dma-debug: add kernel command line parameters
  dma-debug: add initialization code
  ...

Fix trivial conflicts due to whitespace changes in arch/x86/kernel/pci-nommu.c

1  2 
Documentation/kernel-parameters.txt
arch/x86/Kconfig
arch/x86/kernel/Makefile
arch/x86/kernel/pci-nommu.c
drivers/pci/intel-iommu.c
include/linux/intel-iommu.h
lib/Kconfig.debug

index be3bde51b56413c27ad92a3949b816d645f15768,0122e5f810fb998225ec66784d8ea1d497e8e492..aeedb89a307ae2d8b1f6c9aa58399146e6c332b2
@@@ -492,6 -492,16 +492,16 @@@ and is between 256 and 4096 characters
                        Range: 0 - 8192
                        Default: 64
  
+       dma_debug=off   If the kernel is compiled with DMA_API_DEBUG support
+                       this option disables the debugging code at boot.
+       dma_debug_entries=<number>
+                       This option allows to tune the number of preallocated
+                       entries for DMA-API debugging code. One entry is
+                       required per DMA-API allocation. Use this if the
+                       DMA-API debugging code disables itself because the
+                       architectural default is too low.
        hpet=           [X86-32,HPET] option to control HPET usage
                        Format: { enable (default) | disable | force |
                                verbose }
                               If specified, z/VM IUCV HVC accepts connections
                               from listed z/VM user IDs only.
  
 +      i2c_bus=        [HW] Override the default board specific I2C bus speed
 +                           or register an additional I2C bus that is not
 +                           registered from board initialization code.
 +                           Format:
 +                           <bus_id>,<clkrate>
 +
        i8042.debug     [HW] Toggle i8042 debug mode
        i8042.direct    [HW] Put keyboard port into non-translated mode
        i8042.dumbkbd   [HW] Pretend that controller can only read data from
                        If enabled at boot time, /selinux/disable can be used
                        later to disable prior to initial policy load.
  
 -      selinux_compat_net =
 -                      [SELINUX] Set initial selinux_compat_net flag value.
 -                        Format: { "0" | "1" }
 -                        0 -- use new secmark-based packet controls
 -                        1 -- use legacy packet controls
 -                        Default value is 0 (preferred).
 -                        Value can be changed at runtime via
 -                        /selinux/compat_net.
 -
        serialnumber    [BUGS=X86-32]
  
        shapers=        [NET]
diff --combined arch/x86/Kconfig
index 34bc3a89228b58cb31d2aa18c70c1965bb35ace6,c9012b95da6cd40a4bd0e8fc249d462da630fd74..45161b816313f23bf1793d880de83429601bc407
@@@ -40,6 -40,7 +40,7 @@@ config X8
        select HAVE_GENERIC_DMA_COHERENT if X86_32
        select HAVE_EFFICIENT_UNALIGNED_ACCESS
        select USER_STACKTRACE_SUPPORT
+       select HAVE_DMA_API_DEBUG
        select HAVE_KERNEL_GZIP
        select HAVE_KERNEL_BZIP2
        select HAVE_KERNEL_LZMA
@@@ -786,11 -787,6 +787,11 @@@ config X86_MCE_AM
           Additional support for AMD specific MCE features such as
           the DRAM Error Threshold.
  
 +config X86_MCE_THRESHOLD
 +      depends on X86_MCE_AMD || X86_MCE_INTEL
 +      bool
 +      default y
 +
  config X86_MCE_NONFATAL
        tristate "Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4"
        depends on X86_32 && X86_MCE
@@@ -934,12 -930,6 +935,12 @@@ config X86_CPUI
          with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
          /dev/cpu/31/cpuid.
  
 +config X86_CPU_DEBUG
 +      tristate "/sys/kernel/debug/x86/cpu/* - CPU Debug support"
 +      ---help---
 +        If you select this option, this will provide various x86 CPUs
 +        information through debugfs.
 +
  choice
        prompt "High Memory Support"
        default HIGHMEM4G if !X86_NUMAQ
@@@ -1132,7 -1122,7 +1133,7 @@@ config NUMA_EM
  
  config NODES_SHIFT
        int "Maximum NUMA Nodes (as a power of 2)" if !MAXSMP
 -      range 1 9   if X86_64
 +      range 1 9
        default "9" if MAXSMP
        default "6" if X86_64
        default "4" if X86_NUMAQ
@@@ -1440,7 -1430,7 +1441,7 @@@ config CRASH_DUM
  config KEXEC_JUMP
        bool "kexec jump (EXPERIMENTAL)"
        depends on EXPERIMENTAL
 -      depends on KEXEC && HIBERNATION && X86_32
 +      depends on KEXEC && HIBERNATION
        ---help---
          Jump between original kernel and kexeced kernel and invoke
          code in physical address mode via KEXEC
diff --combined arch/x86/kernel/Makefile
index 6e9c1f320acfae807d5bd8bf546030713c6a5f2c,1fc811b3b8551bd228336a5410fcf96276db1a48..c611ad64137f67c1fc06789049e8093365bf1ed7
@@@ -70,6 -70,7 +70,6 @@@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER)   += 
  obj-$(CONFIG_KEXEC)           += machine_kexec_$(BITS).o
  obj-$(CONFIG_KEXEC)           += relocate_kernel_$(BITS).o crash.o
  obj-$(CONFIG_CRASH_DUMP)      += crash_dump_$(BITS).o
 -obj-$(CONFIG_X86_VSMP)                += vsmp_64.o
  obj-$(CONFIG_KPROBES)         += kprobes.o
  obj-$(CONFIG_MODULES)         += module_$(BITS).o
  obj-$(CONFIG_EFI)             += efi.o efi_$(BITS).o efi_stub_$(BITS).o
@@@ -105,12 -106,12 +105,12 @@@ obj-$(CONFIG_MICROCODE)                 += microcode.
  
  obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
  
- obj-$(CONFIG_SWIOTLB)                 += pci-swiotlb_64.o # NB rename without _64
+ obj-$(CONFIG_SWIOTLB)                 += pci-swiotlb.o
  
  ###
  # 64 bit specific files
  ifeq ($(CONFIG_X86_64),y)
 -      obj-$(CONFIG_X86_UV)            += tlb_uv.o bios_uv.o uv_irq.o uv_sysfs.o
 +      obj-$(CONFIG_X86_UV)            += tlb_uv.o bios_uv.o uv_irq.o uv_sysfs.o uv_time.o
        obj-$(CONFIG_X86_PM_TIMER)      += pmtimer_64.o
        obj-$(CONFIG_AUDIT)             += audit_64.o
  
        obj-$(CONFIG_AMD_IOMMU)         += amd_iommu_init.o amd_iommu.o
  
        obj-$(CONFIG_PCI_MMCONFIG)      += mmconf-fam10h_64.o
 +      obj-y                           += vsmp_64.o
  endif
index 8b02a3936d4280ede99fd907e3f87e7a8845ae2e,fe50214db8765d6e064e70cff38def77b9793508..c6d703b393261c2e5f45002b188b4d56638bc530
@@@ -1,14 -1,14 +1,14 @@@
  /* Fallback functions when the main IOMMU code is not compiled in. This
     code is roughly equivalent to i386. */
 -#include <linux/mm.h>
 -#include <linux/init.h>
 -#include <linux/pci.h>
 -#include <linux/string.h>
  #include <linux/dma-mapping.h>
  #include <linux/scatterlist.h>
 +#include <linux/string.h>
 +#include <linux/init.h>
 +#include <linux/pci.h>
 +#include <linux/mm.h>
  
 -#include <asm/iommu.h>
  #include <asm/processor.h>
 +#include <asm/iommu.h>
  #include <asm/dma.h>
  
  static int
@@@ -25,19 -25,19 +25,19 @@@ check_addr(char *name, struct device *h
        return 1;
  }
  
- static dma_addr_t
- nommu_map_single(struct device *hwdev, phys_addr_t paddr, size_t size,
-              int direction)
+ static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
+                                unsigned long offset, size_t size,
+                                enum dma_data_direction dir,
+                                struct dma_attrs *attrs)
  {
-       dma_addr_t bus = paddr;
+       dma_addr_t bus = page_to_phys(page) + offset;
        WARN_ON(size == 0);
-       if (!check_addr("map_single", hwdev, bus, size))
-                               return bad_dma_address;
+       if (!check_addr("map_single", dev, bus, size))
+               return bad_dma_address;
        flush_write_buffers();
        return bus;
  }
  
  /* Map a set of buffers described by scatterlist in streaming
   * mode for DMA.  This is the scatter-gather version of the
   * above pci_map_single interface.  Here the scatter gather list
@@@ -54,7 -54,8 +54,8 @@@
   * the same here.
   */
  static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
-              int nents, int direction)
+                       int nents, enum dma_data_direction dir,
+                       struct dma_attrs *attrs)
  {
        struct scatterlist *s;
        int i;
@@@ -78,12 -79,12 +79,12 @@@ static void nommu_free_coherent(struct 
        free_pages((unsigned long)vaddr, get_order(size));
  }
  
- struct dma_mapping_ops nommu_dma_ops = {
+ struct dma_map_ops nommu_dma_ops = {
 -      .alloc_coherent = dma_generic_alloc_coherent,
 -      .free_coherent = nommu_free_coherent,
 -      .map_sg = nommu_map_sg,
 -      .map_page = nommu_map_page,
 -      .is_phys = 1,
 +      .alloc_coherent = dma_generic_alloc_coherent,
 +      .free_coherent  = nommu_free_coherent,
-       .map_single     = nommu_map_single,
 +      .map_sg         = nommu_map_sg,
++      .map_page       = nommu_map_page,
 +      .is_phys        = 1,
  };
  
  void __init no_iommu_init(void)
index ef167b8b047da4844b57b8e3b9ae356d23eb057b,e7d058aa7b0d35ef02792b7e08cbce26b8dd74e8..49402c399232c2cd3d69c7050bc2cee0605cc59d
@@@ -1004,6 -1004,194 +1004,6 @@@ static int iommu_disable_translation(st
        return 0;
  }
  
 -/* iommu interrupt handling. Most stuff are MSI-like. */
 -
 -static const char *fault_reason_strings[] =
 -{
 -      "Software",
 -      "Present bit in root entry is clear",
 -      "Present bit in context entry is clear",
 -      "Invalid context entry",
 -      "Access beyond MGAW",
 -      "PTE Write access is not set",
 -      "PTE Read access is not set",
 -      "Next page table ptr is invalid",
 -      "Root table address invalid",
 -      "Context table ptr is invalid",
 -      "non-zero reserved fields in RTP",
 -      "non-zero reserved fields in CTP",
 -      "non-zero reserved fields in PTE",
 -};
 -#define MAX_FAULT_REASON_IDX  (ARRAY_SIZE(fault_reason_strings) - 1)
 -
 -const char *dmar_get_fault_reason(u8 fault_reason)
 -{
 -      if (fault_reason > MAX_FAULT_REASON_IDX)
 -              return "Unknown";
 -      else
 -              return fault_reason_strings[fault_reason];
 -}
 -
 -void dmar_msi_unmask(unsigned int irq)
 -{
 -      struct intel_iommu *iommu = get_irq_data(irq);
 -      unsigned long flag;
 -
 -      /* unmask it */
 -      spin_lock_irqsave(&iommu->register_lock, flag);
 -      writel(0, iommu->reg + DMAR_FECTL_REG);
 -      /* Read a reg to force flush the post write */
 -      readl(iommu->reg + DMAR_FECTL_REG);
 -      spin_unlock_irqrestore(&iommu->register_lock, flag);
 -}
 -
 -void dmar_msi_mask(unsigned int irq)
 -{
 -      unsigned long flag;
 -      struct intel_iommu *iommu = get_irq_data(irq);
 -
 -      /* mask it */
 -      spin_lock_irqsave(&iommu->register_lock, flag);
 -      writel(DMA_FECTL_IM, iommu->reg + DMAR_FECTL_REG);
 -      /* Read a reg to force flush the post write */
 -      readl(iommu->reg + DMAR_FECTL_REG);
 -      spin_unlock_irqrestore(&iommu->register_lock, flag);
 -}
 -
 -void dmar_msi_write(int irq, struct msi_msg *msg)
 -{
 -      struct intel_iommu *iommu = get_irq_data(irq);
 -      unsigned long flag;
 -
 -      spin_lock_irqsave(&iommu->register_lock, flag);
 -      writel(msg->data, iommu->reg + DMAR_FEDATA_REG);
 -      writel(msg->address_lo, iommu->reg + DMAR_FEADDR_REG);
 -      writel(msg->address_hi, iommu->reg + DMAR_FEUADDR_REG);
 -      spin_unlock_irqrestore(&iommu->register_lock, flag);
 -}
 -
 -void dmar_msi_read(int irq, struct msi_msg *msg)
 -{
 -      struct intel_iommu *iommu = get_irq_data(irq);
 -      unsigned long flag;
 -
 -      spin_lock_irqsave(&iommu->register_lock, flag);
 -      msg->data = readl(iommu->reg + DMAR_FEDATA_REG);
 -      msg->address_lo = readl(iommu->reg + DMAR_FEADDR_REG);
 -      msg->address_hi = readl(iommu->reg + DMAR_FEUADDR_REG);
 -      spin_unlock_irqrestore(&iommu->register_lock, flag);
 -}
 -
 -static int iommu_page_fault_do_one(struct intel_iommu *iommu, int type,
 -              u8 fault_reason, u16 source_id, unsigned long long addr)
 -{
 -      const char *reason;
 -
 -      reason = dmar_get_fault_reason(fault_reason);
 -
 -      printk(KERN_ERR
 -              "DMAR:[%s] Request device [%02x:%02x.%d] "
 -              "fault addr %llx \n"
 -              "DMAR:[fault reason %02d] %s\n",
 -              (type ? "DMA Read" : "DMA Write"),
 -              (source_id >> 8), PCI_SLOT(source_id & 0xFF),
 -              PCI_FUNC(source_id & 0xFF), addr, fault_reason, reason);
 -      return 0;
 -}
 -
 -#define PRIMARY_FAULT_REG_LEN (16)
 -static irqreturn_t iommu_page_fault(int irq, void *dev_id)
 -{
 -      struct intel_iommu *iommu = dev_id;
 -      int reg, fault_index;
 -      u32 fault_status;
 -      unsigned long flag;
 -
 -      spin_lock_irqsave(&iommu->register_lock, flag);
 -      fault_status = readl(iommu->reg + DMAR_FSTS_REG);
 -
 -      /* TBD: ignore advanced fault log currently */
 -      if (!(fault_status & DMA_FSTS_PPF))
 -              goto clear_overflow;
 -
 -      fault_index = dma_fsts_fault_record_index(fault_status);
 -      reg = cap_fault_reg_offset(iommu->cap);
 -      while (1) {
 -              u8 fault_reason;
 -              u16 source_id;
 -              u64 guest_addr;
 -              int type;
 -              u32 data;
 -
 -              /* highest 32 bits */
 -              data = readl(iommu->reg + reg +
 -                              fault_index * PRIMARY_FAULT_REG_LEN + 12);
 -              if (!(data & DMA_FRCD_F))
 -                      break;
 -
 -              fault_reason = dma_frcd_fault_reason(data);
 -              type = dma_frcd_type(data);
 -
 -              data = readl(iommu->reg + reg +
 -                              fault_index * PRIMARY_FAULT_REG_LEN + 8);
 -              source_id = dma_frcd_source_id(data);
 -
 -              guest_addr = dmar_readq(iommu->reg + reg +
 -                              fault_index * PRIMARY_FAULT_REG_LEN);
 -              guest_addr = dma_frcd_page_addr(guest_addr);
 -              /* clear the fault */
 -              writel(DMA_FRCD_F, iommu->reg + reg +
 -                      fault_index * PRIMARY_FAULT_REG_LEN + 12);
 -
 -              spin_unlock_irqrestore(&iommu->register_lock, flag);
 -
 -              iommu_page_fault_do_one(iommu, type, fault_reason,
 -                              source_id, guest_addr);
 -
 -              fault_index++;
 -              if (fault_index > cap_num_fault_regs(iommu->cap))
 -                      fault_index = 0;
 -              spin_lock_irqsave(&iommu->register_lock, flag);
 -      }
 -clear_overflow:
 -      /* clear primary fault overflow */
 -      fault_status = readl(iommu->reg + DMAR_FSTS_REG);
 -      if (fault_status & DMA_FSTS_PFO)
 -              writel(DMA_FSTS_PFO, iommu->reg + DMAR_FSTS_REG);
 -
 -      spin_unlock_irqrestore(&iommu->register_lock, flag);
 -      return IRQ_HANDLED;
 -}
 -
 -int dmar_set_interrupt(struct intel_iommu *iommu)
 -{
 -      int irq, ret;
 -
 -      irq = create_irq();
 -      if (!irq) {
 -              printk(KERN_ERR "IOMMU: no free vectors\n");
 -              return -EINVAL;
 -      }
 -
 -      set_irq_data(irq, iommu);
 -      iommu->irq = irq;
 -
 -      ret = arch_setup_dmar_msi(irq);
 -      if (ret) {
 -              set_irq_data(irq, NULL);
 -              iommu->irq = 0;
 -              destroy_irq(irq);
 -              return 0;
 -      }
 -
 -      /* Force fault register is cleared */
 -      iommu_page_fault(irq, iommu);
 -
 -      ret = request_irq(irq, iommu_page_fault, 0, iommu->name, iommu);
 -      if (ret)
 -              printk(KERN_ERR "IOMMU: can't request irq\n");
 -      return ret;
 -}
  
  static int iommu_init_domains(struct intel_iommu *iommu)
  {
@@@ -1799,7 -1987,7 +1799,7 @@@ static int __init init_dmars(void
        struct dmar_rmrr_unit *rmrr;
        struct pci_dev *pdev;
        struct intel_iommu *iommu;
 -      int i, ret, unit = 0;
 +      int i, ret;
  
        /*
         * for each drhd
                }
        }
  
 +      /*
 +       * Start from the sane iommu hardware state.
 +       */
 +      for_each_drhd_unit(drhd) {
 +              if (drhd->ignored)
 +                      continue;
 +
 +              iommu = drhd->iommu;
 +
 +              /*
 +               * If the queued invalidation is already initialized by us
 +               * (for example, while enabling interrupt-remapping) then
 +               * we got the things already rolling from a sane state.
 +               */
 +              if (iommu->qi)
 +                      continue;
 +
 +              /*
 +               * Clear any previous faults.
 +               */
 +              dmar_fault(-1, iommu);
 +              /*
 +               * Disable queued invalidation if supported and already enabled
 +               * before OS handover.
 +               */
 +              dmar_disable_qi(iommu);
 +      }
 +
        for_each_drhd_unit(drhd) {
                if (drhd->ignored)
                        continue;
  
                iommu = drhd->iommu;
 +
                if (dmar_enable_qi(iommu)) {
                        /*
                         * Queued Invalidate not enabled, use Register Based
                if (drhd->ignored)
                        continue;
                iommu = drhd->iommu;
 -              sprintf (iommu->name, "dmar%d", unit++);
  
                iommu_flush_write_buffer(iommu);
  
@@@ -2124,11 -2284,13 +2124,13 @@@ error
        return 0;
  }
  
- dma_addr_t intel_map_single(struct device *hwdev, phys_addr_t paddr,
-                           size_t size, int dir)
+ static dma_addr_t intel_map_page(struct device *dev, struct page *page,
+                                unsigned long offset, size_t size,
+                                enum dma_data_direction dir,
+                                struct dma_attrs *attrs)
  {
-       return __intel_map_single(hwdev, paddr, size, dir,
-                                 to_pci_dev(hwdev)->dma_mask);
+       return __intel_map_single(dev, page_to_phys(page) + offset, size,
+                                 dir, to_pci_dev(dev)->dma_mask);
  }
  
  static void flush_unmaps(void)
@@@ -2192,8 -2354,9 +2194,9 @@@ static void add_unmap(struct dmar_domai
        spin_unlock_irqrestore(&async_umap_flush_lock, flags);
  }
  
- void intel_unmap_single(struct device *dev, dma_addr_t dev_addr, size_t size,
-                       int dir)
+ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr,
+                            size_t size, enum dma_data_direction dir,
+                            struct dma_attrs *attrs)
  {
        struct pci_dev *pdev = to_pci_dev(dev);
        struct dmar_domain *domain;
        }
  }
  
- void *intel_alloc_coherent(struct device *hwdev, size_t size,
-                          dma_addr_t *dma_handle, gfp_t flags)
+ static void intel_unmap_single(struct device *dev, dma_addr_t dev_addr, size_t size,
+                              int dir)
+ {
+       intel_unmap_page(dev, dev_addr, size, dir, NULL);
+ }
+ static void *intel_alloc_coherent(struct device *hwdev, size_t size,
+                                 dma_addr_t *dma_handle, gfp_t flags)
  {
        void *vaddr;
        int order;
        return NULL;
  }
  
- void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr,
-                        dma_addr_t dma_handle)
static void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr,
+                               dma_addr_t dma_handle)
  {
        int order;
  
  
  #define SG_ENT_VIRT_ADDRESS(sg)       (sg_virt((sg)))
  
- void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist,
-                   int nelems, int dir)
+ static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist,
+                          int nelems, enum dma_data_direction dir,
+                          struct dma_attrs *attrs)
  {
        int i;
        struct pci_dev *pdev = to_pci_dev(hwdev);
@@@ -2333,8 -2503,8 +2343,8 @@@ static int intel_nontranslate_map_sg(st
        return nelems;
  }
  
- int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int nelems,
-                int dir)
static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int nelems,
+                       enum dma_data_direction dir, struct dma_attrs *attrs)
  {
        void *addr;
        int i;
        return nelems;
  }
  
- static struct dma_mapping_ops intel_dma_ops = {
+ static int intel_mapping_error(struct device *dev, dma_addr_t dma_addr)
+ {
+       return !dma_addr;
+ }
+ struct dma_map_ops intel_dma_ops = {
        .alloc_coherent = intel_alloc_coherent,
        .free_coherent = intel_free_coherent,
-       .map_single = intel_map_single,
-       .unmap_single = intel_unmap_single,
        .map_sg = intel_map_sg,
        .unmap_sg = intel_unmap_sg,
+       .map_page = intel_map_page,
+       .unmap_page = intel_unmap_page,
+       .mapping_error = intel_mapping_error,
  };
  
  static inline int iommu_domain_cache_init(void)
index 78c1262e870473c57914092012607ef45369e3c2,4d6a0a2c00b07c34ed1f41503596844f6e70e4d4..1d6c71d96edeac0d730fb178e91120bebe695300
@@@ -292,8 -292,6 +292,8 @@@ struct intel_iommu 
        spinlock_t      register_lock; /* protect register handling */
        int             seq_id; /* sequence id of the iommu */
        int             agaw; /* agaw of this iommu */
 +      unsigned int    irq;
 +      unsigned char   name[13];    /* Device Name */
  
  #ifdef CONFIG_DMAR
        unsigned long   *domain_ids; /* bitmap of domains */
        spinlock_t      lock; /* protect context, domain ids */
        struct root_entry *root_entry; /* virtual address */
  
 -      unsigned int irq;
 -      unsigned char name[7];    /* Device Name */
        struct iommu_flush flush;
  #endif
        struct q_inval  *qi;            /* Queued invalidation info */
@@@ -321,7 -321,6 +321,7 @@@ extern struct dmar_drhd_unit * dmar_fin
  extern int alloc_iommu(struct dmar_drhd_unit *drhd);
  extern void free_iommu(struct intel_iommu *iommu);
  extern int dmar_enable_qi(struct intel_iommu *iommu);
 +extern void dmar_disable_qi(struct intel_iommu *iommu);
  extern void qi_global_iec(struct intel_iommu *iommu);
  
  extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid,
@@@ -332,11 -331,4 +332,4 @@@ extern int qi_flush_iotlb(struct intel_
  
  extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
  
- extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t);
- extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t);
- extern dma_addr_t intel_map_single(struct device *, phys_addr_t, size_t, int);
- extern void intel_unmap_single(struct device *, dma_addr_t, size_t, int);
- extern int intel_map_sg(struct device *, struct scatterlist *, int, int);
- extern void intel_unmap_sg(struct device *, struct scatterlist *, int, int);
  #endif
diff --combined lib/Kconfig.debug
index 0626fa4856e6c80d45321606c025da5b28f83842,251fa7ba3014947db7fea0ac6950416e27f5bf49..58bfe7e8faba0a6d94307945702ac298891497c4
@@@ -402,7 -402,7 +402,7 @@@ config LOCKDE
        bool
        depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
        select STACKTRACE
 -      select FRAME_POINTER if !X86 && !MIPS && !PPC
 +      select FRAME_POINTER if !X86 && !MIPS && !PPC && !ARM_UNWIND
        select KALLSYMS
        select KALLSYMS_ALL
  
@@@ -912,6 -912,17 +912,17 @@@ config DYNAMIC_DEBU
  
          See Documentation/dynamic-debug-howto.txt for additional information.
  
+ config DMA_API_DEBUG
+       bool "Enable debugging of DMA-API usage"
+       depends on HAVE_DMA_API_DEBUG
+       help
+         Enable this option to debug the use of the DMA API by device drivers.
+         With this option you will be able to detect common bugs in device
+         drivers like double-freeing of DMA mappings or freeing mappings that
+         were never allocated.
+         This option causes a performance degredation.  Use only if you want
+         to debug device drivers. If unsure, say N.
  source "samples/Kconfig"
  
  source "lib/Kconfig.kgdb"