All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
	Will Deacon <will.deacon@arm.com>,
	bhelgaas@google.com, linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 0/3] ARM: PCI: implement generic PCI host controller
Date: Fri, 14 Feb 2014 12:05:27 +0100	[thread overview]
Message-ID: <1800297.J3Exeqph4n@wuerfel> (raw)
In-Reply-To: <20140213182655.GE17248@obsidianresearch.com>

On Thursday 13 February 2014 11:26:55 Jason Gunthorpe wrote:
> The DT representation is very straightforward, just have more copies
> of what you already have. Each DT stanza should be represented in
> Linux a distinct PCI domain.
> 
> In Linux you run into two small problems
>  1) PCI Domain numbers needs to be allocated dynamically
>     * I think there should be a core thing to allocate a domain
>       object w/ a struct device, and assign a unique domain number.
>       We are already seeing drivers do things like keep track
>       of their own domain numbers via a counter (pcie-designware.c)
>       The host bridge object is similar to this but it isn't focused
>       on a domain.

Right, see also my other comment I just sent in the "Re: [PATCH v2 3/3]
PCI: ARM: add support for generic PCI host controller" thread.

The host driver is the wrong place to pick a domain number, but someone
has to do it.

>  2) The space in the IO fixed mapping needs to be allocated to PCI
>     host drivers dynamically
>     * pci_ioremap_io_dynamic that takes a bus address + cpu_physical
>       address and returns a Linux virtual address.
>       The first caller can get a nice traslation where bus address ==
>       Linux virtual address, everyone after can get best efforts.

I think we can have a helper that everything we need to do
with the I/O space:

* parse the ranges property
* pick an appropriate virtual address window
* ioremap the physical window there
* compute the io_offset
* pick a name for the resource
* request the io resource
* register the pci_host_bridge_window

> You will have overlapping physical IO bus addresses - each domain will
> have a 0 IO BAR - but those will have distinct CPU physical addresses
> and can then be uniquely mapped into the IO mapping. So at the struct
> resource level the two domains have disjoint IO addresses, but each
> domain uses a different IO offset..

This would be the common case, but when we have a generic helper function,
it's actually not that are to handle a couple of variations of that,
which we may see in the field and can easily be described with the
existing binding.

* If we allow multiple host bridges to be in the same PCI domain with
  a split bus space, we should also allow them to have a split I/O
  space, e.g. have two 32KB windows, both with io_offset=0. This would
  imply that the second bridge can only support relocatable I/O BARs.

* Similar to that, you may have multiple 64KB windows with io_offset=0.

* Some system may have hardwire I/O windows at a high bus address larger
  than IO_SPACE_LIMIT. This would mean a *negative* io_offset. I can't
  see any reason why anyone would do this, but I also don't see a reason
  to prevent it if we can easily keep the code generic enough to handle
  it without adding extra code.

* A more obscure case would be to have multiple I/O windows on a bus.
  This is allowed by the binding and by the pci_host_bridge_window,
  and while again I don't see a use case, it also doesn't seem hard
  to do, we just keep looping for all ranges rather than stop after
  the first window.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 0/3] ARM: PCI: implement generic PCI host controller
Date: Fri, 14 Feb 2014 12:05:27 +0100	[thread overview]
Message-ID: <1800297.J3Exeqph4n@wuerfel> (raw)
In-Reply-To: <20140213182655.GE17248@obsidianresearch.com>

On Thursday 13 February 2014 11:26:55 Jason Gunthorpe wrote:
> The DT representation is very straightforward, just have more copies
> of what you already have. Each DT stanza should be represented in
> Linux a distinct PCI domain.
> 
> In Linux you run into two small problems
>  1) PCI Domain numbers needs to be allocated dynamically
>     * I think there should be a core thing to allocate a domain
>       object w/ a struct device, and assign a unique domain number.
>       We are already seeing drivers do things like keep track
>       of their own domain numbers via a counter (pcie-designware.c)
>       The host bridge object is similar to this but it isn't focused
>       on a domain.

Right, see also my other comment I just sent in the "Re: [PATCH v2 3/3]
PCI: ARM: add support for generic PCI host controller" thread.

The host driver is the wrong place to pick a domain number, but someone
has to do it.

