public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] arm64: dts: qcom: Add EL2 overlays for WoA devices
@ 2025-05-01 17:03 Nikita Travkin
  2025-05-01 17:03 ` [PATCH 1/5] arm64: dts: qcom: sc7180: Add EL2 overlay " Nikita Travkin
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Nikita Travkin @ 2025-05-01 17:03 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, cros-qcom-dts-watchers
  Cc: Marc Zyngier, Jens Glathe, linux-arm-msm, devicetree,
	linux-kernel, Nikita Travkin

WoA devices use firmware very similar to android, which means that Linux
has to run in EL1 due to the presence of Qualcomm's hypervisor (QHEE or
Gunyah). However Windows can replace that hypervisor using Secure-Launch
flow.

More recently the same approach became possible to be used to boot Linux
in EL2 on those devices, thanks to a tool called slbounce[1].

As of now, booting in EL2 comes with some downsides, most notably that
DSP remoteprocs (importantly, ADSP) can't be booted as Linux relied on
hyp's service to authenticate and launch the firmware. The lack of ADSP
results in missing battery/charging and type-c services (alongside with
missing sound of course). On the other hand it becomes more clear that
running under QHEE/Gunyah /also/ has downsides apart from lacking
virtualization support. For example, x1e devices can't use more than
32GiB of ram when running under Gunyah.

As booting in EL2 depreves us of QHEE/Gunyah services, some changes to
the DT are needed to boot in EL2 correctly:

- GPU ZAP shader must be disabled. Linux will zap the gpu itself;
- If PCIe is present, SMMUv3 must be enabled and controlled properly;
- On x1 devices, hyp-emulated watchdog must be disabled.

To make it easier to run WoA devices in EL2, this series introduces
per-SoC EL2 overlays and -el2.dtb variants of WoA device DTBs. Ready
presence of -el2.dtb-s will allow people to more easily use those
devices in EL2, especially as some recent work on fixing ADSP-related
limitations (at least on x1e) is already being done and can benefit EL2
case as well. [2]

[1] https://github.com/TravMurav/slbounce
[2] https://git.codelinaro.org/stephan.gerhold/linux/-/commit/7c2a82017d32a4a0007443680fd0847e7c92d5bb

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
Nikita Travkin (5):
      arm64: dts: qcom: sc7180: Add EL2 overlay for WoA devices
      arm64: dts: qcom: sc8280xp: Add PCIe IOMMU
      arm64: dts: qcom: sc8280xp: Add EL2 overlay for WoA devices
      arm64: dts: qcom: x1e80100: Add PCIe IOMMU
      arm64: dts: qcom: x1e/x1p: Add EL2 overlay for WoA devices

 arch/arm64/boot/dts/qcom/Makefile          | 54 ++++++++++++++++++++----------
 arch/arm64/boot/dts/qcom/sc7180-el2.dtso   | 22 ++++++++++++
 arch/arm64/boot/dts/qcom/sc8280xp-el2.dtso | 44 ++++++++++++++++++++++++
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi     | 14 ++++++++
 arch/arm64/boot/dts/qcom/x1-el2.dtso       | 46 +++++++++++++++++++++++++
 arch/arm64/boot/dts/qcom/x1e80100.dtsi     | 16 ++++++++-
 6 files changed, 177 insertions(+), 19 deletions(-)
---
base-commit: 8a2d53ce3c5f82683ad3df9a9a55822816fe64e7
change-id: 20250501-sc-el2-overlays-b297325f3729

Best regards,
-- 
Nikita Travkin <nikita@trvn.ru>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/5] arm64: dts: qcom: sc7180: Add EL2 overlay for WoA devices
  2025-05-01 17:03 [PATCH 0/5] arm64: dts: qcom: Add EL2 overlays for WoA devices Nikita Travkin
@ 2025-05-01 17:03 ` Nikita Travkin
  2025-05-01 17:03 ` [PATCH 2/5] arm64: dts: qcom: sc8280xp: Add PCIe IOMMU Nikita Travkin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Nikita Travkin @ 2025-05-01 17:03 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, cros-qcom-dts-watchers
  Cc: Marc Zyngier, Jens Glathe, linux-arm-msm, devicetree,
	linux-kernel, Nikita Travkin

WoA devices using sc7180 use android firmware to boot, which notably
includes QHEE hypervisor. This means that, so far, Linux-based OS could
only boot in EL1 on those devices.

However Windows can replace QHEE upon boot with it's own hypervisor, and
with the use of tools such as "slbounce", it's possible to do the same
for Linux-based OS, in which case some modifications to the DT are
necessary to facilitate the absence of QHEE services.

Add a EL2-specific DT overlay and apply it to sc7180 WoA devices to
create -el2.dtb for each of them alongside "normal" dtb.

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
 arch/arm64/boot/dts/qcom/Makefile        |  3 ++-
 arch/arm64/boot/dts/qcom/sc7180-el2.dtso | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile
index adb4d026bcc4b24d73de92e204db8d525b0770e6..06da6f6791d69f56bafc3dad3e721c9ff2a1a68a 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -138,7 +138,8 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sa8295p-adp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sa8540p-ride.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sa8775p-ride.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sa8775p-ride-r3.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= sc7180-acer-aspire1.dtb
+sc7180-acer-aspire1-el2-dtbs	:= sc7180-acer-aspire1.dtb sc7180-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= sc7180-acer-aspire1.dtb sc7180-acer-aspire1-el2.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sc7180-idp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sc7180-trogdor-coachz-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sc7180-trogdor-coachz-r1-lte.dtb
diff --git a/arch/arm64/boot/dts/qcom/sc7180-el2.dtso b/arch/arm64/boot/dts/qcom/sc7180-el2.dtso
new file mode 100644
index 0000000000000000000000000000000000000000..49a98676ca4db270ecb55e8f801d0800ef9e4def
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sc7180-el2.dtso
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+/*
+ * sc7180 specific modifications required to boot in EL2.
+ */
+
+/dts-v1/;
+/plugin/;
+
+/* We can't and don't need to use zap shader in EL2 as linux can zap the gpu on it's own. */
+&gpu {
+	zap-shader {
+		status = "disabled";
+	};
+};
+
+/* Venus can be used in EL2 if booted similarly to ChromeOS devices. */
+&venus {
+	video-firmware {
+		iommus = <&apps_smmu 0x0c42 0x0>;
+	};
+};

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/5] arm64: dts: qcom: sc8280xp: Add PCIe IOMMU
  2025-05-01 17:03 [PATCH 0/5] arm64: dts: qcom: Add EL2 overlays for WoA devices Nikita Travkin
  2025-05-01 17:03 ` [PATCH 1/5] arm64: dts: qcom: sc7180: Add EL2 overlay " Nikita Travkin
