Skip to content

Commit d652ea3

Browse files
committed
Merge tag 'iommu-updates-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu updates from Joerg Roedel: - ARM SMMU and Mediatek updates from Will Deacon: - Support for MT8192 IOMMU from Mediatek - Arm v7s io-pgtable extensions for MT8192 - Removal of TLBI_ON_MAP quirk - New Qualcomm compatible strings - Allow SVA without hardware broadcast TLB maintenance on SMMUv3 - Virtualization Host Extension support for SMMUv3 (SVA) - Allow SMMUv3 PMU perf driver to be built independently from IOMMU - Some tidy-up in IOVA and core code - Conversion of the AMD IOMMU code to use the generic IO-page-table framework - Intel VT-d updates from Lu Baolu: - Audit capability consistency among different IOMMUs - Add SATC reporting structure support - Add iotlb_sync_map callback support - SDHI support for Renesas IOMMU driver - Misc cleanups and other small improvments * tag 'iommu-updates-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (94 commits) iommu/amd: Fix performance counter initialization MAINTAINERS: repair file pattern in MEDIATEK IOMMU DRIVER iommu/mediatek: Fix error code in probe() iommu/mediatek: Fix unsigned domid comparison with less than zero iommu/vt-d: Parse SATC reporting structure iommu/vt-d: Add new enum value and structure for SATC iommu/vt-d: Add iotlb_sync_map callback iommu/vt-d: Move capability check code to cap_audit files iommu/vt-d: Audit IOMMU Capabilities and add helper functions iommu/vt-d: Fix 'physical' typos iommu: Properly pass gfp_t in _iommu_map() to avoid atomic sleeping iommu/vt-d: Fix compile error [-Werror=implicit-function-declaration] driver/perf: Remove ARM_SMMU_V3_PMU dependency on ARM_SMMU_V3 MAINTAINERS: Add entry for MediaTek IOMMU iommu/mediatek: Add mt8192 support iommu/mediatek: Remove unnecessary check in attach_device iommu/mediatek: Support master use iova over 32bit iommu/mediatek: Add iova reserved function iommu/mediatek: Support for multi domains iommu/mediatek: Add get_domain_id from dev->dma_range_map ...
2 parents 3672ac8 + 45e606f commit d652ea3

Some content is hidden

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

52 files changed

+2389
-1305
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ properties:
3434
items:
3535
- enum:
3636
- qcom,sc7180-smmu-500
37+
- qcom,sc8180x-smmu-500
3738
- qcom,sdm845-smmu-500
3839
- qcom,sm8150-smmu-500
3940
- qcom,sm8250-smmu-500
41+
- qcom,sm8350-smmu-500
4042
- const: arm,mmu-500
4143
- description: Qcom Adreno GPUs implementing "arm,smmu-v2"
4244
items:

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