>  2) The space in the IO fixed mapping needs to be allocated to PCI
>     host drivers dynamically
>     * pci_ioremap_io_dynamic that takes a bus address + cpu_physical
>       address and returns a Linux virtual address.
>       The first caller can get a nice traslation where bus address ==
>       Linux virtual address, everyone after can get best efforts.

I think we can have a helper that everything we need to do
with the I/O space:

* parse the ranges property
* pick an appropriate virtual address window
* ioremap the physical window there
* compute the io_offset
* pick a name for the resource
* request the io resource
* register the pci_host_bridge_window

> You will have overlapping physical IO bus addresses - each domain will
> have a 0 IO BAR - but those will have distinct CPU physical addresses
> and can then be uniquely mapped into the IO mapping. So at the struct
> resource level the two domains have disjoint IO addresses, but each
> domain uses a different IO offset..

This would be the common case, but when we have a generic helper function,
it's actually not that are to handle a couple of variations of that,
which we may see in the field and can easily be described with the
existing binding.

* If we allow multiple host bridges to be in the same PCI domain with
  a split bus space, we should also allow them to have a split I/O
  space, e.g. have two 32KB windows, both with io_offset=0. This would
  imply that the second bridge can only support relocatable I/O BARs.

* Similar to that, you may have multiple 64KB windows with io_offset=0.

* Some system may have hardwire I/O windows at a high bus address larger
  than IO_SPACE_LIMIT. This would mean a *negative* io_offset. I can't
  see any reason why anyone would do this, but I also don't see a reason
  to prevent it if we can easily keep the code generic enough to handle
  it without adding extra code.