@ 2025-05-01 17:03 ` Nikita Travkin
  2025-05-01 17:03 ` [PATCH 3/5] arm64: dts: qcom: sc8280xp: Add EL2 overlay for WoA devices Nikita Travkin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Nikita Travkin @ 2025-05-01 17:03 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, cros-qcom-dts-watchers
  Cc: Marc Zyngier, Jens Glathe, linux-arm-msm, devicetree,
	linux-kernel, Nikita Travkin

sc8280xp has an SMMUv3 connected to PCIe which is normally controlled by
QHEE and is thus transparent to the OS. However if we boot Linux in EL2,
without QHEE, we need to manage this IOMMU ourselves. To make that
easier, and since the hardware actually exists, just not "usually"
managed by Linux, describe it in the dts as "reserved".

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
index 35ef31d4ecf26125407bb64dd2de6e777a3400a3..27d21e1a2d50c6fc12f324ab2b4dfa4b99791b81 100644
--- a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
@@ -4927,6 +4927,20 @@ rx-pins {
 			};
 		};
 
+		pcie_smmu: iommu@14f80000 {
+			compatible = "arm,smmu-v3";
+			reg = <0 0x14f80000 0 0x80000>;
+			#iommu-cells = <1>;
+			interrupts = <GIC_SPI 951 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 955 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 953 IRQ_TYPE_EDGE_RISING>;
+			interrupt-names = "eventq",
+					  "gerror",
+					  "cmdq-sync";
+			dma-coherent;
+			status = "reserved"; /* Controlled by QHEE. */
+		};
+
 		apps_smmu: iommu@15000000 {
 			compatible = "qcom,sc8280xp-smmu-500", "arm,mmu-500";
 			reg = <0 0x15000000 0 0x100000>;

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/5] arm64: dts: qcom: sc8280xp: Add EL2 overlay for WoA devices
  2025-05-01 17:03 [PATCH 0/5] arm64: dts: qcom: Add EL2 overlays for WoA devices Nikita Travkin
  2025-05-01 17:03 ` [PATCH 1/5] arm64: dts: qcom: sc7180: Add EL2 overlay " Nikita Travkin
  2025-05-01 17:03 ` [PATCH 2/5] arm64: dts: qcom: sc8280xp: Add PCIe IOMMU Nikita Travkin
