Skip to content

Commit a13de74

Browse files
committed
Merge tag 'iommu-updates-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu updates from Joerg Roedel: - Consolidate iommu_map/unmap functions. There have been blocking and atomic variants so far, but that was problematic as this approach does not scale with required new variants which just differ in the GFP flags used. So Jason consolidated this back into single functions that take a GFP parameter. - Retire the detach_dev() call-back in iommu_ops - Arm SMMU updates from Will: - Device-tree binding updates: - Cater for three power domains on SM6375 - Document existing compatible strings for Qualcomm SoCs - Tighten up clocks description for platform-specific compatible strings - Enable Qualcomm workarounds for some additional platforms that need them - Intel VT-d updates from Lu Baolu: - Add Intel IOMMU performance monitoring support - Set No Execute Enable bit in PASID table entry - Two performance optimizations - Fix PASID directory pointer coherency - Fix missed rollbacks in error path - Cleanups - Apple t8110 DART support - Exynos IOMMU: - Implement better fault handling - Error handling fixes - Renesas IPMMU: - Add device tree bindings for r8a779g0 - AMD IOMMU: - Various fixes for handling on SNP-enabled systems and handling of faults with unknown request-ids - Cleanups and other small fixes - Various other smaller fixes and cleanups * tag 'iommu-updates-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (71 commits) iommu/amd: Skip attach device domain is same as new domain iommu: Attach device group to old domain in error path iommu/vt-d: Allow to use flush-queue when first level is default iommu/vt-d: Fix PASID directory pointer coherency iommu/vt-d: Avoid superfluous IOTLB tracking in lazy mode iommu/vt-d: Fix error handling in sva enable/disable paths iommu/amd: Improve page fault error reporting iommu/amd: Do not identity map v2 capable device when snp is enabled iommu: Fix error unwind in iommu_group_alloc() iommu/of: mark an unused function as __maybe_unused iommu: dart: DART_T8110_ERROR range should be 0 to 5 iommu/vt-d: Enable IOMMU perfmon support iommu/vt-d: Add IOMMU perfmon overflow handler support iommu/vt-d: Support cpumask for IOMMU perfmon iommu/vt-d: Add IOMMU perfmon support iommu/vt-d: Support Enhanced Command Interface iommu/vt-d: Retrieve IOMMU perfmon capability information iommu/vt-d: Support size of the register set in DRHD iommu/vt-d: Set No Execute Enable bit in PASID table entry iommu/vt-d: Remove sva from intel_svm_dev ...
2 parents 8395d93 + bedd29d commit a13de74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2493
-646
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
What: /sys/bus/event_source/devices/dmar*/format
2+
Date: Jan 2023
3+
KernelVersion: 6.3
4+
Contact: Kan Liang <[email protected]>
5+
Description: Read-only. Attribute group to describe the magic bits
6+
that go into perf_event_attr.config,
7+
perf_event_attr.config1 or perf_event_attr.config2 for
8+
the IOMMU pmu. (See also
9+
ABI/testing/sysfs-bus-event_source-devices-format).
10+
11+
Each attribute in this group defines a bit range in
12+
perf_event_attr.config, perf_event_attr.config1,
13+
or perf_event_attr.config2. All supported attributes
14+
are listed below (See the VT-d Spec 4.0 for possible
15+
attribute values)::
16+
17+
event = "config:0-27" - event ID
18+
event_group = "config:28-31" - event group ID
19+
20+
filter_requester_en = "config1:0" - Enable Requester ID filter
21+
filter_domain_en = "config1:1" - Enable Domain ID filter
22+
filter_pasid_en = "config1:2" - Enable PASID filter
23+
filter_ats_en = "config1:3" - Enable Address Type filter
24+
filter_page_table_en= "config1:4" - Enable Page Table Level filter
25+
filter_requester_id = "config1:16-31" - Requester ID filter
26+
filter_domain = "config1:32-47" - Domain ID filter
27+
filter_pasid = "config2:0-21" - PASID filter
28+
filter_ats = "config2:24-28" - Address Type filter
29+
filter_page_table = "config2:32-36" - Page Table Level filter
30+
31+
What: /sys/bus/event_source/devices/dmar*/cpumask
32+
Date: Jan 2023
33+
KernelVersion: 6.3
34+
Contact: Kan Liang <[email protected]>
35+
Description: Read-only. This file always returns the CPU to which the
36+
IOMMU pmu is bound for access to all IOMMU pmu performance
37+
monitoring events.

