Re: [PATCH resend 2/2] PCI: don't allocate resource above 4G for 32-bit BAR

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

 



On Wed, 2009-02-18 at 19:34 +0300, Ivan Kokshaysky wrote:
> On Wed, Feb 18, 2009 at 01:56:44AM +0800, Yu Zhao wrote:
> > +	max = pci_resource_limit(dev, resno);
> > +
> >  	/* First, try exact prefetching match.. */
> > -	ret = pci_bus_alloc_resource(bus, res, size, align, min,
> > +	ret = pci_bus_alloc_resource(bus, res, size, align, min, max,
> >  				     IORESOURCE_PREFETCH,
> >  				     pcibios_align_resource, dev);
> 
> This breaks resource allocation on alpha and probably other
> arches with multiple pci domains. You cannot assume that resource
> start is equal to the bus address of the respective BAR.
> Even 32-bit BARs can have a resource->start well above 4G.

Than the previous patch was wrong too.

Perhaps pci_resource_limit() should translate its result to the address
as seen by the CPU.  It should walk the bridge tree to the root and
apply all conversions made by the bridges.

If all conversions are just adding the upper address lines, then max
could be just moved to the same 4G area as min:

max += (min & ((u64)-1 - max))

-- 
Regards,
Pavel Roskin
--
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