Merge branch 'core-iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 22 Jul 2011 23:39:42 +0000 (16:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 22 Jul 2011 23:39:42 +0000 (16:39 -0700)
* 'core-iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  iommu/core: Fix build with INTR_REMAP=y && CONFIG_DMAR=n
  iommu/amd: Don't use MSI address range for DMA addresses
  iommu/amd: Move missing parts to drivers/iommu
  iommu: Move iommu Kconfig entries to submenu
  x86/ia64: intel-iommu: move to drivers/iommu/
  x86: amd_iommu: move to drivers/iommu/
  msm: iommu: move to drivers/iommu/
  drivers: iommu: move to a dedicated folder
  x86/amd-iommu: Store device alias as dev_data pointer
  x86/amd-iommu: Search for existind dev_data before allocting a new one
  x86/amd-iommu: Allow dev_data->alias to be NULL
  x86/amd-iommu: Use only dev_data in low-level domain attach/detach functions
  x86/amd-iommu: Use only dev_data for dte and iotlb flushing routines
  x86/amd-iommu: Store ATS state in dev_data
  x86/amd-iommu: Store devid in dev_data
  x86/amd-iommu: Introduce global dev_data_list
  x86/amd-iommu: Remove redundant device_flush_dte() calls
  iommu-api: Add missing header file

Fix up trivial conflicts (independent additions close to each other) in
drivers/Makefile and include/linux/pci.h

1  2 
arch/x86/Kconfig
drivers/Kconfig
drivers/Makefile
drivers/pci/Makefile
drivers/pci/pci.h
include/linux/pci.h

diff --combined arch/x86/Kconfig
@@@ -680,33 -680,6 +680,6 @@@ 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
-       select PCI_MSI
-       select PCI_IOV
-       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.
- config AMD_IOMMU_STATS
-       bool "Export AMD IOMMU statistics to debugfs"
-       depends on AMD_IOMMU
-       select DEBUG_FS
-       ---help---
-         This option enables code in the AMD IOMMU driver to collect various
-         statistics about whats happening in the driver and exports that
-         information to userspace via debugfs.
-         If unsure, say N.
  # need this always selected by IOMMU for the VIA workaround
  config SWIOTLB
        def_bool y if X86_64
  config IOMMU_HELPER
        def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU)
  
- config IOMMU_API
-       def_bool (AMD_IOMMU || DMAR)
  config MAXSMP
        bool "Enable Maximum number of SMP Processors and NUMA Nodes"
        depends on X86_64 && SMP && DEBUG_KERNEL && EXPERIMENTAL
@@@ -1170,7 -1140,7 +1140,7 @@@ comment "NUMA (Summit) requires SMP, 64
  config AMD_NUMA
        def_bool y
        prompt "Old style AMD Opteron NUMA detection"
 -      depends on NUMA && PCI
 +      depends on X86_64 && NUMA && PCI
        ---help---
          Enable AMD NUMA node topology detection.  You should say Y here if
          you have a multi processor AMD system. This uses an old method to
@@@ -1942,55 -1912,6 +1912,6 @@@ config PCI_CNB20LE_QUIR
  
          You should say N unless you know you need this.
  
- config DMAR
-       bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
-       depends on PCI_MSI && ACPI && EXPERIMENTAL
-       help
-         DMA remapping (DMAR) devices support enables independent address
-         translations for Direct Memory Access (DMA) from devices.
-         These DMA remapping devices are reported via ACPI tables
-         and include PCI device scope covered by these DMA
-         remapping devices.
- config DMAR_DEFAULT_ON
-       def_bool y
-       prompt "Enable DMA Remapping Devices by default"
-       depends on DMAR
-       help
-         Selecting this option will enable a DMAR device at boot time if
-         one is found. If this option is not selected, DMAR support can
-         be enabled by passing intel_iommu=on to the kernel. It is
-         recommended you say N here while the DMAR code remains
-         experimental.
- config DMAR_BROKEN_GFX_WA
-       bool "Workaround broken graphics drivers (going away soon)"
-       depends on DMAR && BROKEN
-       ---help---
-         Current Graphics drivers tend to use physical address
-         for DMA and avoid using DMA APIs. Setting this config
-         option permits the IOMMU driver to set a unity map for
-         all the OS-visible memory. Hence the driver can continue
-         to use physical addresses for DMA, at least until this
-         option is removed in the 2.6.32 kernel.
- config DMAR_FLOPPY_WA
-       def_bool y
-       depends on DMAR
-       ---help---
-         Floppy disk drivers are known to bypass DMA API calls
-         thereby failing to work when IOMMU is enabled. This
-         workaround will setup a 1:1 mapping for the first
-         16MiB to make floppy (an ISA device) work.
- config INTR_REMAP
-       bool "Support for Interrupt Remapping (EXPERIMENTAL)"
-       depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI && EXPERIMENTAL
-       ---help---
-         Supports Interrupt remapping for IO-APIC and MSI devices.
-         To use x2apic mode in the CPU's which support x2APIC enhancements or
-         to support platforms with CPU's having > 8 bit APIC ID, say Y.
  source "drivers/pci/pcie/Kconfig"
  
  source "drivers/pci/Kconfig"
