Skip to content

Commit 8e143b9

Browse files
committed
Merge tag 'iommu-updates-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU updates from Joerg Roedel: - Page table code for AMD IOMMU now supports large pages where smaller page-sizes were mapped before. VFIO had to work around that in the past and I included a patch to remove it (acked by Alex Williamson) - Patches to unmodularize a couple of IOMMU drivers that would never work as modules anyway. - Work to unify the the iommu-related pointers in 'struct device' into one pointer. This work is not finished yet, but will probably be in the next cycle. - NUMA aware allocation in iommu-dma code - Support for r8a774a1 and r8a774c0 in the Renesas IOMMU driver - Scalable mode support for the Intel VT-d driver - PM runtime improvements for the ARM-SMMU driver - Support for the QCOM-SMMUv2 IOMMU hardware from Qualcom - Various smaller fixes and improvements * tag 'iommu-updates-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (78 commits) iommu: Check for iommu_ops == NULL in iommu_probe_device() ACPI/IORT: Don't call iommu_ops->add_device directly iommu/of: Don't call iommu_ops->add_device directly iommu: Consolitate ->add/remove_device() calls iommu/sysfs: Rename iommu_release_device() dmaengine: sh: rcar-dmac: Use device_iommu_mapped() xhci: Use device_iommu_mapped() powerpc/iommu: Use device_iommu_mapped() ACPI/IORT: Use device_iommu_mapped() iommu/of: Use device_iommu_mapped() driver core: Introduce device_iommu_mapped() function iommu/tegra: Use helper functions to access dev->iommu_fwspec iommu/qcom: Use helper functions to access dev->iommu_fwspec iommu/of: Use helper functions to access dev->iommu_fwspec iommu/mediatek: Use helper functions to access dev->iommu_fwspec iommu/ipmmu-vmsa: Use helper functions to access dev->iommu_fwspec iommu/dma: Use helper functions to access dev->iommu_fwspec iommu/arm-smmu: Use helper functions to access dev->iommu_fwspec ACPI/IORT: Use helper functions to access dev->iommu_fwspec iommu: Introduce wrappers around dev->iommu_fwspec ...
2 parents 78e8696 + 03ebe48 commit 8e143b9

Some content is hidden

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

46 files changed

+1612
-917
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,12 +1690,12 @@
16901690
By default, super page will be supported if Intel IOMMU
16911691
has the capability. With this option, super page will
16921692
not be supported.
1693-
ecs_off [Default Off]
1694-
By default, extended context tables will be supported if
1695-
the hardware advertises that it has support both for the
1696-
extended tables themselves, and also PASID support. With
1697-
this option set, extended tables will not be used even
1698-
on hardware which claims to support them.
1693+
sm_off [Default Off]
1694+
By default, scalable mode will be supported if the
1695+
hardware advertises that it has support for the scalable
1696+
mode translation. With this option set, scalable mode
1697+
will not be used even on hardware which claims to support
1698+
it.
16991699
tboot_noforce [Default Off]
17001700
Do not force the Intel IOMMU enabled under tboot.
17011701
By default, tboot will force Intel IOMMU on, which

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,20 @@ conditions.
1717
"arm,mmu-401"
1818
"arm,mmu-500"
1919
"cavium,smmu-v2"
20+
"qcom,smmu-v2"
2021

2122
depending on the particular implementation and/or the
2223
version of the architecture implemented.
2324

25+
Qcom SoCs must contain, as below, SoC-specific compatibles
26+
along with "qcom,smmu-v2":
27+
"qcom,msm8996-smmu-v2", "qcom,smmu-v2",
28+
"qcom,sdm845-smmu-v2", "qcom,smmu-v2".
29+
30+
Qcom SoCs implementing "arm,mmu-500" must also include,
31+
as below, SoC-specific compatibles:
32+
"qcom,sdm845-smmu-500", "arm,mmu-500"
33+
2434
- reg : Base address and size of the SMMU.
2535

2636
- #global-interrupts : The number of global interrupts exposed by the
@@ -71,6 +81,22 @@ conditions.
7181
or using stream matching with #iommu-cells = <2>, and
7282
may be ignored if present in such cases.
7383

