Skip to content

Commit 8477ab1

Browse files
committed
Merge tag 'iommu-updates-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux
Pull iommu updates from Joerg Roedel: "Core: - Introduction of iommu-pages infrastructure to consolitate page-table allocation code among hardware drivers. This is ground-work for more generalization in the future - Remove IOMMU_DEV_FEAT_SVA and IOMMU_DEV_FEAT_IOPF feature flags - Convert virtio-iommu to domain_alloc_paging() - KConfig cleanups - Some small fixes for possible overflows and race conditions Intel VT-d driver: - Restore WO permissions on second-level paging entries - Use ida to manage domain id - Miscellaneous cleanups AMD-Vi: - Make sure notifiers finish running before module unload - Add support for HTRangeIgnore feature - Allow matching ACPI HID devices without matching UIDs ARM-SMMU: - SMMUv2: - Recognise the compatible string for SAR2130P MDSS in the Qualcomm driver, as this device requires an identity domain - Fix Adreno stall handling so that GPU debugging is more robust and doesn't e.g. result in deadlock - SMMUv3: - Fix ->attach_dev() error reporting for unrecognised domains - IO-pgtable: - Allow clients (notably, drivers that process requests from userspace) to silence warnings when mapping an already-mapped IOVA S390: - Add support for additional table regions Mediatek: - Add support for MT6893 MM IOMMU And some smaller fixes and improvements in various other drivers" * tag 'iommu-updates-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux: (75 commits) iommu/vt-d: Restore context entry setup order for aliased devices iommu/mediatek: Fix compatible typo for mediatek,mt6893-iommu-mm iommu/arm-smmu-qcom: Make set_stall work when the device is on iommu/arm-smmu: Move handing of RESUME to the context fault handler iommu/arm-smmu-qcom: Enable threaded IRQ for Adreno SMMUv2/MMU500 iommu/io-pgtable-arm: Add quirk to quiet WARN_ON() iommu: Clear the freelist after iommu_put_pages_list() iommu/vt-d: Change dmar_ats_supported() to return boolean iommu/vt-d: Eliminate pci_physfn() in dmar_find_matched_satc_unit() iommu/vt-d: Replace spin_lock with mutex to protect domain ida iommu/vt-d: Use ida to manage domain id iommu/vt-d: Restore WO permissions on second-level paging entries iommu/amd: Allow matching ACPI HID devices without matching UIDs iommu: make inclusion of arm/arm-smmu-v3 directory conditional iommu: make inclusion of riscv directory conditional iommu: make inclusion of amd directory conditional iommu: make inclusion of intel directory conditional iommu: remove duplicate selection of DMAR_TABLE iommu/fsl_pamu: remove trailing space after \n iommu/arm-smmu-qcom: Add SAR2130P MDSS compatible ...
2 parents dd91b5e + 879b141 commit 8477ab1

Some content is hidden

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

61 files changed

+1856
-1356
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ properties:
7474
- mediatek,mt2712-m4u # generation two
7575
- mediatek,mt6779-m4u # generation two
7676
- mediatek,mt6795-m4u # generation two
77+
- mediatek,mt6893-iommu-mm # generation two
7778
- mediatek,mt8167-m4u # generation two
7879
- mediatek,mt8173-m4u # generation two
7980
- mediatek,mt8183-m4u # generation two
@@ -131,6 +132,7 @@ properties:
131132
dt-binding/memory/mt2712-larb-port.h for mt2712,
132133
dt-binding/memory/mt6779-larb-port.h for mt6779,
133134
dt-binding/memory/mt6795-larb-port.h for mt6795,
135+
dt-binding/memory/mediatek,mt6893-memory-port.h for mt6893,
134136
dt-binding/memory/mt8167-larb-port.h for mt8167,
135137
dt-binding/memory/mt8173-larb-port.h for mt8173,
136138
dt-binding/memory/mt8183-larb-port.h for mt8183,
@@ -157,6 +159,7 @@ allOf:
157159
- mediatek,mt2701-m4u
158160
- mediatek,mt2712-m4u
159161
- mediatek,mt6795-m4u
162+
- mediatek,mt6893-iommu-mm
160163
- mediatek,mt8173-m4u
161164
- mediatek,mt8186-iommu-mm
162165
- mediatek,mt8188-iommu-vdo
@@ -173,6 +176,7 @@ allOf:
173176
properties:
174177
compatible:
175178
enum:
179+
- mediatek,mt6893-iommu-mm
176180
- mediatek,mt8186-iommu-mm
177181
- mediatek,mt8188-iommu-vdo
178182
- mediatek,mt8188-iommu-vpp

