Re: [PATCH] x86/PCI: MMCONFIG: fix region end calculation

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

 



On Monday, October 04, 2010 11:56:43 am Yinghai Lu wrote:
> On 10/04/2010 09:16 AM, Bjorn Helgaas wrote:
> > 
> > The end of an MMCONFIG region depends on the ending bus number, not on the
> > number of buses the region covers.  We previously computed the wrong ending
> > address whenever the starting bus number was non-zero, e.g.,:
> > 
> >   MMCONFIG for [bus 00-1f] at [mem 0xe0000000-0xe1ffffff] (base 0xe0000000)
> >   MMCONFIG for [bus 20-3f] at [mem 0xe2000000-0xe1ffffff] (base 0xe0000000)
> > 
> > The correct regions are:
> > 
> >   MMCONFIG for [bus 00-1f] at [mem 0xe0000000-0xe1ffffff] (base 0xe0000000)
> >   MMCONFIG for [bus 20-3f] at [mem 0xe2000000-0xe3ffffff] (base 0xe0000000)
> > 
> > Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
> > ---
> > 
> >  arch/x86/pci/mmconfig-shared.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > 
> > diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
> > index a918553..5cfe94c 100644
> > --- a/arch/x86/pci/mmconfig-shared.c
> > +++ b/arch/x86/pci/mmconfig-shared.c
> > @@ -85,7 +85,7 @@ static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start,
> >  	num_buses = end - start + 1;
> >  	res = &new->res;
> >  	res->start = addr + PCI_MMCFG_BUS_OFFSET(start);
> > -	res->end = addr + PCI_MMCFG_BUS_OFFSET(num_buses) - 1;
> > +	res->end = addr + PCI_MMCFG_BUS_OFFSET(end + 1) - 1;
> >  	res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
> >  	snprintf(new->name, PCI_MMCFG_RESOURCE_NAME_LEN,
> >  		 "PCI MMCONFIG %04x [bus %02x-%02x]", segment, start, end);
> 
> it seems you can kill num_buses in this function.
> 
> or
> -	res->end = addr + PCI_MMCFG_BUS_OFFSET(num_buses) - 1;
> +	res->end = res->start + PCI_MMCFG_BUS_OFFSET(num_buses) - 1;

Right you are, sorry I missed that.  I'll fix it.

Bjorn
--
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