Skip to contentSkip to conversation

core/iommu changes for v3.1

GIT PULL Ingo Molnar 1 participant 1 message Jul 22, 2011

Subsystems (10)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest core-iommu-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git core-iommu-for-linus

Thanks,

Ingo

------------------>
Joerg Roedel (13):
x86/amd-iommu: Remove redundant device_flush_dte() calls x86/amd-iommu: Introduce global dev_data_list
x86/amd-iommu: Store devid in dev_data
x86/amd-iommu: Store ATS state in dev_data
x86/amd-iommu: Use only dev_data for dte and iotlb flushing routines x86/amd-iommu: Use only dev_data in low-level domain attach/detach functions x86/amd-iommu: Allow dev_data->alias to be NULL
x86/amd-iommu: Search for existind dev_data before allocting a new one x86/amd-iommu: Store device alias as dev_data pointer
iommu: Move iommu Kconfig entries to submenu
iommu/amd: Move missing parts to drivers/iommu
iommu/amd: Don't use MSI address range for DMA addresses iommu/core: Fix build with INTR_REMAP=y && CONFIG_DMAR=n

Laura Abbott (1):
iommu-api: Add missing header file

Ohad Ben-Cohen (4):
drivers: iommu: move to a dedicated folder
msm: iommu: move to drivers/iommu/
x86: amd_iommu: move to drivers/iommu/ x86/ia64: intel-iommu: move to drivers/iommu/

 arch/arm/mach-msm/Kconfig                          |   19 --
 arch/arm/mach-msm/Makefile                         |    2 +-
 arch/ia64/Kconfig                                  |   24 --
 arch/x86/Kconfig                                   |   79 -----
 arch/x86/kernel/Makefile                           |    1 -
 drivers/Kconfig                                    |    2 +
 drivers/Makefile                                   |    1 +
 drivers/base/Makefile                              |    1 -
 drivers/iommu/Kconfig                              |  110 +++++++
 drivers/iommu/Makefile                             |    5 +
 {arch/x86/kernel => drivers/iommu}/amd_iommu.c     |  314 ++++++++++++--------
 .../x86/kernel => drivers/iommu}/amd_iommu_init.c  |    8 +-
 .../asm => drivers/iommu}/amd_iommu_proto.h        |    2 +-
 .../asm => drivers/iommu}/amd_iommu_types.h        |    9 +-
 drivers/{pci => iommu}/dmar.c                      |    0
 drivers/{pci => iommu}/intel-iommu.c               |    1 -
 drivers/{pci => iommu}/intr_remapping.c            |    1 -
 drivers/{pci => iommu}/intr_remapping.h            |    0
 drivers/{base => iommu}/iommu.c                    |    0
 drivers/{pci => iommu}/iova.c                      |    0
 .../mach-msm/iommu.c => drivers/iommu/msm_iommu.c  |    0
 .../iommu_dev.c => drivers/iommu/msm_iommu_dev.c   |    0
 drivers/pci/Makefile                               |    5 -
 drivers/pci/pci.h                                  |    2 -
 .../asm/amd_iommu.h => include/linux/amd-iommu.h   |    0
 include/linux/iommu.h                              |    2 +
 include/linux/pci.h                                |   11 +
 27 files changed, 332 insertions(+), 267 deletions(-)
 create mode 100644 drivers/iommu/Kconfig
 create mode 100644 drivers/iommu/Makefile
 rename {arch/x86/kernel => drivers/iommu}/amd_iommu.c (91%)
 rename {arch/x86/kernel => drivers/iommu}/amd_iommu_init.c (99%)
 rename {arch/x86/include/asm => drivers/iommu}/amd_iommu_proto.h (98%)
 rename {arch/x86/include/asm => drivers/iommu}/amd_iommu_types.h (98%)
 rename drivers/{pci => iommu}/dmar.c (100%)
 rename drivers/{pci => iommu}/intel-iommu.c (99%)
 rename drivers/{pci => iommu}/intr_remapping.c (99%)
 rename drivers/{pci => iommu}/intr_remapping.h (100%)
 rename drivers/{base => iommu}/iommu.c (100%)
 rename drivers/{pci => iommu}/iova.c (100%)
 rename arch/arm/mach-msm/iommu.c => drivers/iommu/msm_iommu.c (100%)
 rename arch/arm/mach-msm/iommu_dev.c => drivers/iommu/msm_iommu_dev.c (100%)
 rename arch/x86/include/asm/amd_iommu.h => include/linux/amd-iommu.h (100%)
