linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	linux-pci@vger.kernel.org,
	"Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>,
	"Jason Cooper" <jason@lakedaemon.net>,
	"Scott Branden" <sbranden@broadcom.com>,
	"Jon Mason" <jonmason@broadcom.com>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Pratyush Anand" <pratyush.anand@gmail.com>,
	linux-kernel@vger.kernel.org, rfi@lists.rocketboards.org,
	linux-renesas-soc@vger.kernel.org,
	"Simon Horman" <horms@verge.net.au>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Tanmay Inamdar" <tinamdar@apm.com>,
	"Ray Jui" <rjui@broadcom.com>,
	linux-tegra@vger.kernel.org, "Ley Foon Tan" <lftan@altera.com>,
	"Michal Simek" <michal.simek@xilinx.com>,
	"Sören Brinkmann" <soren.brinkmann@xilinx.com>
Subject: Re: [PATCH v1 00/25] PCI: Request host bridge window resources
Date: Tue, 7 Jun 2016 08:11:05 -0500	[thread overview]
Message-ID: <20160607131105.GA2543@localhost> (raw)
In-Reply-To: <3416214.BpvATlfaN7@wuerfel>

On Tue, Jun 07, 2016 at 10:21:36AM +0200, Arnd Bergmann wrote:
> On Monday, June 6, 2016 6:04:44 PM CEST Bjorn Helgaas wrote:
> > Several host bridge drivers (designware and all derivatives, iproc,
> > xgene, xilinx, and xilinx-nwl) don't request the MMIO and I/O port
> > windows they forward downstream to the PCI bus.
> > 
> > That means the PCI core can't request resources for PCI bridge
> > windows and PCI BARs.
> > 
> > Several other drivers (altera, generic, mvebu, rcar, tegra) do request
> > the windows, but use some duplicated code to do it.
> > 
> > This adds a new devm_request_pci_bus_resources() interface and changes
> > these drivers to use it.  It also fixes several error paths where we failed
> > to free the resource list allocated by of_pci_get_host_bridge_resources().
> > 
> > Tegra guys, please take a look at "PCI: tegra: Remove top-level resource
> > from hierarchy" in particular.  Removing the top-level resource definitely
> > makes /proc/iomem look uglier (although it will look more like that of
> > other drivers).  A short-term fix could be to include device information in
> > the resource name.  I think a better long-term fix would be to make the DT
> > or platform device core request all the resources from the DT.
> > 
> > Comments welcome.  I expect we'll trip over something here, so I marked
> > this "v1" and I don't plan to put it into -next for a while.
> > 
> > This is on my pci/host-request-windows branch, which you can pull or view
> > at https://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/log/?h=pci/host-request-windows
> 
> This looks very nice. There is one related aspect that I have been
> grumbling about for a while, but I don't know what the driver is
> actually supposed to do there:
> 
> For the IORESOURCE_IO resources, some drivers request the MMIO address
> that the window is mapped into, some drivers request the PIO range, and
> some of them request both. I also believe the resource that gets put
> into the bridge resources list is not always the same one (or maybe
> that got fixed by now).
> 
> What do you think is the correct behavior here, should the driver only
> request the PIO range with parent=ioport_resource, or should it also
> request the MMIO window for the I/O ports with parent=iomem_resource?
> In the latter case, any idea how that can be generalized?

I think it should request both because I think iomem_resource should
contain everything in the memory map.  This would be required if we ever
did any significant reassignment of top-level devices, e.g., ACPI devices.
For example, on ia64, we do this:

  /proc/ioports:
  00000000-00003fff : PCI Bus 0000:00
  00004000-00009fff : PCI Bus 0000:80
  0000a000-0000bfff : PCI Bus 0000:a0
  0000c000-0000ffff : PCI Bus 0000:c0

  /proc/iomem:
  80000000-9fffffff : PCI Bus 0000:00
  a0000000-cfffffff : PCI Bus 0000:80
  d0000000-dfffffff : PCI Bus 0000:a0
  e0000000-fdffffff : PCI Bus 0000:c0
  80004000000-80103fffffe : PCI Bus 0000:00
  c0004000000-c0103fffffe : PCI Bus 0000:80
  d0004000000-d0103fffffe : PCI Bus 0000:a0
  e0004000000-e0103fffffe : PCI Bus 0000:c0
  3fffffc000000-3fffffcffffff : PCI Bus 0000:00 I/O Ports 00000000-00003fff
  3fffffd000000-3fffffe7fffff : PCI Bus 0000:80 I/O Ports 00004000-00009fff
  3fffffe800000-3fffffeffffff : PCI Bus 0000:a0 I/O Ports 0000a000-0000bfff
  3ffffff000000-3ffffffffffff : PCI Bus 0000:c0 I/O Ports 0000c000-0000ffff

> Another aspect is that we already have the
> gen_pci_parse_request_of_pci_ranges() function that does the same as your
> new devm_request_pci_bus_resources() and then a few other things. I
> have been wondering whether we could move that function into common
> code convert drivers to use that wherever possible, but I guess we can
> always do that as a follow-up after this series.

Oh, I didn't notice that; thanks for pointing it out.  That should be
consolidated somehow.  It also checks to be sure there is a
non-prefetchable memory resource.  A few other drivers also do that, but
most don't.  I suppose that will mostly catch DT errors.