@ 2025-05-01 17:03 ` Nikita Travkin
  2025-05-01 17:03 ` [PATCH 4/5] arm64: dts: qcom: x1e80100: Add PCIe IOMMU Nikita Travkin
  2025-05-01 17:03 ` [PATCH 5/5] arm64: dts: qcom: x1e/x1p: Add EL2 overlay for WoA devices Nikita Travkin
  4 siblings, 0 replies; 8+ messages in thread
From: Nikita Travkin @ 2025-05-01 17:03 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, cros-qcom-dts-watchers
  Cc: Marc Zyngier, Jens Glathe, linux-arm-msm, devicetree,
	linux-kernel, Nikita Travkin

WoA devices using sc8280xp use android firmware to boot, which notably
includes QHEE hypervisor. This means that, so far, Linux-based OS could
only boot in EL1 on those devices.

However Windows can replace QHEE upon boot with it's own hypervisor, and
with the use of tools such as "slbounce", it's possible to do the same
for Linux-based OS, in which case some modifications to the DT are
necessary to facilitate the absence of QHEE services.

Add a EL2-specific DT overlay and apply it to sc8280xp WoA devices to
create -el2.dtb for each of them alongside "normal" dtb.

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
 arch/arm64/boot/dts/qcom/Makefile          | 15 ++++++----
 arch/arm64/boot/dts/qcom/sc8280xp-el2.dtso | 44 ++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile
index 06da6f6791d69f56bafc3dad3e721c9ff2a1a68a..12d9ed1129b4e83146e561910aca9fc3718b0820 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -205,11 +205,16 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sc7280-idp2.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sc7280-crd-r3.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sc8180x-lenovo-flex-5g.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sc8180x-primus.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-crd.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-huawei-gaokun3.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-lenovo-thinkpad-x13s.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-microsoft-arcata.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-microsoft-blackrock.dtb
+sc8280xp-crd-el2-dtbs	:= sc8280xp-crd.dtb sc8280xp-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-crd.dtb sc8280xp-crd-el2.dtb
+sc8280xp-huawei-gaokun3-el2-dtbs	:= sc8280xp-huawei-gaokun3.dtb sc8280xp-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-huawei-gaokun3.dtb sc8280xp-huawei-gaokun3-el2.dtb
+sc8280xp-lenovo-thinkpad-x13s-el2-dtbs	:= sc8280xp-lenovo-thinkpad-x13s.dtb sc8280xp-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-lenovo-thinkpad-x13s.dtb sc8280xp-lenovo-thinkpad-x13s-el2.dtb
+sc8280xp-microsoft-arcata-el2-dtbs	:= sc8280xp-microsoft-arcata.dtb sc8280xp-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-microsoft-arcata.dtb sc8280xp-microsoft-arcata-el2.dtb
+sc8280xp-microsoft-blackrock-el2-dtbs	:= sc8280xp-microsoft-blackrock.dtb sc8280xp-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-microsoft-blackrock.dtb sc8280xp-microsoft-blackrock-el2.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sda660-inforce-ifc6560.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm450-lenovo-tbx605f.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm450-motorola-ali.dtb
diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-el2.dtso b/arch/arm64/boot/dts/qcom/sc8280xp-el2.dtso
new file mode 100644
index 0000000000000000000000000000000000000000..25d1fa4bc2055e67db0508aa09c8a8bd7fa01687
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sc8280xp-el2.dtso
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+/*
+ * sc8280xp specific modifications required to boot in EL2.
+ */
+
+/dts-v1/;
+/plugin/;
+
+/* We can't and don't need to use zap shader in EL2 as linux can zap the gpu on it's own. */
+&gpu {
+	zap-shader {
+		status = "disabled";
+	};
+};
+
+/*
+ * When running under QHEE, this IOMMU is controlled by the firmware,
+ * however when we take ownership of it in EL2, we need to configure
+ * it properly to use PCIe.
+ */
+&pcie2a {
+	iommu-map = <0 &pcie_smmu 0x20000 0x10000>;
+};
+
+&pcie2b {
+	iommu-map = <0 &pcie_smmu 0x30000 0x10000>;
+};
+
+&pcie3a {
+	iommu-map = <0 &pcie_smmu 0x40000 0x10000>;
+};
+
+&pcie3b {
+	iommu-map = <0 &pcie_smmu 0x50000 0x10000>;
+};
+
+&pcie4 {
+	iommu-map = <0 &pcie_smmu 0x60000 0x10000>;
+};
+
+&pcie_smmu {
+	status = "okay";
+};

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/5] arm64: dts: qcom: x1e80100: Add PCIe IOMMU
  2025-05-01 17:03 [PATCH 0/5] arm64: dts: qcom: Add EL2 overlays for WoA devices Nikita Travkin
                   ` (2 preceding siblings ...)
  2025-05-01 17:03 ` [PATCH 3/5] arm64: dts: qcom: sc8280xp: Add EL2 overlay for WoA devices Nikita Travkin
@ 2025-05-01 17:03 ` Nikita Travkin
  2025-05-01 17:03 ` [PATCH 5/5] arm64: dts: qcom: x1e/x1p: Add EL2 overlay for WoA devices Nikita Travkin
  4 siblings, 0 replies; 8+ messages in thread
From: Nikita Travkin @ 2025-05-01 17:03 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, cros-qcom-dts-watchers
  Cc: Marc Zyngier, Jens Glathe, linux-arm-msm, devicetree,
	linux-kernel, Nikita Travkin

x1e80100 has an SMMUv3 connected to PCIe which is normally controlled by
Gunyah and is thus transparent to the OS. However if we boot Linux in
EL2, without Gunyah, we need to manage this IOMMU ourselves. To make
that easier, and since the hardware actually exists, just not "usually"
managed by Linux, describe it in the dts as "reserved".

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
 arch/arm64/boot/dts/qcom/x1e80100.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/x1e80100.dtsi b/arch/arm64/boot/dts/qcom/x1e80100.dtsi
index 46b79fce92c90d969e3de48bc88e27915d1592bb..7a3e75294be545a719f3543a8b874900f7c78f99 100644
--- a/arch/arm64/boot/dts/qcom/x1e80100.dtsi
+++ b/arch/arm64/boot/dts/qcom/x1e80100.dtsi
@@ -7940,6 +7940,20 @@ apps_smmu: iommu@15000000 {
 			dma-coherent;
 		};
 
+		pcie_smmu: iommu@15400000 {
+			compatible = "arm,smmu-v3";
+			reg = <0 0x15400000 0 0x80000>;
+			#iommu-cells = <1>;
+			interrupts = <GIC_SPI 138 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 134 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 136 IRQ_TYPE_EDGE_RISING>;
+			interrupt-names = "eventq",
+					  "gerror",
+					  "cmdq-sync";
+			dma-coherent;
+			status = "reserved"; /* Controlled by Gunyah. */
+		};
+
 		intc: interrupt-controller@17000000 {
 			compatible = "arm,gic-v3";
 			reg = <0 0x17000000 0 0x10000>,     /* GICD */

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/5] arm64: dts: qcom: x1e/x1p: Add EL2 overlay for WoA devices
  2025-05-01 17:03 [PATCH 0/5] arm64: dts: qcom: Add EL2 overlays for WoA devices Nikita Travkin
                   ` (3 preceding siblings ...)
  2025-05-01 17:03 ` [PATCH 4/5] arm64: dts: qcom: x1e80100: Add PCIe IOMMU Nikita Travkin
@ 2025-05-01 17:03 ` Nikita Travkin
  2025-05-02 10:38   ` Marc Zyngier
  4 siblings, 1 reply; 8+ messages in thread
From: Nikita Travkin @ 2025-05-01 17:03 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, cros-qcom-dts-watchers
  Cc: Marc Zyngier, Jens Glathe, linux-arm-msm, devicetree,
	linux-kernel, Nikita Travkin

WoA devices using x1e/x1p use android firmware to boot, which notably
includes Gunyah hypervisor. This means that, so far, Linux-based OS
could only boot in EL1 on those devices.

However Windows can replace Gunyah upon boot with it's own hypervisor,
and with the use of tools such as "slbounce", it's possible to do the
same for Linux-based OS, in which case some modifications to the DT are
necessary to facilitate the absence of Gunyah services.

Add a EL2-specific DT overlay and apply it to x1e/x1p WoA devices to
create -el2.dtb for each of them alongside "normal" dtb.

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
 arch/arm64/boot/dts/qcom/Makefile      | 36 +++++++++++++++++---------
 arch/arm64/boot/dts/qcom/x1-el2.dtso   | 46 ++++++++++++++++++++++++++++++++++
 arch/arm64/boot/dts/qcom/x1e80100.dtsi |  2 +-
 3 files changed, 71 insertions(+), 13 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile
index 12d9ed1129b4e83146e561910aca9fc3718b0820..4300b29397c6a0087e5c5909d756d733f308d373 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -299,15 +299,27 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sm8650-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8650-qrd.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8750-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8750-qrd.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e001de-devkit.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e78100-lenovo-thinkpad-t14s.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e78100-lenovo-thinkpad-t14s-oled.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-asus-vivobook-s15.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-crd.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-dell-xps13-9345.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-hp-omnibook-x14.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-lenovo-yoga-slim7x.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-microsoft-romulus13.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-microsoft-romulus15.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-qcp.dtb
-dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-crd.dtb
+x1e001de-devkit-el2-dtbs	:= x1e001de-devkit.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e001de-devkit.dtb x1e001de-devkit-el2.dtb
+x1e78100-lenovo-thinkpad-t14s-el2-dtbs	:= x1e78100-lenovo-thinkpad-t14s.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e78100-lenovo-thinkpad-t14s.dtb x1e78100-lenovo-thinkpad-t14s-el2.dtb
+x1e78100-lenovo-thinkpad-t14s-oled-el2-dtbs	:= x1e78100-lenovo-thinkpad-t14s-oled.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e78100-lenovo-thinkpad-t14s-oled.dtb x1e78100-lenovo-thinkpad-t14s-oled-el2.dtb
+x1e80100-asus-vivobook-s15-el2-dtbs	:= x1e80100-asus-vivobook-s15.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-asus-vivobook-s15.dtb x1e80100-asus-vivobook-s15-el2.dtb
+x1e80100-crd-el2-dtbs	:= x1e80100-crd.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-crd.dtb x1e80100-crd-el2.dtb
+x1e80100-dell-xps13-9345-el2-dtbs	:= x1e80100-dell-xps13-9345.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-dell-xps13-9345.dtb x1e80100-dell-xps13-9345-el2.dtb
+x1e80100-hp-omnibook-x14-el2-dtbs	:= x1e80100-hp-omnibook-x14.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-hp-omnibook-x14.dtb x1e80100-hp-omnibook-x14-el2.dtb
+x1e80100-lenovo-yoga-slim7x-el2-dtbs	:= x1e80100-lenovo-yoga-slim7x.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-lenovo-yoga-slim7x.dtb x1e80100-lenovo-yoga-slim7x-el2.dtb
+x1e80100-microsoft-romulus13-el2-dtbs	:= x1e80100-microsoft-romulus13.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-microsoft-romulus13.dtb x1e80100-microsoft-romulus13-el2.dtb
+x1e80100-microsoft-romulus15-el2-dtbs	:= x1e80100-microsoft-romulus15.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-microsoft-romulus15.dtb x1e80100-microsoft-romulus15-el2.dtb
+x1e80100-qcp-el2-dtbs	:= x1e80100-qcp.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-qcp.dtb x1e80100-qcp-el2.dtb
+x1p42100-crd-el2-dtbs	:= x1p42100-crd.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-crd.dtb x1p42100-crd-el2.dtb
diff --git a/arch/arm64/boot/dts/qcom/x1-el2.dtso b/arch/arm64/boot/dts/qcom/x1-el2.dtso
new file mode 100644
index 0000000000000000000000000000000000000000..7a818045ef098b44632df45253d32e31c5c7aeed
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/x1-el2.dtso
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+/*
+ * x1 specific modifications required to boot in EL2.
+ */
+
+/dts-v1/;
+/plugin/;
+
+/* We can't and don't need to use zap shader in EL2 as linux can zap the gpu on it's own. */
+&gpu_zap_shader {
+	status = "disabled";
+};
+
+/*
+ * When running under Gunyah, this IOMMU is controlled by the firmware,
+ * however when we take ownership of it in EL2, we need to configure
+ * it properly to use PCIe.
+ */
+&pcie3 {
+	iommu-map = <0 &pcie_smmu 0x30000 0x10000>;
+};
+
+&pcie4 {
+	iommu-map = <0 &pcie_smmu 0x40000 0x10000>;
+};
+
+&pcie5 {
+	iommu-map = <0 &pcie_smmu 0x50000 0x10000>;
+};
+
+&pcie6a {
+	iommu-map = <0 &pcie_smmu 0x60000 0x10000>;
+};
+
+&pcie_smmu {
+	status = "okay";
+};
+
+/*
+ * The "SBSA watchdog" is implemented in software in Gunyah
+ * and can't be used when running in EL2.
+ */
+&sbsa_watchdog {
+	status = "disabled";
+};
diff --git a/arch/arm64/boot/dts/qcom/x1e80100.dtsi b/arch/arm64/boot/dts/qcom/x1e80100.dtsi
index 7a3e75294be545a719f3543a8b874900f7c78f99..c04a2615ca77629b27fbd6fd98f1a25a3b6697db 100644
--- a/arch/arm64/boot/dts/qcom/x1e80100.dtsi
+++ b/arch/arm64/boot/dts/qcom/x1e80100.dtsi
@@ -8163,7 +8163,7 @@ frame@1780d000 {
 			};
 		};
 
-		watchdog@1c840000 {
+		sbsa_watchdog: watchdog@1c840000 {
 			compatible = "arm,sbsa-gwdt";
 			reg = <0 0x1c840000 0 0x1000>,
 			      <0 0x1c850000 0 0x1000>;

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 5/5] arm64: dts: qcom: x1e/x1p: Add EL2 overlay for WoA devices
  2025-05-01 17:03 ` [PATCH 5/5] arm64: dts: qcom: x1e/x1p: Add EL2 overlay for WoA devices Nikita Travkin
