Re: dump more than 265 bytes PCI config SPACE

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

 



Matthew Wilcox wrote:
> On Thu, Mar 18, 2010 at 12:09:21PM -0700, Joyce Yu wrote:
>>> Does your Linux machine with its PCIe card have MMCONFIG enabled?
>>> Check your dmesg to find out.  If not, Linux can't access the extended
>>> config space.
>>>
>>> Need more information before we go any further down this decision tree.
>> It is a PCIe card running on Linux. But I didn't find anything with  
>> MMCONFIG in the system. I also couldn't find it in the  
>> 2.6.16/2.6.18/2.6.22/2.6.24/2.4.26 linux kernel tree.
> 
> My laptop reports this in dmesg:
> 
> [    0.188307] PCI: MMCONFIG for domain 0000 [bus 00-3f] at [mem 0xf8000000-0xfbffffff] (base 0xf8000000)
> [    0.188325] PCI: MMCONFIG at [mem 0xf8000000-0xfbffffff] reserved in E820
> [    0.188450] PCI: Using MMCONFIG for extended config space
> [    0.188572] PCI: Using configuration type 1 for base access
> 
> and it gets access to extended config space.
> 
> Support for extended config space was added before 2.6.12, but I don't
> think it was ever supported by 2.4.
> 
> So we need to figure out why your machine doesn't support extended
> config space.  What chipset does it use?  Is there a BIOS update available
> for it?  What does it report in dmesg for config space accesses?
> 

In addition to having MMCONFIG enabled on the system (hw & kernel),
you also need to be root because of this snippet in drivers/pci/pci-sysfs.c,
pci_read_config():
        unsigned int size = 64;
        loff_t init_off = off;
        u8 *data = (u8*) buf;

        /* Several chips lock up trying to read undefined config space */
        if (capable(CAP_SYS_ADMIN)) {
                size = dev->cfg_size;
        } else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
                size = 128;
        }

which will truncate the read to 1st 64-bytes, so unpriv user can't
crash a system that has badly behaving PCI(e) config space.

IMO, the CAP_SYS_ADMIN ought to be replaced w/a quirk check
for badly-behaving devices &/or chip sets.

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