arch/s390/include/asm/pci_dma.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ enum zpci_ioat_dtype {
2525
#define ZPCI_KEY (PAGE_DEFAULT_KEY << 5)
2626

2727
#define ZPCI_TABLE_SIZE_RT (1UL << 42)
28+
#define ZPCI_TABLE_SIZE_RS (1UL << 53)
2829

2930
#define ZPCI_IOTA_STO_FLAG (ZPCI_IOTA_IOT_ENABLED | ZPCI_KEY | ZPCI_IOTA_DT_ST)
3031
#define ZPCI_IOTA_RTTO_FLAG (ZPCI_IOTA_IOT_ENABLED | ZPCI_KEY | ZPCI_IOTA_DT_RT)
@@ -55,6 +56,8 @@ enum zpci_ioat_dtype {
5556
#define ZPCI_PT_BITS 8
5657
#define ZPCI_ST_SHIFT (ZPCI_PT_BITS + PAGE_SHIFT)
5758
#define ZPCI_RT_SHIFT (ZPCI_ST_SHIFT + ZPCI_TABLE_BITS)
59+
#define ZPCI_RS_SHIFT (ZPCI_RT_SHIFT + ZPCI_TABLE_BITS)
60+
#define ZPCI_RF_SHIFT (ZPCI_RS_SHIFT + ZPCI_TABLE_BITS)
5861

5962
#define ZPCI_RTE_FLAG_MASK 0x3fffUL
6063
#define ZPCI_RTE_ADDR_MASK (~ZPCI_RTE_FLAG_MASK)

drivers/accel/amdxdna/aie2_pci.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -512,12 +512,6 @@ static int aie2_init(struct amdxdna_dev *xdna)
512512
goto release_fw;
513513
}
514514

515-
ret = iommu_dev_enable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
516-
if (ret) {
517-
XDNA_ERR(xdna, "Enable PASID failed, ret %d", ret);
518-
goto free_irq;
519-
}
520-
521515
psp_conf.fw_size = fw->size;
522516
psp_conf.fw_buf = fw->data;
523517
for (i = 0; i < PSP_MAX_REGS; i++)
@@ -526,14 +520,14 @@ static int aie2_init(struct amdxdna_dev *xdna)
526520
if (!ndev->psp_hdl) {
527521
XDNA_ERR(xdna, "failed to create psp");
528522
ret = -ENOMEM;
529-
goto disable_sva;
523+
goto free_irq;
530524
}
531525
xdna->dev_handle = ndev;
532526

533527
ret = aie2_hw_start(xdna);
534528
if (ret) {
535529
XDNA_ERR(xdna, "start npu failed, ret %d", ret);
536-
goto disable_sva;
530+
goto free_irq;
537531
}
538532

539533
ret = aie2_mgmt_fw_query(ndev);
@@ -584,8 +578,6 @@ static int aie2_init(struct amdxdna_dev *xdna)
584578
aie2_error_async_events_free(ndev);
585579
stop_hw:
586580
aie2_hw_stop(xdna);
587-
disable_sva:
588-
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
589581
free_irq:
590582
pci_free_irq_vectors(pdev);
591583
release_fw:
@@ -601,7 +593,6 @@ static void aie2_fini(struct amdxdna_dev *xdna)
601593

602594
aie2_hw_stop(xdna);
603595
aie2_error_async_events_free(ndev);
604-
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
605596
pci_free_irq_vectors(pdev);
606597
}
607598