@ 2025-05-02 10:38   ` Marc Zyngier
  2025-05-02 12:55     ` Nikita Travkin
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Zyngier @ 2025-05-02 10:38 UTC (permalink / raw)
  To: Nikita Travkin
  Cc: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, cros-qcom-dts-watchers, Jens Glathe, linux-arm-msm,
	devicetree, linux-kernel

On Thu, 01 May 2025 18:03:45 +0100,
Nikita Travkin <nikita@trvn.ru> wrote:
> 
> WoA devices using x1e/x1p use android firmware to boot, which notably
> includes Gunyah hypervisor. This means that, so far, Linux-based OS
> could only boot in EL1 on those devices.
> 
> However Windows can replace Gunyah upon boot with it's own hypervisor,
> and with the use of tools such as "slbounce", it's possible to do the
> same for Linux-based OS, in which case some modifications to the DT are
> necessary to facilitate the absence of Gunyah services.
> 
> Add a EL2-specific DT overlay and apply it to x1e/x1p WoA devices to
> create -el2.dtb for each of them alongside "normal" dtb.
> 
> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
> ---
>  arch/arm64/boot/dts/qcom/Makefile      | 36 +++++++++++++++++---------
>  arch/arm64/boot/dts/qcom/x1-el2.dtso   | 46 ++++++++++++++++++++++++++++++++++
>  arch/arm64/boot/dts/qcom/x1e80100.dtsi |  2 +-
>  3 files changed, 71 insertions(+), 13 deletions(-)
>

