Commit e1cbc3b9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull iommu updates from Joerg Roedel:

 - Intel VT-d driver updates:
     - Domain force snooping improvement.
     - Cleanups, no intentional functional changes.

 - ARM SMMU driver updates:
     - Add new Qualcomm device-tree compatible strings
     - Add new Nvidia device-tree compatible string for Tegra234
     - Fix UAF in SMMUv3 shared virtual addressing code
     - Force identity-mapped domains for users of ye olde SMMU legacy
       binding
     - Minor cleanups

 - Fix a BUG_ON in the vfio_iommu_group_notifier:
     - Groundwork for upcoming iommufd framework
     - Introduction of DMA ownership so that an entire IOMMU group is
       either controlled by the kernel or by user-space

 - MT8195 and MT8186 support in the Mediatek IOMMU driver

 - Make forcing of cache-coherent DMA more coherent between IOMMU
   drivers

 - Fixes for thunderbolt device DMA protection

 - Various smaller fixes and cleanups

* tag 'iommu-updates-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (88 commits)
  iommu/amd: Increase timeout waiting for GA log enablement
  iommu/s390: Tolerate repeat attach_dev calls
  iommu/vt-d: Remove hard coding PGSNP bit in PASID entries
  iommu/vt-d: Remove domain_update_iommu_snooping()
  iommu/vt-d: Check domain force_snooping against attached devices
  iommu/vt-d: Block force-snoop domain attaching if no SC support
  iommu/vt-d: Size Page Request Queue to avoid overflow condition
  iommu/vt-d: Fold dmar_insert_one_dev_info() into its caller
  iommu/vt-d: Change return type of dmar_insert_one_dev_info()
  iommu/vt-d: Remove unneeded validity check on dev
  iommu/dma: Explicitly sort PCI DMA windows
  iommu/dma: Fix iova map result check bug
  iommu/mediatek: Fix NULL pointer dereference when printing dev_name
  iommu: iommu_group_claim_dma_owner() must always assign a domain
  iommu/arm-smmu: Force identity domains for legacy binding
  iommu/arm-smmu: Support Tegra234 SMMU
  dt-bindings: arm-smmu: Add compatible for Tegra234 SOC
  dt-bindings: arm-smmu: Document nvidia,memory-controller property
  iommu/arm-smmu-qcom: Add SC8280XP support
  dt-bindings: arm-smmu: Add compatible for Qualcomm SC8280XP
  ...
parents 3335d555 b0dacee2
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -37,8 +37,10 @@ properties:
              - qcom,sc7180-smmu-500
              - qcom,sc7280-smmu-500
              - qcom,sc8180x-smmu-500
              - qcom,sc8280xp-smmu-500
              - qcom,sdm845-smmu-500
              - qcom,sdx55-smmu-500
              - qcom,sdx65-smmu-500
              - qcom,sm6350-smmu-500
              - qcom,sm8150-smmu-500
              - qcom,sm8250-smmu-500
@@ -62,8 +64,9 @@ properties:
          for improved performance.
        items:
          - enum:
              - nvidia,tegra194-smmu
              - nvidia,tegra186-smmu
              - nvidia,tegra194-smmu
              - nvidia,tegra234-smmu
          - const: nvidia,smmu-500
      - items:
          - const: arm,mmu-500
@@ -157,6 +160,17 @@ properties:
  power-domains:
    maxItems: 1

  nvidia,memory-controller:
    description: |
      A phandle to the memory controller on NVIDIA Tegra186 and later SoCs.
      The memory controller needs to be programmed with a mapping of memory
      client IDs to ARM SMMU stream IDs.

      If this property is absent, the mapping programmed by early firmware
      will be used and it is not guaranteed that IOMMU translations will be
      enabled for any given device.
    $ref: /schemas/types.yaml#/definitions/phandle

required:
  - compatible
  - reg
@@ -172,13 +186,20 @@ allOf:
        compatible:
          contains:
            enum:
              - nvidia,tegra194-smmu
              - nvidia,tegra186-smmu
              - nvidia,tegra194-smmu
              - nvidia,tegra234-smmu
    then:
      properties:
        reg:
          minItems: 1
          maxItems: 2

      # The reference to the memory controller is required to ensure that the
      # memory client to stream ID mapping can be done synchronously with the
      # IOMMU attachment.
      required:
        - nvidia,memory-controller
    else:
      properties:
        reg:
+23 −11
Original line number Diff line number Diff line
@@ -76,7 +76,11 @@ properties:
          - mediatek,mt8167-m4u  # generation two
          - mediatek,mt8173-m4u  # generation two
          - mediatek,mt8183-m4u  # generation two
          - mediatek,mt8186-iommu-mm         # generation two
          - mediatek,mt8192-m4u  # generation two
          - mediatek,mt8195-iommu-vdo        # generation two
          - mediatek,mt8195-iommu-vpp        # generation two
          - mediatek,mt8195-iommu-infra      # generation two

      - description: mt7623 generation one
        items:
@@ -119,7 +123,9 @@ properties:
      dt-binding/memory/mt8167-larb-port.h for mt8167,
      dt-binding/memory/mt8173-larb-port.h for mt8173,
      dt-binding/memory/mt8183-larb-port.h for mt8183,
      dt-binding/memory/mt8186-memory-port.h for mt8186,
      dt-binding/memory/mt8192-larb-port.h for mt8192.
      dt-binding/memory/mt8195-memory-port.h for mt8195.

  power-domains:
    maxItems: 1
@@ -128,7 +134,6 @@ required:
  - compatible
  - reg
  - interrupts
  - mediatek,larbs
  - '#iommu-cells'

