Skip to content

Commit 4f97010

Browse files
committed
Merge tag 'iommu-updates-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu updates from Joerg Roedel: - Big cleanup of almost unsused parts of the IOMMU API by Christoph Hellwig. This mostly affects the Freescale PAMU driver. - New IOMMU driver for Unisoc SOCs - ARM SMMU Updates from Will: - Drop vestigial PREFETCH_ADDR support (SMMUv3) - Elide TLB sync logic for empty gather (SMMUv3) - Fix "Service Failure Mode" handling (SMMUv3) - New Qualcomm compatible string (SMMUv2) - Removal of the AMD IOMMU performance counter writeable check on AMD. It caused long boot delays on some machines and is only needed to work around an errata on some older (possibly pre-production) chips. If someone is still hit by this hardware issue anyway the performance counters will just return 0. - Support for targeted invalidations in the AMD IOMMU driver. Before that the driver only invalidated a single 4k page or the whole IO/TLB for an address space. This has been extended now and is mostly useful for emulated AMD IOMMUs. - Several fixes for the Shared Virtual Memory support in the Intel VT-d driver - Mediatek drivers can now be built as modules - Re-introduction of the forcedac boot option which got lost when converting the Intel VT-d driver to the common dma-iommu implementation. - Extension of the IOMMU device registration interface and support iommu_ops to be const again when drivers are built as modules. * tag 'iommu-updates-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (84 commits) iommu: Streamline registration interface iommu: Statically set module owner iommu/mediatek-v1: Add error handle for mtk_iommu_probe iommu/mediatek-v1: Avoid build fail when build as module iommu/mediatek: Always enable the clk on resume iommu/fsl-pamu: Fix uninitialized variable warning iommu/vt-d: Force to flush iotlb before creating superpage iommu/amd: Put newline after closing bracket in warning iommu/vt-d: Fix an error handling path in 'intel_prepare_irq_remapping()' iommu/vt-d: Fix build error of pasid_enable_wpe() with !X86 iommu/amd: Remove performance counter pre-initialization test Revert "iommu/amd: Fix performance counter initialization" iommu/amd: Remove duplicate check of devid iommu/exynos: Remove unneeded local variable initialization iommu/amd: Page-specific invalidations for more than one page iommu/arm-smmu-v3: Remove the unused fields for PREFETCH_CONFIG command iommu/vt-d: Avoid unnecessary cache flush in pasid entry teardown iommu/vt-d: Invalidate PASID cache when root/context entry changed iommu/vt-d: Remove WO permissions on second-level paging entries iommu/vt-d: Report the right page fault address ...
2 parents f34b2cf + 2d471b2 commit 4f97010

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

+2117
-2242
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,13 +1877,6 @@
18771877
bypassed by not enabling DMAR with this option. In
18781878
this case, gfx device will use physical address for
18791879
DMA.
1880-
forcedac [X86-64]
1881-
With this option iommu will not optimize to look
1882-
for io virtual address below 32-bit forcing dual
1883-
address cycle on pci bus for cards supporting greater
1884-
than 32-bit addressing. The default is to look
1885-
for translation below 32-bit and if not available
1886-
then look in the higher range.
18871880
strict [Default Off]
18881881
With this option on every unmap_single operation will
18891882
result in a hardware IOTLB flush operation as opposed
@@ -1972,6 +1965,14 @@
19721965
nobypass [PPC/POWERNV]
19731966
Disable IOMMU bypass, using IOMMU for PCI devices.
19741967