Lines changed: 0 additions & 105 deletions
This file was deleted.
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/iommu/mediatek,iommu.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: MediaTek IOMMU Architecture Implementation
8+
9+
maintainers:
10+
- Yong Wu <[email protected]>
11+
12+
description: |+
13+
Some MediaTek SOCs contain a Multimedia Memory Management Unit (M4U), and
14+
this M4U have two generations of HW architecture. Generation one uses flat
15+
pagetable, and only supports 4K size page mapping. Generation two uses the
16+
ARM Short-Descriptor translation table format for address translation.
17+
18+
About the M4U Hardware Block Diagram, please check below:
19+
20+
EMI (External Memory Interface)
21+
|
22+
m4u (Multimedia Memory Management Unit)
23+
|
24+
+--------+
25+
| |
26+
gals0-rx gals1-rx (Global Async Local Sync rx)
27+
| |
28+
| |
29+
gals0-tx gals1-tx (Global Async Local Sync tx)
30+
| | Some SoCs may have GALS.
31+
+--------+
32+
|
33+
SMI Common(Smart Multimedia Interface Common)
34+
|
35+
+----------------+-------
36+
| |
37+
| gals-rx There may be GALS in some larbs.
38+
| |
39+
| |
40+
| gals-tx
41+
| |
42+
SMI larb0 SMI larb1 ... SoCs have several SMI local arbiter(larb).
43+
(display) (vdec)
44+
| |
45+
| |
46+
+-----+-----+ +----+----+
47+
| | | | | |
48+
| | |... | | | ... There are different ports in each larb.
49+
| | | | | |
50+
OVL0 RDMA0 WDMA0 MC PP VLD
51+
52+
As above, The Multimedia HW will go through SMI and M4U while it
53+
access EMI. SMI is a bridge between m4u and the Multimedia HW. It contain
54+
smi local arbiter and smi common. It will control whether the Multimedia
55+
HW should go though the m4u for translation or bypass it and talk
56+
directly with EMI. And also SMI help control the power domain and clocks for
57+
each local arbiter.
58+
59+
Normally we specify a local arbiter(larb) for each multimedia HW
60+
like display, video decode, and camera. And there are different ports
61+
in each larb. Take a example, There are many ports like MC, PP, VLD in the
62+
video decode local arbiter, all these ports are according to the video HW.
63+
64+
In some SoCs, there may be a GALS(Global Async Local Sync) module between
65+
smi-common and m4u, and additional GALS module between smi-larb and
66+
smi-common. GALS can been seen as a "asynchronous fifo" which could help
67+
synchronize for the modules in different clock frequency.
68+
69+
properties:
70+
compatible:
71+
oneOf:
72+
- enum:
73+
- mediatek,mt2701-m4u # generation one
74+
- mediatek,mt2712-m4u # generation two
75+
- mediatek,mt6779-m4u # generation two
76+
- mediatek,mt8167-m4u # generation two
77+
- mediatek,mt8173-m4u # generation two
78+
- mediatek,mt8183-m4u # generation two
79+
- mediatek,mt8192-m4u # generation two
80+
81+
- description: mt7623 generation one
82+
items:
83+
- const: mediatek,mt7623-m4u
84+
- const: mediatek,mt2701-m4u
85+
86+
reg:
87+
maxItems: 1
88+
89+
interrupts:
90+
maxItems: 1
91+
92+
clocks:
93+
items:
94+
- description: bclk is the block clock.
95+
96+
clock-names:
97+
items:
98+
- const: bclk
99+
100+
mediatek,larbs:
101+
$ref: /schemas/types.yaml#/definitions/phandle-array
102+
minItems: 1
103+
maxItems: 32
104+
description: |
105+
List of phandle to the local arbiters in the current Socs.
106+
Refer to bindings/memory-controllers/mediatek,smi-larb.yaml. It must sort
107+
according to the local arbiter index, like larb0, larb1, larb2...
108+
109+
'#iommu-cells':
110+
const: 1
111+
description: |
112+
This is the mtk_m4u_id according to the HW. Specifies the mtk_m4u_id as
113+
defined in
114+
dt-binding/memory/mt2701-larb-port.h for mt2701 and mt7623,
115+
dt-binding/memory/mt2712-larb-port.h for mt2712,
116+
dt-binding/memory/mt6779-larb-port.h for mt6779,
117+
dt-binding/memory/mt8167-larb-port.h for mt8167,
118+
dt-binding/memory/mt8173-larb-port.h for mt8173,
119+
dt-binding/memory/mt8183-larb-port.h for mt8183,
120+
dt-binding/memory/mt8192-larb-port.h for mt8192.
121+
122+
power-domains:
123+
maxItems: 1
124+
125+
required:
126+
- compatible
127+
- reg
128+
- interrupts
129+
- mediatek,larbs
130+
- '#iommu-cells'
131+
132+
allOf:
133+
- if:
134+
properties:
135+
compatible:
136+
contains:
137+
enum:
138+
- mediatek,mt2701-m4u
139+
- mediatek,mt2712-m4u
140+
- mediatek,mt8173-m4u
141+
- mediatek,mt8192-m4u
142+
143+
then:
144+
required:
145+
- clocks
146+
147+
- if:
148+
properties:
149+
compatible:
150+
enum:
151+
- mediatek,mt8192-m4u
152+
153+
then:
154+
required:
155+
- power-domains
156+
157+
additionalProperties: false
158+
159+
examples:
160+
- |
161+
#include <dt-bindings/clock/mt8173-clk.h>
162+
#include <dt-bindings/interrupt-controller/arm-gic.h>
163+
164+
iommu: iommu@10205000 {
165+
compatible = "mediatek,mt8173-m4u";
166+
reg = <0x10205000 0x1000>;
167+
interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_LOW>;
168+
clocks = <&infracfg CLK_INFRA_M4U>;
169+
clock-names = "bclk";
170+
mediatek,larbs = <&larb0 &larb1 &larb2
171+
&larb3 &larb4 &larb5>;
172+
#iommu-cells = <1>;
173+
};
174+
175+
- |
176+
#include <dt-bindings/memory/mt8173-larb-port.h>
177+
178+
/* Example for a client device */
179+
display {
180+
compatible = "mediatek,mt8173-disp";
181+
iommus = <&iommu M4U_PORT_DISP_OVL0>,
182+
<&iommu M4U_PORT_DISP_RDMA0>;
183+
};

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11175,6 +11175,15 @@ S: Maintained
1117511175
F: Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
1117611176
F: drivers/i2c/busses/i2c-mt65xx.c
1117711177