[...]

> diff --git a/arch/arm64/boot/dts/qcom/x1-el2.dtso b/arch/arm64/boot/dts/qcom/x1-el2.dtso
> new file mode 100644
> index 0000000000000000000000000000000000000000..7a818045ef098b44632df45253d32e31c5c7aeed
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/x1-el2.dtso
> @@ -0,0 +1,46 @@
> +// SPDX-License-Identifier: BSD-3-Clause
> +
> +/*
> + * x1 specific modifications required to boot in EL2.
> + */
> +
> +/dts-v1/;
> +/plugin/;
> +
> +/* We can't and don't need to use zap shader in EL2 as linux can zap the gpu on it's own. */
> +&gpu_zap_shader {
> +	status = "disabled";
> +};
> +
> +/*
> + * When running under Gunyah, this IOMMU is controlled by the firmware,
> + * however when we take ownership of it in EL2, we need to configure
> + * it properly to use PCIe.
> + */
> +&pcie3 {
> +	iommu-map = <0 &pcie_smmu 0x30000 0x10000>;
> +};
> +
> +&pcie4 {
> +	iommu-map = <0 &pcie_smmu 0x40000 0x10000>;
> +};
> +
> +&pcie5 {
> +	iommu-map = <0 &pcie_smmu 0x50000 0x10000>;
> +};
> +
> +&pcie6a {
> +	iommu-map = <0 &pcie_smmu 0x60000 0x10000>;
> +};
> +
> +&pcie_smmu {
> +	status = "okay";
> +};
> +
> +/*
> + * The "SBSA watchdog" is implemented in software in Gunyah
> + * and can't be used when running in EL2.
> + */
> +&sbsa_watchdog {
> +	status = "disabled";
> +};

