From: Andrew Murray <andrew.murray@arm.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Rob Herring <robh@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
Robin.Murphy@arm.com
Subject: Re: [PATCH 05/11] PCI: versatile: Use pci_parse_request_of_pci_ranges()
Date: Mon, 30 Sep 2019 20:36:57 +0100 [thread overview]
Message-ID: <20190930193655.GH42880@e119886-lin.cambridge.arm.com> (raw)
In-Reply-To: <CAFEAcA_Lu73n9z-fyWNLvnxXyk-JcUbONHE5x06Uh9Upk4MVbw@mail.gmail.com>
On Mon, Sep 30, 2019 at 05:56:51PM +0100, Peter Maydell wrote:
> On Thu, 26 Sep 2019 at 22:45, Rob Herring <robh@kernel.org> wrote:
> >
> > On Wed, Sep 25, 2019 at 5:37 AM Andrew Murray <andrew.murray@arm.com> wrote:
> > >
> > > On Tue, Sep 24, 2019 at 04:46:24PM -0500, Rob Herring wrote:
> > > > Convert ARM Versatile host bridge to use the common
> > > > pci_parse_request_of_pci_ranges().
> > > >
> > > > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > > > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > > > Signed-off-by: Rob Herring <robh@kernel.org>
> > > > ---
>
> > > > static int versatile_pci_probe(struct platform_device *pdev)
> > > > {
> > > > struct device *dev = &pdev->dev;
> > > > struct resource *res;
> > > > - int ret, i, myslot = -1;
> > > > + struct resource_entry *entry;
> > > > + int ret, i, myslot = -1, mem = 0;
> > >
> > > I think 'mem' should be initialised to 1, at least that's what the original
> > > code did. However I'm not sure why it should start from 1.
> >
> > The original code I moved from arch/arm had 32MB @ 0x0c000000 called
> > "PCI unused" which was requested with request_resource(), but never
> > provided to the PCI core. Otherwise, I kept the setup the same. No one
> > has complained in 4 years, though I'm not sure anyone would have
> > noticed if I just deleted PCI support...
>
> Yes, QEMU users will notice if you drop or break PCI support :-)
> I don't think anybody is using real hardware PCI though.
>
> Anyway, the 'mem' indexes here matter because you're passing
> them to PCI_IMAP() and PCI_SMAP(), which are writing to
> hardware registers. If you write to PCI_IMAP0 when we
> were previously writing to PCI_IMAP1 then suddenly you're
> not configuring the behaviour for accesses to the PCI
> window that's at CPU physaddr 0x50000000, you're configuring
> the window that's at CPU physaddr 0x44000000, which is
> entirely different (and notably is smaller, being only
> 0x0c000000 in size rather than 0x10000000).
>
> If this is supposed to be a no-behaviour-change refactor
> then it would probably be a good test to check that we're
> writing exactly the same values to the hardware registers
> on the device as we were before the change.
As far as I understand...
According to the device tree arch/arm/boot/dts/versatile-pb.dts we describe
a 1:1 mapping between CPU and PCI addresses for the IORESOURCE_MEM resources:
ranges = <0x01000000 0 0x00000000 0x43000000 0 0x00010000 /* downstream I/O */
0x02000000 0 0x50000000 0x50000000 0 0x10000000 /* non-prefetchable memory */
0x42000000 0 0x60000000 0x60000000 0 0x10000000>; /* prefetchable memory */
The existing code achieves this by shifting the CPU address and writing 0x5 to
PCI_IMAP(1) and 0x6 >> 28 to PCI_IMAP(2). This value represents the top 4 bits of
the outgoing PCI address, with the remainder of the bits as written to the AHB
window. The hardware has three windows at 0x44000000, 0x50000000 and 0x60000000
which relate to PCI_IMAP0, 1 and 2 respectively.
Therefore the existing code creates an effective 1:1 mapping as follows:
CPU 0x50000000 => PCI 0x50000000
CPU 0x60000000 => PCI 0x60000000
If we were to instead write 0x5 to PCI_IMAP(0) and 0x6 to PCI_IMAP(1), as per
this patch - then we end up with an effective broken mapping of:
CPU 0x50000000 => PCI 0x60000000
CPU 0x60000000 => PCI unset
Therefore I'd suggest we preserve the existing numbering and change mem back to
1.
More information about the hardware can be foud here:
http://arminfo.emea.arm.com/help/index.jsp?topic=/com.arm.doc.dui0224i/Bbajjbce.html
Thanks,
Andrew Murray
>
> thanks
> -- PMM
next prev parent reply other threads:[~2019-09-30 20:53 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-24 21:46 [PATCH 00/11] PCI dma-ranges parsing consolidation Rob Herring
2019-09-24 21:46 ` [PATCH 01/11] PCI: aardvark: Use pci_parse_request_of_pci_ranges() Rob Herring
2019-09-25 8:59 ` Thomas Petazzoni
2019-09-25 9:04 ` Andrew Murray
2019-09-24 21:46 ` [PATCH 02/11] PCI: altera: " Rob Herring
2019-09-25 10:24 ` Andrew Murray
2019-09-25 12:33 ` Rob Herring
2019-09-30 15:13 ` Andrew Murray
2019-09-30 17:36 ` Rob Herring
2019-10-15 11:02 ` Lorenzo Pieralisi
2019-10-15 11:17 ` Rob Herring
2019-09-24 21:46 ` [PATCH 03/11] PCI: mediatek: " Rob Herring
2019-09-25 11:34 ` Andrew Murray
2019-09-24 21:46 ` [PATCH 04/11] PCI: versatile: Enable COMPILE_TEST Rob Herring
2019-09-26 8:12 ` Andrew Murray
2019-09-24 21:46 ` [PATCH 05/11] PCI: versatile: Use pci_parse_request_of_pci_ranges() Rob Herring
2019-09-25 10:37 ` Andrew Murray
2019-09-26 21:44 ` Rob Herring
2019-09-30 15:16 ` Andrew Murray
2019-09-30 16:56 ` Peter Maydell
2019-09-30 19:36 ` Andrew Murray [this message]
2019-09-24 21:46 ` [PATCH 06/11] PCI: of: Add inbound resource parsing to helpers Rob Herring
2019-09-25 9:00 ` Thomas Petazzoni
2019-09-26 8:29 ` Andrew Murray
2019-09-26 10:43 ` Gustavo Pimentel
2019-09-27 16:12 ` Jingoo Han
2019-09-27 16:12 ` Jingoo Han
2019-09-24 21:46 ` [PATCH 07/11] PCI: ftpci100: Use inbound resources for setup Rob Herring
2019-09-26 8:39 ` Andrew Murray
2019-09-24 21:46 ` [PATCH 08/11] PCI: v3-semi: " Rob Herring
2019-09-26 8:39 ` Andrew Murray
2019-09-30 22:00 ` Linus Walleij
2019-09-24 21:46 ` [PATCH 09/11] PCI: xgene: " Rob Herring
2019-09-26 8:39 ` Andrew Murray
2019-09-24 21:46 ` [PATCH 10/11] PCI: iproc: " Rob Herring
2019-09-26 8:39 ` Andrew Murray
2019-09-24 21:46 ` [PATCH 11/11] PCI: rcar: " Rob Herring
2019-09-26 8:47 ` Andrew Murray
2019-09-26 12:53 ` Rob Herring
2019-09-26 13:32 ` Andrew Murray
2019-09-26 8:49 ` [PATCH 00/11] PCI dma-ranges parsing consolidation Andrew Murray
2019-09-26 11:20 ` Marc Gonzalez
2019-09-26 13:11 ` Rob Herring
2019-09-26 13:38 ` Andrew Murray
2019-09-26 14:09 ` Marc Gonzalez
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=20190930193655.GH42880@e119886-lin.cambridge.arm.com \
--to=andrew.murray@arm.com \
--cc=Robin.Murphy@arm.com \
--cc=bhelgaas@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=peter.maydell@linaro.org \
--cc=robh@kernel.org \
/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).