Re: of/pci: Fix the conversion of IO ranges into IO resources
From: Michael Ellerman
Date: Wed Oct 15 2014 - 22:56:18 EST
On Wed, 2014-10-15 at 10:02 +0100, Liviu Dudau wrote:
> On Wed, Oct 15, 2014 at 08:35:07AM +0100, Benjamin Herrenschmidt wrote:
> > On Thu, 2014-10-09 at 20:02 +0000, Linux Kernel Mailing List wrote:
> > > Gitweb: http://git.kernel.org/linus/;a=commit;h=0b0b0893d49b34201a6c4416b1a707b580b91e3d
> > > Commit: 0b0b0893d49b34201a6c4416b1a707b580b91e3d
> > > Author: Liviu Dudau <Liviu.Dudau@xxxxxxx>
> > > Committer: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> > >
> > > of/pci: Fix the conversion of IO ranges into IO resources
> > >
> > > The ranges property for a host bridge controller in DT describes the
> > > mapping between the PCI bus address and the CPU physical address. The
> > > resources framework however expects that the IO resources start at a pseudo
> > > "port" address 0 (zero) and have a maximum size of IO_SPACE_LIMIT. The
> > > conversion from PCI ranges to resources failed to take that into account,
> > > returning a CPU physical address instead of a port number.
> > >
> > > Also fix all the drivers that depend on the old behaviour by fetching the
> > > CPU physical address based on the port number where it is being needed.
> >
> > Michael just signaled me that this completely breaks IO space on powerpc ...
>
> Hi Benjamin,
>
> I'm sorry to hear that I've broke powerpc before I've had a chance to actually
> change the code there. I would like to get the details of what functionality
> get broken.
You changed code that arch/powerpc depends on, without updating it, or even
CC'ing us on the patches. I'm not sure what you mean by "before I've had a
chance to actually change the code there" - it's too late.
> The pci_register_io_range() function (the "allocator" for IO space) is a
> weak function. It takes the CPU physical address of the range and its size
> and makes sure that it can fit that area in the arch's space for PCI IO.
> The main purpose of that function is to be a helper to pci_address_to_pio()
> in order to help return the correct answer in that function. pci_address_to_pio()
> is also weak and can be overwritten.
Yes, we already provide our own version of pci_address_to_pio().
The problem is it's too early to call it when we come in from
find_and_init_phbs() -> pci_process_bridge_OF_ranges(), so it returns junk.
I think you were expecting us to hit the #ifndef PCI_IOBASE case, which looks
like it might have worked.
For now we're just going to stop using of_pci_range_to_resource().
cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/