Loading arch/s390/pci/pci_bus.c +3 −2 Original line number Diff line number Diff line Loading @@ -197,9 +197,10 @@ void pcibios_bus_add_device(struct pci_dev *pdev) * With pdev->no_vf_scan the common PCI probing code does not * perform PF/VF linking. */ if (zdev->vfn) if (zdev->vfn) { zpci_bus_setup_virtfn(zdev->zbus, pdev, zdev->vfn); pdev->no_command_memory = 1; } } static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev) Loading drivers/pci/iov.c +1 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,7 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id) virtfn->device = iov->vf_device; virtfn->is_virtfn = 1; virtfn->physfn = pci_dev_get(dev); virtfn->no_command_memory = 1; if (id == 0) pci_read_vf_config_common(virtfn); Loading drivers/vfio/pci/vfio_pci.c +0 −1 Original line number Diff line number Diff line Loading @@ -1862,7 +1862,6 @@ static const struct vfio_device_ops vfio_pci_ops = { static int vfio_pci_reflck_attach(struct vfio_pci_device *vdev); static void vfio_pci_reflck_put(struct vfio_pci_reflck *reflck); static struct pci_driver vfio_pci_driver; static int vfio_pci_bus_notifier(struct notifier_block *nb, unsigned long action, void *data) Loading drivers/vfio/pci/vfio_pci_config.c +14 −10 Original line number Diff line number Diff line Loading @@ -406,7 +406,7 @@ bool __vfio_pci_memory_enabled(struct vfio_pci_device *vdev) * PF SR-IOV capability, there's therefore no need to trigger * faults based on the virtual value. */ return pdev->is_virtfn || (cmd & PCI_COMMAND_MEMORY); return pdev->no_command_memory || (cmd & PCI_COMMAND_MEMORY); } /* Loading Loading @@ -523,8 +523,8 @@ static int vfio_basic_config_read(struct vfio_pci_device *vdev, int pos, count = vfio_default_config_read(vdev, pos, count, perm, offset, val); /* Mask in virtual memory enable for SR-IOV devices */ if (offset == PCI_COMMAND && vdev->pdev->is_virtfn) { /* Mask in virtual memory enable */ if (offset == PCI_COMMAND && vdev->pdev->no_command_memory) { u16 cmd = le16_to_cpu(*(__le16 *)&vdev->vconfig[PCI_COMMAND]); u32 tmp_val = le32_to_cpu(*val); Loading Loading @@ -592,9 +592,11 @@ static int vfio_basic_config_write(struct vfio_pci_device *vdev, int pos, * shows it disabled (phys_mem/io, then the device has * undergone some kind of backdoor reset and needs to be * restored before we allow it to enable the bars. * SR-IOV devices will trigger this, but we catch them later * SR-IOV devices will trigger this - for mem enable let's * catch this now and for io enable it will be caught later */ if ((new_mem && virt_mem && !phys_mem) || if ((new_mem && virt_mem && !phys_mem && !pdev->no_command_memory) || (new_io && virt_io && !phys_io) || vfio_need_bar_restore(vdev)) vfio_bar_restore(vdev); Loading Loading @@ -1737,12 +1739,14 @@ int vfio_config_init(struct vfio_pci_device *vdev) vconfig[PCI_INTERRUPT_PIN]); vconfig[PCI_INTERRUPT_PIN] = 0; /* Gratuitous for good VFs */ } if (pdev->no_command_memory) { /* * VFs do no implement the memory enable bit of the COMMAND * register therefore we'll not have it set in our initial * copy of config space after pci_enable_device(). For * consistency with PFs, set the virtual enable bit here. * VFs and devices that set pdev->no_command_memory do not * implement the memory enable bit of the COMMAND register * therefore we'll not have it set in our initial copy of * config space after pci_enable_device(). For consistency * with PFs, set the virtual enable bit here. */ *(__le16 *)&vconfig[PCI_COMMAND] |= cpu_to_le16(PCI_COMMAND_MEMORY); Loading drivers/vfio/vfio.c +7 −2 Original line number Diff line number Diff line Loading @@ -1949,8 +1949,10 @@ int vfio_pin_pages(struct device *dev, unsigned long *user_pfn, int npage, if (!group) return -ENODEV; if (group->dev_counter > 1) return -EINVAL; if (group->dev_counter > 1) { ret = -EINVAL; goto err_pin_pages; } ret = vfio_group_add_container_user(group); if (ret) Loading Loading @@ -2051,6 +2053,9 @@ int vfio_group_pin_pages(struct vfio_group *group, if (!group || !user_iova_pfn || !phys_pfn || !npage) return -EINVAL; if (group->dev_counter > 1) return -EINVAL; if (npage > VFIO_PIN_PAGES_MAX_ENTRIES) return -E2BIG; Loading Loading
arch/s390/pci/pci_bus.c +3 −2 Original line number Diff line number Diff line Loading @@ -197,9 +197,10 @@ void pcibios_bus_add_device(struct pci_dev *pdev) * With pdev->no_vf_scan the common PCI probing code does not * perform PF/VF linking. */ if (zdev->vfn) if (zdev->vfn) { zpci_bus_setup_virtfn(zdev->zbus, pdev, zdev->vfn); pdev->no_command_memory = 1; } } static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev) Loading
drivers/pci/iov.c +1 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,7 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id) virtfn->device = iov->vf_device; virtfn->is_virtfn = 1; virtfn->physfn = pci_dev_get(dev); virtfn->no_command_memory = 1; if (id == 0) pci_read_vf_config_common(virtfn); Loading
drivers/vfio/pci/vfio_pci.c +0 −1 Original line number Diff line number Diff line Loading @@ -1862,7 +1862,6 @@ static const struct vfio_device_ops vfio_pci_ops = { static int vfio_pci_reflck_attach(struct vfio_pci_device *vdev); static void vfio_pci_reflck_put(struct vfio_pci_reflck *reflck); static struct pci_driver vfio_pci_driver; static int vfio_pci_bus_notifier(struct notifier_block *nb, unsigned long action, void *data) Loading
drivers/vfio/pci/vfio_pci_config.c +14 −10 Original line number Diff line number Diff line Loading @@ -406,7 +406,7 @@ bool __vfio_pci_memory_enabled(struct vfio_pci_device *vdev) * PF SR-IOV capability, there's therefore no need to trigger * faults based on the virtual value. */ return pdev->is_virtfn || (cmd & PCI_COMMAND_MEMORY); return pdev->no_command_memory || (cmd & PCI_COMMAND_MEMORY); } /* Loading Loading @@ -523,8 +523,8 @@ static int vfio_basic_config_read(struct vfio_pci_device *vdev, int pos, count = vfio_default_config_read(vdev, pos, count, perm, offset, val); /* Mask in virtual memory enable for SR-IOV devices */ if (offset == PCI_COMMAND && vdev->pdev->is_virtfn) { /* Mask in virtual memory enable */ if (offset == PCI_COMMAND && vdev->pdev->no_command_memory) { u16 cmd = le16_to_cpu(*(__le16 *)&vdev->vconfig[PCI_COMMAND]); u32 tmp_val = le32_to_cpu(*val); Loading Loading @@ -592,9 +592,11 @@ static int vfio_basic_config_write(struct vfio_pci_device *vdev, int pos, * shows it disabled (phys_mem/io, then the device has * undergone some kind of backdoor reset and needs to be * restored before we allow it to enable the bars. * SR-IOV devices will trigger this, but we catch them later * SR-IOV devices will trigger this - for mem enable let's * catch this now and for io enable it will be caught later */ if ((new_mem && virt_mem && !phys_mem) || if ((new_mem && virt_mem && !phys_mem && !pdev->no_command_memory) || (new_io && virt_io && !phys_io) || vfio_need_bar_restore(vdev)) vfio_bar_restore(vdev); Loading Loading @@ -1737,12 +1739,14 @@ int vfio_config_init(struct vfio_pci_device *vdev) vconfig[PCI_INTERRUPT_PIN]); vconfig[PCI_INTERRUPT_PIN] = 0; /* Gratuitous for good VFs */ } if (pdev->no_command_memory) { /* * VFs do no implement the memory enable bit of the COMMAND * register therefore we'll not have it set in our initial * copy of config space after pci_enable_device(). For * consistency with PFs, set the virtual enable bit here. * VFs and devices that set pdev->no_command_memory do not * implement the memory enable bit of the COMMAND register * therefore we'll not have it set in our initial copy of * config space after pci_enable_device(). For consistency * with PFs, set the virtual enable bit here. */ *(__le16 *)&vconfig[PCI_COMMAND] |= cpu_to_le16(PCI_COMMAND_MEMORY); Loading
drivers/vfio/vfio.c +7 −2 Original line number Diff line number Diff line Loading @@ -1949,8 +1949,10 @@ int vfio_pin_pages(struct device *dev, unsigned long *user_pfn, int npage, if (!group) return -ENODEV; if (group->dev_counter > 1) return -EINVAL; if (group->dev_counter > 1) { ret = -EINVAL; goto err_pin_pages; } ret = vfio_group_add_container_user(group); if (ret) Loading Loading @@ -2051,6 +2053,9 @@ int vfio_group_pin_pages(struct vfio_group *group, if (!group || !user_iova_pfn || !phys_pfn || !npage) return -EINVAL; if (group->dev_counter > 1) return -EINVAL; if (npage > VFIO_PIN_PAGES_MAX_ENTRIES) return -E2BIG; Loading