Documentation/devicetree/bindings/iommu/apple,dart.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ properties:
2424
compatible:
2525
enum:
2626
- apple,t8103-dart
27+
- apple,t8110-dart
2728
- apple,t6000-dart
2829

2930
reg:

Documentation/devicetree/bindings/iommu/arm,smmu.yaml

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ properties:
3636
- enum:
3737
- qcom,qcm2290-smmu-500
3838
- qcom,qdu1000-smmu-500
39+
- qcom,sa8775p-smmu-500
3940
- qcom,sc7180-smmu-500
4041
- qcom,sc7280-smmu-500
4142
- qcom,sc8180x-smmu-500
4243
- qcom,sc8280xp-smmu-500
4344
- qcom,sdm670-smmu-500
4445
- qcom,sdm845-smmu-500
46+
- qcom,sdx55-smmu-500
47+
- qcom,sdx65-smmu-500
4548
- qcom,sm6115-smmu-500
49+
- qcom,sm6125-smmu-500
4650
- qcom,sm6350-smmu-500
4751
- qcom,sm6375-smmu-500
4852
- qcom,sm8150-smmu-500
@@ -52,14 +56,6 @@ properties:
5256
- const: qcom,smmu-500
5357
- const: arm,mmu-500
5458

55-
- description: Qcom SoCs implementing "arm,mmu-500" (non-qcom implementation)
56-
deprecated: true
57-
items:
58-
- enum:
59-
- qcom,sdx55-smmu-500
60-
- qcom,sdx65-smmu-500
61-
- const: arm,mmu-500
62-
6359
- description: Qcom SoCs implementing "arm,mmu-500" (legacy binding)
6460
deprecated: true
6561
items:
@@ -84,6 +80,7 @@ properties:
8480
items:
8581
- enum:
8682
- qcom,sc7280-smmu-500
83+
- qcom,sm8150-smmu-500
8784
- qcom,sm8250-smmu-500
8885
- const: qcom,adreno-smmu
8986
- const: arm,mmu-500
@@ -201,7 +198,8 @@ properties:
201198
maxItems: 7
202199

203200
power-domains:
204-
maxItems: 1
201+
minItems: 1
202+
maxItems: 3
205203

206204
nvidia,memory-controller:
207205
description: |
@@ -366,6 +364,56 @@ allOf:
366364
- description: interface clock required to access smmu's registers
367365
through the TCU's programming interface.
368366

367+
# Disallow clocks for all other platforms with specific compatibles
368+
- if:
369+
properties:
370+
compatible:
371+
contains:
372+
enum:
373+
- cavium,smmu-v2
374+
- marvell,ap806-smmu-500
375+
- nvidia,smmu-500
376+
- qcom,qcm2290-smmu-500
377+
- qcom,qdu1000-smmu-500
378+
- qcom,sa8775p-smmu-500
379+
- qcom,sc7180-smmu-500
380+
- qcom,sc8180x-smmu-500
381+
- qcom,sc8280xp-smmu-500
382+
- qcom,sdm670-smmu-500
383+
- qcom,sdm845-smmu-500
384+
- qcom,sdx55-smmu-500
385+
- qcom,sdx65-smmu-500
386+
- qcom,sm6115-smmu-500
387+
- qcom,sm6125-smmu-500
388+
- qcom,sm6350-smmu-500
389+
- qcom,sm6375-smmu-500
390+
- qcom,sm8350-smmu-500
391+
- qcom,sm8450-smmu-500
392+
then:
393+
properties:
394+
clock-names: false
395+
clocks: false
396+
397+
- if:
398+
properties:
399+
compatible:
400+
contains:
401+
const: qcom,sm6375-smmu-500
402+
then:
403+
properties:
404+
power-domains:
405+
items:
406+
- description: SNoC MMU TBU RT GDSC
407+
- description: SNoC MMU TBU NRT GDSC
408+
- description: SNoC TURING MMU TBU0 GDSC
409+
410+
required:
411+
- power-domains
412+
else:
413+
properties:
414+
power-domains:
415+
maxItems: 1
416+
369417
examples:
370418
- |+
371419
/* SMMU with stream matching or stream indexing */