drivers/dma/idxd/init.c

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -702,27 +702,6 @@ static void idxd_disable_system_pasid(struct idxd_device *idxd)
702702
idxd->pasid = IOMMU_PASID_INVALID;
703703
}
704704

705-
static int idxd_enable_sva(struct pci_dev *pdev)
706-
{
707-
int ret;
708-
709-
ret = iommu_dev_enable_feature(&pdev->dev, IOMMU_DEV_FEAT_IOPF);
710-
if (ret)
711-
return ret;
712-
713-
ret = iommu_dev_enable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
714-
if (ret)
715-
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_IOPF);
716-
717-
return ret;
718-
}
719-
720-
static void idxd_disable_sva(struct pci_dev *pdev)
721-
{
722-
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
723-
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_IOPF);
724-
}
725-
726705
static int idxd_probe(struct idxd_device *idxd)
727706
{
728707
struct pci_dev *pdev = idxd->pdev;
@@ -737,17 +716,13 @@ static int idxd_probe(struct idxd_device *idxd)
737716
dev_dbg(dev, "IDXD reset complete\n");
738717

739718
if (IS_ENABLED(CONFIG_INTEL_IDXD_SVM) && sva) {
740-
if (idxd_enable_sva(pdev)) {
741-
dev_warn(dev, "Unable to turn on user SVA feature.\n");
742-
} else {
743-
set_bit(IDXD_FLAG_USER_PASID_ENABLED, &idxd->flags);
719+
set_bit(IDXD_FLAG_USER_PASID_ENABLED, &idxd->flags);
744720

745-
rc = idxd_enable_system_pasid(idxd);
746-
if (rc)
747-
dev_warn(dev, "No in-kernel DMA with PASID. %d\n", rc);
748-
else
749-
set_bit(IDXD_FLAG_PASID_ENABLED, &idxd->flags);
750-
}
721+
rc = idxd_enable_system_pasid(idxd);
722+
if (rc)
723+
dev_warn(dev, "No in-kernel DMA with PASID. %d\n", rc);
724+
else
725+
set_bit(IDXD_FLAG_PASID_ENABLED, &idxd->flags);
751726
} else if (!sva) {
752727
dev_warn(dev, "User forced SVA off via module param.\n");
753728
}
@@ -785,8 +760,6 @@ static int idxd_probe(struct idxd_device *idxd)
785760
err:
786761
if (device_pasid_enabled(idxd))
787762
idxd_disable_system_pasid(idxd);
788-
if (device_user_pasid_enabled(idxd))
789-
idxd_disable_sva(pdev);
790763
return rc;
791764
}
792765

@@ -797,8 +770,6 @@ static void idxd_cleanup(struct idxd_device *idxd)
797770
idxd_cleanup_internals(idxd);
798771
if (device_pasid_enabled(idxd))
799772
idxd_disable_system_pasid(idxd);
800-
if (device_user_pasid_enabled(idxd))
801-
idxd_disable_sva(idxd->pdev);
802773
}
803774