allOf:
@@ -140,7 +145,10 @@ allOf:
              - mediatek,mt2701-m4u
              - mediatek,mt2712-m4u
              - mediatek,mt8173-m4u
              - mediatek,mt8186-iommu-mm
              - mediatek,mt8192-m4u
              - mediatek,mt8195-iommu-vdo
              - mediatek,mt8195-iommu-vpp

    then:
      required:
@@ -150,12 +158,26 @@ allOf:
      properties:
        compatible:
          enum:
            - mediatek,mt8186-iommu-mm
            - mediatek,mt8192-m4u
            - mediatek,mt8195-iommu-vdo
            - mediatek,mt8195-iommu-vpp

    then:
      required:
        - power-domains

  - if: # The IOMMUs don't have larbs.
      not:
        properties:
          compatible:
            contains:
              const: mediatek,mt8195-iommu-infra

    then:
      required:
        - mediatek,larbs

additionalProperties: false

examples:
@@ -173,13 +195,3 @@ examples:
                             <&larb3>, <&larb4>, <&larb5>;
            #iommu-cells = <1>;
    };

  - |
    #include <dt-bindings/memory/mt8173-larb-port.h>

    /* Example for a client device */
    display {
           compatible = "mediatek,mt8173-disp";
           iommus = <&iommu M4U_PORT_DISP_OVL0>,
                    <&iommu M4U_PORT_DISP_RDMA0>;
     };
+0 −10
Original line number Diff line number Diff line
@@ -86,16 +86,6 @@ examples:
  - |
    #include <dt-bindings/clock/exynos5250.h>

    gsc_0: scaler@13e00000 {
      compatible = "samsung,exynos5-gsc";
      reg = <0x13e00000 0x1000>;
      interrupts = <0 85 0>;
      power-domains = <&pd_gsc>;
      clocks = <&clock CLK_GSCL0>;
      clock-names = "gscl";
      iommus = <&sysmmu_gsc0>;
    };

    sysmmu_gsc0: iommu@13e80000 {
      compatible = "samsung,exynos-sysmmu";
      reg = <0x13E80000 0x1000>;
+2 −8
Original line number Diff line number Diff line
@@ -1375,14 +1375,6 @@ L: linux-input@vger.kernel.org
S:	Odd fixes
F:	drivers/input/mouse/bcm5974.c
APPLE DART IOMMU DRIVER
M:	Sven Peter <sven@svenpeter.dev>
R:	Alyssa Rosenzweig <alyssa@rosenzweig.io>
L:	iommu@lists.linux-foundation.org
S:	Maintained
F:	Documentation/devicetree/bindings/iommu/apple,dart.yaml
F:	drivers/iommu/apple-dart.c
APPLE PCIE CONTROLLER DRIVER
M:	Alyssa Rosenzweig <alyssa@rosenzweig.io>
M:	Marc Zyngier <maz@kernel.org>
@@ -1834,6 +1826,7 @@ F: Documentation/devicetree/bindings/arm/apple/*
F:	Documentation/devicetree/bindings/clock/apple,nco.yaml
F:	Documentation/devicetree/bindings/i2c/apple,i2c.yaml
F:	Documentation/devicetree/bindings/interrupt-controller/apple,*
F:	Documentation/devicetree/bindings/iommu/apple,dart.yaml
F:	Documentation/devicetree/bindings/iommu/apple,sart.yaml
F:	Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
F:	Documentation/devicetree/bindings/nvme/apple,nvme-ans.yaml
@@ -1845,6 +1838,7 @@ F: arch/arm64/boot/dts/apple/
F:	drivers/clk/clk-apple-nco.c
F:	drivers/i2c/busses/i2c-pasemi-core.c
F:	drivers/i2c/busses/i2c-pasemi-platform.c
F:	drivers/iommu/apple-dart.c
F:	drivers/irqchip/irq-apple-aic.c
F:	drivers/mailbox/apple-mailbox.c
F:	drivers/nvme/host/apple.c
+36 −1
Original line number Diff line number Diff line
@@ -20,6 +20,10 @@
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <linux/of_irq.h>
#include <linux/of_device.h>
#include <linux/acpi.h>
#include <linux/iommu.h>
#include <linux/dma-map-ops.h>

#define to_amba_driver(d)	container_of(d, struct amba_driver, drv)

@@ -273,6 +277,36 @@ static void amba_shutdown(struct device *dev)
		drv->shutdown(to_amba_device(dev));
}

static int amba_dma_configure(struct device *dev)
{
	struct amba_driver *drv = to_amba_driver(dev->driver);
	enum dev_dma_attr attr;
	int ret = 0;

	if (dev->of_node) {
		ret = of_dma_configure(dev, dev->of_node, true);
	} else if (has_acpi_companion(dev)) {
		attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode));
		ret = acpi_dma_configure(dev, attr);
	}

	if (!ret && !drv->driver_managed_dma) {
		ret = iommu_device_use_default_domain(dev);
		if (ret)
			arch_teardown_dma_ops(dev);
	}

	return ret;
}

static void amba_dma_cleanup(struct device *dev)
{
	struct amba_driver *drv = to_amba_driver(dev->driver);

	if (!drv->driver_managed_dma)
		iommu_device_unuse_default_domain(dev);
}

#ifdef CONFIG_PM
/*
 * Hooks to provide runtime PM of the pclk (bus clock).  It is safe to
@@ -341,7 +375,8 @@ struct bus_type amba_bustype = {
	.probe		= amba_probe,
	.remove		= amba_remove,
	.shutdown	= amba_shutdown,
	.dma_configure	= platform_dma_configure,
	.dma_configure	= amba_dma_configure,
	.dma_cleanup	= amba_dma_cleanup,
	.pm		= &amba_pm,
};
EXPORT_SYMBOL_GPL(amba_bustype);
Loading