arch/arm/mach-msm/Kconfig +0 -19
index 1516896..888e925 100644
@@ -148,22 +148,6 @@ config MACH_MSM8960_RUMI3
 
 endmenu
 
-config MSM_IOMMU
-	bool "MSM IOMMU Support"
-	depends on ARCH_MSM8X60 || ARCH_MSM8960
-	select IOMMU_API
-	default n
-	help
-	  Support for the IOMMUs found on certain Qualcomm SOCs.
-	  These IOMMUs allow virtualization of the address space used by most
-	  cores within the multimedia subsystem.
-
-	  If unsure, say N here.
-
-config IOMMU_PGTABLES_L2
-	def_bool y
-	depends on MSM_IOMMU && MMU && SMP && CPU_DCACHE_DISABLE=n
-
 config MSM_DEBUG_UART
 	int
 	default 1 if MSM_DEBUG_UART1
@@ -205,9 +189,6 @@ config MSM_GPIOMUX
 config MSM_V2_TLMM
 	bool
 
-config IOMMU_API
-	bool
-
 config MSM_SCM
 	bool
 endif
arch/arm/mach-msm/Makefile +1 -1
index 9519fd2..b70658c 100644
@@ -3,7 +3,7 @@ obj-y += clock.o
 obj-$(CONFIG_DEBUG_FS) += clock-debug.o
 
 obj-$(CONFIG_MSM_VIC) += irq-vic.o
-obj-$(CONFIG_MSM_IOMMU) += iommu.o iommu_dev.o devices-iommu.o
+obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
 
 obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o acpuclock-arm11.o
 obj-$(CONFIG_ARCH_MSM7X30) += dma.o
arch/ia64/Kconfig +0 -24
index 38280ef..7336ba6 100644
@@ -627,27 +627,6 @@ source "drivers/pci/hotplug/Kconfig"
 
 source "drivers/pcmcia/Kconfig"
 
-config DMAR
-        bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
-        depends on IA64_GENERIC && 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.
-
 endmenu
 
 endif
@@ -681,6 +660,3 @@ source "lib/Kconfig"
 
 config IOMMU_HELPER
 	def_bool (IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_GENERIC || SWIOTLB)
-
-config IOMMU_API
-	def_bool (DMAR)
arch/x86/Kconfig +0 -79

97 lines not on this page · raw message

arch/x86/kernel/Makefile +0 -1
index 90b06d4..11817ff 100644
@@ -123,7 +123,6 @@ ifeq ($(CONFIG_X86_64),y)
 
 	obj-$(CONFIG_GART_IOMMU)	+= amd_gart_64.o aperture_64.o
 	obj-$(CONFIG_CALGARY_IOMMU)	+= pci-calgary_64.o tce_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
drivers/Kconfig +2 -0
index 3bb154d..9d51318 100644
@@ -126,4 +126,6 @@ source "drivers/hwspinlock/Kconfig"
 
 source "drivers/clocksource/Kconfig"
 
+source "drivers/iommu/Kconfig"
+
 endmenu
drivers/Makefile +1 -0
index 09f3232..2b551e9 100644
@@ -122,3 +122,4 @@ obj-y				+= ieee802154/
 obj-y				+= clk/
 
 obj-$(CONFIG_HWSPINLOCK)	+= hwspinlock/