I also carry this [1] patch to correctly route MSIs from pcie5 to the
ITS. There is no reason not to. The same treatment could be applied to
pcie3, but I never tried it.

Thanks,

	M.

[1] https://lore.kernel.org/linux-arm-kernel/20241024161814.1827514-1-maz@kernel.org/

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 5/5] arm64: dts: qcom: x1e/x1p: Add EL2 overlay for WoA devices
  2025-05-02 10:38   ` Marc Zyngier
@ 2025-05-02 12:55     ` Nikita Travkin
  0 siblings, 0 replies; 8+ messages in thread
From: Nikita Travkin @ 2025-05-02 12:55 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, cros-qcom-dts-watchers, Jens Glathe, linux-arm-msm,
	devicetree, linux-kernel

Marc Zyngier писал(а) 02.05.2025 15:38:
> On Thu, 01 May 2025 18:03:45 +0100,
> Nikita Travkin <nikita@trvn.ru> wrote:
>> 
>> WoA devices using x1e/x1p use android firmware to boot, which notably
>> includes Gunyah hypervisor. This means that, so far, Linux-based OS
>> could only boot in EL1 on those devices.
>> 
>> However Windows can replace Gunyah upon boot with it's own hypervisor,
>> and with the use of tools such as "slbounce", it's possible to do the
>> same for Linux-based OS, in which case some modifications to the DT are
>> necessary to facilitate the absence of Gunyah services.
>> 
>> Add a EL2-specific DT overlay and apply it to x1e/x1p WoA devices to
>> create -el2.dtb for each of them alongside "normal" dtb.
>> 
>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>> ---
>>  arch/arm64/boot/dts/qcom/Makefile      | 36 +++++++++++++++++---------
>>  arch/arm64/boot/dts/qcom/x1-el2.dtso   | 46 ++++++++++++++++++++++++++++++++++
>>  arch/arm64/boot/dts/qcom/x1e80100.dtsi |  2 +-
>>  3 files changed, 71 insertions(+), 13 deletions(-)
>>
> 
> [...]
> 
>> diff --git a/arch/arm64/boot/dts/qcom/x1-el2.dtso b/arch/arm64/boot/dts/qcom/x1-el2.dtso
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..7a818045ef098b44632df45253d32e31c5c7aeed
>> --- /dev/null
>> +++ b/arch/arm64/boot/dts/qcom/x1-el2.dtso
>> @@ -0,0 +1,46 @@
>> +// SPDX-License-Identifier: BSD-3-Clause
>> +
>> +/*
>> + * x1 specific modifications required to boot in EL2.
>> + */
>> +
>> +/dts-v1/;
>> +/plugin/;
>> +
>> +/* We can't and don't need to use zap shader in EL2 as linux can zap the gpu on it's own. */
>> +&gpu_zap_shader {
>> +	status = "disabled";
>> +};
>> +
>> +/*
>> + * When running under Gunyah, this IOMMU is controlled by the firmware,
>> + * however when we take ownership of it in EL2, we need to configure
>> + * it properly to use PCIe.
>> + */
>> +&pcie3 {
>> +	iommu-map = <0 &pcie_smmu 0x30000 0x10000>;
>> +};
>> +
>> +&pcie4 {
>> +	iommu-map = <0 &pcie_smmu 0x40000 0x10000>;
>> +};
>> +
>> +&pcie5 {
>> +	iommu-map = <0 &pcie_smmu 0x50000 0x10000>;
>> +};
>> +
>> +&pcie6a {
>> +	iommu-map = <0 &pcie_smmu 0x60000 0x10000>;
>> +};
>> +
>> +&pcie_smmu {
>> +	status = "okay";
>> +};
>> +
>> +/*
>> + * The "SBSA watchdog" is implemented in software in Gunyah
>> + * and can't be used when running in EL2.
>> + */
>> +&sbsa_watchdog {
>> +	status = "disabled";
>> +};
> 
> I also carry this [1] patch to correctly route MSIs from pcie5 to the
> ITS. There is no reason not to. The same treatment could be applied to
> pcie3, but I never tried it.
> 