84+
- clock-names: List of the names of clocks input to the device. The
85+
required list depends on particular implementation and
86+
is as follows:
87+
- for "qcom,smmu-v2":
88+
- "bus": clock required for downstream bus access and
89+
for the smmu ptw,
90+
- "iface": clock required to access smmu's registers
91+
through the TCU's programming interface.
92+
- unspecified for other implementations.
93+
94+
- clocks: Specifiers for all clocks listed in the clock-names property,
95+
as per generic clock bindings.
96+
97+
- power-domains: Specifiers for power domains required to be powered on for
98+
the SMMU to operate, as per generic power domain bindings.
99+
74100
** Deprecated properties:
75101

76102
- mmu-masters (deprecated in favour of the generic "iommus" binding) :
@@ -137,3 +163,20 @@ conditions.
137163
iommu-map = <0 &smmu3 0 0x400>;
138164
...
139165
};
166+
167+
/* Qcom's arm,smmu-v2 implementation */
168+
smmu4: iommu@d00000 {
169+
compatible = "qcom,msm8996-smmu-v2", "qcom,smmu-v2";
170+
reg = <0xd00000 0x10000>;
171+
172+
#global-interrupts = <1>;
173+
interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>,
174+
<GIC_SPI 320 IRQ_TYPE_LEVEL_HIGH>,
175+
<GIC_SPI 321 IRQ_TYPE_LEVEL_HIGH>;
176+
#iommu-cells = <1>;
177+
power-domains = <&mmcc MDSS_GDSC>;
178+
179+
clocks = <&mmcc SMMU_MDP_AXI_CLK>,
180+
<&mmcc SMMU_MDP_AHB_CLK>;
181+
clock-names = "bus", "iface";
182+
};

Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Required Properties:
1414
- "renesas,ipmmu-r8a7743" for the R8A7743 (RZ/G1M) IPMMU.
1515
- "renesas,ipmmu-r8a7744" for the R8A7744 (RZ/G1N) IPMMU.
1616
- "renesas,ipmmu-r8a7745" for the R8A7745 (RZ/G1E) IPMMU.
17+
- "renesas,ipmmu-r8a774a1" for the R8A774A1 (RZ/G2M) IPMMU.
18+
- "renesas,ipmmu-r8a774c0" for the R8A774C0 (RZ/G2E) IPMMU.
1719
- "renesas,ipmmu-r8a7790" for the R8A7790 (R-Car H2) IPMMU.
1820
- "renesas,ipmmu-r8a7791" for the R8A7791 (R-Car M2-W) IPMMU.
1921
- "renesas,ipmmu-r8a7793" for the R8A7793 (R-Car M2-N) IPMMU.

arch/powerpc/kernel/eeh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ static int dev_has_iommu_table(struct device *dev, void *data)
14721472
if (!dev)
14731473
return 0;
14741474

