From: Rob Herring <robh@kernel.org>
To: Daire.McNamara@microchip.com
Cc: Cyril.Jean@microchip.com, linux-riscv@lists.infradead.org,
kw@linux.com, Conor.Dooley@microchip.com,
david.abdurachmanov@gmail.com, devicetree@vger.kernel.org,
lpieralisi@kernel.org, aou@eecs.berkeley.edu, palmer@dabbelt.com,
paul.walmsley@sifive.com, linux-pci@vger.kernel.org,
Padmarao.Begari@microchip.com, krzysztof.kozlowski+dt@linaro.org,
bhelgaas@google.com, heinrich.schuchardt@canonical.com
Subject: Re: [PATCH v1 1/4] dt-bindings: PCI: microchip: add fabric address translation properties
Date: Thu, 8 Sep 2022 15:57:48 -0500 [thread overview]
Message-ID: <20220908205748.GA3240357-robh@kernel.org> (raw)
In-Reply-To: <173950d1b76e13c1476f196afc0e804e93d6e602.camel@microchip.com>
On Mon, Sep 05, 2022 at 02:54:07PM +0000, Daire.McNamara@microchip.com wrote:
> On Fri, 2022-09-02 at 11:28 -0500, Rob Herring wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > On Fri, Sep 2, 2022 at 9:22 AM <daire.mcnamara@microchip.com> wrote:
> > > From: Conor Dooley <conor.dooley@microchip.com>
> > >
> > > On PolarFire SoC both in- & out-bound address translations occur in two
> > > stages. The specific translations are tightly coupled to the FPGA
> > > designs and supplement the {dma-,}ranges properties. The first stage of
> > > the translation is done by the FPGA fabric & the second by the root
> > > port.
> > > Add two properties so that the translation tables in the root port's
> > > bridge layer can be configured to account for the translation done by
> > > the FPGA fabric.
> >
> > I'm skeptical that ranges/dma-ranges can't handle what you need.
> > Anything in this area is going to need justification 'ranges doesn't
> > work because x, y, z...'.
> >
> > > Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> > > Signed-off-by: Daire McNamara <daire.mcnamara@microchip.com>
> > > ---
> > > .../bindings/pci/microchip,pcie-host.yaml | 107 ++++++++++++++++++
> > > 1 file changed, 107 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/pci/microchip,pcie-host.yaml b/Documentation/devicetree/bindings/pci/microchip,pcie-host.yaml
> > > index 23d95c65acff..29bb1fe99a2e 100644
> > > --- a/Documentation/devicetree/bindings/pci/microchip,pcie-host.yaml
> > > +++ b/Documentation/devicetree/bindings/pci/microchip,pcie-host.yaml
> > > @@ -71,6 +71,113 @@ properties:
> > > minItems: 1
> > > maxItems: 6
> > >
> > > + microchip,outbound-fabric-translation-ranges:
> > > + $ref: /schemas/types.yaml#/definitions/uint32-matrix
> > > + minItems: 1
> > > + maxItems: 32
> > > + description: |
> > > + The CPU-to-PCIe (outbound) address translation takes place in two stages.
> > > + Depending on the FPGA bitstream, the outbound address translation tables
> > > + in the PCIe root port's bridge layer will need to be configured to account
> > > + for only its part of the overall outbound address translation.
> > > +
> > > + The first stage of outbound address translation occurs between the CPU address
> > > + and an intermediate "FPGA address". The second stage of outbound address
> > > + translation occurs between this FPGA address and the PCIe address. Use this
> > > + property, in conjunction with the ranges property, to divide the overall
> > > + address translation into these two stages so that the PCIe address
> > > + translation tables can be correctly configured.
> >
> > Sounds like you need 2 levels of ranges/dma-ranges.
> >
> > / {
> > fpga-bus {
> > ranges = ...
> > dma-ranges = ...
> > pcie@... {
> > ranges = ...
> > dma-ranges = ...
> > };
> > };
> > };
> Thanks a million for looking at this! Very much appreciated.
>
> So, this is what I tried. I've cut down the dts I used to what I think is the minimum
> fragment to discuss the issue I'm facing.
>
> So, I replaced this stanza:
>
> pcie: pcie@3000000000 {
> ...
> reg = <0x30 0x0 0x0 0x8000000>, <0x0 0x43000000 0x0 0x10000>;
> reg-names = "cfg", "apb";
> ranges = <0x0000000 0x0 0x0000000 0x30 0x0000000 0x0 0x8000000>,
> <0x3000000 0x0 0x8000000 0x30 0x8000000 0x0 0x80000000>;
> ...
> };
>
> with this two-level stanza:
>
> fpga_bus: fpga-bus {
> #address-cells = <2>;
> #size-cells = <2>;
> ranges = <0 0 0x30 0 0x40 0>;
> compatible = "simple-bus";
> ...
>
> pcie: pcie@0 {
> reg = <0x0 0x0 0x0 0x8000000>, <0x0 0x43000000 0x0 0x10000>;
> reg-names = "cfg", "apb";
> ranges = <0x0000000 0x0 0x0000000 0 0x0000000 0x0 0x8000000>,
> <0x3000000 0x0 0x8000000 0 0x8000000 0x0 0x80000000>;
> ...
> };
> };
>
> and I ran into two problems:
> 1) the ranges presented to the driver via resource_list_for_each_entry(entry, &bridge->windows)
> were unchanged. The start and end of both resources were still in 0x30'0000'0000 space,
> not 0x0000'0000 as I'd hoped. The two levels of range had been amalgamated before
> presentation to the rootport driver, so my initial problem was unchanged ...
Yes, that's expected as the translation will walk up parents to root
node. You will have to get the untranslated values out of
ranges yourself. If you use the range parsing functions on the parent
node ranges, you'll get the 0 from of_range.bus_addr.
>
> 2) a new issue cropped up. While the 'cfg' register property is in 0x30'0000'0000 space,
> the 'abp' interface is actually delivered over a separate FIC and is in a 0x4000'0000
> memory space. In the two-level stanza, it was now being provided to the rootport
> driver at a base of 0x30'4000'0000 which is incorrect. This is very typical for
> designers to route abp over a different FIC to axi.
If the fpga-bus ranges has a 1:1 entry for 0x43000000 child bus then it
should get translated correctly. Worst case, you may need to define a
child bus address outside of 0x30_00000000 range that translates back to
0x43000000.
Rob
next prev parent reply other threads:[~2022-09-08 20:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 14:21 [PATCH v1 0/4] PCI: microchip: apportion address translation between rootport and FPGA daire.mcnamara
2022-09-02 14:21 ` [PATCH v1 1/4] dt-bindings: PCI: microchip: add fabric address translation properties daire.mcnamara
2022-09-02 16:28 ` Rob Herring
2022-09-02 16:51 ` Daire.McNamara
2022-09-05 14:54 ` Daire.McNamara
2022-09-08 20:57 ` Rob Herring [this message]
2022-09-02 14:22 ` [PATCH v1 2/4] riscv: dts: " daire.mcnamara
2022-09-02 14:29 ` Conor.Dooley
2022-09-02 14:22 ` [PATCH v1 3/4] PCI: " daire.mcnamara
2022-09-02 16:49 ` Bjorn Helgaas
2022-09-02 16:54 ` Daire.McNamara
2022-09-02 14:22 ` [PATCH v1 4/4] of: PCI: tidy up logging of ranges containing configuration space type daire.mcnamara
2022-09-08 20:59 ` Rob Herring
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=20220908205748.GA3240357-robh@kernel.org \
--to=robh@kernel.org \
--cc=Conor.Dooley@microchip.com \
--cc=Cyril.Jean@microchip.com \
--cc=Daire.McNamara@microchip.com \
--cc=Padmarao.Begari@microchip.com \
--cc=aou@eecs.berkeley.edu \
--cc=bhelgaas@google.com \
--cc=david.abdurachmanov@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=heinrich.schuchardt@canonical.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.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).