Oh, interesting... I will add 

    &pcie3 { msi-map = <0 &gic_its 0xb0000 0x10000>; };
    &pcie5 { msi-map = <0 &gic_its 0xd0000 0x10000>; };

to the overlay then. (At least I hope the base value falls in line with
the rule so far, while I know how to confirm iommu-map via acpi tables,
not sure where this one is described, if at all)

Will send a v2 shortly, thanks!

Nikita

> Thanks,
> 
> 	M.
> 
> [1] https://lore.kernel.org/linux-arm-kernel/20241024161814.1827514-1-maz@kernel.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-05-02 12:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-01 17:03 [PATCH 0/5] arm64: dts: qcom: Add EL2 overlays for WoA devices Nikita Travkin
2025-05-01 17:03 ` [PATCH 1/5] arm64: dts: qcom: sc7180: Add EL2 overlay " Nikita Travkin
2025-05-01 17:03 ` [PATCH 2/5] arm64: dts: qcom: sc8280xp: Add PCIe IOMMU Nikita Travkin
2025-05-01 17:03 ` [PATCH 3/5] arm64: dts: qcom: sc8280xp: Add EL2 overlay for WoA devices Nikita Travkin
2025-05-01 17:03 ` [PATCH 4/5] arm64: dts: qcom: x1e80100: Add PCIe IOMMU Nikita Travkin
2025-05-01 17:03 ` [PATCH 5/5] arm64: dts: qcom: x1e/x1p: Add EL2 overlay for WoA devices Nikita Travkin
2025-05-02 10:38   ` Marc Zyngier
2025-05-02 12:55     ` Nikita Travkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox