Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'pci/jiang-iov-fixes' into next

* pci/jiang-iov-fixes:
PCI: Hide remove and rescan sysfs interfaces for SR-IOV virtual functions
PCI: Finish SR-IOV VF setup before adding the device

+30 -5
+2 -3
drivers/pci/iov.c
··· 92 92 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device); 93 93 pci_setup_device(virtfn); 94 94 virtfn->dev.parent = dev->dev.parent; 95 + virtfn->physfn = pci_dev_get(dev); 96 + virtfn->is_virtfn = 1; 95 97 96 98 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { 97 99 res = dev->resource + PCI_IOV_RESOURCES + i; ··· 114 112 115 113 pci_device_add(virtfn, virtfn->bus); 116 114 mutex_unlock(&iov->dev->sriov->lock); 117 - 118 - virtfn->physfn = pci_dev_get(dev); 119 - virtfn->is_virtfn = 1; 120 115 121 116 rc = pci_bus_add_device(virtfn); 122 117 sprintf(buf, "virtfn%u", id);
+28 -2
drivers/pci/pci-sysfs.c
··· 325 325 } 326 326 return count; 327 327 } 328 + struct device_attribute dev_rescan_attr = __ATTR(rescan, (S_IWUSR|S_IWGRP), 329 + NULL, dev_rescan_store); 328 330 329 331 static void remove_callback(struct device *dev) 330 332 { ··· 356 354 count = ret; 357 355 return count; 358 356 } 357 + struct device_attribute dev_remove_attr = __ATTR(remove, (S_IWUSR|S_IWGRP), 358 + NULL, remove_store); 359 359 360 360 static ssize_t 361 361 dev_bus_rescan_store(struct device *dev, struct device_attribute *attr, ··· 508 504 __ATTR(broken_parity_status,(S_IRUGO|S_IWUSR), 509 505 broken_parity_status_show,broken_parity_status_store), 510 506 __ATTR(msi_bus, 0644, msi_bus_show, msi_bus_store), 511 - __ATTR(remove, (S_IWUSR|S_IWGRP), NULL, remove_store), 512 - __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_rescan_store), 513 507 #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) 514 508 __ATTR(d3cold_allowed, 0644, d3cold_allowed_show, d3cold_allowed_store), 515 509 #endif ··· 1465 1463 return a->mode; 1466 1464 } 1467 1465 1466 + static struct attribute *pci_dev_hp_attrs[] = { 1467 + &dev_remove_attr.attr, 1468 + &dev_rescan_attr.attr, 1469 + NULL, 1470 + }; 1471 + 1472 + static umode_t pci_dev_hp_attrs_are_visible(struct kobject *kobj, 1473 + struct attribute *a, int n) 1474 + { 1475 + struct device *dev = container_of(kobj, struct device, kobj); 1476 + struct pci_dev *pdev = to_pci_dev(dev); 1477 + 1478 + if (pdev->is_virtfn) 1479 + return 0; 1480 + 1481 + return a->mode; 1482 + } 1483 + 1484 + static struct attribute_group pci_dev_hp_attr_group = { 1485 + .attrs = pci_dev_hp_attrs, 1486 + .is_visible = pci_dev_hp_attrs_are_visible, 1487 + }; 1488 + 1468 1489 #ifdef CONFIG_PCI_IOV 1469 1490 static struct attribute *sriov_dev_attrs[] = { 1470 1491 &sriov_totalvfs_attr.attr, ··· 1519 1494 1520 1495 static const struct attribute_group *pci_dev_attr_groups[] = { 1521 1496 &pci_dev_attr_group, 1497 + &pci_dev_hp_attr_group, 1522 1498 #ifdef CONFIG_PCI_IOV 1523 1499 &sriov_dev_attr_group, 1524 1500 #endif