aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci-sysfs.c')
-rw-r--r--drivers/pci/pci-sysfs.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 06c7f0b85cd2..eb6bee8724cc 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -278,6 +278,16 @@ static ssize_t subordinate_bus_number_show(struct device *dev,
278} 278}
279static DEVICE_ATTR_RO(subordinate_bus_number); 279static DEVICE_ATTR_RO(subordinate_bus_number);
280 280
281static ssize_t ari_enabled_show(struct device *dev,
282 struct device_attribute *attr,
283 char *buf)
284{
285 struct pci_dev *pci_dev = to_pci_dev(dev);
286
287 return sprintf(buf, "%u\n", pci_ari_enabled(pci_dev->bus));
288}
289static DEVICE_ATTR_RO(ari_enabled);
290
281static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, 291static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
282 char *buf) 292 char *buf)
283{ 293{
@@ -348,7 +358,7 @@ static ssize_t numa_node_store(struct device *dev,
348 return -EINVAL; 358 return -EINVAL;
349 359
350 add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); 360 add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
351 dev_alert(&pdev->dev, FW_BUG "Overriding NUMA node to %d. Contact your vendor for updates.", 361 pci_alert(pdev, FW_BUG "Overriding NUMA node to %d. Contact your vendor for updates.",
352 node); 362 node);
353 363
354 dev->numa_node = node; 364 dev->numa_node = node;
@@ -411,7 +421,7 @@ static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,
411 */ 421 */
412 if (!subordinate) { 422 if (!subordinate) {
413 pdev->no_msi = !val; 423 pdev->no_msi = !val;
414 dev_info(&pdev->dev, "MSI/MSI-X %s for future drivers\n", 424 pci_info(pdev, "MSI/MSI-X %s for future drivers\n",
415 val ? "allowed" : "disallowed"); 425 val ? "allowed" : "disallowed");
416 return count; 426 return count;
417 } 427 }
@@ -613,7 +623,7 @@ static ssize_t sriov_numvfs_store(struct device *dev,
613 623
614 /* is PF driver loaded w/callback */ 624 /* is PF driver loaded w/callback */
615 if (!pdev->driver || !pdev->driver->sriov_configure) { 625 if (!pdev->driver || !pdev->driver->sriov_configure) {
616 dev_info(&pdev->dev, "Driver doesn't support SRIOV configuration via sysfs\n"); 626 pci_info(pdev, "Driver doesn't support SRIOV configuration via sysfs\n");
617 ret = -ENOENT; 627 ret = -ENOENT;
618 goto exit; 628 goto exit;
619 } 629 }
@@ -626,7 +636,7 @@ static ssize_t sriov_numvfs_store(struct device *dev,
626 636
627 /* enable VFs */ 637 /* enable VFs */
628 if (pdev->sriov->num_VFs) { 638 if (pdev->sriov->num_VFs) {
629 dev_warn(&pdev->dev, "%d VFs already enabled. Disable before enabling %d VFs\n", 639 pci_warn(pdev, "%d VFs already enabled. Disable before enabling %d VFs\n",
630 pdev->sriov->num_VFs, num_vfs); 640 pdev->sriov->num_VFs, num_vfs);
631 ret = -EBUSY; 641 ret = -EBUSY;
632 goto exit; 642 goto exit;
@@ -637,7 +647,7 @@ static ssize_t sriov_numvfs_store(struct device *dev,
637 goto exit; 647 goto exit;
638 648
639 if (ret != num_vfs) 649 if (ret != num_vfs)
640 dev_warn(&pdev->dev, "%d VFs requested; only %d enabled\n", 650 pci_warn(pdev, "%d VFs requested; only %d enabled\n",
641 num_vfs, ret); 651 num_vfs, ret);
642 652
643exit: 653exit:
@@ -786,6 +796,7 @@ static struct attribute *pci_dev_attrs[] = {
786 &dev_attr_devspec.attr, 796 &dev_attr_devspec.attr,
787#endif 797#endif
788 &dev_attr_driver_override.attr, 798 &dev_attr_driver_override.attr,
799 &dev_attr_ari_enabled.attr,
789 NULL, 800 NULL,
790}; 801};
791 802
@@ -1216,14 +1227,9 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
1216 if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(res->start)) 1227 if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(res->start))
1217 return -EINVAL; 1228 return -EINVAL;
1218 1229
1219 if (!pci_mmap_fits(pdev, bar, vma, PCI_MMAP_SYSFS)) { 1230 if (!pci_mmap_fits(pdev, bar, vma, PCI_MMAP_SYSFS))
1220 WARN(1, "process \"%s\" tried to map 0x%08lx bytes at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n",
1221 current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff,
1222 pci_name(pdev), bar,
1223 (u64)pci_resource_start(pdev, bar),
1224 (u64)pci_resource_len(pdev, bar));
1225 return -EINVAL; 1231 return -EINVAL;
1226 } 1232
1227 mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; 1233 mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
1228 1234
1229 return pci_mmap_resource_range(pdev, bar, vma, mmap_type, write_combine); 1235 return pci_mmap_resource_range(pdev, bar, vma, mmap_type, write_combine);