1968+
iommu.forcedac= [ARM64, X86] Control IOVA allocation for PCI devices.
1969+
Format: { "0" | "1" }
1970+
0 - Try to allocate a 32-bit DMA address first, before
1971+
falling back to the full range if needed.
1972+
1 - Allocate directly from the full usable range,
1973+
forcing Dual Address Cycle for PCI cards supporting
1974+
greater than 32-bit addressing.
1975+
19751976
iommu.strict= [ARM64] Configure TLB invalidation behaviour
19761977
Format: { "0" | "1" }
19771978
0 - Lazy mode.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ properties:
3434
items:
3535
- enum:
3636
- qcom,sc7180-smmu-500
37+
- qcom,sc7280-smmu-500
3738
- qcom,sc8180x-smmu-500
3839
- qcom,sdm845-smmu-500
3940
- qcom,sm8150-smmu-500
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
# Copyright 2020 Unisoc Inc.
3+
%YAML 1.2
4+
---
5+
$id: http://devicetree.org/schemas/iommu/sprd,iommu.yaml#
6+
$schema: http://devicetree.org/meta-schemas/core.yaml#
7+
8+
title: Unisoc IOMMU and Multi-media MMU
9+
10+
maintainers:
11+
- Chunyan Zhang <[email protected]>
12+
13+
properties:
14+
compatible:
15+
enum:
16+
- sprd,iommu-v1
17+
18+
"#iommu-cells":
19+
const: 0
20+
description:
21+
Unisoc IOMMUs are all single-master IOMMU devices, therefore no
22+
additional information needs to associate with its master device.
23+
Please refer to the generic bindings document for more details,
24+
Documentation/devicetree/bindings/iommu/iommu.txt
25+
26+
reg:
27+
maxItems: 1
28+
29+
clocks:
30+
description:
31+
Reference to a gate clock phandle, since access to some of IOMMUs are
32+
controlled by gate clock, but this is not required.
33+
34+
required:
35+
- compatible
36+
- reg
37+
- "#iommu-cells"
38+
39+
additionalProperties: false
40+
41+
examples:
42+
- |
43+
iommu_disp: iommu@63000800 {
44+
compatible = "sprd,iommu-v1";
45+
reg = <0x63000800 0x80>;
46+
#iommu-cells = <0>;
47+
};
48+
49+
- |
50+
iommu_jpg: iommu@62300300 {
51+
compatible = "sprd,iommu-v1";
52+
reg = <0x62300300 0x80>;
53+
#iommu-cells = <0>;
54+
clocks = <&mm_gate 1>;
55+
};
56+
57+
...

arch/powerpc/include/asm/fsl_pamu_stash.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@
77
#ifndef __FSL_PAMU_STASH_H
88
#define __FSL_PAMU_STASH_H
99

10+
struct iommu_domain;
11+
1012
/* cache stash targets */
1113
enum pamu_stash_target {
1214
PAMU_ATTR_CACHE_L1 = 1,
1315
PAMU_ATTR_CACHE_L2,
1416
PAMU_ATTR_CACHE_L3,
1517
};
1618

17-
/*
18-
* This attribute allows configuring stashig specific parameters
19-
* in the PAMU hardware.
20-
*/
21-
22-
struct pamu_stash_attribute {
23-
u32 cpu; /* cpu number */
24-
u32 cache; /* cache to stash to: L1,L2,L3 */
25-
};
19+
int fsl_pamu_configure_l1_stash(struct iommu_domain *domain, u32 cpu);
2620

2721
#endif /* __FSL_PAMU_STASH_H */

arch/x86/events/amd/iommu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/init.h>
1515
#include <linux/cpumask.h>
1616
#include <linux/slab.h>
17+
#include <linux/amd-iommu.h>
1718

1819
#include "../perf_event.h"
1920
#include "iommu.h"

arch/x86/events/amd/iommu.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,4 @@
2121
#define PC_MAX_SPEC_BNKS 64
2222
#define PC_MAX_SPEC_CNTRS 16
2323

24-
struct amd_iommu;
25-
26-
/* amd_iommu_init.c external support functions */
27-
extern int amd_iommu_get_num_iommus(void);
28-
29-
extern bool amd_iommu_pc_supported(void);
30-
31-
extern u8 amd_iommu_pc_get_max_banks(unsigned int idx);
32-
33-
extern u8 amd_iommu_pc_get_max_counters(unsigned int idx);
34-
35-
extern int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr,
36-
u8 fxn, u64 *value);
37-
38-
extern int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr,
39-
u8 fxn, u64 *value);
40-
41-
extern struct amd_iommu *get_amd_iommu(int idx);
42-
4324
#endif /*_PERF_EVENT_AMD_IOMMU_H_*/

