diff options
| author | Ohad Ben-Cohen <ohad@wizery.com> | 2011-06-10 14:42:27 -0400 |
|---|---|---|
| committer | Joerg Roedel <joerg.roedel@amd.com> | 2011-06-21 04:49:30 -0400 |
| commit | 166e9278a3f98bab29ebb3d685a81cfb11b98be0 (patch) | |
| tree | f8f3e8a28c5d96d9053567d6a9ef8e04e7b298dd | |
| parent | 29b68415e335ba9e0eb6057f9405aa4d9c23efe4 (diff) | |
x86/ia64: intel-iommu: move to drivers/iommu/
This should ease finding similarities with different platforms,
with the intention of solving problems once in a generic framework
which everyone can use.
Note: to move intel-iommu.c, the declaration of pci_find_upstream_pcie_bridge()
has to move from drivers/pci/pci.h to include/linux/pci.h. This is handled
in this patch, too.
As suggested, also drop DMAR's EXPERIMENTAL tag while we're at it.
Compile-tested on x86_64.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
| -rw-r--r-- | arch/ia64/Kconfig | 21 | ||||
| -rw-r--r-- | arch/x86/Kconfig | 50 | ||||
| -rw-r--r-- | drivers/iommu/Kconfig | 49 | ||||
| -rw-r--r-- | drivers/iommu/Makefile | 2 | ||||
| -rw-r--r-- | drivers/iommu/dmar.c (renamed from drivers/pci/dmar.c) | 0 | ||||
| -rw-r--r-- | drivers/iommu/intel-iommu.c (renamed from drivers/pci/intel-iommu.c) | 1 | ||||
| -rw-r--r-- | drivers/iommu/intr_remapping.c (renamed from drivers/pci/intr_remapping.c) | 1 | ||||
| -rw-r--r-- | drivers/iommu/intr_remapping.h (renamed from drivers/pci/intr_remapping.h) | 0 | ||||
| -rw-r--r-- | drivers/iommu/iova.c (renamed from drivers/pci/iova.c) | 0 | ||||
| -rw-r--r-- | drivers/pci/Makefile | 5 | ||||
| -rw-r--r-- | drivers/pci/pci.h | 2 | ||||
| -rw-r--r-- | include/linux/pci.h | 11 |
12 files changed, 62 insertions, 80 deletions
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 9929e4e11ea0..7336ba653b8f 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
| @@ -627,27 +627,6 @@ source "drivers/pci/hotplug/Kconfig" | |||
| 627 | 627 | ||
| 628 | source "drivers/pcmcia/Kconfig" | 628 | source "drivers/pcmcia/Kconfig" |
| 629 | 629 | ||
| 630 | config DMAR | ||
| 631 | bool "Support for DMA Remapping Devices (EXPERIMENTAL)" | ||
| 632 | depends on IA64_GENERIC && ACPI && EXPERIMENTAL | ||
| 633 | help | ||
| 634 | DMA remapping (DMAR) devices support enables independent address | ||
| 635 | translations for Direct Memory Access (DMA) from devices. | ||
| 636 | These DMA remapping devices are reported via ACPI tables | ||
| 637 | and include PCI device scope covered by these DMA | ||
| 638 | remapping devices. | ||
| 639 | |||
| 640 | config DMAR_DEFAULT_ON | ||
| 641 | def_bool y | ||
| 642 | prompt "Enable DMA Remapping Devices by default" | ||
| 643 | depends on DMAR | ||
| 644 | help | ||
| 645 | Selecting this option will enable a DMAR device at boot time if | ||
| 646 | one is found. If this option is not selected, DMAR support can | ||
| 647 | be enabled by passing intel_iommu=on to the kernel. It is | ||
| 648 | recommended you say N here while the DMAR code remains | ||
| 649 | experimental. | ||
| 650 | |||
| 651 | endmenu | 630 | endmenu |
| 652 | 631 | ||
| 653 | endif | 632 | endif |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1b6a2e212db4..a169573c64fc 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -1912,56 +1912,6 @@ config PCI_CNB20LE_QUIRK | |||
| 1912 | 1912 | ||
| 1913 | You should say N unless you know you need this. | 1913 | You should say N unless you know you need this. |
| 1914 | 1914 | ||
| 1915 | config DMAR | ||
| 1916 | bool "Support for DMA Remapping Devices (EXPERIMENTAL)" | ||
| 1917 | depends on PCI_MSI && ACPI && EXPERIMENTAL | ||
| 1918 | select IOMMU_API | ||
| 1919 | help | ||
| 1920 | DMA remapping (DMAR) devices support enables independent address | ||
| 1921 | translations for Direct Memory Access (DMA) from devices. | ||
| 1922 | These DMA remapping devices are reported via ACPI tables | ||
| 1923 | and include PCI device scope covered by these DMA | ||
| 1924 | remapping devices. | ||
| 1925 | |||
| 1926 | config DMAR_DEFAULT_ON | ||
| 1927 | def_bool y | ||
| 1928 | prompt "Enable DMA Remapping Devices by default" | ||
| 1929 | depends on DMAR | ||
| 1930 | help | ||
| 1931 | Selecting this option will enable a DMAR device at boot time if | ||
| 1932 | one is found. If this option is not selected, DMAR support can | ||
| 1933 | be enabled by passing intel_iommu=on to the kernel. It is | ||
| 1934 | recommended you say N here while the DMAR code remains | ||
| 1935 | experimental. | ||
| 1936 | |||
| 1937 | config DMAR_BROKEN_GFX_WA | ||
| 1938 | bool "Workaround broken graphics drivers (going away soon)" | ||
| 1939 | depends on DMAR && BROKEN | ||
| 1940 | ---help--- | ||
| 1941 | Current Graphics drivers tend to use physical address | ||
| 1942 | for DMA and avoid using DMA APIs. Setting this config | ||
| 1943 | option permits the IOMMU driver to set a unity map for | ||
| 1944 | all the OS-visible memory. Hence the driver can continue | ||
| 1945 | to use physical addresses for DMA, at least until this | ||
| 1946 | option is removed in the 2.6.32 kernel. | ||
| 1947 | |||
| 1948 | config DMAR_FLOPPY_WA | ||
| 1949 | def_bool y | ||
| 1950 | depends on DMAR | ||
| 1951 | ---help--- | ||
| 1952 | Floppy disk drivers are known to bypass DMA API calls | ||
| 1953 | thereby failing to work when IOMMU is enabled. This | ||
| 1954 | workaround will setup a 1:1 mapping for the first | ||
| 1955 | 16MiB to make floppy (an ISA device) work. | ||
| 1956 | |||
| 1957 | config INTR_REMAP | ||
| 1958 | bool "Support for Interrupt Remapping (EXPERIMENTAL)" | ||
| 1959 | depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI && EXPERIMENTAL | ||
| 1960 | ---help--- | ||
| 1961 | Supports Interrupt remapping for IO-APIC and MSI devices. | ||
| 1962 | To use x2apic mode in the CPU's which support x2APIC enhancements or | ||
| 1963 | to support platforms with CPU's having > 8 bit APIC ID, say Y. | ||
| 1964 | |||
| 1965 | source "drivers/pci/pcie/Kconfig" | 1915 | source "drivers/pci/pcie/Kconfig" |
| 1966 | 1916 | ||
| 1967 | source "drivers/pci/Kconfig" | 1917 | source "drivers/pci/Kconfig" |
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 9246c5bf25af..e2a5f141ae2d 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig | |||
| @@ -46,3 +46,52 @@ config AMD_IOMMU_STATS | |||
| 46 | statistics about whats happening in the driver and exports that | 46 | statistics about whats happening in the driver and exports that |
| 47 | information to userspace via debugfs. | 47 | information to userspace via debugfs. |
| 48 | If unsure, say N. | 48 | If unsure, say N. |
| 49 | |||
| 50 | # Intel IOMMU support | ||
| 51 | config DMAR | ||
| 52 | bool "Support for DMA Remapping Devices" | ||
| 53 | depends on PCI_MSI && ACPI && (X86 || IA64_GENERIC) | ||
| 54 | select IOMMU_API | ||
| 55 | help | ||
| 56 | DMA remapping (DMAR) devices support enables independent address | ||
| 57 | translations for Direct Memory Access (DMA) from devices. | ||
| 58 | These DMA remapping devices are reported via ACPI tables | ||
| 59 | and include PCI device scope covered by these DMA | ||
| 60 | remapping devices. | ||
| 61 | |||
| 62 | config DMAR_DEFAULT_ON | ||
| 63 | def_bool y | ||
| 64 | prompt "Enable DMA Remapping Devices by default" | ||
| 65 | depends on DMAR | ||
| 66 | help | ||
| 67 | Selecting this option will enable a DMAR device at boot time if | ||
| 68 | one is found. If this option is not selected, DMAR support can | ||
| 69 | be enabled by passing intel_iommu=on to the kernel. | ||
| 70 | |||
| 71 | config DMAR_BROKEN_GFX_WA | ||
| 72 | bool "Workaround broken graphics drivers (going away soon)" | ||
| 73 | depends on DMAR && BROKEN && X86 | ||
| 74 | ---help--- | ||
| 75 | Current Graphics drivers tend to use physical address | ||
| 76 | for DMA and avoid using DMA APIs. Setting this config | ||
| 77 | option permits the IOMMU driver to set a unity map for | ||
| 78 | all the OS-visible memory. Hence the driver can continue | ||
| 79 | to use physical addresses for DMA, at least until this | ||
| 80 | option is removed in the 2.6.32 kernel. | ||
| 81 | |||
| 82 | config DMAR_FLOPPY_WA | ||
| 83 | def_bool y | ||
| 84 | depends on DMAR && X86 | ||
| 85 | ---help--- | ||
| 86 | Floppy disk drivers are known to bypass DMA API calls | ||
| 87 | thereby failing to work when IOMMU is enabled. This | ||
| 88 | workaround will setup a 1:1 mapping for the first | ||
| 89 | 16MiB to make floppy (an ISA device) work. | ||
| 90 | |||
| 91 | config INTR_REMAP | ||
| 92 | bool "Support for Interrupt Remapping (EXPERIMENTAL)" | ||
| 93 | depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI && EXPERIMENTAL | ||
| 94 | ---help--- | ||
| 95 | Supports Interrupt remapping for IO-APIC and MSI devices. | ||
| 96 | To use x2apic mode in the CPU's which support x2APIC enhancements or | ||
| 97 | to support platforms with CPU's having > 8 bit APIC ID, say Y. | ||
diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile index 4237eaf84609..49e9c0f46bd5 100644 --- a/drivers/iommu/Makefile +++ b/drivers/iommu/Makefile | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | obj-$(CONFIG_IOMMU_API) += iommu.o | 1 | obj-$(CONFIG_IOMMU_API) += iommu.o |
| 2 | obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o msm_iommu_dev.o | 2 | obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o msm_iommu_dev.o |
| 3 | obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o | 3 | obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o |
| 4 | obj-$(CONFIG_DMAR) += dmar.o iova.o intel-iommu.o | ||
| 5 | obj-$(CONFIG_INTR_REMAP) += dmar.o intr_remapping.o | ||
diff --git a/drivers/pci/dmar.c b/drivers/iommu/dmar.c index 3dc9befa5aec..3dc9befa5aec 100644 --- a/drivers/pci/dmar.c +++ b/drivers/iommu/dmar.c | |||
diff --git a/drivers/pci/intel-iommu.c b/drivers/iommu/intel-iommu.c index f02c34d26d1b..c621c98c99da 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -42,7 +42,6 @@ | |||
| 42 | #include <linux/pci-ats.h> | 42 | #include <linux/pci-ats.h> |
| 43 | #include <asm/cacheflush.h> | 43 | #include <asm/cacheflush.h> |
| 44 | #include <asm/iommu.h> | 44 | #include <asm/iommu.h> |
| 45 | #include "pci.h" | ||
| 46 | 45 | ||
| 47 | #define ROOT_SIZE VTD_PAGE_SIZE | 46 | #define ROOT_SIZE VTD_PAGE_SIZE |
| 48 | #define CONTEXT_SIZE VTD_PAGE_SIZE | 47 | #define CONTEXT_SIZE VTD_PAGE_SIZE |
diff --git a/drivers/pci/intr_remapping.c b/drivers/iommu/intr_remapping.c index 3607faf28a4d..1a89d4a2cadf 100644 --- a/drivers/pci/intr_remapping.c +++ b/drivers/iommu/intr_remapping.c | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | #include "intr_remapping.h" | 13 | #include "intr_remapping.h" |
| 14 | #include <acpi/acpi.h> | 14 | #include <acpi/acpi.h> |
| 15 | #include <asm/pci-direct.h> | 15 | #include <asm/pci-direct.h> |
| 16 | #include "pci.h" | ||
| 17 | 16 | ||
| 18 | static struct ioapic_scope ir_ioapic[MAX_IO_APICS]; | 17 | static struct ioapic_scope ir_ioapic[MAX_IO_APICS]; |
| 19 | static struct hpet_scope ir_hpet[MAX_HPET_TBS]; | 18 | static struct hpet_scope ir_hpet[MAX_HPET_TBS]; |
diff --git a/drivers/pci/intr_remapping.h b/drivers/iommu/intr_remapping.h index 5662fecfee60..5662fecfee60 100644 --- a/drivers/pci/intr_remapping.h +++ b/drivers/iommu/intr_remapping.h | |||
diff --git a/drivers/pci/iova.c b/drivers/iommu/iova.c index c5c274ab5c5a..c5c274ab5c5a 100644 --- a/drivers/pci/iova.c +++ b/drivers/iommu/iova.c | |||
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 094308e41be5..825c02b40daa 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile | |||
| @@ -29,11 +29,6 @@ obj-$(CONFIG_PCI_MSI) += msi.o | |||
| 29 | # Build the Hypertransport interrupt support | 29 | # Build the Hypertransport interrupt support |
| 30 | obj-$(CONFIG_HT_IRQ) += htirq.o | 30 | obj-$(CONFIG_HT_IRQ) += htirq.o |
| 31 | 31 | ||
| 32 | # Build Intel IOMMU support | ||
| 33 | obj-$(CONFIG_DMAR) += dmar.o iova.o intel-iommu.o | ||
| 34 | |||
| 35 | obj-$(CONFIG_INTR_REMAP) += dmar.o intr_remapping.o | ||
| 36 | |||
| 37 | obj-$(CONFIG_PCI_IOV) += iov.o | 32 | obj-$(CONFIG_PCI_IOV) += iov.o |
| 38 | 33 | ||
| 39 | # | 34 | # |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 731e20265ace..b7bf11dd546a 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
| @@ -184,8 +184,6 @@ pci_match_one_device(const struct pci_device_id *id, const struct pci_dev *dev) | |||
| 184 | return NULL; | 184 | return NULL; |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev); | ||
| 188 | |||
| 189 | /* PCI slot sysfs helper code */ | 187 | /* PCI slot sysfs helper code */ |
| 190 | #define to_pci_slot(s) container_of(s, struct pci_slot, kobj) | 188 | #define to_pci_slot(s) container_of(s, struct pci_slot, kobj) |
| 191 | 189 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index c446b5ca2d38..970bfe0941c3 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -1589,5 +1589,16 @@ int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt); | |||
| 1589 | int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, | 1589 | int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, |
| 1590 | unsigned int len, const char *kw); | 1590 | unsigned int len, const char *kw); |
| 1591 | 1591 | ||
| 1592 | /** | ||
| 1593 | * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device | ||
| 1594 | * @pdev: the PCI device | ||
| 1595 | * | ||
| 1596 | * if the device is PCIE, return NULL | ||
| 1597 | * if the device isn't connected to a PCIe bridge (that is its parent is a | ||
| 1598 | * legacy PCI bridge and the bridge is directly connected to bus 0), return its | ||
| 1599 | * parent | ||
| 1600 | */ | ||
| 1601 | struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev); | ||
| 1602 | |||
| 1592 | #endif /* __KERNEL__ */ | 1603 | #endif /* __KERNEL__ */ |
| 1593 | #endif /* LINUX_PCI_H */ | 1604 | #endif /* LINUX_PCI_H */ |
