[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250422061406.112539-8-huaqian.li@siemens.com>
Date: Tue, 22 Apr 2025 14:14:06 +0800
From: huaqian.li@...mens.com
To: helgaas@...nel.org
Cc: baocheng.su@...mens.com,
bhelgaas@...gle.com,
conor+dt@...nel.org,
devicetree@...r.kernel.org,
diogo.ivo@...mens.com,
huaqian.li@...mens.com,
jan.kiszka@...mens.com,
kristo@...nel.org,
krzk+dt@...nel.org,
kw@...ux.com,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org,
lpieralisi@...nel.org,
nm@...com,
robh@...nel.org,
s-vadapalli@...com,
ssantosh@...nel.org,
vigneshr@...com
Subject: [PATCH v8 7/7] arm64: dts: ti: iot2050: Add overlay for DMA isolation for devices behind PCI RC
From: Jan Kiszka <jan.kiszka@...mens.com>
Reserve a 64M memory region and ensure that all PCI devices do their DMA
only inside that region. This is configured via a restricted-dma-pool
and enforced with the help of the first PVU.
Applying this isolation is not totally free in terms of overhead and
memory consumption. It makes only sense for variants that support
secure booting, and generally only when this is actually enable.
Therefore model it as overlay that can be activated on demand. The
firmware will take care of this via DT fixup during boot and will also
provide a way to adjust the pool size.
Signed-off-by: Jan Kiszka <jan.kiszka@...mens.com>
Signed-off-by: Li Hua Qian <huaqian.li@...mens.com>
---
arch/arm64/boot/dts/ti/Makefile | 5 +++
...am6548-iot2050-advanced-dma-isolation.dtso | 33 +++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 arch/arm64/boot/dts/ti/k3-am6548-iot2050-advanced-dma-isolation.dtso
diff --git a/arch/arm64/boot/dts/ti/Makefile b/arch/arm64/boot/dts/ti/Makefile
index 03d4cecfc001..12c2cee955f2 100644
--- a/arch/arm64/boot/dts/ti/Makefile
+++ b/arch/arm64/boot/dts/ti/Makefile
@@ -73,8 +73,10 @@ k3-am654-gp-evm-dtbs := k3-am654-base-board.dtb \
k3-am654-evm-dtbs := k3-am654-base-board.dtb k3-am654-icssg2.dtbo
k3-am654-idk-dtbs := k3-am654-evm.dtb k3-am654-idk.dtbo k3-am654-pcie-usb2.dtbo
k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-dtbs := k3-am6548-iot2050-advanced-m2.dtb \
+ k3-am6548-iot2050-advanced-dma-isolation.dtbo \
k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie.dtbo
k3-am6548-iot2050-advanced-m2-bkey-usb3-dtbs := k3-am6548-iot2050-advanced-m2.dtb \
+ k3-am6548-iot2050-advanced-dma-isolation.dtbo \
k3-am6548-iot2050-advanced-m2-bkey-usb3.dtbo
dtb-$(CONFIG_ARCH_K3) += k3-am6528-iot2050-basic.dtb
dtb-$(CONFIG_ARCH_K3) += k3-am6528-iot2050-basic-pg2.dtb
@@ -261,7 +263,10 @@ DTC_FLAGS_k3-am62p5-sk += -@
DTC_FLAGS_k3-am642-evm += -@
DTC_FLAGS_k3-am642-phyboard-electra-rdk += -@
DTC_FLAGS_k3-am642-tqma64xxl-mbax4xxl += -@
+DTC_FLAGS_k3-am6548-iot2050-advanced += -@
DTC_FLAGS_k3-am6548-iot2050-advanced-m2 += -@
+DTC_FLAGS_k3-am6548-iot2050-advanced-pg2 += -@
+DTC_FLAGS_k3-am6548-iot2050-advanced-sm += -@
DTC_FLAGS_k3-am68-sk-base-board += -@
DTC_FLAGS_k3-am69-sk += -@
DTC_FLAGS_k3-j7200-common-proc-board += -@
diff --git a/arch/arm64/boot/dts/ti/k3-am6548-iot2050-advanced-dma-isolation.dtso b/arch/arm64/boot/dts/ti/k3-am6548-iot2050-advanced-dma-isolation.dtso
new file mode 100644
index 000000000000..dfd75d2dc245
--- /dev/null
+++ b/arch/arm64/boot/dts/ti/k3-am6548-iot2050-advanced-dma-isolation.dtso
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * IOT2050, overlay for isolating DMA requests via PVU
+ * Copyright (c) Siemens AG, 2024
+ *
+ * Authors:
+ * Jan Kiszka <jan.kiszka@...mens.com>
+ */
+
+/dts-v1/;
+/plugin/;
+
+&{/reserved-memory} {
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ pci_restricted_dma_region: restricted-dma@...00000 {
+ compatible = "restricted-dma-pool";
+ reg = <0 0xc0000000 0 0x4000000>;
+ };
+};
+
+&pcie0_rc {
+ memory-region = <&pci_restricted_dma_region>;
+};
+
+&pcie1_rc {
+ memory-region = <&pci_restricted_dma_region>;
+};
+
+&ti_pvu0 {
+ status = "okay";
+};
--
2.34.1
Powered by blists - more mailing lists