diff --combined drivers/Kconfig
@@@ -94,6 -94,8 +94,6 @@@ source "drivers/memstick/Kconfig
  
  source "drivers/leds/Kconfig"
  
 -source "drivers/nfc/Kconfig"
 -
  source "drivers/accessibility/Kconfig"
  
  source "drivers/infiniband/Kconfig"
@@@ -124,4 -126,6 +124,6 @@@ source "drivers/hwspinlock/Kconfig
  
  source "drivers/clocksource/Kconfig"
  
+ source "drivers/iommu/Kconfig"
  endmenu
diff --combined drivers/Makefile
@@@ -122,4 -122,4 +122,5 @@@ obj-y                              += ieee802154
  obj-y                         += clk/
  
  obj-$(CONFIG_HWSPINLOCK)      += hwspinlock/
 +obj-$(CONFIG_NFC)             += nfc/
+ obj-$(CONFIG_IOMMU_SUPPORT)   += iommu/
diff --combined drivers/pci/Makefile
@@@ -29,11 -29,6 +29,6 @@@ obj-$(CONFIG_PCI_MSI) += msi.
  # Build the Hypertransport interrupt support
  obj-$(CONFIG_HT_IRQ) += htirq.o
  
- # Build Intel IOMMU support
- obj-$(CONFIG_DMAR) += dmar.o iova.o intel-iommu.o
- obj-$(CONFIG_INTR_REMAP) += dmar.o intr_remapping.o
  obj-$(CONFIG_PCI_IOV) += iov.o
  
  #
@@@ -71,6 -66,4 +66,6 @@@ obj-$(CONFIG_PCI_STUB) += pci-stub.
  
  obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += xen-pcifront.o
  
 +obj-$(CONFIG_OF) += of.o
 +
  ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG
diff --combined drivers/pci/pci.h
@@@ -146,8 -146,6 +146,8 @@@ static inline void pci_no_msi(void) { 
  static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
  #endif
  
 +extern void pci_realloc(void);
 +
  static inline int pci_no_d1d2(struct pci_dev *dev)
  {
        unsigned int parent_dstates = 0;
@@@ -186,8 -184,6 +186,6 @@@ pci_match_one_device(const struct pci_d
        return NULL;
  }
  
- struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
  /* PCI slot sysfs helper code */
  #define to_pci_slot(s) container_of(s, struct pci_slot, kobj)
  
diff --combined include/linux/pci.h
@@@ -1589,33 -1589,16 +1589,44 @@@ int pci_vpd_find_tag(const u8 *buf, uns
  int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
                              unsigned int len, const char *kw);
  
 +/* PCI <-> OF binding helpers */
 +#ifdef CONFIG_OF
 +struct device_node;
 +extern void pci_set_of_node(struct pci_dev *dev);
 +extern void pci_release_of_node(struct pci_dev *dev);
 +extern void pci_set_bus_of_node(struct pci_bus *bus);
 +extern void pci_release_bus_of_node(struct pci_bus *bus);
 +
 +/* Arch may override this (weak) */
 +extern struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus);
 +
 +static inline struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
 +{
 +      return pdev ? pdev->dev.of_node : NULL;
 +}
 +
 +static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
 +{
 +      return bus ? bus->dev.of_node : NULL;
 +}
 +
 +#else /* CONFIG_OF */
 +static inline void pci_set_of_node(struct pci_dev *dev) { }
 +static inline void pci_release_of_node(struct pci_dev *dev) { }
 +static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
 +static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
 +#endif  /* CONFIG_OF */
 +
+ /**
+  * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
+  * @pdev: the PCI device
+  *
+  * if the device is PCIE, return NULL
+  * if the device isn't connected to a PCIe bridge (that is its parent is a
+  * legacy PCI bridge and the bridge is directly connected to bus 0), return its
+  * parent
+  */
+ struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
  #endif /* __KERNEL__ */
  #endif /* LINUX_PCI_H */