From: Vlad Banea <montrealtango@gmail.com>
To: Yixun Lan <dlan@kernel.org>
Cc: troy.mitchell@linux.spacemit.com, wangruikang@iscas.ac.cn,
guodong.xu@oss.qualcomm.com, jyc0019@gmail.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, pjw@kernel.org,
palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
devicetree@vger.kernel.org, linux-riscv@lists.infradead.org,
spacemit@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH v2] riscv: dts: spacemit: k1: give each PCIe port its own DMA window
Date: Thu, 12 Nov 2026 21:31:58 -0500 [thread overview]
Message-ID: <20261113023158.2872492-1-montrealtango@gmail.com> (raw)
On K1 a PCIe master only sees DDR: bus addresses 0-2 GB map to CPU
0-2 GB and bus 2-16 GB to CPU 4-18 GB. A root port does not forward
upstream an inbound access that falls inside its own memory window, so
dma-ranges must skip each port's own outbound window; the other ports'
windows reach memory.
The shared pcie-bus skips all three windows, bus 0x8000_0000-0xb7ff_ffff,
which leaves CPU addresses 0x1_0000_0000-0x1_37ff_ffff unreachable from
every port. Give each port its own bus that skips only its own window.
On boards with more than 2 GB of RAM, each port can then reach another
512-640 MB without SWIOTLB bouncing.
Signed-off-by: Vlad Banea <montrealtango@gmail.com>
---
Notes:
Changes in v2:
- describe the K1 PCIe address map instead of citing the vendor DT (Troy)
- "more than 2 GB" instead of 4 GB (Troy)
- drop the RFC tag
- RFC: https://lore.kernel.org/all/20261112015148.3911178-1-montrealtango@gmail.com/
Tested on an OrangePi R2S (8 GB, RTL8125B on pcie1 and pcie2): SWIOTLB
use under load went from up to 87 slots to none.
arch/riscv/boot/dts/spacemit/k1.dtsi | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index 3fabfd34114b..949843bb7789 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -1152,13 +1152,14 @@ eth1: ethernet@cac81000 {
};
};
- pcie-bus {
+ pcie0-bus {
compatible = "simple-bus";
ranges;
#address-cells = <2>;
#size-cells = <2>;
+ /* skips pcie0's own window, bus 0x8000_0000-0x8fff_ffff */
dma-ranges = <0x0 0x00000000 0x0 0x00000000 0x0 0x80000000>,
- <0x0 0xb8000000 0x1 0x38000000 0x3 0x48000000>;
+ <0x0 0x90000000 0x1 0x10000000 0x3 0x70000000>;
pcie0: pcie@ca000000 {
device_type = "pci";
@@ -1203,6 +1204,17 @@ pcie0_port: pcie@0 {
ranges;
};
};
+ };
+
+ pcie1-bus {
+ compatible = "simple-bus";
+ ranges;
+ #address-cells = <2>;
+ #size-cells = <2>;
+ /* skips pcie1's own window, bus 0x9000_0000-0x9fff_ffff */
+ dma-ranges = <0x0 0x00000000 0x0 0x00000000 0x0 0x80000000>,
+ <0x0 0x80000000 0x1 0x00000000 0x0 0x10000000>,
+ <0x0 0xa0000000 0x1 0x20000000 0x3 0x60000000>;
pcie1: pcie@ca400000 {
device_type = "pci";
@@ -1247,6 +1259,17 @@ pcie1_port: pcie@0 {
ranges;
};
};
+ };
+
+ pcie2-bus {
+ compatible = "simple-bus";
+ ranges;
+ #address-cells = <2>;
+ #size-cells = <2>;
+ /* skips pcie2's own window, bus 0xa000_0000-0xb7ff_ffff */
+ dma-ranges = <0x0 0x00000000 0x0 0x00000000 0x0 0x80000000>,
+ <0x0 0x80000000 0x1 0x00000000 0x0 0x20000000>,
+ <0x0 0xb8000000 0x1 0x38000000 0x3 0x48000000>;
pcie2: pcie@ca800000 {
device_type = "pci";
base-commit: d05c6236496071916e19012cda7149465f15e66e
--
2.53.0
reply other threads:[~2026-11-13 2:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261113023158.2872492-1-montrealtango@gmail.com \
--to=montrealtango@gmail.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlan@kernel.org \
--cc=guodong.xu@oss.qualcomm.com \
--cc=jyc0019@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=spacemit@lists.linux.dev \
--cc=troy.mitchell@linux.spacemit.com \
--cc=wangruikang@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®