Skip to content

Commit dc7aafb

Browse files
committed
Merge tag 'iommu-updates-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu updates from Joerg Roedel: "This time with: - support for the generic PCI device alias code in x86 IOMMU drivers - a new sysfs interface for IOMMUs - preparations for hotplug support in the Intel IOMMU driver - change the AMD IOMMUv2 driver to not hold references to core data structures like mm_struct or task_struct. Rely on mmu_notifers instead. - removal of the OMAP IOVMM interface, all users of it are converted to DMA-API now - make the struct iommu_ops const everywhere - initial PCI support for the ARM SMMU driver - there is now a generic device tree binding documented for ARM IOMMUs - various fixes and cleanups all over the place Also included are some changes to the OMAP code, which are acked by the maintainer" * tag 'iommu-updates-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (67 commits) devicetree: Add generic IOMMU device tree bindings iommu/vt-d: Fix race setting IRQ CPU affinity while freeing IRQ iommu/amd: Fix 2 typos in comments iommu/amd: Fix device_state reference counting iommu/amd: Remove change_pte mmu_notifier call-back iommu/amd: Don't set pasid_state->mm to NULL in unbind_pasid iommu/exynos: Select ARM_DMA_USE_IOMMU iommu/vt-d: Exclude devices using RMRRs from IOMMU API domains iommu/omap: Remove platform data da_start and da_end fields ARM: omap: Don't set iommu pdata da_start and da_end fields iommu/omap: Remove virtual memory manager iommu/vt-d: Fix issue in computing domain's iommu_snooping flag iommu/vt-d: Introduce helper function iova_size() to improve code readability iommu/vt-d: Introduce helper domain_pfn_within_range() to simplify code iommu/vt-d: Simplify intel_unmap_sg() and kill duplicated code iommu/vt-d: Change iommu_enable/disable_translation to return void iommu/vt-d: Simplify include/linux/dmar.h iommu/vt-d: Avoid freeing virtual machine domain in free_dmar_iommu() iommu/vt-d: Fix possible invalid memory access caused by free_dmar_iommu() iommu/vt-d: Allocate dynamic domain id for virtual domains only ...
2 parents 161d2e0 + 4c5e9d9 commit dc7aafb

41 files changed

Lines changed: 1567 additions & 2050 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
What: /sys/class/iommu/<iommu>/devices/
2+
Date: June 2014
3+
KernelVersion: 3.17
4+
Contact: Alex Williamson <alex.williamson@redhat.com>
5+
Description:
6+
IOMMU drivers are able to link devices managed by a
7+
given IOMMU here to allow association of IOMMU to
8+
device.
9+
10+
What: /sys/devices/.../iommu
11+
Date: June 2014
12+
KernelVersion: 3.17
13+
Contact: Alex Williamson <alex.williamson@redhat.com>
14+
Description:
15+
IOMMU drivers are able to link the IOMMU for a
16+
given device here to allow association of device to
17+
IOMMU.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
What: /sys/class/iommu/<iommu>/amd-iommu/cap
2+
Date: June 2014
3+
KernelVersion: 3.17
4+
Contact: Alex Williamson <alex.williamson@redhat.com>
5+
Description:
6+
IOMMU capability header as documented in the AMD IOMMU
7+
specification. Format: %x
8+
9+
What: /sys/class/iommu/<iommu>/amd-iommu/features
10+
Date: June 2014
11+
KernelVersion: 3.17
12+
Contact: Alex Williamson <alex.williamson@redhat.com>
13+
Description:
14+
Extended features of the IOMMU. Format: %llx
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
What: /sys/class/iommu/<iommu>/intel-iommu/address
2+
Date: June 2014
3+
KernelVersion: 3.17
4+
Contact: Alex Williamson <alex.williamson@redhat.com>
5+
Description:
6+
Physical address of the VT-d DRHD for this IOMMU.
7+
Format: %llx. This allows association of a sysfs
8+
intel-iommu with a DMAR DRHD table entry.
9+
10+
What: /sys/class/iommu/<iommu>/intel-iommu/cap
11+
Date: June 2014
12+
KernelVersion: 3.17
13+
Contact: Alex Williamson <alex.williamson@redhat.com>
14+
Description:
15+
The cached hardware capability register value
16+
of this DRHD unit. Format: %llx.
17+
18+
What: /sys/class/iommu/<iommu>/intel-iommu/ecap
19+
Date: June 2014
20+
KernelVersion: 3.17
21+
Contact: Alex Williamson <alex.williamson@redhat.com>
22+
Description:
23+
The cached hardware extended capability register
24+
value of this DRHD unit. Format: %llx.
25+
26+
What: /sys/class/iommu/<iommu>/intel-iommu/version
27+
Date: June 2014
28+
KernelVersion: 3.17
29+
Contact: Alex Williamson <alex.williamson@redhat.com>
30+
Description:
31+
The architecture version as reported from the
32+
VT-d VER_REG. Format: %d:%d, major:minor