Documentation/devicetree/bindings/iommu/qcom,iommu.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ to non-secure vs secure interrupt line.
1010
- compatible : Should be one of:
1111

1212
"qcom,msm8916-iommu"
13+
"qcom,msm8953-iommu"
1314

1415
Followed by "qcom,msm-iommu-v1".
1516

Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ properties:
4949
- enum:
5050
- renesas,ipmmu-r8a779a0 # R-Car V3U
5151
- renesas,ipmmu-r8a779f0 # R-Car S4-8
52+
- renesas,ipmmu-r8a779g0 # R-Car V4H
5253
- const: renesas,rcar-gen4-ipmmu-vmsa # R-Car Gen4
5354

5455
reg:

Documentation/devicetree/bindings/reserved-memory/reserved-memory.yaml

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,30 @@ properties:
5252
Address and Length pairs. Specifies regions of memory that are
5353
acceptable to allocate from.
5454
55+
iommu-addresses:
56+
$ref: /schemas/types.yaml#/definitions/phandle-array
57+
description: >
58+
A list of phandle and specifier pairs that describe static IO virtual
59+
address space mappings and carveouts associated with a given reserved
60+
memory region. The phandle in the first cell refers to the device for
61+
which the mapping or carveout is to be created.
62+
63+
The specifier consists of an address/size pair and denotes the IO
64+
virtual address range of the region for the given device. The exact
65+
format depends on the values of the "#address-cells" and "#size-cells"
66+
properties of the device referenced via the phandle.
67+
68+
When used in combination with a "reg" property, an IOVA mapping is to
69+
be established for this memory region. One example where this can be
70+
useful is to create an identity mapping for physical memory that the
71+
firmware has configured some hardware to access (such as a bootsplash
72+
framebuffer).
73+
74+
If no "reg" property is specified, the "iommu-addresses" property
75+
defines carveout regions in the IOVA space for the given device. This
76+
can be useful if a certain memory region should not be mapped through
77+
the IOMMU.
78+
5579
no-map:
5680
type: boolean
5781
description: >
@@ -89,12 +113,69 @@ allOf:
89113
- no-map
90114

91115
oneOf:
92-
- required:
93-
- reg
116+
- oneOf:
117+
- required:
118+
- reg
119+
120+
- required:
121+
- size
122+
123+
- oneOf:
124+
# IOMMU reservations
125+
- required:
126+
- iommu-addresses
94127

95-
- required:
96-
- size
128+
# IOMMU mappings
129+
- required:
130+
- reg
131+
- iommu-addresses
97132

98133
additionalProperties: true
99134