Bjorn

  reply	other threads:[~2016-06-07 13:11 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 23:04 [PATCH v1 00/25] PCI: Request host bridge window resources Bjorn Helgaas
2016-06-06 23:04 ` [PATCH v1 01/25] PCI: Add devm_request_pci_bus_resources() Bjorn Helgaas
2016-06-06 23:05 ` [PATCH v1 02/25] PCI: designware: Free bridge resource list on failure Bjorn Helgaas
2016-06-06 23:05 ` [PATCH v1 03/25] PCI: designware: Request host bridge window resources Bjorn Helgaas
2016-06-06 23:05 ` [PATCH v1 04/25] PCI: designware: Simplify host bridge window iteration Bjorn Helgaas
2016-06-06 23:05 ` [PATCH v1 05/25] PCI: iproc: Request host bridge window resources Bjorn Helgaas
2016-06-06 23:05 ` [PATCH v1 06/25] PCI: xgene: Free bridge resource list on failure Bjorn Helgaas
2016-06-06 23:05 ` [PATCH v1 07/25] PCI: xgene: Request host bridge window resources Bjorn Helgaas
2016-06-06 23:05 ` [PATCH v1 08/25] PCI: xilinx: Free bridge resource list on failure Bjorn Helgaas
2016-06-06 23:05 ` [PATCH v1 09/25] PCI: xilinx: Request host bridge window resources Bjorn Helgaas
2016-06-06 23:05 ` [PATCH v1 10/25] PCI: xilinx-nwl: Free bridge resource list on failure Bjorn Helgaas
2016-06-06 23:06 ` [PATCH v1 11/25] PCI: xilinx-nwl: Request host bridge window resources Bjorn Helgaas
2016-06-06 23:06 ` [PATCH v1 12/25] PCI: xilinx-nwl: Use dev_printk() when possible Bjorn Helgaas
2016-06-06 23:06 ` [PATCH v1 13/25] PCI: altera: Request host bridge window resources with core function Bjorn Helgaas
2016-06-06 23:06 ` [PATCH v1 14/25] PCI: altera: Simplify host bridge window iteration Bjorn Helgaas
2016-06-06 23:06 ` [PATCH v1 15/25] PCI: generic: Free resource list close to where it's allocated Bjorn Helgaas
2016-06-20 16:56   ` Tyler Baker
2016-06-20 17:22     ` Lorenzo Pieralisi
2016-06-21 15:14       ` Bjorn Helgaas
2016-06-06 23:06 ` [PATCH v1 16/25] PCI: generic: Request host bridge window resources with core function Bjorn Helgaas
2016-06-06 23:06 ` [PATCH v1 17/25] PCI: generic: Simplify host bridge window iteration Bjorn Helgaas
2016-06-06 23:06 ` [PATCH v1 18/25] PCI: mvebu: Request host bridge window resources with core function Bjorn Helgaas
2016-06-06 23:07 ` [PATCH v1 19/25] PCI: rcar Gen2: Request host bridge window resources Bjorn Helgaas
2016-06-21 10:41   ` Geert Uytterhoeven
2016-06-21 14:26     ` Bjorn Helgaas
2016-06-21 15:41       ` Valentine Barshak
2016-06-21 16:49         ` Bjorn Helgaas
2016-06-24 14:19           ` Geert Uytterhoeven
2016-06-06 23:07 ` [PATCH v1 20/25] PCI: rcar: Request host bridge window resources with core function Bjorn Helgaas
2016-06-06 23:07 ` [PATCH v1 21/25] PCI: rcar: Simplify host bridge window iteration Bjorn Helgaas
2016-06-06 23:07 ` [PATCH v1 22/25] PCI: tegra: Remove top-level resource from hierarchy Bjorn Helgaas
2016-06-06 23:07 ` [PATCH v1 23/25] PCI: tegra: Request host bridge window resources with core function Bjorn Helgaas
2016-06-06 23:07 ` [PATCH v1 24/25] PCI: versatile: " Bjorn Helgaas
2016-06-06 23:07 ` [PATCH v1 25/25] PCI: versatile: Simplify host bridge window iteration Bjorn Helgaas
2016-06-07  8:21 ` [PATCH v1 00/25] PCI: Request host bridge window resources Arnd Bergmann
2016-06-07 13:11   ` Bjorn Helgaas [this message]
2016-06-07 13:25     ` Arnd Bergmann
2016-06-07 23:34       ` Bjorn Helgaas
2016-06-18 17:58     ` Bjorn Helgaas
2016-06-10 19:00 ` Duc Dang
2016-06-18 18:07 ` Bjorn Helgaas
2016-06-21 11:58   ` wangyijing
2016-06-21 15:03     ` Bjorn Helgaas
2016-06-22  1:07       ` wangyijing

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=20160607131105.GA2543@localhost \
    --to=helgaas@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=horms@verge.net.au \
    --cc=jason@lakedaemon.net \
    --cc=jingoohan1@gmail.com \
    --cc=jonmason@broadcom.com \
    --cc=lftan@altera.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=pratyush.anand@gmail.com \
    --cc=rfi@lists.rocketboards.org \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=soren.brinkmann@xilinx.com \
    --cc=thierry.reding@gmail.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=tinamdar@apm.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).