Skip to content

Commit f1c243f

Browse files
committed
Merge tag 'iommu-updates-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux
Pull iommu updates from Joerg Roedel: "Core changes: - PASID support for the blocked_domain ARM-SMMU Updates: - SMMUv2: - Implement per-client prefetcher configuration on Qualcomm SoCs - Support for the Adreno SMMU on Qualcomm's SDM670 SOC - SMMUv3: - Pretty-printing of event records - Drop the ->domain_alloc_paging implementation in favour of domain_alloc_paging_flags(flags==0) - IO-PGTable: - Generalisation of the page-table walker to enable external walkers (e.g. for debugging unexpected page-faults from the GPU) - Minor fix for handling concatenated PGDs at stage-2 with 16KiB pages - Misc: - Clean-up device probing and replace the crufty probe-deferral hack with a more robust implementation of arm_smmu_get_by_fwnode() - Device-tree binding updates for a bunch of Qualcomm platforms Intel VT-d Updates: - Remove domain_alloc_paging() - Remove capability audit code - Draining PRQ in sva unbind path when FPD bit set - Link cache tags of same iommu unit together AMD-Vi Updates: - Use CMPXCHG128 to update DTE - Cleanups of the domain_alloc_paging() path RiscV IOMMU: - Platform MSI support - Shutdown support Rockchip IOMMU: - Add DT bindings for Rockchip RK3576 More smaller fixes and cleanups" * tag 'iommu-updates-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux: (66 commits) iommu: Use str_enable_disable-like helpers iommu/amd: Fully decode all combinations of alloc_paging_flags iommu/amd: Move the nid to pdom_setup_pgtable() iommu/amd: Change amd_iommu_pgtable to use enum protection_domain_mode iommu/amd: Remove type argument from do_iommu_domain_alloc() and related iommu/amd: Remove dev == NULL checks iommu/amd: Remove domain_alloc() iommu/amd: Remove unused amd_iommu_domain_update() iommu/riscv: Fixup compile warning iommu/arm-smmu-v3: Add missing #include of linux/string_choices.h iommu/arm-smmu-v3: Use str_read_write helper w/ logs iommu/io-pgtable-arm: Add way to debug pgtable walk iommu/io-pgtable-arm: Re-use the pgtable walk for iova_to_phys iommu/io-pgtable-arm: Make pgtable walker more generic iommu/arm-smmu: Add ACTLR data and support for qcom_smmu_500 iommu/arm-smmu: Introduce ACTLR custom prefetcher settings iommu/arm-smmu: Add support for PRR bit setup iommu/arm-smmu: Refactor qcom_smmu structure to include single pointer iommu/arm-smmu: Re-enable context caching in smmu reset operation iommu/vt-d: Link cache tags of same iommu unit together ...
2 parents c9c0543 + 125f34e commit f1c243f

Some content is hidden

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

43 files changed

+1304
-1036
lines changed

Documentation/arch/arm64/silicon-errata.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ stable kernels.
198198
+----------------+-----------------+-----------------+-----------------------------+
199199
| ARM | Neoverse-V3 | #3312417 | ARM64_ERRATUM_3194386 |
200200
+----------------+-----------------+-----------------+-----------------------------+
201-
| ARM | MMU-500 | #841119,826419 | N/A |
201+
| ARM | MMU-500 | #841119,826419 | ARM_SMMU_MMU_500_CPRE_ERRATA|
202+
| | | #562869,1047329 | |
202203
+----------------+-----------------+-----------------+-----------------------------+
203204
| ARM | MMU-600 | #1076982,1209401| N/A |
204205
+----------------+-----------------+-----------------+-----------------------------+

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ properties:
6161
- qcom,sm8450-smmu-500
6262
- qcom,sm8550-smmu-500
6363
- qcom,sm8650-smmu-500
64+
- qcom,sm8750-smmu-500
6465
- qcom,x1e80100-smmu-500
6566
- const: qcom,smmu-500
6667
- const: arm,mmu-500
@@ -88,6 +89,7 @@ properties:
8889
items:
8990
- enum:
9091
- qcom,qcm2290-smmu-500
92+
- qcom,qcs615-smmu-500
9193
- qcom,sa8255p-smmu-500
9294
- qcom,sa8775p-smmu-500
9395
- qcom,sar2130p-smmu-500
@@ -102,6 +104,7 @@ properties:
102104
- qcom,sm8450-smmu-500
103105
- qcom,sm8550-smmu-500
104106
- qcom,sm8650-smmu-500
107+
- qcom,sm8750-smmu-500
105108
- qcom,x1e80100-smmu-500
106109
- const: qcom,adreno-smmu
107110
- const: qcom,smmu-500
@@ -122,6 +125,7 @@ properties:
122125
- qcom,msm8996-smmu-v2
123126
- qcom,sc7180-smmu-v2
124127
- qcom,sdm630-smmu-v2
128+
- qcom,sdm670-smmu-v2
125129
- qcom,sdm845-smmu-v2
126130
- qcom,sm6350-smmu-v2
127131
- qcom,sm7150-smmu-v2
@@ -474,6 +478,7 @@ allOf:
474478
items:
475479
- enum:
476480
- qcom,qcm2290-smmu-500
481+
- qcom,qcs615-smmu-500
477482
- qcom,sm6115-smmu-500
478483
- qcom,sm6125-smmu-500
479484
- const: qcom,adreno-smmu
@@ -550,6 +555,23 @@ allOf:
550555
- description: GPU SNoC bus clock
551556
- description: GPU AHB clock
552557