135+
examples:
136+
- |
137+
/ {
138+
compatible = "foo";
139+
model = "foo";
140+
141+
#address-cells = <2>;
142+
#size-cells = <2>;
143+
144+
reserved-memory {
145+
#address-cells = <2>;
146+
#size-cells = <2>;
147+
ranges;
148+
149+
adsp_resv: reservation-adsp {
150+
/*
151+
* Restrict IOVA mappings for ADSP buffers to the 512 MiB region
152+
* from 0x40000000 - 0x5fffffff. Anything outside is reserved by
153+
* the ADSP for I/O memory and private memory allocations.
154+
*/
155+
iommu-addresses = <&adsp 0x0 0x00000000 0x00 0x40000000>,
156+
<&adsp 0x0 0x60000000 0xff 0xa0000000>;
157+
};
158+
159+
fb: framebuffer@90000000 {
160+
reg = <0x0 0x90000000 0x0 0x00800000>;
161+
iommu-addresses = <&dc0 0x0 0x90000000 0x0 0x00800000>;
162+
};
163+
};
164+
165+
bus@0 {
166+
#address-cells = <1>;
167+
#size-cells = <1>;
168+
ranges = <0x0 0x0 0x0 0x40000000>;
169+
170+
adsp: adsp@2990000 {
171+
reg = <0x2990000 0x2000>;
172+
memory-region = <&adsp_resv>;
173+
};
174+
175+
dc0: display@15200000 {
176+
reg = <0x15200000 0x10000>;
177+
memory-region = <&fb>;
178+
};
179+
};
180+
};
100181
...

MAINTAINERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10354,7 +10354,6 @@ L: [email protected]
1035410354
S: Supported
1035510355
T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
1035610356
F: drivers/iommu/intel/
10357-
F: include/linux/intel-svm.h
1035810357

1035910358
INTEL IPU3 CSI-2 CIO2 DRIVER
1036010359
M: Yong Zhi <[email protected]>

arch/arm/mm/dma-mapping.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,8 @@ __iommu_create_mapping(struct device *dev, struct page **pages, size_t size,
984984

985985
len = (j - i) << PAGE_SHIFT;
986986
ret = iommu_map(mapping->domain, iova, phys, len,
987-
__dma_info_to_prot(DMA_BIDIRECTIONAL, attrs));
987+
__dma_info_to_prot(DMA_BIDIRECTIONAL, attrs),
988+
GFP_KERNEL);
988989
if (ret < 0)
989990
goto fail;
990991
iova += len;
@@ -1207,7 +1208,8 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg,
12071208

12081209
prot = __dma_info_to_prot(dir, attrs);
12091210

1210-
ret = iommu_map(mapping->domain, iova, phys, len, prot);
1211+
ret = iommu_map(mapping->domain, iova, phys, len, prot,
1212+
GFP_KERNEL);
12111213
if (ret < 0)
12121214
goto fail;
12131215
count += len >> PAGE_SHIFT;
@@ -1379,7 +1381,8 @@ static dma_addr_t arm_iommu_map_page(struct device *dev, struct page *page,
13791381

13801382
prot = __dma_info_to_prot(dir, attrs);
13811383

1382-
ret = iommu_map(mapping->domain, dma_addr, page_to_phys(page), len, prot);
1384+
ret = iommu_map(mapping->domain, dma_addr, page_to_phys(page), len,
1385+
prot, GFP_KERNEL);
13831386
if (ret < 0)
13841387
goto fail;
13851388

@@ -1443,7 +1446,7 @@ static dma_addr_t arm_iommu_map_resource(struct device *dev,
14431446

14441447
prot = __dma_info_to_prot(dir, attrs) | IOMMU_MMIO;
14451448

1446-
ret = iommu_map(mapping->domain, dma_addr, addr, len, prot);
1449+
ret = iommu_map(mapping->domain, dma_addr, addr, len, prot, GFP_KERNEL);
14471450
if (ret < 0)
14481451
goto fail;
14491452

arch/s390/include/asm/pci_dma.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,10 @@ static inline unsigned long *get_st_pto(unsigned long entry)
186186

187187
/* Prototypes */
188188
void dma_free_seg_table(unsigned long);
189-
unsigned long *dma_alloc_cpu_table(void);
189+
unsigned long *dma_alloc_cpu_table(gfp_t gfp);
190190
void dma_cleanup_tables(unsigned long *);
191-
unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr);
191+
unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr,
192+
gfp_t gfp);
192193
void dma_update_cpu_trans(unsigned long *entry, phys_addr_t page_addr, int flags);
193194

194195
extern const struct dma_map_ops s390_pci_dma_ops;

0 commit comments

Comments
 (0)