Skip to content

Commit

Permalink
Merge pull request #3 from svenpeter42/dart-pr
Browse files Browse the repository at this point in the history
DART v5 + iommu/next dependencies
  • Loading branch information
svenpeter42 authored Aug 8, 2021
2 parents c500bee + 5a8cd2b commit e3866e3
Show file tree
Hide file tree
Showing 13 changed files with 1,455 additions and 130 deletions.
81 changes: 81 additions & 0 deletions Documentation/devicetree/bindings/iommu/apple,dart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iommu/apple,dart.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Apple DART IOMMU

maintainers:
- Sven Peter <sven@svenpeter.dev>

description: |+
Apple SoCs may contain an implementation of their Device Address
Resolution Table which provides a mandatory layer of address
translations for various masters.
Each DART instance is capable of handling up to 16 different streams
with individual pagetables and page-level read/write protection flags.
This DART IOMMU also raises interrupts in response to various
fault conditions.
properties:
compatible:
const: apple,t8103-dart

reg:
maxItems: 1

interrupts:
maxItems: 1

clocks:
description:
Reference to the gate clock phandle if required for this IOMMU.
Optional since not all IOMMUs are attached to a clock gate.

'#iommu-cells':
const: 1
description:
Has to be one. The single cell describes the stream id emitted by
a master to the IOMMU.

required:
- compatible
- reg
- '#iommu-cells'
- interrupts

additionalProperties: false

examples:
- |+
dart1: iommu@82f80000 {
compatible = "apple,t8103-dart";
reg = <0x82f80000 0x4000>;
interrupts = <1 781 4>;
#iommu-cells = <1>;
};
master1 {
iommus = <&dart1 0>;
};
- |+
dart2a: iommu@82f00000 {
compatible = "apple,t8103-dart";
reg = <0x82f00000 0x4000>;
interrupts = <1 781 4>;
#iommu-cells = <1>;
};
dart2b: iommu@82f80000 {
compatible = "apple,t8103-dart";
reg = <0x82f80000 0x4000>;
interrupts = <1 781 4>;
#iommu-cells = <1>;
};
master2 {
iommus = <&dart2a 0>, <&dart2b 1>;
};
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,13 @@ 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>
L: iommu@lists.linux-foundation.org
S: Maintained
F: Documentation/devicetree/bindings/iommu/apple,dart.yaml
F: drivers/iommu/apple-dart.c

APPLE SMC DRIVER
M: Henrik Rydberg <rydberg@bitmath.org>
L: linux-hwmon@vger.kernel.org
Expand Down
51 changes: 51 additions & 0 deletions arch/arm64/boot/dts/apple/t8103.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
#size-cells = <2>;

ranges;
dma-ranges;
nonposted-mmio;

serial0: serial@235200000 {
Expand All @@ -131,5 +132,55 @@
interrupt-controller;
reg = <0x2 0x3b100000 0x0 0x8000>;
};

dwc3_0_dart_0: iommu@382f00000 {
compatible = "apple,t8103-dart";
reg = <0x3 0x82f00000 0x0 0x4000>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 781 IRQ_TYPE_LEVEL_HIGH>;
#iommu-cells = <1>;
};

dwc3_0_dart_1: iommu@382f80000 {
compatible = "apple,t8103-dart";
reg = <0x3 0x82f80000 0x0 0x4000>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 781 IRQ_TYPE_LEVEL_HIGH>;
#iommu-cells = <1>;
};

dwc3_0: usb@382280000{
compatible = "snps,dwc3";
reg = <0x3 0x82280000 0x0 0x100000>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 777 IRQ_TYPE_LEVEL_HIGH>;
dr_mode = "host";
iommus = <&dwc3_0_dart_0 0>, <&dwc3_0_dart_1 1>;
};

dwc3_1_dart_0: iommu@502f00000 {
compatible = "apple,t8103-dart";
reg = <0x5 0x02f00000 0x0 0x4000>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 861 IRQ_TYPE_LEVEL_HIGH>;
#iommu-cells = <1>;
};

dwc3_1_dart_1: iommu@502f80000 {
compatible = "apple,t8103-dart";
reg = <0x5 0x02f80000 0x0 0x4000>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 861 IRQ_TYPE_LEVEL_HIGH>;
#iommu-cells = <1>;
};

dwc3_1: usb@502280000{
compatible = "snps,dwc3";
reg = <0x5 0x02280000 0x0 0x100000>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 857 IRQ_TYPE_LEVEL_HIGH>;
dr_mode = "host";
iommus = <&dwc3_1_dart_0 0>, <&dwc3_1_dart_1 1>;
};
};
};
14 changes: 14 additions & 0 deletions drivers/iommu/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,20 @@ config SPAPR_TCE_IOMMU
Enables bits of IOMMU API required by VFIO. The iommu_ops
is not implemented as it is not necessary for VFIO.

config APPLE_DART
tristate "Apple DART IOMMU Support"
depends on ARM64 || (COMPILE_TEST && !GENERIC_ATOMIC64)
select IOMMU_API
select IOMMU_IO_PGTABLE_LPAE
default ARCH_APPLE
help
Support for Apple DART (Device Address Resolution Table) IOMMUs
found in Apple ARM SoCs like the M1.
This IOMMU is required for most peripherals using DMA to access
the main memory.

Say Y here if you are using an Apple SoC.

# ARM IOMMU support
config ARM_SMMU
tristate "ARM Ltd. System MMU (SMMU) Support"
Expand Down
1 change: 1 addition & 0 deletions drivers/iommu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ obj-$(CONFIG_HYPERV_IOMMU) += hyperv-iommu.o
obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o
obj-$(CONFIG_IOMMU_SVA_LIB) += iommu-sva-lib.o io-pgfault.o
obj-$(CONFIG_SPRD_IOMMU) += sprd-iommu.o
obj-$(CONFIG_APPLE_DART) += apple-dart.o
Loading

0 comments on commit e3866e3

Please sign in to comment.