Re: [PATCH] powerpc/PCI: compute I/O space bus-to-resource offset consistently

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2012-02-27 at 19:50 -0700, Bjorn Helgaas wrote:
> --- a/arch/powerpc/kernel/pci_32.c
> +++ b/arch/powerpc/kernel/pci_32.c
> @@ -219,9 +219,9 @@ void __devinit pcibios_setup_phb_io_space(struct
> pci_controller *hose)
>         struct resource *res = &hose->io_resource;
>  
>         /* Fixup IO space offset */
> -       io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
> -       res->start = (res->start + io_offset) & 0xffffffffu;
> -       res->end = (res->end + io_offset) & 0xffffffffu;
> +       io_offset = pcibios_io_space_offset(hose);
> +       res->start += io_offset;
> +       res->end += io_offset;
>  } 

Well, you are losing the 0xffffffff mask... so basically, what happens
is that your offset, if negative, will be 0 extended by
pcibios_io_space_offset() instead of sign-extended, and thus the
resource will have crap stuff in the top 32-bit.

As I said on irc, it might be a non-issue because the inX/outX accessors
are going to take an unsigned int port number anyway, but anything that
tries to print out that resource (or expose it to userspace) will look
bad.

One way to fix that is to ensure that pcibios_io_space_offset() does a
full sign extension to 64-bit.

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux