aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-05 21:46:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-05 21:46:26 -0400
commit3f583bc21977a608908b83d03ee2250426a5695c (patch)
tree05ddffa3804cda744d9b68796d5f2c9a0ff5e1df
parent3e76b749ea09a6411ceb33e6fd47f20eb6df268b (diff)
parente172b81222548b856ecbe59b305d2cb733d512c4 (diff)
Merge tag 'iommu-updates-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU upates from Joerg Roedel: "This time a few more updates queued up. - Rework VT-d code to support ACPI devices - Improvements for memory and PCI hotplug support in the VT-d driver - Device-tree support for OMAP IOMMU - Convert OMAP IOMMU to use devm_* interfaces - Fixed PASID support for AMD IOMMU - Other random cleanups and fixes for OMAP, ARM-SMMU and SHMOBILE IOMMU Most of the changes are in the VT-d driver because some rework was necessary for better hotplug and ACPI device support" * tag 'iommu-updates-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (75 commits) iommu/vt-d: Fix error handling in ANDD processing iommu/vt-d: returning free pointer in get_domain_for_dev() iommu/vt-d: Only call dmar_acpi_dev_scope_init() if DRHD units present iommu/vt-d: Check for NULL pointer in dmar_acpi_dev_scope_init() iommu/amd: Fix logic to determine and checking max PASID iommu/vt-d: Include ACPI devices in iommu=pt iommu/vt-d: Finally enable translation for non-PCI devices iommu/vt-d: Remove to_pci_dev() in intel_map_page() iommu/vt-d: Remove pdev from intel_iommu_attach_device() iommu/vt-d: Remove pdev from iommu_no_mapping() iommu/vt-d: Make domain_add_dev_info() take struct device iommu/vt-d: Make domain_remove_one_dev_info() take struct device iommu/vt-d: Rename 'hwdev' variables to 'dev' now that that's the norm iommu/vt-d: Remove some pointless to_pci_dev() calls iommu/vt-d: Make get_valid_domain_for_dev() take struct device iommu/vt-d: Make iommu_should_identity_map() take struct device iommu/vt-d: Handle RMRRs for non-PCI devices iommu/vt-d: Make get_domain_for_dev() take struct device iommu/vt-d: Make domain_context_mapp{ed,ing}() take struct device iommu/vt-d: Make device_to_iommu() cope with non-PCI devices ...
-rw-r--r--Documentation/devicetree/bindings/iommu/arm,smmu.txt6
-rw-r--r--Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt26
-rw-r--r--arch/arm/mach-omap2/omap-iommu.c5
-rw-r--r--drivers/iommu/Kconfig2
-rw-r--r--drivers/iommu/amd_iommu.c8
-rw-r--r--drivers/iommu/amd_iommu_init.c16
-rw-r--r--drivers/iommu/amd_iommu_types.h11
-rw-r--r--drivers/iommu/arm-smmu.c105
-rw-r--r--drivers/iommu/dmar.c513
-rw-r--r--drivers/iommu/intel-iommu.c1610
-rw-r--r--drivers/iommu/intel_irq_remapping.c108
-rw-r--r--drivers/iommu/iova.c64
-rw-r--r--drivers/iommu/omap-iommu.c162
-rw-r--r--drivers/iommu/omap-iommu.h5
-rw-r--r--drivers/iommu/omap-iommu2.c3
-rw-r--r--include/acpi/actbl2.h15
-rw-r--r--include/linux/dmar.h82
-rw-r--r--include/linux/intel-iommu.h1
-rw-r--r--include/linux/iova.h2
19 files changed, 1754 insertions, 990 deletions
diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
index e34c6cdd8ba8..f284b99402bc 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
@@ -48,6 +48,12 @@ conditions.
48 from the mmu-masters towards memory) node for this 48 from the mmu-masters towards memory) node for this
49 SMMU. 49 SMMU.
50 50
51- calxeda,smmu-secure-config-access : Enable proper handling of buggy
52 implementations that always use secure access to
53 SMMU configuration registers. In this case non-secure
54 aliases of secure registers have to be used during
55 SMMU configuration.
56
51Example: 57Example:
52 58
53 smmu { 59 smmu {
diff --git a/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt b/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt
new file mode 100644
index 000000000000..42531dc387aa
--- /dev/null
+++ b/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt
@@ -0,0 +1,26 @@
1OMAP2+ IOMMU
2
3Required properties:
4- compatible : Should be one of,
5 "ti,omap2-iommu" for OMAP2/OMAP3 IOMMU instances
6 "ti,omap4-iommu" for OMAP4/OMAP5 IOMMU instances
7 "ti,dra7-iommu" for DRA7xx IOMMU instances
8- ti,hwmods : Name of the hwmod associated with the IOMMU instance
9- reg : Address space for the configuration registers
10- interrupts : Interrupt specifier for the IOMMU instance
11
12Optional properties:
13- ti,#tlb-entries : Number of entries in the translation look-aside buffer.
14 Should be either 8 or 32 (default: 32)
15- ti,iommu-bus-err-back : Indicates the IOMMU instance supports throwing
16 back a bus error response on MMU faults.
17
18Example:
19 /* OMAP3 ISP MMU */
20 mmu_isp: mmu@480bd400 {
21 compatible = "ti,omap2-iommu";
22 reg = <0x480bd400 0x80>;
23 interrupts = <24>;
24 ti,hwmods = "mmu_isp";
25 ti,#tlb-entries = <8>;
26 };
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c
index f6daae821ebb..f1fab5684a24 100644
--- a/arch/arm/mach-omap2/omap-iommu.c
+++ b/arch/arm/mach-omap2/omap-iommu.c
@@ -10,6 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13#include <linux/of.h>
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
15#include <linux/err.h> 16#include <linux/err.h>
@@ -58,6 +59,10 @@ static int __init omap_iommu_dev_init(struct omap_hwmod *oh, void *unused)
58 59
59static int __init omap_iommu_init(void) 60static int __init omap_iommu_init(void)
60{ 61{
62 /* If dtb is there, the devices will be created dynamically */
63 if (of_have_populated_dt())
64 return -ENODEV;
65
61 return omap_hwmod_for_each_by_class("mmu", omap_iommu_dev_init, NULL); 66 return omap_hwmod_for_each_by_class("mmu", omap_iommu_dev_init, NULL);
62} 67}
63/* must be ready before omap3isp is probed */ 68/* must be ready before omap3isp is probed */
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 79bbc21c1d01..df56e4c74a7e 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -207,7 +207,7 @@ config SHMOBILE_IOMMU
207 bool "IOMMU for Renesas IPMMU/IPMMUI" 207 bool "IOMMU for Renesas IPMMU/IPMMUI"
208 default n 208 default n
209 depends on ARM 209 depends on ARM
210 depends on SH_MOBILE || COMPILE_TEST 210 depends on ARCH_SHMOBILE || COMPILE_TEST
211 select IOMMU_API 211 select IOMMU_API
212 select ARM_DMA_USE_IOMMU 212 select ARM_DMA_USE_IOMMU
213 select SHMOBILE_IPMMU 213 select SHMOBILE_IPMMU
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index faf0da4bb3a2..c949520bd196 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -963,7 +963,7 @@ static void build_inv_iommu_pasid(struct iommu_cmd *cmd, u16 domid, int pasid,
963 963
964 address &= ~(0xfffULL); 964 address &= ~(0xfffULL);
965 965
966 cmd->data[0] = pasid & PASID_MASK; 966 cmd->data[0] = pasid;
967 cmd->data[1] = domid; 967 cmd->data[1] = domid;
968 cmd->data[2] = lower_32_bits(address); 968 cmd->data[2] = lower_32_bits(address);
969 cmd->data[3] = upper_32_bits(address); 969 cmd->data[3] = upper_32_bits(address);
@@ -982,10 +982,10 @@ static void build_inv_iotlb_pasid(struct iommu_cmd *cmd, u16 devid, int pasid,
982 address &= ~(0xfffULL); 982 address &= ~(0xfffULL);
983 983
984 cmd->data[0] = devid; 984 cmd->data[0] = devid;
985 cmd->data[0] |= (pasid & 0xff) << 16; 985 cmd->data[0] |= ((pasid >> 8) & 0xff) << 16;
986 cmd->data[0] |= (qdep & 0xff) << 24; 986 cmd->data[0] |= (qdep & 0xff) << 24;
987 cmd->data[1] = devid; 987 cmd->data[1] = devid;
988 cmd->data[1] |= ((pasid >> 8) & 0xfff) << 16; 988 cmd->data[1] |= (pasid & 0xff) << 16;
989 cmd->data[2] = lower_32_bits(address); 989 cmd->data[2] = lower_32_bits(address);
990 cmd->data[2] |= CMD_INV_IOMMU_PAGES_GN_MASK; 990 cmd->data[2] |= CMD_INV_IOMMU_PAGES_GN_MASK;
991 cmd->data[3] = upper_32_bits(address); 991 cmd->data[3] = upper_32_bits(address);
@@ -1001,7 +1001,7 @@ static void build_complete_ppr(struct iommu_cmd *cmd, u16 devid, int pasid,
1001 1001
1002 cmd->data[0] = devid; 1002 cmd->data[0] = devid;
1003 if (gn) { 1003 if (gn) {
1004 cmd->data[1] = pasid & PASID_MASK; 1004 cmd->data[1] = pasid;
1005 cmd->data[2] = CMD_INV_IOMMU_PAGES_GN_MASK; 1005 cmd->data[2] = CMD_INV_IOMMU_PAGES_GN_MASK;
1006 } 1006 }
1007 cmd->data[3] = tag & 0x1ff; 1007 cmd->data[3] = tag & 0x1ff;
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 28b4bea7c109..b76c58dbe30c 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -150,7 +150,7 @@ int amd_iommus_present;
150bool amd_iommu_np_cache __read_mostly; 150bool amd_iommu_np_cache __read_mostly;
151bool amd_iommu_iotlb_sup __read_mostly = true; 151bool amd_iommu_iotlb_sup __read_mostly = true;
152 152
153u32 amd_iommu_max_pasids __read_mostly = ~0; 153u32 amd_iommu_max_pasid __read_mostly = ~0;
154 154
155bool amd_iommu_v2_present __read_mostly; 155bool amd_iommu_v2_present __read_mostly;
156bool amd_iommu_pc_present __read_mostly; 156bool amd_iommu_pc_present __read_mostly;
@@ -1231,14 +1231,16 @@ static int iommu_init_pci(struct amd_iommu *iommu)
1231 1231
1232 if (iommu_feature(iommu, FEATURE_GT)) { 1232 if (iommu_feature(iommu, FEATURE_GT)) {
1233 int glxval; 1233 int glxval;
1234 u32 pasids; 1234 u32 max_pasid;
1235 u64 shift; 1235 u64 pasmax;
1236 1236
1237 shift = iommu->features & FEATURE_PASID_MASK; 1237 pasmax = iommu->features & FEATURE_PASID_MASK;
1238 shift >>= FEATURE_PASID_SHIFT; <