drivers/acpi/arm64/iort.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -968,15 +968,16 @@ static int iort_pci_iommu_init(struct pci_dev *pdev, u16 alias, void *data)
968968
static void iort_named_component_init(struct device *dev,
969969
struct acpi_iort_node *node)
970970
{
971+
struct property_entry props[2] = {};
971972
struct acpi_iort_named_component *nc;
972-
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
973-
974-
if (!fwspec)
975-
return;
976973

977974
nc = (struct acpi_iort_named_component *)node->node_data;
978-
fwspec->num_pasid_bits = FIELD_GET(ACPI_IORT_NC_PASID_BITS,
979-
nc->node_flags);
975+
props[0] = PROPERTY_ENTRY_U32("pasid-num-bits",
976+
FIELD_GET(ACPI_IORT_NC_PASID_BITS,
977+
nc->node_flags));
978+
979+
if (device_add_properties(dev, props))
980+
dev_warn(dev, "Could not add device properties\n");
980981
}
981982

982983
static int iort_nc_iommu_map(struct device *dev, struct acpi_iort_node *node)

drivers/gpu/drm/amd/amdkfd/kfd_iommu.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,6 @@ int kfd_iommu_resume(struct kfd_dev *kfd)
333333
return 0;
334334
}
335335

336-
extern bool amd_iommu_pc_supported(void);
337-
extern u8 amd_iommu_pc_get_max_banks(u16 devid);
338-
extern u8 amd_iommu_pc_get_max_counters(u16 devid);
339-
340336
/** kfd_iommu_add_perf_counters - Add IOMMU performance counters to topology
341337
*/
342338
int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev)

drivers/gpu/drm/msm/adreno/adreno_gpu.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,7 @@ int adreno_zap_shader_load(struct msm_gpu *gpu, u32 pasid)
188188

189189
void adreno_set_llc_attributes(struct iommu_domain *iommu)
190190
{
191-
struct io_pgtable_domain_attr pgtbl_cfg;
192-
193-
pgtbl_cfg.quirks = IO_PGTABLE_QUIRK_ARM_OUTER_WBWA;
194-
iommu_domain_set_attr(iommu, DOMAIN_ATTR_IO_PGTABLE_CFG, &pgtbl_cfg);
191+
iommu_set_pgtable_quirks(iommu, IO_PGTABLE_QUIRK_ARM_OUTER_WBWA);
195192
}
196193

197194
struct msm_gem_address_space *

drivers/iommu/Kconfig

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ config S390_AP_IOMMU
349349
is not implemented as it is not necessary for VFIO.
350350

351351
config MTK_IOMMU
352-
bool "MTK IOMMU Support"
352+
tristate "MediaTek IOMMU Support"
353353
depends on ARCH_MEDIATEK || COMPILE_TEST
354354
select ARM_DMA_USE_IOMMU
355355
select IOMMU_API
@@ -364,7 +364,7 @@ config MTK_IOMMU
364364
If unsure, say N here.
365365

366366
config MTK_IOMMU_V1
367-
bool "MTK IOMMU Version 1 (M4U gen1) Support"
367+
tristate "MediaTek IOMMU Version 1 (M4U gen1) Support"
368368
depends on ARM
369369
depends on ARCH_MEDIATEK || COMPILE_TEST
370370
select ARM_DMA_USE_IOMMU
@@ -408,4 +408,16 @@ config VIRTIO_IOMMU
408408

409409
Say Y here if you intend to run this kernel as a guest.
410410

411+
config SPRD_IOMMU
412+
tristate "Unisoc IOMMU Support"
413+
depends on ARCH_SPRD || COMPILE_TEST
414+
select IOMMU_API
415+
help
416+
Support for IOMMU on Unisoc's SoCs, this IOMMU can be used by
417+
Unisoc's multimedia devices, such as display, Image codec(jpeg)
418+
and a few signal processors, including VSP(video), GSP(graphic),
419+
ISP(image), and CPP(camera pixel processor), etc.
420+
421+
Say Y here if you want to use the multimedia devices listed above.
422+
411423
endif # IOMMU_SUPPORT

0 commit comments

Comments
 (0)