558+
- if:
559+
properties:
560+
compatible:
561+
items:
562+
- const: qcom,sm8750-smmu-500
563+
- const: qcom,adreno-smmu
564+
- const: qcom,smmu-500
565+
- const: arm,mmu-500
566+
then:
567+
properties:
568+
clock-names:
569+
items:
570+
- const: hlos
571+
clocks:
572+
items:
573+
- description: HLOS vote clock
574+
553575
# Disallow clocks for all other platforms with specific compatibles
554576
- if:
555577
properties:
@@ -559,7 +581,6 @@ allOf:
559581
- cavium,smmu-v2
560582
- marvell,ap806-smmu-500
561583
- nvidia,smmu-500
562-
- qcom,qcs615-smmu-500
563584
- qcom,qcs8300-smmu-500
564585
- qcom,qdu1000-smmu-500
565586
- qcom,sa8255p-smmu-500

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ properties:
2121
- items:
2222
- enum:
2323
- qcom,msm8916-iommu
24+
- qcom,msm8917-iommu
2425
- qcom,msm8953-iommu
2526
- const: qcom,msm-iommu-v1
2627
- items:

Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ properties:
2525
- rockchip,rk3568-iommu
2626
- items:
2727
- enum:
28+
- rockchip,rk3576-iommu
2829
- rockchip,rk3588-iommu
2930
- const: rockchip,rk3568-iommu
3031

drivers/iommu/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,18 @@ config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
367367
'arm-smmu.disable_bypass' will continue to override this
368368
config.
369369

370+
config ARM_SMMU_MMU_500_CPRE_ERRATA
371+
bool "Enable errata workaround for CPRE in SMMU reset path"
372+
depends on ARM_SMMU
373+
default y
374+
help
375+
Say Y here (by default) to apply workaround to disable
376+
MMU-500's next-page prefetcher for sake of 4 known errata.
377+
378+
Say N here only when it is sure that any errata related to
379+
prefetch enablement are not applicable on the platform.
380+
Refer silicon-errata.rst for info on errata IDs.
381+
370382
config ARM_SMMU_QCOM
371383
def_tristate y
372384
depends on ARM_SMMU && ARCH_QCOM

drivers/iommu/amd/amd_iommu.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ irqreturn_t amd_iommu_int_thread_evtlog(int irq, void *data);
1616
irqreturn_t amd_iommu_int_thread_pprlog(int irq, void *data);
1717
irqreturn_t amd_iommu_int_thread_galog(int irq, void *data);
1818
irqreturn_t amd_iommu_int_handler(int irq, void *data);
19-
void amd_iommu_apply_erratum_63(struct amd_iommu *iommu, u16 devid);
2019
void amd_iommu_restart_log(struct amd_iommu *iommu, const char *evt_type,
2120
u8 cntrl_intr, u8 cntrl_log,
2221
u32 status_run_mask, u32 status_overflow_mask);
@@ -41,13 +40,13 @@ void amd_iommu_disable(void);
4140
int amd_iommu_reenable(int mode);
4241
int amd_iommu_enable_faulting(unsigned int cpu);
4342
extern int amd_iommu_guest_ir;
44-
extern enum io_pgtable_fmt amd_iommu_pgtable;
43+
extern enum protection_domain_mode amd_iommu_pgtable;
4544
extern int amd_iommu_gpt_level;
4645
extern unsigned long amd_iommu_pgsize_bitmap;
4746