+obj-$(CONFIG_IOMMU_SUPPORT)	+= iommu/
drivers/base/Makefile +0 -1
index 4c5701c..5ab0d07 100644
@@ -13,7 +13,6 @@ obj-$(CONFIG_FW_LOADER)	+= firmware_class.o
 obj-$(CONFIG_NUMA)	+= node.o
 obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o
 obj-$(CONFIG_SMP)	+= topology.o
-obj-$(CONFIG_IOMMU_API) += iommu.o
 ifeq ($(CONFIG_SYSFS),y)
 obj-$(CONFIG_MODULES)	+= module.o
 endif
drivers/iommu/Kconfig new file +110 -0

110 lines not on this page · raw message

drivers/iommu/Makefile new file +5 -0
new file mode 100644
index 0000000..4d4d77d
@@ -0,0 +1,5 @@
+obj-$(CONFIG_IOMMU_API) += iommu.o
+obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o msm_iommu_dev.o
+obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o
+obj-$(CONFIG_DMAR) += dmar.o iova.o intel-iommu.o
+obj-$(CONFIG_INTR_REMAP) += dmar.o intr_remapping.o
drivers/iommu/amd_iommu.c renamed from arch/x86/kernel/amd_iommu.c +187 -127

571 lines not on this page · raw message

drivers/iommu/amd_iommu_init.c renamed from arch/x86/kernel/amd_iommu_init.c +5 -3
similarity index 99%
rename from arch/x86/kernel/amd_iommu_init.c
rename to drivers/iommu/amd_iommu_init.c
index bfc8453..82d2410 100644
@@ -24,14 +24,16 @@
 #include <linux/syscore_ops.h>
 #include <linux/interrupt.h>
 #include <linux/msi.h>
+#include <linux/amd-iommu.h>
 #include <asm/pci-direct.h>
-#include <asm/amd_iommu_proto.h>
-#include <asm/amd_iommu_types.h>
-#include <asm/amd_iommu.h>
 #include <asm/iommu.h>
 #include <asm/gart.h>
 #include <asm/x86_init.h>
 #include <asm/iommu_table.h>
+
+#include "amd_iommu_proto.h"
+#include "amd_iommu_types.h"
+
 /*
  * definitions for the ACPI scanning code
  */
drivers/iommu/amd_iommu_proto.h renamed from arch/x86/include/asm/amd_iommu_proto.h +1 -1
similarity index 98%
rename from arch/x86/include/asm/amd_iommu_proto.h
rename to drivers/iommu/amd_iommu_proto.h
index 55d95eb..7ffaa64 100644
@@ -19,7 +19,7 @@
 #ifndef _ASM_X86_AMD_IOMMU_PROTO_H
 #define _ASM_X86_AMD_IOMMU_PROTO_H
 
-#include <asm/amd_iommu_types.h>
+#include "amd_iommu_types.h"
 
 extern int amd_iommu_init_dma_ops(void);
 extern int amd_iommu_init_passthrough(void);