804775
/*

drivers/iommu/Kconfig

Lines changed: 1 addition & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,14 @@ config MSM_IOMMU
192192
If unsure, say N here.
193193

194194
source "drivers/iommu/amd/Kconfig"
195+
source "drivers/iommu/arm/Kconfig"
195196
source "drivers/iommu/intel/Kconfig"
196197
source "drivers/iommu/iommufd/Kconfig"
197198
source "drivers/iommu/riscv/Kconfig"
198199

199200
config IRQ_REMAP
200201
bool "Support for Interrupt Remapping"
201202
depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI
202-
select DMAR_TABLE if INTEL_IOMMU
203203
help
204204
Supports Interrupt remapping for IO-APIC and MSI devices.
205205
To use x2apic mode in the CPU's which support x2APIC enhancements or
@@ -314,150 +314,6 @@ config APPLE_DART
314314

315315
Say Y here if you are using an Apple SoC.
316316

317-
# ARM IOMMU support
318-
config ARM_SMMU
319-
tristate "ARM Ltd. System MMU (SMMU) Support"
320-
depends on ARM64 || ARM || COMPILE_TEST
321-
depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
322-
select IOMMU_API
323-
select IOMMU_IO_PGTABLE_LPAE
324-
select ARM_DMA_USE_IOMMU if ARM
325-
help
326-
Support for implementations of the ARM System MMU architecture
327-
versions 1 and 2.
328-
329-
Say Y here if your SoC includes an IOMMU device implementing
330-
the ARM SMMU architecture.
331-
332-
config ARM_SMMU_LEGACY_DT_BINDINGS
333-
bool "Support the legacy \"mmu-masters\" devicetree bindings"
334-
depends on ARM_SMMU=y && OF
335-
help
336-
Support for the badly designed and deprecated "mmu-masters"
337-
devicetree bindings. This allows some DMA masters to attach
338-
to the SMMU but does not provide any support via the DMA API.
339-
If you're lucky, you might be able to get VFIO up and running.
340-
341-
If you say Y here then you'll make me very sad. Instead, say N
342-
and move your firmware to the utopian future that was 2016.
343-
344-
config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
345-
bool "Default to disabling bypass on ARM SMMU v1 and v2"
346-
depends on ARM_SMMU
347-
default y
348-
help
349-
Say Y here to (by default) disable bypass streams such that
350-
incoming transactions from devices that are not attached to
351-
an iommu domain will report an abort back to the device and
352-
will not be allowed to pass through the SMMU.
353-
354-
Any old kernels that existed before this KConfig was
355-
introduced would default to _allowing_ bypass (AKA the
356-
equivalent of NO for this config). However the default for
357-
this option is YES because the old behavior is insecure.
358-
359-
There are few reasons to allow unmatched stream bypass, and
360-
even fewer good ones. If saying YES here breaks your board
361-
you should work on fixing your board. This KConfig option
362-
is expected to be removed in the future and we'll simply
363-
hardcode the bypass disable in the code.
364-
365-
NOTE: the kernel command line parameter
366-
'arm-smmu.disable_bypass' will continue to override this
367-
config.
368-
369-
config ARM_SMMU_MMU_500_CPRE_ERRATA
370-
bool "Enable errata workaround for CPRE in SMMU reset path"
371-
depends on ARM_SMMU
372-
default y
373-
help
374-
Say Y here (by default) to apply workaround to disable
375-
MMU-500's next-page prefetcher for sake of 4 known errata.
376-
377-
Say N here only when it is sure that any errata related to
378-
prefetch enablement are not applicable on the platform.
379-
Refer silicon-errata.rst for info on errata IDs.
380-
381-
config ARM_SMMU_QCOM
382-
def_tristate y
383-
depends on ARM_SMMU && ARCH_QCOM
384-
select QCOM_SCM
385-
help
386-
When running on a Qualcomm platform that has the custom variant
387-
of the ARM SMMU, this needs to be built into the SMMU driver.
388-
389-
config ARM_SMMU_QCOM_DEBUG
390-
bool "ARM SMMU QCOM implementation defined debug support"
391-
depends on ARM_SMMU_QCOM=y
392-
help
393-
Support for implementation specific debug features in ARM SMMU
394-
hardware found in QTI platforms. This include support for
395-
the Translation Buffer Units (TBU) that can be used to obtain
396-
additional information when debugging memory management issues
397-
like context faults.
398-
399-
Say Y here to enable debug for issues such as context faults
400-
or TLB sync timeouts which requires implementation defined
401-
register dumps.
402-
403-
config ARM_SMMU_V3
404-
tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support"
405-
depends on ARM64
406-
select IOMMU_API
407-
select IOMMU_IO_PGTABLE_LPAE
408-
select GENERIC_MSI_IRQ
409-
select IOMMUFD_DRIVER if IOMMUFD
410-
help
411-
Support for implementations of the ARM System MMU architecture
412-
version 3 providing translation support to a PCIe root complex.
413-
414-
Say Y here if your system includes an IOMMU device implementing
415-
the ARM SMMUv3 architecture.
416-
417-
if ARM_SMMU_V3
418-
config ARM_SMMU_V3_SVA
419-
bool "Shared Virtual Addressing support for the ARM SMMUv3"
420-
select IOMMU_SVA
421-
select IOMMU_IOPF
422-
select MMU_NOTIFIER
423-
help
424-
Support for sharing process address spaces with devices using the
425-
SMMUv3.
426-
427-
Say Y here if your system supports SVA extensions such as PCIe PASID
428-
and PRI.
429-
430-
config ARM_SMMU_V3_IOMMUFD
431-
bool "Enable IOMMUFD features for ARM SMMUv3 (EXPERIMENTAL)"
432-
depends on IOMMUFD
433-
help
434-
Support for IOMMUFD features intended to support virtual machines
435-
with accelerated virtual IOMMUs.
436-
437-
Say Y here if you are doing development and testing on this feature.
438-
439-
config ARM_SMMU_V3_KUNIT_TEST
440-
tristate "KUnit tests for arm-smmu-v3 driver" if !KUNIT_ALL_TESTS
441-
depends on KUNIT
442-
depends on ARM_SMMU_V3_SVA
443-
default KUNIT_ALL_TESTS
444-
help
445-
Enable this option to unit-test arm-smmu-v3 driver functions.
446-
447-
If unsure, say N.
448-
449-
config TEGRA241_CMDQV
450-
bool "NVIDIA Tegra241 CMDQ-V extension support for ARM SMMUv3"
451-
depends on ACPI
452-
help
453-
Support for NVIDIA CMDQ-Virtualization extension for ARM SMMUv3. The
454-
CMDQ-V extension is similar to v3.3 ECMDQ for multi command queues
455-
support, except with virtualization capabilities.
456-
457-
Say Y here if your system is NVIDIA Tegra241 (Grace) or it has the same
458-
CMDQ-V extension.
459-
endif
460-
461317
config S390_IOMMU
462318
def_bool y if S390 && PCI
463319
depends on S390 && PCI
@@ -494,18 +350,6 @@ config MTK_IOMMU_V1
494350

495351
if unsure, say N here.
496352

497-
config QCOM_IOMMU
498-
# Note: iommu drivers cannot (yet?) be built as modules
499-
bool "Qualcomm IOMMU Support"
500-
depends on ARCH_QCOM || COMPILE_TEST
501-
depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
502-
select QCOM_SCM
503-
select IOMMU_API
504-
select IOMMU_IO_PGTABLE_LPAE
505-
select ARM_DMA_USE_IOMMU
506-
help
507-
Support for IOMMU on certain Qualcomm SoCs.
508-
509353
config HYPERV_IOMMU
510354
bool "Hyper-V IRQ Handling"
511355
depends on HYPERV && X86

drivers/iommu/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
obj-y += amd/ intel/ arm/ iommufd/ riscv/
2+
obj-y += arm/ iommufd/
3+
obj-$(CONFIG_AMD_IOMMU) += amd/
4+
obj-$(CONFIG_INTEL_IOMMU) += intel/
5+
obj-$(CONFIG_RISCV_IOMMU) += riscv/
36
obj-$(CONFIG_IOMMU_API) += iommu.o
7+
obj-$(CONFIG_IOMMU_SUPPORT) += iommu-pages.o
48
obj-$(CONFIG_IOMMU_API) += iommu-traces.o
59
obj-$(CONFIG_IOMMU_API) += iommu-sysfs.o
610
obj-$(CONFIG_IOMMU_DEBUGFS) += iommu-debugfs.o

drivers/iommu/amd/Makefile

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

drivers/iommu/amd/amd_iommu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ static inline int get_pci_sbdf_id(struct pci_dev *pdev)
147147
return PCI_SEG_DEVID_TO_SBDF(seg, devid);
148148
}
149149

150+
bool amd_iommu_ht_range_ignore(void);
151+
150152
/*
151153
* This must be called after device probe completes. During probe
152154
* use rlookup_amd_iommu() get the iommu.

0 commit comments

Comments
 (0)