‎Documentation/devicetree/bindings/iommu/arm,smmu.txt‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ conditions.
4242

4343
** System MMU optional properties:
4444

45-
- smmu-parent : When multiple SMMUs are chained together, this
46-
property can be used to provide a phandle to the
47-
parent SMMU (that is the next SMMU on the path going
48-
from the mmu-masters towards memory) node for this
49-
SMMU.
50-
5145
- calxeda,smmu-secure-config-access : Enable proper handling of buggy
5246
implementations that always use secure access to
5347
SMMU configuration registers. In this case non-secure
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
This document describes the generic device tree binding for IOMMUs and their
2+
master(s).
3+
4+
5+
IOMMU device node:
6+
==================
7+
8+
An IOMMU can provide the following services:
9+
10+
* Remap address space to allow devices to access physical memory ranges that
11+
they otherwise wouldn't be capable of accessing.
12+
13+
Example: 32-bit DMA to 64-bit physical addresses
14+
15+
* Implement scatter-gather at page level granularity so that the device does
16+
not have to.
17+
18+
* Provide system protection against "rogue" DMA by forcing all accesses to go
19+
through the IOMMU and faulting when encountering accesses to unmapped
20+
address regions.
21+
22+
* Provide address space isolation between multiple contexts.
23+
24+
Example: Virtualization
25+
26+
Device nodes compatible with this binding represent hardware with some of the
27+
above capabilities.
28+
29+
IOMMUs can be single-master or multiple-master. Single-master IOMMU devices
30+
typically have a fixed association to the master device, whereas multiple-
31+
master IOMMU devices can translate accesses from more than one master.
32+
33+
The device tree node of the IOMMU device's parent bus must contain a valid
34+
"dma-ranges" property that describes how the physical address space of the
35+
IOMMU maps to memory. An empty "dma-ranges" property means that there is a
36+
1:1 mapping from IOMMU to memory.
37+
38+
Required properties:
39+
--------------------
40+
- #iommu-cells: The number of cells in an IOMMU specifier needed to encode an
41+
address.
42+
43+
The meaning of the IOMMU specifier is defined by the device tree binding of
44+
the specific IOMMU. Below are a few examples of typical use-cases:
45+
46+
- #iommu-cells = <0>: Single master IOMMU devices are not configurable and
47+
therefore no additional information needs to be encoded in the specifier.
48+
This may also apply to multiple master IOMMU devices that do not allow the
49+
association of masters to be configured. Note that an IOMMU can by design
50+
be multi-master yet only expose a single master in a given configuration.
51+
In such cases the number of cells will usually be 1 as in the next case.
52+
- #iommu-cells = <1>: Multiple master IOMMU devices may need to be configured
53+
in order to enable translation for a given master. In such cases the single
54+
address cell corresponds to the master device's ID. In some cases more than
55+
one cell can be required to represent a single master ID.
56+
- #iommu-cells = <4>: Some IOMMU devices allow the DMA window for masters to
57+
be configured. The first cell of the address in this may contain the master
58+
device's ID for example, while the second cell could contain the start of
59+
the DMA window for the given device. The length of the DMA window is given
60+
by the third and fourth cells.
61+
62+
Note that these are merely examples and real-world use-cases may use different
63+
definitions to represent their individual needs. Always refer to the specific
64+
IOMMU binding for the exact meaning of the cells that make up the specifier.
65+
66+
67+
IOMMU master node:
68+
==================
69+
70+
Devices that access memory through an IOMMU are called masters. A device can
71+
have multiple master interfaces (to one or more IOMMU devices).
72+
73+
Required properties:
74+
--------------------
75+
- iommus: A list of phandle and IOMMU specifier pairs that describe the IOMMU
76+
master interfaces of the device. One entry in the list describes one master
77+
interface of the device.
78+
79+
When an "iommus" property is specified in a device tree node, the IOMMU will
80+
be used for address translation. If a "dma-ranges" property exists in the
81+
device's parent node it will be ignored. An exception to this rule is if the
82+
referenced IOMMU is disabled, in which case the "dma-ranges" property of the
83+
parent shall take effect. Note that merely disabling a device tree node does
84+
not guarantee that the IOMMU is really disabled since the hardware may not
85+
have a means to turn off translation. But it is invalid in such cases to
86+
disable the IOMMU's device tree node in the first place because it would
87+
prevent any driver from properly setting up the translations.
88+
89+
90+
Notes:
91+
======
92+
93+
One possible extension to the above is to use an "iommus" property along with
94+
a "dma-ranges" property in a bus device node (such as PCI host bridges). This
95+
can be useful to describe how children on the bus relate to the IOMMU if they
96+
are not explicitly listed in the device tree (e.g. PCI devices). However, the
97+
requirements of that use-case haven't been fully determined yet. Implementing
98+
this is therefore not recommended without further discussion and extension of
99+
this binding.
100+
101+
102+
Examples:
103+
=========
104+
105+
Single-master IOMMU:
106+
--------------------
107+
108+
iommu {
109+
#iommu-cells = <0>;
110+
};
111+
112+
master {
113+
iommus = <&{/iommu}>;
114+
};
115+
116+
Multiple-master IOMMU with fixed associations:
117+
----------------------------------------------
118+
119+
/* multiple-master IOMMU */
120+
iommu {
121+
/*
122+
* Masters are statically associated with this IOMMU and share
123+
* the same address translations because the IOMMU does not
124+
* have sufficient information to distinguish between masters.
125+
*
126+
* Consequently address translation is always on or off for
127+
* all masters at any given point in time.
128+
*/
129+
#iommu-cells = <0>;
130+
};
131+
132+
/* static association with IOMMU */
133+
master@1 {
134+
reg = <1>;
135+
iommus = <&{/iommu}>;
136+
};
137+
138+
/* static association with IOMMU */
139+
master@2 {
140+
reg = <2>;
141+
iommus = <&{/iommu}>;
142+
};
143+
144+
Multiple-master IOMMU:
145+
----------------------
146+
147+
iommu {
148+
/* the specifier represents the ID of the master */
149+
#iommu-cells = <1>;
150+
};
151+
152+
master@1 {
153+
/* device has master ID 42 in the IOMMU */
154+
iommus = <&{/iommu} 42>;
155+
};
156+
157+
master@2 {
158+
/* device has master IDs 23 and 24 in the IOMMU */
159+
iommus = <&{/iommu} 23>, <&{/iommu} 24>;
160+
};
161+
162+
Multiple-master IOMMU with configurable DMA window:
163+
---------------------------------------------------
164+
165+
/ {
166+
iommu {
167+
/*
168+
* One cell for the master ID and one cell for the
169+
* address of the DMA window. The length of the DMA
170+
* window is encoded in two cells.
171+
*
172+
* The DMA window is the range addressable by the
173+
* master (i.e. the I/O virtual address space).
174+
*/
175+
#iommu-cells = <4>;
176+
};
177+
178+
master {
179+
/* master ID 42, 4 GiB DMA window starting at 0 */
180+
iommus = <&{/iommu} 42 0 0x1 0x0>;
181+
};
182+
};

