Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-09 Thread Bjorn Helgaas
On Wed, Jul 9, 2014 at 12:20 AM, Arnd Bergmann wrote: > On Tuesday 08 July 2014, Bjorn Helgaas wrote: >> I think my confusion is because your pci_register_io_range() and >> pci_addess_to_pci() implementations assume that every io_range starts at >> I/O port 0 on PCI (correct me if I'm wrong). I

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-09 Thread Liviu Dudau
On Wed, Jul 09, 2014 at 07:20:49AM +0100, Arnd Bergmann wrote: > On Tuesday 08 July 2014, Bjorn Helgaas wrote: > > On Tue, Jul 8, 2014 at 1:00 AM, Arnd Bergmann wrote: > > > On Tuesday 08 July 2014, Bjorn Helgaas wrote: > > >> On Tue, Jul 01, 2014 at 07:43:28PM +0100, Liviu Dudau wrote: > > >> > +

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-09 Thread Liviu Dudau
On Wed, Jul 09, 2014 at 07:32:37AM +0100, Arnd Bergmann wrote: > On Wednesday 09 July 2014, Liviu Dudau wrote: > > > Maybe that assumption is guaranteed by OF, but it doesn't hold for ACPI; > > > ACPI can describe several I/O port apertures for a single bridge, each > > > associated with a differen

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-09 Thread Liviu Dudau
On Tue, Jul 08, 2014 at 03:14:17PM +0100, Arnd Bergmann wrote: > On Tuesday 08 July 2014, Liviu Dudau wrote: > > > Here's what these look like in /proc/iomem and /proc/ioports (note that > > > there are two resource structs for each memory-mapped IO port space: one > > > IORESOURCE_MEM for the memo

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-08 Thread Arnd Bergmann
On Wednesday 09 July 2014, Liviu Dudau wrote: > > Maybe that assumption is guaranteed by OF, but it doesn't hold for ACPI; > > ACPI can describe several I/O port apertures for a single bridge, each > > associated with a different CPU physical memory region. > > That is actually a good catch, I've

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-08 Thread Arnd Bergmann
On Tuesday 08 July 2014, Bjorn Helgaas wrote: > On Tue, Jul 8, 2014 at 1:00 AM, Arnd Bergmann wrote: > > On Tuesday 08 July 2014, Bjorn Helgaas wrote: > >> On Tue, Jul 01, 2014 at 07:43:28PM +0100, Liviu Dudau wrote: > >> > +static LIST_HEAD(io_range_list); > >> > + > >> > +/* > >> > + * Record th

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-08 Thread Arnd Bergmann
On Tuesday 08 July 2014, Liviu Dudau wrote: > > Here's what these look like in /proc/iomem and /proc/ioports (note that > > there are two resource structs for each memory-mapped IO port space: one > > IORESOURCE_MEM for the memory-mapped area (used only by the host bridge > > driver), and one IORES

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-08 Thread Liviu Dudau
On Tue, Jul 08, 2014 at 10:29:51PM +0100, Bjorn Helgaas wrote: > On Tue, Jul 8, 2014 at 1:00 AM, Arnd Bergmann wrote: > > On Tuesday 08 July 2014, Bjorn Helgaas wrote: > >> On Tue, Jul 01, 2014 at 07:43:28PM +0100, Liviu Dudau wrote: > >> > +static LIST_HEAD(io_range_list); > >> > + > >> > +/* > >

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-08 Thread Bjorn Helgaas
On Tue, Jul 8, 2014 at 1:00 AM, Arnd Bergmann wrote: > On Tuesday 08 July 2014, Bjorn Helgaas wrote: >> On Tue, Jul 01, 2014 at 07:43:28PM +0100, Liviu Dudau wrote: >> > +static LIST_HEAD(io_range_list); >> > + >> > +/* >> > + * Record the PCI IO range (expressed as CPU physical address + size). >

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-08 Thread Liviu Dudau
On Tue, Jul 08, 2014 at 01:14:18AM +0100, Bjorn Helgaas wrote: > On Tue, Jul 01, 2014 at 07:43:28PM +0100, Liviu Dudau wrote: > > Some architectures do not have a simple view of the PCI I/O space > > and instead use a range of CPU addresses that map to bus addresses. For > > some architectures thes

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-08 Thread Arnd Bergmann
On Tuesday 08 July 2014, Bjorn Helgaas wrote: > On Tue, Jul 01, 2014 at 07:43:28PM +0100, Liviu Dudau wrote: > > +static LIST_HEAD(io_range_list); > > + > > +/* > > + * Record the PCI IO range (expressed as CPU physical address + size). > > + * Return a negative value if an error has occured, zero

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-07 Thread Bjorn Helgaas
On Tue, Jul 01, 2014 at 07:43:28PM +0100, Liviu Dudau wrote: > Some architectures do not have a simple view of the PCI I/O space > and instead use a range of CPU addresses that map to bus addresses. For > some architectures these ranges will be expressed by OF bindings > in a device tree file. > >

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-02 Thread Liviu Dudau
On Wed, Jul 02, 2014 at 12:22:22PM +0100, Will Deacon wrote: > On Tue, Jul 01, 2014 at 07:43:28PM +0100, Liviu Dudau wrote: > > Some architectures do not have a simple view of the PCI I/O space > > and instead use a range of CPU addresses that map to bus addresses. For > > some architectures these

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-02 Thread Arnd Bergmann
On Wednesday 02 July 2014 15:23:03 Liviu Dudau wrote: > > > > Your solution looks correct to me, just using different > > tradeoffs to what I was expecting: You get a working pci_address_to_pio() > > function, which is probably never needed, but in turn you need to > > keep the state of each host

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-02 Thread Liviu Dudau
On Wed, Jul 02, 2014 at 01:30:31PM +0100, Arnd Bergmann wrote: > On Tuesday 01 July 2014 21:45:09 Liviu Dudau wrote: > > On Tue, Jul 01, 2014 at 09:36:10PM +0200, Arnd Bergmann wrote: > > > On Tuesday 01 July 2014 19:43:28 Liviu Dudau wrote: > > > > > > This still conflicts with the other allocato

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-02 Thread Liviu Dudau
On Wed, Jul 02, 2014 at 01:38:04PM +0100, Arnd Bergmann wrote: > Some more detailed comments now > > On Tuesday 01 July 2014 19:43:28 Liviu Dudau wrote: > > +/* > > + * Record the PCI IO range (expressed as CPU physical address + size). > > + * Return a negative value if an error has occured, zero

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-02 Thread Arnd Bergmann
Some more detailed comments now On Tuesday 01 July 2014 19:43:28 Liviu Dudau wrote: > +/* > + * Record the PCI IO range (expressed as CPU physical address + size). > + * Return a negative value if an error has occured, zero otherwise > + */ > +int __weak pci_register_io_range(phys_addr_t addr, res

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-02 Thread Arnd Bergmann
On Tuesday 01 July 2014 21:45:09 Liviu Dudau wrote: > On Tue, Jul 01, 2014 at 09:36:10PM +0200, Arnd Bergmann wrote: > > On Tuesday 01 July 2014 19:43:28 Liviu Dudau wrote: > > > > This still conflicts with the other allocator you have in patch 9 > > for pci_remap_iospace: nothing guarantees that

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-02 Thread Will Deacon
On Tue, Jul 01, 2014 at 07:43:28PM +0100, Liviu Dudau wrote: > Some architectures do not have a simple view of the PCI I/O space > and instead use a range of CPU addresses that map to bus addresses. For > some architectures these ranges will be expressed by OF bindings > in a device tree file. > >

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-01 Thread Liviu Dudau
On Tue, Jul 01, 2014 at 09:36:10PM +0200, Arnd Bergmann wrote: > On Tuesday 01 July 2014 19:43:28 Liviu Dudau wrote: > > +/* > > + * Record the PCI IO range (expressed as CPU physical address + size). > > + * Return a negative value if an error has occured, zero otherwise > > + */ > > +int __weak p

Re: [PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-01 Thread Arnd Bergmann
On Tuesday 01 July 2014 19:43:28 Liviu Dudau wrote: > +/* > + * Record the PCI IO range (expressed as CPU physical address + size). > + * Return a negative value if an error has occured, zero otherwise > + */ > +int __weak pci_register_io_range(phys_addr_t addr, resource_size_t size) > +{ > +#ifdef

[PATCH v8 3/9] pci: Introduce pci_register_io_range() helper function.

2014-07-01 Thread Liviu Dudau
Some architectures do not have a simple view of the PCI I/O space and instead use a range of CPU addresses that map to bus addresses. For some architectures these ranges will be expressed by OF bindings in a device tree file. Introduce a pci_register_io_range() helper function with a generic imple