Skip to content

Commit 53564f4

Browse files
committed
Merge tag 'iommu-updates-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux
Pull iommu updates from Will Deacon: "Core: - Remove the 'pgsize_bitmap' member from 'struct iommu_ops' - Convert the x86 drivers over to msi_create_parent_irq_domain() AMD-Vi: - Add support for examining driver/device internals via debugfs - Add support for "HATDis" to disable host translation when it is not supported - Add support for limiting the maximum host translation level based on EFR[HATS] Apple DART: - Don't enable as built-in by default when ARCH_APPLE is selected Arm SMMU: - Devicetree bindings update for the Qualcomm SMMU in the "Milos" SoC - Support for Qualcomm SM6115 MDSS parts - Disable PRR on Qualcomm SM8250 as using these bits causes the hypervisor to explode Intel VT-d: - Reorganize Intel VT-d to be ready for iommupt - Optimize iotlb_sync_map for non-caching/non-RWBF modes - Fix missed PASID in dev TLB invalidation in cache_tag_flush_all() Mediatek: - Fix build warnings when W=1 Samsung Exynos: - Add support for reserved memory regions specified by the bootloader TI OMAP: - Use syscon_regmap_lookup_by_phandle_args() instead of parsing the node manually Misc: - Cleanups and minor fixes across the board" * tag 'iommu-updates-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux: (48 commits) iommu/vt-d: Fix UAF on sva unbind with pending IOPFs iommu/vt-d: Make iotlb_sync_map a static property of dmar_domain dt-bindings: arm-smmu: Remove sdm845-cheza specific entry iommu/amd: Fix geometry.aperture_end for V2 tables iommu/amd: Wrap debugfs ABI testing symbols snippets in literal code blocks iommu/amd: Add documentation for AMD IOMMU debugfs support iommu/amd: Add debugfs support to dump IRT Table iommu/amd: Add debugfs support to dump device table iommu/amd: Add support for device id user input iommu/amd: Add debugfs support to dump IOMMU command buffer iommu/amd: Add debugfs support to dump IOMMU Capability registers iommu/amd: Add debugfs support to dump IOMMU MMIO registers iommu/amd: Refactor AMD IOMMU debugfs initial setup dt-bindings: arm-smmu: document the support on Milos iommu/exynos: add support for reserved regions iommu/arm-smmu: disable PRR on SM8250 iommu/arm-smmu-v3: Revert vmaster in the error path iommu/io-pgtable-arm: Remove unused macro iopte_prot iommu/arm-smmu-qcom: Add SM6115 MDSS compatible iommu/qcom: Fix pgsize_bitmap ...
2 parents d9104ce + b9e6e8a commit 53564f4

Some content is hidden

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

42 files changed

