linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: David Woodhouse <dwmw@amazon.co.uk>
Cc: Jonathan Chocron <jonnyc@amazon.com>,
	linux-pci@vger.kernel.org, bhelgaas@google.com,
	linux-kernel@vger.kernel.org, vaerov@amazon.com,
	benh@kernel.crashing.org, alisaidi@amazon.com, zeev@amazon.com,
	ronenk@amazon.com, barakw@amazon.com,
	Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
	Zhou Wang <wangzhou1@hisilicon.com>
Subject: Re: [PATCH v2] PCI: al: Add Amazon Annapurna Labs PCIe host controller driver
Date: Wed, 27 Mar 2019 11:39:11 +0000	[thread overview]
Message-ID: <20190327113911.GB8331@e107981-ln.cambridge.arm.com> (raw)
In-Reply-To: <7bab98421e2144a934d369e49454f0424c2a3758.camel@amazon.co.uk>

On Wed, Mar 27, 2019 at 09:43:26AM +0000, David Woodhouse wrote:
> On Tue, 2019-03-26 at 12:17 +0000, Lorenzo Pieralisi wrote:
> > This code is basically identical to (apart from the string matching
> > the DBI resource)
> > 
> > drivers/pci/controller/pcie-hisi.c
> > 
> > because, as you said, that's a DW quirk that is really not
> > platform specific AFAICS.
> > 
> > Not that I am really fond of the idea but in practice we can
> > create a quirk that applies to all host controllers DW based,
> > in case they want to boot with ACPI, this patch is basically
> > code duplication.
> 
> Having chatted to Jonny in a little more detail... this isn't quite
> duplicate code. On the Annapurna implementation we have fixed the
> alignment constraints so we can just use pci_generic_config_read()
> directly instead of forcing alignment. We only need to filter out the
> "ghost" devices on bus zero.
> 
> There might eventually be scope for some form of consolidation, but it
> doesn't really seem clear at this point that it would be worth it.

The pci_ecam_ops.init function can be certainly reused but I agree
duplicating it is not a big deal either - I just noticed it and asked.

we can merge code as-is and think about writing a common init function
if/when needed.

> There are three separate quirks needed for different versions of the DW
> controller.
> 
> One is that the config space of the controller itself shows up multiple
> times in all slots of bus zero.
> 
> The second is that bus zero cannot be accessed through ECAM and must be
> accessed through a separate MMIO region.
> 
> The third is the requirement for 32-bit alignment of the host
> controller's config space (through the special MMIO region).

I missed this one - thanks for clarifying.

> Some vendors have managed to work around some of these issues, for
> example Annapurna fixing the alignment one. It looks like the three DT
> matches in pci-host-generic.c which use pci_dw_ecam_bus_ops are
> assuming the hardware suffers only issue #1 from the list above, and
> not the other two.
> 
> The Annapurna hardware gives us a new combination, and that's why it
> isn't quite a duplicate. Again, there may be scope for consolidation in
> the future but it's not clear what it should look like. Especially as
> when exposed through DT, both the hisi and al versions seem to do
> things quite differently and need their own specific code there anyway.

DT PCI host bridge bootstrap is a different story and on that
consolidation is all but impossible.

I just want to keep MCFG ECAM quirks as simple as possible, code as it
stands is horrible enough and I wish I could remove the mechanism in
the future rather than adding more to it, hopefully we are getting
there.

> There will be a DT variant of the AL driver coming in the near future,
> but when it's exposed via ACPI in the "as close to ECAM compliant as we
> could make it in this iteration of the hardware" mode, it's relatively
> simple so we did that patch first.

That's fine, no problems with that.

Thanks,
Lorenzo

  reply	other threads:[~2019-03-27 11:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25 11:07 [PATCH] PCI: al: add pcie-al.c jonnyc
2019-03-25 12:58 ` Bjorn Helgaas
2019-03-25 15:56   ` Jonathan Chocron
2019-03-25 17:36     ` Bjorn Helgaas
2019-03-26 10:00 ` [PATCH v2] PCI: al: Add Amazon Annapurna Labs PCIe host controller driver Jonathan Chocron
2019-03-26 12:17   ` Lorenzo Pieralisi
2019-03-26 13:24     ` David Woodhouse
2019-03-26 15:58       ` Lorenzo Pieralisi
2019-03-27  9:52         ` David Woodhouse
2019-03-27 11:20           ` Lorenzo Pieralisi
2019-03-27 11:40             ` David Woodhouse
2019-03-27  9:43     ` David Woodhouse
2019-03-27 11:39       ` Lorenzo Pieralisi [this message]
2019-03-27 12:01         ` David Woodhouse
2019-03-26 12:55   ` Bjorn Helgaas
2019-03-28 10:55     ` Jonathan Chocron
2019-03-28 11:57     ` [PATCH v3] " Jonathan Chocron
2019-04-08 22:57       ` Benjamin Herrenschmidt
2019-04-16 13:13         ` David Woodhouse
2019-04-16 14:01       ` Lorenzo Pieralisi
2019-04-25 14:08       ` Bjorn Helgaas

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=20190327113911.GB8331@e107981-ln.cambridge.arm.com \
    --to=lorenzo.pieralisi@arm.com \
    --cc=alisaidi@amazon.com \
    --cc=barakw@amazon.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=dwmw@amazon.co.uk \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=jonnyc@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=ronenk@amazon.com \
    --cc=vaerov@amazon.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=zeev@amazon.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).