From: Aurelien Jarno <aurelien@aurel32.net>
To: "Frédéric Mahé" <frederic.mahe@cirad.fr>
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Rob Herring" <robh@kernel.org>, "Yixun Lan" <dlan@kernel.org>,
"Troy Mitchell" <troy.mitchell@linux.spacemit.com>,
"Alex Elder" <elder@riscstar.com>,
"Encrow Thorne" <encrow.thorne@linux.spacemit.com>,
linux-pci@vger.kernel.org, spacemit@lists.linux.dev,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: spacemit-k1: Request the Gen2 speed change once the link is up
Date: Tue, 17 Nov 2026 22:42:08 +0100 [thread overview]
Message-ID: <avzKMAtDqeqHIivr@aurel32.net> (raw)
In-Reply-To: <20261117085508.83388-1-frederic.mahe@cirad.fr>
Hi Frédéric,
On 2026-11-17 09:55, Frédéric Mahé wrote:
> On a Banana Pi BPI-F3, an NVMe SSD in the M.2 slot (pcie1) always comes
> up at 2.5 GT/s, although the root port and the drive both support
> 5 GT/s. The Directed Speed Change that dw_pcie_setup_rc() requests
> before the LTSSM is enabled has no effect on K1. Setting Retrain Link
> in the root port's Link Control from userspace brings the link to
> 5 GT/s, so the link itself is fine.
>
> Once the link is up, request the speed change again, wait for the
> controller to clear SPEED_CHANGE (as pci-imx6 does), then briefly for
> Link Status to report the new speed. A port with nothing behind it is
> skipped after 100 ms.
>
> With an SK hynix BC511, the link now trains at 5 GT/s x2 and fio
> sequential read goes from 397 to 575-640 MB/s. Data verified with fio
> crc32c. The empty pcie2 port behaves as before.
>
> This change was developed with the help of Claude (Anthropic); I
> reviewed and tested it on hardware.
>
> Signed-off-by: Frédéric Mahé <frederic.mahe@cirad.fr>
> ---
> The K1 PCIe cover letter says all ports run at 5 GT/s, so maybe this
> depends on the drive or the firmware; on this board the link always came
> up at 2.5 GT/s before this patch. Tested on top of v7.4-rc1 with "PCI:
> spacemit: Ignore PERST# input in RC mode on K1" (applies cleanly without
> it too).
>
> drivers/pci/controller/dwc/pcie-spacemit-k1.c | 48 +++++++++++++++++++
> 1 file changed, 48 insertions(+)
Thanks, I confirming this works well and greatly improves the NVMe
performance. I have just tested it for a few hours, and I'll mail back
if I encountered any stability issue on the long term. In the meantime:
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://aurel32.net
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Aurelien Jarno <aurelien@aurel32.net>
To: "Frédéric Mahé" <frederic.mahe@cirad.fr>
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Rob Herring" <robh@kernel.org>, "Yixun Lan" <dlan@kernel.org>,
"Troy Mitchell" <troy.mitchell@linux.spacemit.com>,
"Alex Elder" <elder@riscstar.com>,
"Encrow Thorne" <encrow.thorne@linux.spacemit.com>,
linux-pci@vger.kernel.org, spacemit@lists.linux.dev,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: spacemit-k1: Request the Gen2 speed change once the link is up
Date: Tue, 17 Nov 2026 22:42:08 +0100 [thread overview]
Message-ID: <avzKMAtDqeqHIivr@aurel32.net> (raw)
In-Reply-To: <20261117085508.83388-1-frederic.mahe@cirad.fr>
Hi Frédéric,
On 2026-11-17 09:55, Frédéric Mahé wrote:
> On a Banana Pi BPI-F3, an NVMe SSD in the M.2 slot (pcie1) always comes
> up at 2.5 GT/s, although the root port and the drive both support
> 5 GT/s. The Directed Speed Change that dw_pcie_setup_rc() requests
> before the LTSSM is enabled has no effect on K1. Setting Retrain Link
> in the root port's Link Control from userspace brings the link to
> 5 GT/s, so the link itself is fine.
>
> Once the link is up, request the speed change again, wait for the
> controller to clear SPEED_CHANGE (as pci-imx6 does), then briefly for
> Link Status to report the new speed. A port with nothing behind it is
> skipped after 100 ms.
>
> With an SK hynix BC511, the link now trains at 5 GT/s x2 and fio
> sequential read goes from 397 to 575-640 MB/s. Data verified with fio
> crc32c. The empty pcie2 port behaves as before.
>
> This change was developed with the help of Claude (Anthropic); I
> reviewed and tested it on hardware.
>
> Signed-off-by: Frédéric Mahé <frederic.mahe@cirad.fr>
> ---
> The K1 PCIe cover letter says all ports run at 5 GT/s, so maybe this
> depends on the drive or the firmware; on this board the link always came
> up at 2.5 GT/s before this patch. Tested on top of v7.4-rc1 with "PCI:
> spacemit: Ignore PERST# input in RC mode on K1" (applies cleanly without
> it too).
>
> drivers/pci/controller/dwc/pcie-spacemit-k1.c | 48 +++++++++++++++++++
> 1 file changed, 48 insertions(+)
Thanks, I confirming this works well and greatly improves the NVMe
performance. I have just tested it for a few hours, and I'll mail back
if I encountered any stability issue on the long term. In the meantime:
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://aurel32.net
next prev parent reply other threads:[~2026-11-17 21:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 8:55 [PATCH] PCI: spacemit-k1: Request the Gen2 speed change once the link is up Frédéric Mahé
2026-11-17 8:55 ` Frédéric Mahé
2026-11-17 9:03 ` sashiko-bot
2026-11-17 21:42 ` Aurelien Jarno [this message]
2026-11-17 21:42 ` Aurelien Jarno
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=avzKMAtDqeqHIivr@aurel32.net \
--to=aurelien@aurel32.net \
--cc=bhelgaas@google.com \
--cc=dlan@kernel.org \
--cc=elder@riscstar.com \
--cc=encrow.thorne@linux.spacemit.com \
--cc=frederic.mahe@cirad.fr \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=spacemit@lists.linux.dev \
--cc=troy.mitchell@linux.spacemit.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.