Displaying 12 results from an estimated 12 matches for "pci_vfs_assigned".
2018 Jun 01
3
[PATCH v2] virtio_pci: support enabling VFs
...ruct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
+ struct virtio_device *vdev = &vp_dev->vdev;
+ int ret;
+
+ if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
+ return -EBUSY;
+
+ if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
+ return -EINVAL;
+
+ if (pci_vfs_assigned(pci_dev))
+ return -EPERM;
+
+ if (num_vfs == 0) {
+ pci_disable_sriov(pci_dev);
+ return 0;
+ }
+
+ ret = pci_enable_sriov(pci_dev, num_vfs);
+ if (ret < 0)
+ return ret;
+
+ return num_vfs;
+}
+
static struct pci_driver virtio_pci_driver = {
.name = "virtio-pci",
.id_table...
2018 Jun 01
3
[PATCH v2] virtio_pci: support enabling VFs
...ruct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
+ struct virtio_device *vdev = &vp_dev->vdev;
+ int ret;
+
+ if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
+ return -EBUSY;
+
+ if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
+ return -EINVAL;
+
+ if (pci_vfs_assigned(pci_dev))
+ return -EPERM;
+
+ if (num_vfs == 0) {
+ pci_disable_sriov(pci_dev);
+ return 0;
+ }
+
+ ret = pci_enable_sriov(pci_dev, num_vfs);
+ if (ret < 0)
+ return ret;
+
+ return num_vfs;
+}
+
static struct pci_driver virtio_pci_driver = {
.name = "virtio-pci",
.id_table...
2018 Jun 01
2
[PATCH v3] virtio_pci: support enabling VFs
...ruct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
+ struct virtio_device *vdev = &vp_dev->vdev;
+ int ret;
+
+ if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
+ return -EBUSY;
+
+ if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
+ return -EINVAL;
+
+ if (pci_vfs_assigned(pci_dev))
+ return -EPERM;
+
+ if (num_vfs == 0) {
+ pci_disable_sriov(pci_dev);
+ return 0;
+ }
+
+ ret = pci_enable_sriov(pci_dev, num_vfs);
+ if (ret < 0)
+ return ret;
+
+ return num_vfs;
+}
+
static struct pci_driver virtio_pci_driver = {
.name = "virtio-pci",
.id_table...
2018 Jun 01
2
[PATCH v3] virtio_pci: support enabling VFs
...ruct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
+ struct virtio_device *vdev = &vp_dev->vdev;
+ int ret;
+
+ if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
+ return -EBUSY;
+
+ if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
+ return -EINVAL;
+
+ if (pci_vfs_assigned(pci_dev))
+ return -EPERM;
+
+ if (num_vfs == 0) {
+ pci_disable_sriov(pci_dev);
+ return 0;
+ }
+
+ ret = pci_enable_sriov(pci_dev, num_vfs);
+ if (ret < 0)
+ return ret;
+
+ return num_vfs;
+}
+
static struct pci_driver virtio_pci_driver = {
.name = "virtio-pci",
.id_table...
2018 Jun 05
2
[virtio-dev] Re: [PATCH v3] virtio_pci: support enabling VFs
...&vp_dev->vdev;
> > + int ret;
> > +
> > + if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
> > + return -EBUSY;
> > +
> > + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> > + return -EINVAL;
> > +
> > + if (pci_vfs_assigned(pci_dev))
> > + return -EPERM;
> > +
> > + if (num_vfs == 0) {
> > + pci_disable_sriov(pci_dev);
> > + return 0;
> > + }
> > +
> > + ret = pci_enable_sriov(pci_dev, num_vfs);
> > + if (ret < 0)
> > + return ret;
> > +
> >...
2018 Jun 06
2
[virtio-dev] Re: [PATCH v3] virtio_pci: support enabling VFs
...> + if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
> > > > + return -EBUSY;
> > > > +
> > > > + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> > > > + return -EINVAL;
> > > > +
> > > > + if (pci_vfs_assigned(pci_dev))
> > > > + return -EPERM;
> > > > +
> > > > + if (num_vfs == 0) {
> > > > + pci_disable_sriov(pci_dev);
> > > > + return 0;
> > > > + }
> > > > +
> > > > + ret = pci_enable_sriov(pci_dev, num...
2018 Jun 06
2
[virtio-dev] Re: [PATCH v3] virtio_pci: support enabling VFs
...IO_CONFIG_S_DRIVER_OK))
> > > > > > + return -EBUSY;
> > > > > > +
> > > > > > + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> > > > > > + return -EINVAL;
> > > > > > +
> > > > > > + if (pci_vfs_assigned(pci_dev))
> > > > > > + return -EPERM;
> > > > > > +
> > > > > > + if (num_vfs == 0) {
> > > > > > + pci_disable_sriov(pci_dev);
> > > > > > + return 0;
> > > > > > + }
> > > >...
2018 Jun 01
0
[PATCH v2] virtio_pci: support enabling VFs
...ci_dev);
> + struct virtio_device *vdev = &vp_dev->vdev;
> + int ret;
> +
> + if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
> + return -EBUSY;
> +
> + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> + return -EINVAL;
> +
> + if (pci_vfs_assigned(pci_dev))
> + return -EPERM;
Not a comment on this patch - existing code has the
same race - but generally
1. this seems racy since assigning vfs does not seem
to take device lock
2. does this work correctly for kvm at all?
pci_set_dev_assigned seems to be only called by xen.
Can you l...
2018 Jun 04
0
[PATCH v3] virtio_pci: support enabling VFs
...ci_dev);
> + struct virtio_device *vdev = &vp_dev->vdev;
> + int ret;
> +
> + if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
> + return -EBUSY;
> +
> + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> + return -EINVAL;
> +
> + if (pci_vfs_assigned(pci_dev))
> + return -EPERM;
> +
> + if (num_vfs == 0) {
> + pci_disable_sriov(pci_dev);
> + return 0;
> + }
> +
> + ret = pci_enable_sriov(pci_dev, num_vfs);
> + if (ret < 0)
> + return ret;
> +
> + return num_vfs;
> +}
> +
> static struct pci_d...
2018 Jun 05
0
[virtio-dev] Re: [PATCH v3] virtio_pci: support enabling VFs
...t;
> > > +
> > > + if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
> > > + return -EBUSY;
> > > +
> > > + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> > > + return -EINVAL;
> > > +
> > > + if (pci_vfs_assigned(pci_dev))
> > > + return -EPERM;
> > > +
> > > + if (num_vfs == 0) {
> > > + pci_disable_sriov(pci_dev);
> > > + return 0;
> > > + }
> > > +
> > > + ret = pci_enable_sriov(pci_dev, num_vfs);
> > > + if (ret < 0)...
2018 Jun 06
0
[virtio-dev] Re: [PATCH v3] virtio_pci: support enabling VFs
...gt;get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
> > > > > + return -EBUSY;
> > > > > +
> > > > > + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> > > > > + return -EINVAL;
> > > > > +
> > > > > + if (pci_vfs_assigned(pci_dev))
> > > > > + return -EPERM;
> > > > > +
> > > > > + if (num_vfs == 0) {
> > > > > + pci_disable_sriov(pci_dev);
> > > > > + return 0;
> > > > > + }
> > > > > +
> > > > &g...
2018 Jun 06
0
[virtio-dev] Re: [PATCH v3] virtio_pci: support enabling VFs
...gt; > > > > > + return -EBUSY;
> > > > > > > +
> > > > > > > + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> > > > > > > + return -EINVAL;
> > > > > > > +
> > > > > > > + if (pci_vfs_assigned(pci_dev))
> > > > > > > + return -EPERM;
> > > > > > > +
> > > > > > > + if (num_vfs == 0) {
> > > > > > > + pci_disable_sriov(pci_dev);
> > > > > > > + return 0;
> > > > > >...