drivers/iommu/amd_iommu_types.h renamed from arch/x86/include/asm/amd_iommu_types.h +7 -2
similarity index 98%
rename from arch/x86/include/asm/amd_iommu_types.h
rename to drivers/iommu/amd_iommu_types.h
index 4c99829..5b9c507 100644
@@ -310,10 +310,15 @@ struct protection_domain {
  */
 struct iommu_dev_data {
 	struct list_head list;		  /* For domain->dev_list */
-	struct device *dev;		  /* Device this data belong to */
-	struct device *alias;		  /* The Alias Device */
+	struct list_head dev_data_list;	  /* For global dev_data_list */
+	struct iommu_dev_data *alias_data;/* The alias dev_data */
 	struct protection_domain *domain; /* Domain the device is bound to */
 	atomic_t bind;			  /* Domain attach reverent count */
+	u16 devid;			  /* PCI Device ID */
+	struct {
+		bool enabled;
+		int qdep;
+	} ats;				  /* ATS state */
 };
 
 /*
drivers/iommu/dmar.c renamed from drivers/pci/dmar.c +0 -0
similarity index 100%
rename from drivers/pci/dmar.c
rename to drivers/iommu/dmar.c
drivers/iommu/intel-iommu.c renamed from drivers/pci/intel-iommu.c +0 -1
similarity index 99%
rename from drivers/pci/intel-iommu.c
rename to drivers/iommu/intel-iommu.c
index f02c34d..c621c98 100644
@@ -42,7 +42,6 @@
 #include <linux/pci-ats.h>
 #include <asm/cacheflush.h>
 #include <asm/iommu.h>
-#include "pci.h"
 
 #define ROOT_SIZE		VTD_PAGE_SIZE
 #define CONTEXT_SIZE		VTD_PAGE_SIZE
drivers/iommu/intr_remapping.c renamed from drivers/pci/intr_remapping.c +0 -1
similarity index 99%
rename from drivers/pci/intr_remapping.c
rename to drivers/iommu/intr_remapping.c
index 3607faf..1a89d4a 100644
@@ -13,7 +13,6 @@
 #include "intr_remapping.h"
 #include <acpi/acpi.h>
 #include <asm/pci-direct.h>
-#include "pci.h"
 
 static struct ioapic_scope ir_ioapic[MAX_IO_APICS];
 static struct hpet_scope ir_hpet[MAX_HPET_TBS];
drivers/iommu/intr_remapping.h renamed from drivers/pci/intr_remapping.h +0 -0
similarity index 100%
rename from drivers/pci/intr_remapping.h
rename to drivers/iommu/intr_remapping.h
drivers/iommu/iommu.c renamed from drivers/base/iommu.c +0 -0
similarity index 100%
rename from drivers/base/iommu.c
rename to drivers/iommu/iommu.c
drivers/iommu/iova.c renamed from drivers/pci/iova.c +0 -0
similarity index 100%
rename from drivers/pci/iova.c
rename to drivers/iommu/iova.c
drivers/iommu/msm_iommu.c renamed from arch/arm/mach-msm/iommu.c +0 -0
similarity index 100%
rename from arch/arm/mach-msm/iommu.c
rename to drivers/iommu/msm_iommu.c
drivers/iommu/msm_iommu_dev.c renamed from arch/arm/mach-msm/iommu_dev.c +0 -0
similarity index 100%
rename from arch/arm/mach-msm/iommu_dev.c
rename to drivers/iommu/msm_iommu_dev.c
drivers/pci/Makefile +0 -5
index 094308e..825c02b 100644
@@ -29,11 +29,6 @@ obj-$(CONFIG_PCI_MSI) += msi.o
 # 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
 
 #
drivers/pci/pci.h +0 -2
index 731e202..b7bf11d 100644
@@ -184,8 +184,6 @@ pci_match_one_device(const struct pci_device_id *id, const struct pci_dev *dev)
 	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)
 
include/linux/amd-iommu.h renamed from arch/x86/include/asm/amd_iommu.h +0 -0
similarity index 100%
rename from arch/x86/include/asm/amd_iommu.h
rename to include/linux/amd-iommu.h
include/linux/iommu.h +2 -0
index 0a2ba40..9940319 100644
@@ -19,6 +19,8 @@
 #ifndef __LINUX_IOMMU_H
 #define __LINUX_IOMMU_H
 
+#include <linux/errno.h>
+
 #define IOMMU_READ	(1)
 #define IOMMU_WRITE	(2)
 #define IOMMU_CACHE	(4) /* DMA cache coherency */
include/linux/pci.h +11 -0
index c446b5c..970bfe0 100644
@@ -1589,5 +1589,16 @@ int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt);
 int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
 			      unsigned int len, const char *kw);
 
+/**
+ * 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 */