+956
-351
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
What: /sys/kernel/debug/iommu/amd/iommu<x>/mmio
2+
Date: January 2025
3+
Contact: Dheeraj Kumar Srivastava <[email protected]>
4+
Description:
5+
This file provides read/write access for user input. Users specify the
6+
MMIO register offset for iommu<x>, and the file outputs the corresponding
7+
MMIO register value of iommu<x>
8+
9+
Example::
10+
11+
$ echo "0x18" > /sys/kernel/debug/iommu/amd/iommu00/mmio
12+
$ cat /sys/kernel/debug/iommu/amd/iommu00/mmio
13+
14+
Output::
15+
16+
Offset:0x18 Value:0x000c22000003f48d
17+
18+
What: /sys/kernel/debug/iommu/amd/iommu<x>/capability
19+
Date: January 2025
20+
Contact: Dheeraj Kumar Srivastava <[email protected]>
21+
Description:
22+
This file provides read/write access for user input. Users specify the
23+
capability register offset for iommu<x>, and the file outputs the
24+
corresponding capability register value of iommu<x>.
25+
26+
Example::
27+
28+
$ echo "0x10" > /sys/kernel/debug/iommu/amd/iommu00/capability
29+
$ cat /sys/kernel/debug/iommu/amd/iommu00/capability
30+
31+
Output::
32+
33+
Offset:0x10 Value:0x00203040
34+
35+
What: /sys/kernel/debug/iommu/amd/iommu<x>/cmdbuf
36+
Date: January 2025
37+
Contact: Dheeraj Kumar Srivastava <[email protected]>
38+
Description:
39+
This file is a read-only output file containing iommu<x> command
40+
buffer entries.
41+
42+
Examples::
43+
44+
$ cat /sys/kernel/debug/iommu/amd/iommu<x>/cmdbuf
45+
46+
Output::
47+
48+
CMD Buffer Head Offset:339 Tail Offset:339
49+
0: 00835001 10000001 00003c00 00000000
50+
1: 00000000 30000005 fffff003 7fffffff
51+
2: 00835001 10000001 00003c01 00000000
52+
3: 00000000 30000005 fffff003 7fffffff
53+
4: 00835001 10000001 00003c02 00000000
54+
5: 00000000 30000005 fffff003 7fffffff
55+
6: 00835001 10000001 00003c03 00000000
56+
7: 00000000 30000005 fffff003 7fffffff
57+
8: 00835001 10000001 00003c04 00000000
58+
9: 00000000 30000005 fffff003 7fffffff
59+
10: 00835001 10000001 00003c05 00000000
60+
11: 00000000 30000005 fffff003 7fffffff
61+
[...]
62+
63+
What: /sys/kernel/debug/iommu/amd/devid
64+
Date: January 2025
65+
Contact: Dheeraj Kumar Srivastava <[email protected]>
66+
Description:
67+
This file provides read/write access for user input. Users specify the
68+
device ID, which can be used to dump IOMMU data structures such as the
69+
interrupt remapping table and device table.
70+
71+
Example:
72+
73+
1.
74+
::
75+
76+
$ echo 0000:01:00.0 > /sys/kernel/debug/iommu/amd/devid
77+
$ cat /sys/kernel/debug/iommu/amd/devid
78+
79+
Output::
80+
81+
0000:01:00.0
82+
83+
2.
84+
::
85+
86+
$ echo 01:00.0 > /sys/kernel/debug/iommu/amd/devid
87+
$ cat /sys/kernel/debug/iommu/amd/devid
88+
89+
Output::
90+
91+
0000:01:00.0
92+
93+
What: /sys/kernel/debug/iommu/amd/devtbl
94+
Date: January 2025
95+
Contact: Dheeraj Kumar Srivastava <[email protected]>
96+
Description:
97+
This file is a read-only output file containing the device table entry
98+
for the device ID provided in /sys/kernel/debug/iommu/amd/devid.
99+
100+
Example::
101+
102+
$ cat /sys/kernel/debug/iommu/amd/devtbl
103+
104+
Output::
105+
106+
DeviceId QWORD[3] QWORD[2] QWORD[1] QWORD[0] iommu
107+
0000:01:00.0 0000000000000000 20000001373b8013 0000000000000038 6000000114d7b603 iommu3
108+
109+
What: /sys/kernel/debug/iommu/amd/irqtbl
110+
Date: January 2025
111+
Contact: Dheeraj Kumar Srivastava <[email protected]>
112+
Description:
113+
This file is a read-only output file containing valid IRT table entries
114+
for the device ID provided in /sys/kernel/debug/iommu/amd/devid.
115+
116+
Example::
117+
118+
$ cat /sys/kernel/debug/iommu/amd/irqtbl
119+
120+
Output::
121+
122+
DeviceId 0000:01:00.0
123+
IRT[0000] 0000000000000020 0000000000000241
124+
IRT[0001] 0000000000000020 0000000000000841
125+
IRT[0002] 0000000000000020 0000000000002041
126+
IRT[0003] 0000000000000020 0000000000008041
127+
IRT[0004] 0000000000000020 0000000000020041
128+
IRT[0005] 0000000000000020 0000000000080041
129+
IRT[0006] 0000000000000020 0000000000200041
130+
IRT[0007] 0000000000000020 0000000000800041
131+
[...]

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ properties:
3535
- description: Qcom SoCs implementing "qcom,smmu-500" and "arm,mmu-500"
3636
items:
3737
- enum:
38+
- qcom,milos-smmu-500
3839
- qcom,qcm2290-smmu-500
3940
- qcom,qcs615-smmu-500
4041
- qcom,qcs8300-smmu-500
@@ -88,6 +89,7 @@ properties:
8889
- description: Qcom Adreno GPUs implementing "qcom,smmu-500" and "arm,mmu-500"
8990
items:
9091
- enum:
92+
- qcom,milos-smmu-500
9193
- qcom,qcm2290-smmu-500
9294
- qcom,qcs615-smmu-500
9395
- qcom,qcs8300-smmu-500
@@ -132,10 +134,6 @@ properties:
132134
- qcom,sm7150-smmu-v2
133135
- const: qcom,adreno-smmu
134136
- const: qcom,smmu-v2
135-
- description: Qcom Adreno GPUs on Google Cheza platform
136-
items:
137-
- const: qcom,sdm845-smmu-v2
138-
- const: qcom,smmu-v2
139137
- description: Marvell SoCs implementing "arm,mmu-500"
140138
items:
141139
- const: marvell,ap806-smmu-500
@@ -534,6 +532,7 @@ allOf:
534532
compatible:
535533
items:
536534
- enum:
535+
- qcom,milos-smmu-500
537536
- qcom,sar2130p-smmu-500
538537
- qcom,sm8550-smmu-500
539538
- qcom,sm8650-smmu-500