1475-
if (dev->iommu_group) {
1475+
if (device_iommu_mapped(dev)) {
14761476
*ppdev = pdev;
14771477
return 1;
14781478
}

arch/powerpc/kernel/iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ int iommu_add_device(struct iommu_table_group *table_group, struct device *dev)
10881088
if (!device_is_registered(dev))
10891089
return -ENOENT;
10901090

1091-
if (dev->iommu_group) {
1091+
if (device_iommu_mapped(dev)) {
10921092
pr_debug("%s: Skipping device %s with iommu group %d\n",
10931093
__func__, dev_name(dev),
10941094
iommu_group_id(dev->iommu_group));
@@ -1109,7 +1109,7 @@ void iommu_del_device(struct device *dev)
11091109
* and we needn't detach them from the associated
11101110
* IOMMU groups
11111111
*/
1112-
if (!dev->iommu_group) {
1112+
if (!device_iommu_mapped(dev)) {
11131113
pr_debug("iommu_tce: skipping device %s with no tbl\n",
11141114
dev_name(dev));
11151115
return;

arch/x86/kernel/tboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*/
2121

22-
#include <linux/dma_remapping.h>
22+
#include <linux/intel-iommu.h>
2323
#include <linux/init_task.h>
2424
#include <linux/spinlock.h>
2525
#include <linux/export.h>

drivers/acpi/arm64/iort.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ static inline bool iort_iommu_driver_enabled(u8 type)
779779
static struct acpi_iort_node *iort_get_msi_resv_iommu(struct device *dev)
780780
{
781781
struct acpi_iort_node *iommu;
782-
struct iommu_fwspec *fwspec = dev->iommu_fwspec;
782+
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
783783

784784
iommu = iort_get_iort_node(fwspec->iommu_fwnode);
785785

@@ -794,9 +794,10 @@ static struct acpi_iort_node *iort_get_msi_resv_iommu(struct device *dev)
794794
return NULL;
795795
}
796796

797-
static inline const struct iommu_ops *iort_fwspec_iommu_ops(
798-
struct iommu_fwspec *fwspec)
797+
static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev)
799798
{
799+
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
800+
800801
return (fwspec && fwspec->ops) ? fwspec->ops : NULL;
801802
}
802803

@@ -805,8 +806,8 @@ static inline int iort_add_device_replay(const struct iommu_ops *ops,
805806
{
806807
int err = 0;
807808

808-
if (ops->add_device && dev->bus && !dev->iommu_group)
809-
err = ops->add_device(dev);
809+
if (dev->bus && !device_iommu_mapped(dev))
810+
err = iommu_probe_device(dev);
810811

811812
return err;
812813
}
@@ -824,6 +825,7 @@ static inline int iort_add_device_replay(const struct iommu_ops *ops,
824825
*/
825826
int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
826827
{
828+
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
827829
struct acpi_iort_its_group *its;
828830
struct acpi_iort_node *iommu_node, *its_node = NULL;
829831
int i, resv = 0;
@@ -841,9 +843,9 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
841843
* a given PCI or named component may map IDs to.
842844
*/
843845

844-
for (i = 0; i < dev->iommu_fwspec->num_ids; i++) {
846+
for (i = 0; i < fwspec->num_ids; i++) {
845847
its_node = iort_node_map_id(iommu_node,
846-
dev->iommu_fwspec->ids[i],
848+
fwspec->ids[i],
847849
NULL, IORT_MSI_TYPE);
848850
if (its_node)
849851
break;
@@ -874,8 +876,7 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
874876
return (resv == its->its_count) ? resv : -ENODEV;
875877
}
876878
#else
877-
static inline const struct iommu_ops *iort_fwspec_iommu_ops(
878-
struct iommu_fwspec *fwspec)
879+
static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev);
879880
{ return NULL; }
880881
static inline int iort_add_device_replay(const struct iommu_ops *ops,
881882
struct device *dev)
@@ -1045,7 +1046,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
10451046
* If we already translated the fwspec there
10461047
* is nothing left to do, return the iommu_ops.
10471048
*/
1048-
ops = iort_fwspec_iommu_ops(dev->iommu_fwspec);
1049+
ops = iort_fwspec_iommu_ops(dev);
10491050
if (ops)
10501051
return ops;
10511052

@@ -1084,7 +1085,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
10841085
* add_device callback for dev, replay it to get things in order.
10851086
*/
10861087
if (!err) {
1087-
ops = iort_fwspec_iommu_ops(dev->iommu_fwspec);
1088+
ops = iort_fwspec_iommu_ops(dev);
10881089
err = iort_add_device_replay(ops, dev);
10891090
}
10901091

drivers/dma/sh/rcar-dmac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)
18091809
* level we can't disable it selectively, so ignore channel 0 for now if
18101810
* the device is part of an IOMMU group.
18111811
*/
1812-
if (pdev->dev.iommu_group) {
1812+
if (device_iommu_mapped(&pdev->dev)) {
18131813
dmac->n_channels--;
18141814
channels_offset = 1;
18151815
}

drivers/gpu/drm/i915/i915_gem_execbuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
*/
2828

29-
#include <linux/dma_remapping.h>
29+
#include <linux/intel-iommu.h>
3030
#include <linux/reservation.h>
3131
#include <linux/sync_file.h>
3232
#include <linux/uaccess.h>

drivers/gpu/drm/i915/intel_display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#include <drm/drm_plane_helper.h>
4747
#include <drm/drm_rect.h>
4848
#include <drm/drm_atomic_uapi.h>
49-
#include <linux/dma_remapping.h>
49+
#include <linux/intel-iommu.h>
5050
#include <linux/reservation.h>
5151

5252
/* Primary plane formats for gen <= 3 */

drivers/gpu/drm/vmwgfx/vmwgfx_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <drm/ttm/ttm_placement.h>
3535
#include <drm/ttm/ttm_bo_driver.h>
3636
#include <drm/ttm/ttm_module.h>
37-
#include <linux/dma_remapping.h>
37+
#include <linux/intel-iommu.h>
3838

3939
#define VMWGFX_DRIVER_DESC "Linux drm driver for VMware graphics devices"
4040
#define VMWGFX_CHIP_SVGAII 0

0 commit comments

Comments
 (0)