* A more obscure case would be to have multiple I/O windows on a bus.
  This is allowed by the binding and by the pci_host_bridge_window,
  and while again I don't see a use case, it also doesn't seem hard
  to do, we just keep looping for all ranges rather than stop after
  the first window.

	Arnd

  reply	other threads:[~2014-02-14 11:05 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 20:16 [PATCH v2 0/3] ARM: PCI: implement generic PCI host controller Will Deacon
2014-02-12 20:16 ` Will Deacon
2014-02-12 20:16 ` [PATCH v2 1/3] ARM: mach-virt: allow PCI support to be selected Will Deacon
2014-02-12 20:16   ` Will Deacon
2014-02-12 20:16 ` [PATCH v2 2/3] ARM: bios32: use pci_enable_resource to enable PCI resources Will Deacon
2014-02-12 20:16   ` Will Deacon
2014-02-12 22:28   ` Jason Gunthorpe
2014-02-12 22:28     ` Jason Gunthorpe
2014-02-13 10:06     ` Will Deacon
2014-02-13 10:06       ` Will Deacon
2014-02-13 12:22   ` Jingoo Han
2014-02-13 12:22     ` Jingoo Han
2014-02-12 20:16 ` [PATCH v2 3/3] PCI: ARM: add support for generic PCI host controller Will Deacon
2014-02-12 20:16   ` Will Deacon
2014-02-12 20:59   ` Arnd Bergmann
2014-02-12 20:59     ` Arnd Bergmann
2014-02-13 11:04     ` Will Deacon
2014-02-13 11:04       ` Will Deacon
2014-02-13 11:47       ` Arnd Bergmann
2014-02-13 11:47         ` Arnd Bergmann
2014-02-13 12:00         ` Will Deacon
2014-02-13 12:00           ` Will Deacon
2014-02-13 12:21           ` Arnd Bergmann
2014-02-13 12:21             ` Arnd Bergmann
2014-02-12 21:51   ` Kumar Gala
2014-02-12 21:51     ` Kumar Gala
2014-02-13 11:07     ` Will Deacon
2014-02-13 11:07       ` Will Deacon
2014-02-13 16:22       ` Kumar Gala
2014-02-13 16:22         ` Kumar Gala
2014-02-13 16:25         ` Will Deacon
2014-02-13 16:25           ` Will Deacon
2014-02-13 16:28         ` Arnd Bergmann
2014-02-13 16:28           ` Arnd Bergmann
2014-02-13 18:11           ` Mark Rutland
2014-02-13 18:11             ` Mark Rutland
2014-02-13 18:11             ` Mark Rutland
2014-02-13 18:26           ` Jason Gunthorpe
2014-02-13 18:26             ` Jason Gunthorpe
2014-02-13 19:53             ` Will Deacon
2014-02-13 19:53               ` Will Deacon
2014-02-13 20:20               ` Jason Gunthorpe
2014-02-13 20:20                 ` Jason Gunthorpe
2014-02-14  9:59               ` Arnd Bergmann
2014-02-14  9:59                 ` Arnd Bergmann
2014-02-14 22:00                 ` Liviu Dudau
2014-02-14 22:00                   ` Liviu Dudau
2014-02-15 13:03                   ` Arnd Bergmann
2014-02-15 13:03                     ` Arnd Bergmann
2014-02-18 17:41                     ` Jason Gunthorpe
2014-02-18 17:41                       ` Jason Gunthorpe
2014-02-18 18:25                       ` Arnd Bergmann
2014-02-18 18:25                         ` Arnd Bergmann
2014-02-18 18:45                         ` Jason Gunthorpe
2014-02-18 18:45                           ` Jason Gunthorpe
2014-02-18 19:13                           ` Arnd Bergmann
2014-02-18 19:13                             ` Arnd Bergmann
2014-02-19  2:44                       ` Liviu Dudau
2014-02-19  2:44                         ` Liviu Dudau
2014-02-19  6:48                         ` Jason Gunthorpe
2014-02-19  6:48                           ` Jason Gunthorpe
2014-02-19 10:24                         ` Arnd Bergmann
2014-02-19 10:24                           ` Arnd Bergmann
2014-02-19 11:37                           ` Liviu Dudau
2014-02-19 11:37                             ` Liviu Dudau
2014-02-19 13:26                             ` Arnd Bergmann
2014-02-19 13:26                               ` Arnd Bergmann
2014-02-19 15:30                               ` Liviu Dudau
2014-02-19 15:30                                 ` Liviu Dudau
2014-02-19 19:47                                 ` Arnd Bergmann
2014-02-19 19:47                                   ` Arnd Bergmann
2014-02-19  0:28                     ` Bjorn Helgaas
2014-02-19  0:28                       ` Bjorn Helgaas
2014-02-19  9:58                       ` Arnd Bergmann
2014-02-19  9:58                         ` Arnd Bergmann
2014-02-19 18:20                         ` Bjorn Helgaas
2014-02-19 18:20                           ` Bjorn Helgaas
2014-02-19 19:06                           ` Arnd Bergmann
2014-02-19 19:06                             ` Arnd Bergmann
2014-02-19 20:18                             ` Bjorn Helgaas
2014-02-19 20:18                               ` Bjorn Helgaas
2014-02-19 20:48                               ` Arnd Bergmann
2014-02-19 20:48                                 ` Arnd Bergmann
2014-02-19 21:10                                 ` Jason Gunthorpe
2014-02-19 21:10                                   ` Jason Gunthorpe
2014-02-19 21:33                                 ` Bjorn Helgaas
2014-02-19 21:33                                   ` Bjorn Helgaas
2014-02-19 22:12                                   ` Arnd Bergmann
2014-02-19 22:12                                     ` Arnd Bergmann
2014-02-19 22:18                                     ` Bjorn Helgaas
2014-02-19 22:18                                       ` Bjorn Helgaas
2014-02-13 19:52         ` Rob Herring
2014-02-13 19:52           ` Rob Herring
2014-02-13 18:06       ` Jason Gunthorpe
2014-02-13 18:06         ` Jason Gunthorpe
2014-02-13 19:51         ` Will Deacon
2014-02-13 19:51           ` Will Deacon
2014-02-13 18:26 ` [PATCH v2 0/3] ARM: PCI: implement " Jason Gunthorpe
2014-02-13 18:26   ` Jason Gunthorpe
2014-02-14 11:05   ` Arnd Bergmann [this message]
2014-02-14 11:05     ` Arnd Bergmann
2014-02-18 18:00     ` Jason Gunthorpe
2014-02-18 18:00       ` Jason Gunthorpe
2014-02-18 18:40       ` Arnd Bergmann
2014-02-18 18:40         ` Arnd Bergmann

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=1800297.J3Exeqph4n@wuerfel \
    --to=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=will.deacon@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.