drivers/iommu/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ source "drivers/iommu/riscv/Kconfig"
200200
config IRQ_REMAP
201201
bool "Support for Interrupt Remapping"
202202
depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI
203+
select IRQ_MSI_LIB
203204
help
204205
Supports Interrupt remapping for IO-APIC and MSI devices.
205206
To use x2apic mode in the CPU's which support x2APIC enhancements or
@@ -305,7 +306,6 @@ config APPLE_DART
305306
depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_DART
306307
select IOMMU_API
307308
select IOMMU_IO_PGTABLE_DART
308-
default ARCH_APPLE
309309
help
310310
Support for Apple DART (Device Address Resolution Table) IOMMUs
311311
found in Apple ARM SoCs like the M1.

drivers/iommu/amd/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ config AMD_IOMMU
77
select PCI_ATS
88
select PCI_PRI
99
select PCI_PASID
10+
select IRQ_MSI_LIB
1011
select MMU_NOTIFIER
1112
select IOMMU_API
1213
select IOMMU_IOVA

drivers/iommu/amd/amd_iommu.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ void *__init iommu_alloc_4k_pages(struct amd_iommu *iommu,
2828
gfp_t gfp, size_t size);
2929

3030
#ifdef CONFIG_AMD_IOMMU_DEBUGFS
31-
void amd_iommu_debugfs_setup(struct amd_iommu *iommu);
31+
void amd_iommu_debugfs_setup(void);
3232
#else
33-
static inline void amd_iommu_debugfs_setup(struct amd_iommu *iommu) {}
33+
static inline void amd_iommu_debugfs_setup(void) {}
3434
#endif
3535

3636
/* Needed for interrupt remapping */
@@ -42,7 +42,9 @@ int amd_iommu_enable_faulting(unsigned int cpu);
4242
extern int amd_iommu_guest_ir;
4343
extern enum protection_domain_mode amd_iommu_pgtable;
4444
extern int amd_iommu_gpt_level;
45+
extern u8 amd_iommu_hpt_level;
4546
extern unsigned long amd_iommu_pgsize_bitmap;
47+
extern bool amd_iommu_hatdis;
4648

4749
/* Protection domain ops */
4850
void amd_iommu_init_identity_domain(void);

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
#define FEATURE_GA BIT_ULL(7)
9595
#define FEATURE_HE BIT_ULL(8)
9696
#define FEATURE_PC BIT_ULL(9)
97+
#define FEATURE_HATS GENMASK_ULL(11, 10)
9798
#define FEATURE_GATS GENMASK_ULL(13, 12)
9899
#define FEATURE_GLX GENMASK_ULL(15, 14)
99100
#define FEATURE_GAM_VAPIC BIT_ULL(21)
@@ -460,6 +461,9 @@
460461
/* IOMMU Feature Reporting Field (for IVHD type 10h */
461462
#define IOMMU_FEAT_GASUP_SHIFT 6
462463

464+
/* IOMMU HATDIS for IVHD type 11h and 40h */
465+
#define IOMMU_IVHD_ATTR_HATDIS_SHIFT 0
466+
463467
/* IOMMU Extended Feature Register (EFR) */
464468
#define IOMMU_EFR_XTSUP_SHIFT 2
465469
#define IOMMU_EFR_GASUP_SHIFT 7
@@ -558,7 +562,8 @@ struct amd_io_pgtable {
558562
};
559563

560564
enum protection_domain_mode {
561-
PD_MODE_V1 = 1,
565+
PD_MODE_NONE,
566+
PD_MODE_V1,
562567
PD_MODE_V2,
563568
};
564569

@@ -790,6 +795,8 @@ struct amd_iommu {
790795
#ifdef CONFIG_AMD_IOMMU_DEBUGFS
791796
/* DebugFS Info */
792797
struct dentry *debugfs;
798+
int dbg_mmio_offset;
799+
int dbg_cap_offset;
793800
#endif
794801

795802
/* IOPF support */
@@ -890,6 +897,13 @@ struct dev_table_entry {
890897
};
891898
};
892899

900+
/*
901+
* Structure defining one entry in the command buffer
902+
*/
903+
struct iommu_cmd {
904+
u32 data[4];
905+
};
906+
893907
/*
894908
* Structure to sture persistent DTE flags from IVHD
895909
*/

0 commit comments

Comments
 (0)