‎arch/arm/mach-omap2/omap-iommu.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ static int __init omap_iommu_dev_init(struct omap_hwmod *oh, void *unused)
3434

3535
pdata->name = oh->name;
3636
pdata->nr_tlb_entries = a->nr_tlb_entries;
37-
pdata->da_start = a->da_start;
38-
pdata->da_end = a->da_end;
3937

4038
if (oh->rst_lines_cnt == 1) {
4139
pdata->reset_name = oh->rst_lines->name;

‎arch/arm/mach-omap2/omap_hwmod_3xxx_data.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2986,8 +2986,6 @@ static struct omap_hwmod_class omap3xxx_mmu_hwmod_class = {
29862986
/* mmu isp */
29872987

29882988
static struct omap_mmu_dev_attr mmu_isp_dev_attr = {
2989-
.da_start = 0x0,
2990-
.da_end = 0xfffff000,
29912989
.nr_tlb_entries = 8,
29922990
};
29932991

@@ -3026,8 +3024,6 @@ static struct omap_hwmod omap3xxx_mmu_isp_hwmod = {
30263024
/* mmu iva */
30273025

30283026
static struct omap_mmu_dev_attr mmu_iva_dev_attr = {
3029-
.da_start = 0x11000000,
3030-
.da_end = 0xfffff000,
30313027
.nr_tlb_entries = 32,
30323028
};
30333029

‎arch/arm/mach-omap2/omap_hwmod_44xx_data.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,8 +2084,6 @@ static struct omap_hwmod_class omap44xx_mmu_hwmod_class = {
20842084
/* mmu ipu */
20852085

20862086
static struct omap_mmu_dev_attr mmu_ipu_dev_attr = {
2087-
.da_start = 0x0,
2088-
.da_end = 0xfffff000,
20892087
.nr_tlb_entries = 32,
20902088
};
20912089

@@ -2133,8 +2131,6 @@ static struct omap_hwmod omap44xx_mmu_ipu_hwmod = {
21332131
/* mmu dsp */
21342132

21352133
static struct omap_mmu_dev_attr mmu_dsp_dev_attr = {
2136-
.da_start = 0x0,
2137-
.da_end = 0xfffff000,
21382134
.nr_tlb_entries = 32,
21392135
};
21402136

‎drivers/iommu/Kconfig‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ config AMD_IOMMU_STATS
7676

7777
config AMD_IOMMU_V2
7878
tristate "AMD IOMMU Version 2 driver"
79-
depends on AMD_IOMMU && PROFILING
79+
depends on AMD_IOMMU
8080
select MMU_NOTIFIER
8181
---help---
8282
This option enables support for the AMD IOMMUv2 features of the IOMMU
@@ -143,16 +143,12 @@ config OMAP_IOMMU
143143
depends on ARCH_OMAP2PLUS
144144
select IOMMU_API
145145

146-
config OMAP_IOVMM
147-
tristate "OMAP IO Virtual Memory Manager Support"
148-
depends on OMAP_IOMMU
149-
150146
config OMAP_IOMMU_DEBUG
151-
tristate "Export OMAP IOMMU/IOVMM internals in DebugFS"
152-
depends on OMAP_IOVMM && DEBUG_FS
147+
tristate "Export OMAP IOMMU internals in DebugFS"
148+
depends on OMAP_IOMMU && DEBUG_FS
153149
help
154150
Select this to see extensive information about
155-
the internal state of OMAP IOMMU/IOVMM in debugfs.
151+
the internal state of OMAP IOMMU in debugfs.
156152

157153
Say N unless you know you need this.
158154

@@ -180,6 +176,7 @@ config EXYNOS_IOMMU
180176
bool "Exynos IOMMU Support"
181177
depends on ARCH_EXYNOS
182178
select IOMMU_API
179+
select ARM_DMA_USE_IOMMU
183180
help
184181
Support for the IOMMU (System MMU) of Samsung Exynos application
185182
processor family. This enables H/W multimedia accelerators to see

‎drivers/iommu/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
obj-$(CONFIG_IOMMU_API) += iommu.o
22
obj-$(CONFIG_IOMMU_API) += iommu-traces.o
3+
obj-$(CONFIG_IOMMU_API) += iommu-sysfs.o
34
obj-$(CONFIG_OF_IOMMU) += of_iommu.o
45
obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o msm_iommu_dev.o
56
obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o
@@ -11,7 +12,6 @@ obj-$(CONFIG_IPMMU_VMSA) += ipmmu-vmsa.o
1112
obj-$(CONFIG_IRQ_REMAP) += intel_irq_remapping.o irq_remapping.o
1213
obj-$(CONFIG_OMAP_IOMMU) += omap-iommu.o
1314
obj-$(CONFIG_OMAP_IOMMU) += omap-iommu2.o
14-
obj-$(CONFIG_OMAP_IOVMM) += omap-iovmm.o
1515
obj-$(CONFIG_OMAP_IOMMU_DEBUG) += omap-iommu-debug.o
1616
obj-$(CONFIG_TEGRA_IOMMU_GART) += tegra-gart.o
1717
obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o

0 commit comments

Comments
 (0)