11178+
MEDIATEK IOMMU DRIVER
11179+
M: Yong Wu <[email protected]>
11180+
11181+
L: [email protected] (moderated for non-subscribers)
11182+
S: Supported
11183+
F: Documentation/devicetree/bindings/iommu/mediatek*
11184+
F: drivers/iommu/mtk_iommu*
11185+
F: include/dt-bindings/memory/mt*-port.h
11186+
1117811187
MEDIATEK JPEG DRIVER
1117911188
M: Rick Chang <[email protected]>
1118011189
M: Bin Liu <[email protected]>

drivers/iommu/amd/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config AMD_IOMMU
1010
select IOMMU_API
1111
select IOMMU_IOVA
1212
select IOMMU_DMA
13+
select IOMMU_IO_PGTABLE
1314
depends on X86_64 && PCI && ACPI && HAVE_CMPXCHG_DOUBLE
1415
help
1516
With this option you can enable support for AMD IOMMU hardware in

drivers/iommu/amd/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
obj-$(CONFIG_AMD_IOMMU) += iommu.o init.o quirks.o
2+
obj-$(CONFIG_AMD_IOMMU) += iommu.o init.o quirks.o io_pgtable.o
33
obj-$(CONFIG_AMD_IOMMU_DEBUGFS) += debugfs.o
44
obj-$(CONFIG_AMD_IOMMU_V2) += iommu_v2.o

drivers/iommu/amd/amd_iommu.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ extern void amd_iommu_disable(void);
3636
extern int amd_iommu_reenable(int);
3737
extern int amd_iommu_enable_faulting(void);
3838
extern int amd_iommu_guest_ir;
39+
extern enum io_pgtable_fmt amd_iommu_pgtable;
3940

4041
/* IOMMUv2 specific functions */
4142
struct iommu_domain;
@@ -56,6 +57,10 @@ extern void amd_iommu_domain_direct_map(struct iommu_domain *dom);
5657
extern int amd_iommu_domain_enable_v2(struct iommu_domain *dom, int pasids);
5758
extern int amd_iommu_flush_page(struct iommu_domain *dom, u32 pasid,
5859
u64 address);
60+
extern void amd_iommu_update_and_flush_device_table(struct protection_domain *domain);
61+
extern void amd_iommu_domain_update(struct protection_domain *domain);
62+
extern void amd_iommu_domain_flush_complete(struct protection_domain *domain);
63+
extern void amd_iommu_domain_flush_tlb_pde(struct protection_domain *domain);
5964
extern int amd_iommu_flush_tlb(struct iommu_domain *dom, u32 pasid);
6065
extern int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, u32 pasid,
6166
unsigned long cr3);
@@ -99,6 +104,21 @@ static inline void *iommu_phys_to_virt(unsigned long paddr)
99104
return phys_to_virt(__sme_clr(paddr));
100105
}
101106

107+
static inline
108+
void amd_iommu_domain_set_pt_root(struct protection_domain *domain, u64 root)
109+
{
110+
atomic64_set(&domain->iop.pt_root, root);
111+
domain->iop.root = (u64 *)(root & PAGE_MASK);
112+
domain->iop.mode = root & 7; /* lowest 3 bits encode pgtable mode */
113+
}
114+
115+
static inline
116+
void amd_iommu_domain_clr_pt_root(struct protection_domain *domain)
117+
{
118+
amd_iommu_domain_set_pt_root(domain, 0);
119+
}
120+
121+
102122
extern bool translation_pre_enabled(struct amd_iommu *iommu);
103123
extern bool amd_iommu_is_attach_deferred(struct iommu_domain *domain,
104124
struct device *dev);
@@ -111,4 +131,6 @@ void amd_iommu_apply_ivrs_quirks(void);
111131
static inline void amd_iommu_apply_ivrs_quirks(void) { }
112132
#endif
113133

134+
extern void amd_iommu_domain_set_pgtable(struct protection_domain *domain,
135+
u64 *root, int mode);
114136
#endif

0 commit comments

Comments
 (0)