Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1504391
| From | Willy Tarreau <w@1wt.eu> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.10 02/16] PCI: Support PCIe devices with short cfg_size |
| Date | 2016-10-20 01:00 +0200 |
| Message-ID | <su807-7Cg-43@gated-at.bofh.it> (permalink) |
| References | <su801-7Cg-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: "Jason S. McMullan" <jason.mcmullan@netronome.com> commit c20aecf6963d1273d8f6d61c042b4845441ca592 upstream. If a device quirk modifies the pci_dev->cfg_size to be less than PCI_CFG_SPACE_EXP_SIZE (4096), but greater than PCI_CFG_SPACE_SIZE (256), the PCI sysfs interface truncates the readable size to PCI_CFG_SPACE_SIZE. Allow sysfs access to config space up to cfg_size, even if the device doesn't support the entire 4096-byte PCIe config space. Note that pci_read_config() and pci_write_config() limit access to dev->cfg_size even though pcie_config_attr contains 4096 (the maximum size). Signed-off-by: Jason S. McMullan <jason.mcmullan@netronome.com> [simon: edited changelog] Signed-off-by: Simon Horman <simon.horman@netronome.com> [bhelgaas: more changelog edits] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Willy Tarreau <w@1wt.eu> --- drivers/pci/pci-sysfs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 689f3c8..aee15ce 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1308,10 +1308,10 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) if (!sysfs_initialized) return -EACCES; - if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) - retval = sysfs_create_bin_file(&pdev->dev.kobj, &pci_config_attr); - else + if (pdev->cfg_size > PCI_CFG_SPACE_SIZE) retval = sysfs_create_bin_file(&pdev->dev.kobj, &pcie_config_attr); + else + retval = sysfs_create_bin_file(&pdev->dev.kobj, &pci_config_attr); if (retval) goto err; @@ -1368,10 +1368,10 @@ err_rom_file: err_resource_files: pci_remove_resource_files(pdev); err_config_file: - if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) - sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); - else + if (pdev->cfg_size > PCI_CFG_SPACE_SIZE) sysfs_remove_bin_file(&pdev->dev.kobj, &pcie_config_attr); + else + sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); err: return retval; } @@ -1405,10 +1405,10 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev) pci_remove_capabilities_sysfs(pdev); - if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) - sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); - else + if (pdev->cfg_size > PCI_CFG_SPACE_SIZE) sysfs_remove_bin_file(&pdev->dev.kobj, &pcie_config_attr); + else + sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); pci_remove_resource_files(pdev); -- 2.8.0.rc2.1.gbe9624a
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.10 00/16] 3.10.104-stable review Willy Tarreau <w@1wt.eu> - 2016-10-20 01:00 +0200 [PATCH 3.10 15/16] xen-netback: ref count shared rings Willy Tarreau <w@1wt.eu> - 2016-10-20 01:00 +0200 [PATCH 3.10 02/16] PCI: Support PCIe devices with short cfg_size Willy Tarreau <w@1wt.eu> - 2016-10-20 01:00 +0200 [PATCH 3.10 06/16] PCI: Limit config space size for Netronome NFP4000 Willy Tarreau <w@1wt.eu> - 2016-10-20 01:00 +0200 [PATCH 3.10 05/16] PCI: Add Netronome NFP4000 PF device ID Willy Tarreau <w@1wt.eu> - 2016-10-20 01:00 +0200 [PATCH 3.10 08/16] megaraid_sas: Fix probing cards without io port Willy Tarreau <w@1wt.eu> - 2016-10-20 01:00 +0200 [PATCH 3.10 10/16] staging: comedi: daqboard2000: bug fix board type matching code Willy Tarreau <w@1wt.eu> - 2016-10-20 01:00 +0200 [PATCH 3.10 04/16] PCI: Limit config space size for Netronome NFP6000 family Willy Tarreau <w@1wt.eu> - 2016-10-20 01:00 +0200 [PATCH 3.10 09/16] crypto: nx - off by one bug in nx_of_update_msc() Willy Tarreau <w@1wt.eu> - 2016-10-20 01:00 +0200 [PATCH 3.10 12/16] mm: thp: fix SMP race condition between THP page fault and MADV_DONTNEED Willy Tarreau <w@1wt.eu> - 2016-10-20 01:00 +0200
csiph-web