devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ondřej Jirman" <megi@xff.cz>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: Robin Murphy <robin.murphy@arm.com>,
	pgwipeout@gmail.com, heiko@sntech.de,
	linux-rockchip@lists.infradead.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, michael.riesch@wolfvision.net,
	frattaroli.nicolas@gmail.com, s.hauer@pengutronix.de,
	frank-w@public-files.de, ezequiel@vanguardiasur.com.ar,
	yifeng.zhao@rock-chips.com, jbx6244@gmail.com,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] arm64: dts: rockchip: rk356x: Fix PCIe register map and ranges
Date: Sun, 12 Mar 2023 21:46:58 +0100	[thread overview]
Message-ID: <20230312204658.qibiabohxwv2mn5i@core> (raw)
In-Reply-To: <87y1o1buef.fsf@bloch.sibelius.xs4all.nl>

Hi,

On Sun, Mar 12, 2023 at 09:13:12PM +0100, Mark Kettenis wrote:
> [...]
>
> It seems translation isn't actually broken.  At least I got it to work
> with a slight twist.  What seems to be happening is that reads (and
> writes?) to the first 64 MB of the PCIe memory address space
> (0x00000000-0x03ffffff) don't make it out to the PCIe device.  I
> suspect they are somehow claimed by the RC, maybe because the BAR for
> the root complex isn't properly disabled.
> 
> If I change the PCIe bus addess of the mmio window from 0x00000000 to
> 0x40000000 like so:
> 
>     ranges = <0x01000000 0x0 0x3ef00000 0x3 0x3ef00000 0x0 0x00100000
>               0x02000000 0x0 0x40000000 0x3 0x00000000 0x0 0x3ef00000>;
> 
> my NVMe drive seems to work just fine.  I picked 0x40000000 here
> because it is nicely aligned on a 1GB boundary, which matches the size
> of the region.  Diff against a recent linux-next at the end of this
> mail.
> 
> So what I think is happening is that Linux is allocating resources
> from the top of the region.  So only if you have a more complicated
> PCIe hierarchy it ends up allocating from the low 64 MB and runs into
> the issue.  OpenBSD on the other hand allocates from the bottom, which
> pretty much guarantees that I hit the issue.
> 
> Now this could be a driver bug.  As far as I can tell BAR0/1 is
> properly disabled, but maybe there is some additional bit that we need
> to set.  But I don't think there are any downsides of my workaround.
> We can still provide a ~1GB mmio range; it just starts at 0x40000000
> instead of 0x00000000.
> 
> Maybe somebody can test this on Linux?

There were other discussions and patches posted, and further testing happened
since this discussion (just by looking at the dates...).

The result was: 
https://lore.kernel.org/lkml/20221112114125.1637543-1-aholmes@omnom.net/
https://lore.kernel.org/lkml/20221112114125.1637543-2-aholmes@omnom.net/

The changes for pcie2x1 in that patch make PCIe work on Linux under many
different device combinations, incl. with various combinations of devices
behind PCIe switch, etc.

That patch includes your change, too.

(The patch is not correct for pcie3, see discussion.)

kind regards,
	o.

> > > b. We do in fact require IO and Config to be 32 bit addressable to be
> > > fully compatible.
> > > 
> > > These issues are compounded in rk3588 where we have much smaller
> > > regions in the 32bit space for PCIe, so a definite answer on the true
> > > requirements and limitations would be quite helpful.
> > > 
> > > As always, thank you for your time,
> > > Peter
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
> index eed0059a68b8..218e51f41852 100644
> --- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
> @@ -983,7 +983,7 @@ pcie2x1: pcie@fe260000 {
>  		phy-names = "pcie-phy";
>  		power-domains = <&power RK3568_PD_PIPE>;
>  		ranges = <0x01000000 0x0 0x3ef00000 0x3 0x3ef00000 0x0 0x00100000
> -			  0x02000000 0x0 0x00000000 0x3 0x00000000 0x0 0x3ef00000>;
> +			  0x02000000 0x0 0x40000000 0x3 0x00000000 0x0 0x3ef00000>;
>  		resets = <&cru SRST_PCIE20_POWERUP>;
>  		reset-names = "pipe";
>  		#address-cells = <3>;

      reply	other threads:[~2023-03-12 20:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05  8:54 [PATCH v2] arm64: dts: rockchip: rk356x: Fix PCIe register map and ranges Ondrej Jirman
2022-10-05 11:42 ` Peter Geis
2022-10-05 12:49   ` Ondřej Jirman
2022-10-05 22:08   ` Ondřej Jirman
2022-10-17 11:56     ` Heiko Stuebner
2022-10-21 13:07       ` Peter Geis
2022-10-21 15:39         ` Ondřej Jirman
2022-10-21 16:48           ` Peter Geis
2022-10-21 19:32             ` Ondřej Jirman
2022-10-21 20:52               ` Mark Kettenis
2022-10-22 12:19                 ` Peter Geis
2022-10-22 14:36                   ` Ondřej Jirman
2022-10-22 16:41                   ` Ondřej Jirman
2022-10-22 17:24                   ` Mark Kettenis
2022-10-24 11:05                     ` Robin Murphy
2022-10-24 20:16                       ` Peter Geis
2022-10-25 10:29                         ` Robin Murphy
2023-03-12 20:13                           ` Mark Kettenis
2023-03-12 20:46                             ` Ondřej Jirman [this message]

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=20230312204658.qibiabohxwv2mn5i@core \
    --to=megi@xff.cz \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=frank-w@public-files.de \
    --cc=frattaroli.nicolas@gmail.com \
    --cc=heiko@sntech.de \
    --cc=jbx6244@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=michael.riesch@wolfvision.net \
    --cc=pgwipeout@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=s.hauer@pengutronix.de \
    --cc=yifeng.zhao@rock-chips.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).