4847
/* Protection domain ops */
4948
void amd_iommu_init_identity_domain(void);
50-
struct protection_domain *protection_domain_alloc(unsigned int type, int nid);
49+
struct protection_domain *protection_domain_alloc(void);
5150
void protection_domain_free(struct protection_domain *domain);
5251
struct iommu_domain *amd_iommu_domain_alloc_sva(struct device *dev,
5352
struct mm_struct *mm);
@@ -89,7 +88,6 @@ int amd_iommu_complete_ppr(struct device *dev, u32 pasid, int status, int tag);
8988
*/
9089
void amd_iommu_flush_all_caches(struct amd_iommu *iommu);
9190
void amd_iommu_update_and_flush_device_table(struct protection_domain *domain);
92-
void amd_iommu_domain_update(struct protection_domain *domain);
9391
void amd_iommu_domain_flush_pages(struct protection_domain *domain,
9492
u64 address, size_t size);
9593
void amd_iommu_dev_flush_pasid_pages(struct iommu_dev_data *dev_data,
@@ -184,3 +182,6 @@ void amd_iommu_domain_set_pgtable(struct protection_domain *domain,
184182
struct dev_table_entry *get_dev_table(struct amd_iommu *iommu);
185183

186184
#endif
185+
186+
struct dev_table_entry *amd_iommu_get_ivhd_dte_flags(u16 segid, u16 devid);
187+
struct iommu_dev_data *search_dev_data(struct amd_iommu *iommu, u16 devid);

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@
220220
#define DEV_ENTRY_EX 0x67
221221
#define DEV_ENTRY_SYSMGT1 0x68
222222
#define DEV_ENTRY_SYSMGT2 0x69
223+
#define DTE_DATA1_SYSMGT_MASK GENMASK_ULL(41, 40)
224+
223225
#define DEV_ENTRY_IRQ_TBL_EN 0x80
224226
#define DEV_ENTRY_INIT_PASS 0xb8
225227
#define DEV_ENTRY_EINT_PASS 0xb9
@@ -407,27 +409,26 @@
407409
#define DTE_FLAG_HAD (3ULL << 7)
408410
#define DTE_FLAG_GIOV BIT_ULL(54)
409411
#define DTE_FLAG_GV BIT_ULL(55)
410-
#define DTE_GLX_SHIFT (56)
411-
#define DTE_GLX_MASK (3)
412+
#define DTE_GLX GENMASK_ULL(57, 56)
412413
#define DTE_FLAG_IR BIT_ULL(61)
413414
#define DTE_FLAG_IW BIT_ULL(62)
414415

415416
#define DTE_FLAG_IOTLB BIT_ULL(32)
416417
#define DTE_FLAG_MASK (0x3ffULL << 32)
417418
#define DEV_DOMID_MASK 0xffffULL
418419

419-
#define DTE_GCR3_VAL_A(x) (((x) >> 12) & 0x00007ULL)
420-
#define DTE_GCR3_VAL_B(x) (((x) >> 15) & 0x0ffffULL)
421-
#define DTE_GCR3_VAL_C(x) (((x) >> 31) & 0x1fffffULL)
422-
423-
#define DTE_GCR3_SHIFT_A 58
424-
#define DTE_GCR3_SHIFT_B 16
425-
#define DTE_GCR3_SHIFT_C 43
420+
#define DTE_GCR3_14_12 GENMASK_ULL(60, 58)
421+
#define DTE_GCR3_30_15 GENMASK_ULL(31, 16)
422+
#define DTE_GCR3_51_31 GENMASK_ULL(63, 43)
426423

427424
#define DTE_GPT_LEVEL_SHIFT 54
425+
#define DTE_GPT_LEVEL_MASK GENMASK_ULL(55, 54)
428426

429427
#define GCR3_VALID 0x01ULL
430428

429+
/* DTE[128:179] | DTE[184:191] */
430+
#define DTE_DATA2_INTR_MASK ~GENMASK_ULL(55, 52)
431+
431432
#define IOMMU_PAGE_MASK (((1ULL << 52) - 1) & ~0xfffULL)
432433
#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_PR)
433434
#define IOMMU_PTE_DIRTY(pte) ((pte) & IOMMU_PTE_HD)
@@ -468,7 +469,7 @@ extern bool amd_iommu_dump;
468469
#define DUMP_printk(format, arg...) \
469470
do { \
470471
if (amd_iommu_dump) \
471-
pr_info("AMD-Vi: " format, ## arg); \
472+
pr_info(format, ## arg); \
472473
} while(0);
473474

474475
/* global flag if IOMMUs cache non-present entries */
@@ -516,6 +517,9 @@ extern struct kmem_cache *amd_iommu_irq_cache;
516517
#define for_each_pdom_dev_data_safe(pdom_dev_data, next, pdom) \
517518
list_for_each_entry_safe((pdom_dev_data), (next), &pdom->dev_data_list, list)
518519

520+
#define for_each_ivhd_dte_flags(entry) \
521+
list_for_each_entry((entry), &amd_ivhd_dev_flags_list, list)
522+
519523
struct amd_iommu;
520524
struct iommu_domain;
521525
struct irq_domain;
@@ -837,6 +841,7 @@ struct devid_map {
837841
struct iommu_dev_data {
838842
/*Protect against attach/detach races */
839843
struct mutex mutex;
844+
spinlock_t dte_lock; /* DTE lock for 256-bit access */
840845

841846
struct list_head list; /* For domain->dev_list */
842847
struct llist_node dev_data_list; /* For global dev_data_list */
@@ -881,7 +886,21 @@ extern struct list_head amd_iommu_list;
881886
* Structure defining one entry in the device table
882887
*/
883888
struct dev_table_entry {
884-
u64 data[4];
889+
union {
890+
u64 data[4];
891+
u128 data128[2];
892+
};
893+
};
894+
895+
/*
896+
* Structure to sture persistent DTE flags from IVHD
897+
*/
898+
struct ivhd_dte_flags {
899+
struct list_head list;
900+
u16 segid;
901+
u16 devid_first;
902+
u16 devid_last;
903+
struct dev_table_entry dte;
885904
};
886905

887906
/*

0 commit comments

Comments
 (0)