diff mbox

[4.4-rc8] pci: Make 4K config space available for non PCI-e/PCI-X devices

Message ID BLUPR0401MB168387B77DBE972BC1723D6894F50@BLUPR0401MB1683.namprd04.prod.outlook.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Ananth, Rajesh Jan. 7, 2016, 11:20 p.m. UTC
Resending this in PLAIN TEXT.

Description:

The Kernel PCI driver that probes the devices always reports the config space as 256 bytes for the PCI devices that are not PCI-e or PCI-X.  
There are some vendor devices that are not PCI-e or PCI-X, but might have the configuration space data that is more than 256 bytes  in size to
be made accessible through the standard sys-fs "/sys/bus/pci/devices/./config" link.  

Currently, the current Kernel does not provide the extended config space access for those devices, and a proprietary mechanism is
oftentimes used by the vendor utilities to address that. As the problem could be seen, use of proprietary tools and utilities automatically
leads to user confusion of using non-standard tools across different vendor devices.

Patch:



Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
     person who certified (a), (b) or (c) and I have not modified
     it.

(d) I understand and agree that this project and the contribution
     are public and that a record of the contribution (including all
     personal information I submit with it, including my sign-off) is
     maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

    Signed-off-by: Rajesh A Developer <rajesh.ananth@smartm.com>


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

Comments

Alex Williamson Jan. 8, 2016, 2:01 a.m. UTC | #1
On Thu, 2016-01-07 at 23:20 +0000, Ananth, Rajesh wrote:
> Resending this in PLAIN TEXT.
> 
> Description:
> 
> The Kernel PCI driver that probes the devices always reports the
> config space as 256 bytes for the PCI devices that are not PCI-e or
> PCI-X.  
> There are some vendor devices that are not PCI-e or PCI-X, but might
> have the configuration space data that is more than 256 bytes  in
> size to
> be made accessible through the standard sys-fs
> "/sys/bus/pci/devices/./config" link.  
> 
> Currently, the current Kernel does not provide the extended config
> space access for those devices, and a proprietary mechanism is
> oftentimes used by the vendor utilities to address that. As the
> problem could be seen, use of proprietary tools and utilities
> automatically
> leads to user confusion of using non-standard tools across different
> vendor devices.
> 
> Patch:
> 
> --- linux-4.4-rc8/drivers/pci/probe.c.orig      2016-01-07
> 13:30:54.310392700 -0800
> +++ linux-4.4-rc8/drivers/pci/probe.c   2016-01-07 13:32:14.586392700
> -0800
> @@ -1119,28 +1119,8 @@ static int pci_cfg_space_size_ext(struct
> 
> int pci_cfg_space_size(struct pci_dev *dev)
> {
> -       int pos;
> -       u32 status;
> -       u16 class;
> -
> -       class = dev->class >> 8;
> -       if (class == PCI_CLASS_BRIDGE_HOST)
> -               return pci_cfg_space_size_ext(dev);
> -
> -       if (!pci_is_pcie(dev)) {
> -               pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
> -               if (!pos)
> -                       goto fail;
> -
> -               pci_read_config_dword(dev, pos + PCI_X_STATUS,
> &status);
> -               if (!(status & (PCI_X_STATUS_266MHZ |
> PCI_X_STATUS_533MHZ)))
> -                       goto fail;
> -       }
> -
>         return pci_cfg_space_size_ext(dev);
> 
> - fail:
> -       return PCI_CFG_SPACE_SIZE;
> }

Just no.  Use quirks if there are specific devices which provide
extended config space in non-standard ways, don't impose this broken
behavior everywhere.  Thanks,

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

Patch

--- linux-4.4-rc8/drivers/pci/probe.c.orig      2016-01-07 13:30:54.310392700 -0800
+++ linux-4.4-rc8/drivers/pci/probe.c   2016-01-07 13:32:14.586392700 -0800
@@ -1119,28 +1119,8 @@  static int pci_cfg_space_size_ext(struct

int pci_cfg_space_size(struct pci_dev *dev)
{
-       int pos;
-       u32 status;
-       u16 class;
-
-       class = dev->class >> 8;
-       if (class == PCI_CLASS_BRIDGE_HOST)
-               return pci_cfg_space_size_ext(dev);
-
-       if (!pci_is_pcie(dev)) {
-               pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
-               if (!pos)
-                       goto fail;
-
-               pci_read_config_dword(dev, pos + PCI_X_STATUS, &status);
-               if (!(status & (PCI_X_STATUS_266MHZ | PCI_X_STATUS_533MHZ)))
-                       goto fail;
-       }
-
        return pci_cfg_space_size_ext(dev);

- fail:
-       return PCI_CFG_SPACE_SIZE;
}

#define LEGACY_IO_RESOURCE     (IORESOURCE_IO | IORESOURCE_PCI_FIXED)