5619003173
vDPA/ifcvf: get_config_size should return dev specific config size
...
get_config_size() should return the size based on the decected
device type.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20210419063326.3748-4-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-05-03 04:55:54 -04:00
6ad31d162a
vDPA/ifcvf: enable Intel C5000X-PL virtio-block for vDPA
...
This commit enabled Intel FPGA SmartNIC C5000X-PL virtio-block
for vDPA.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20210419063326.3748-3-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-05-03 04:55:54 -04:00
26bfea1309
vDPA/ifcvf: deduce VIRTIO device ID when probe
...
This commit deduces VIRTIO device ID as device type when probe,
then ifcvf_vdpa_get_device_id() can simply return the ID.
ifcvf_vdpa_get_features() and ifcvf_vdpa_get_config_size()
can work properly based on the device ID.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Link: https://lore.kernel.org/r/20210419063326.3748-2-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Acked-by: Jason Wang <jasowang@redhat.com >
2021-05-03 04:55:54 -04:00
442706f9f9
vdpa: add get_config_size callback in vdpa_config_ops
...
This new callback is used to get the size of the configuration space
of vDPA devices.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com >
Link: https://lore.kernel.org/r/20210315163450.254396-9-sgarzare@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Acked-by: Jason Wang <jasowang@redhat.com >
2021-05-03 04:55:53 -04:00
e8ef612495
vDPA/ifcvf: deduce VIRTIO device ID from pdev ids
...
This commit deduces the VIRTIO device ID of a probed
device from its pdev device ids.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Link: https://lore.kernel.org/r/20210317094933.16417-8-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Acked-by: Jason Wang <jasowang@redhat.com >
2021-05-03 04:55:52 -04:00
1d895a6808
vDPA/ifcvf: verify mandatory feature bits for vDPA
...
vDPA requres VIRTIO_F_ACCESS_PLATFORM as a must, this commit
examines this when set features.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20210317094933.16417-7-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-05-03 04:55:52 -04:00
69d00d9858
vDPA/ifcvf: fetch device feature bits when probe
...
This commit would read and store device feature
bits when probe.
rename ifcvf_get_features() to ifcvf_get_hw_features(),
it reads and stores features of the probed device.
new ifcvf_get_features() simply returns stored
feature bits.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20210317094933.16417-6-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-05-03 04:55:52 -04:00
2f1b305070
vDPA/ifcvf: remove the version number string
...
This commit removes the version number string, using kernel
version is enough.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Reviewed-by: Leon Romanovsky <leonro@nvidia.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20210317094933.16417-5-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-05-03 04:55:52 -04:00
51fc387b67
vDPA/ifcvf: rename original IFCVF dev ids to N3000 ids
...
IFCVF driver probes multiple types of devices now,
to distinguish the original device driven by IFCVF
from others, it is renamed as "N3000".
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20210317094933.16417-4-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-05-03 04:55:52 -04:00
139c3fd9c9
vDPA/ifcvf: enable Intel C5000X-PL virtio-net for vDPA
...
This commit enabled Intel FPGA SmartNIC C5000X-PL virtio-net
for vDPA
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20210317094933.16417-3-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-05-03 04:55:52 -04:00
0ecb196078
vDPA/ifcvf: get_vendor_id returns a device specific vendor id
...
In this commit, ifcvf_get_vendor_id() will return
a device specific vendor id of the probed pci device
than a hard code.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20210317094933.16417-2-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-05-03 04:55:52 -04:00
f00bdce045
vdpa: set the virtqueue num during register
...
This patch delay the queue number setting to vDPA device
registering. This allows us to probe the virtqueue numbers between
device allocation and registering.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com >
Signed-off-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20210223061905.422659-3-jasowang@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-02-25 14:26:00 -05:00
fd70a406a3
vdpa: Extend routine to accept vdpa device name
...
In a subsequent patch, when user initiated command creates a vdpa device,
the user chooses the name of the vdpa device.
To support it, extend the device allocation API to consider this name
specified by the caller driver.
Signed-off-by: Parav Pandit <parav@nvidia.com >
Reviewed-by: Eli Cohen <elic@nvidia.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20210105103203.82508-3-parav@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-02-23 07:52:56 -05:00
4d10367fd4
vdpa: ifcvf: Use dma_set_mask_and_coherent to simplify code
...
'pci_set_dma_mask()' + 'pci_set_consistent_dma_mask()' can be replaced by
an equivalent 'dma_set_mask_and_coherent()' which is much less verbose.
While at it, fix a typo (s/confiugration/configuration)
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Link: https://lore.kernel.org/r/20201129125434.1462638-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Acked-by: Jason Wang <jasowang@redhat.com >
2020-12-18 16:14:28 -05:00
2b9f28d5e8
vdpa: ifcvf: free config irq in ifcvf_free_irq()
...
We don't free config irq in ifcvf_free_irq() which will trigger a
BUG() in pci core since we try to free the vectors that has an
action. Fixing this by recording the config irq in ifcvf_hw structure
and free it in ifcvf_free_irq().
Fixes: e7991f376a
("ifcvf: implement config interrupt in IFCVF")
Cc: Zhu Lingshan <lingshan.zhu@intel.com >
Signed-off-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20200723091254.20617-2-jasowang@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Reviewed-by: Zhu Lingshan <lingshan.zhu@intel.com >
Fixes: e7991f376a
("ifcvf: implement config interrupt in IFCVF")
Cc: Zhu Lingshan <a class="moz-txt-link-rfc2396E" href="mailto:lingshan.zhu@intel.com "><lingshan.zhu@intel.com ></a>
Signed-off-by: Jason Wang <a class="moz-txt-link-rfc2396E" href="mailto:jasowang@redhat.com "><jasowang@redhat.com ></a>
2020-08-26 08:13:59 -04:00
9f4ce5d72b
vdpa: ifcvf: return err when fail to request config irq
...
We ignore the err of requesting config interrupt, fix this.
Fixes: e7991f376a
("ifcvf: implement config interrupt in IFCVF")
Cc: Zhu Lingshan <lingshan.zhu@intel.com >
Signed-off-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20200723091254.20617-1-jasowang@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Reviewed-by: Zhu Lingshan <lingshan.zhu@intel.com >
Fixes: e7991f376a
("ifcvf: implement config interrupt in IFCVF")
Cc: Zhu Lingshan <a class="moz-txt-link-rfc2396E" href="mailto:lingshan.zhu@intel.com "><lingshan.zhu@intel.com ></a>
Signed-off-by: Jason Wang <a class="moz-txt-link-rfc2396E" href="mailto:jasowang@redhat.com "><jasowang@redhat.com ></a>
Tested-by: Maxime Coquelin <maxime.coquelin@redhat.com >
2020-08-26 07:10:53 -04:00
23750e39d5
vdpa: Modify get_vq_state() to return error code
...
Modify get_vq_state() so it returns an error code. In case of hardware
acceleration, the available index may be retrieved from the device, an
operation that can possibly fail.
Reviewed-by: Parav Pandit <parav@mellanox.com >
Signed-off-by: Eli Cohen <eli@mellanox.com >
Link: https://lore.kernel.org/r/20200804162048.22587-9-eli@mellanox.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Acked-by: Jason Wang <jasowang@redhat.com >
2020-08-05 19:00:23 -04:00
aac50c0bd4
net/vdpa: Use struct for set/get vq state
...
For now VQ state involves 16 bit available index value encoded in u64
variable. In the future it will be extended to contain more fields. Use
struct to contain the state, now containing only a single u16 for the
available index. In the future we can add fields to this struct.
Reviewed-by: Parav Pandit <parav@mellanox.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Signed-off-by: Eli Cohen <eli@mellanox.com >
Link: https://lore.kernel.org/r/20200804162048.22587-8-eli@mellanox.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-08-05 18:39:19 -04:00
a9974489b6
vdpa: remove hard coded virtq num
...
This will enable vdpa providers to add support for multi queue feature
and publish it to upper layers (vhost and virtio).
Signed-off-by: Max Gurtovoy <maxg@mellanox.com >
Reviewed-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20200804162048.22587-7-eli@mellanox.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-08-05 18:39:18 -04:00
3597a2fba6
ifcvf: implement vdpa_config_ops.get_vq_irq()
...
This commit implemented vdpa_config_ops.get_vq_irq() in ifcvf,
and initialized vq irq to -EINVAL. So that ifcvf can report
irq number of a vq, or -EINVAL if the vq is not assigned an
irq number.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Suggested-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20200731065533.4144-6-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-08-05 11:08:42 -04:00
321bd21261
virtio: VIRTIO_F_IOMMU_PLATFORM -> VIRTIO_F_ACCESS_PLATFORM
...
Rename the bit to match latest virtio spec.
Add a compat macro to avoid breaking existing userspace.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Reviewed-by: David Hildenbrand <david@redhat.com >
2020-08-03 16:11:42 -04:00
e7991f376a
ifcvf: implement config interrupt in IFCVF
...
This commit implements config interrupt support
in IFC VF
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/1591352835-22441-6-git-send-email-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-06-06 16:26:47 -04:00
bb02e6e63d
ifcvf: ignore continuous setting same status value
...
User space may try to set status of same value multiple times,
this patch handles this case more efficiently by ignoring the
setting of the same status value.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Link: https://lore.kernel.org/r/1591352835-22441-3-git-send-email-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-06-06 16:25:22 -04:00
7dd793f37e
ifcvf: move IRQ request/free to status change handlers
...
This commit move IRQ request and free operations from probe()
to VIRTIO status change handler to comply with VIRTIO spec.
VIRTIO spec 1.1, section 2.1.2 Device Requirements: Device Status Field
The device MUST NOT consume buffers or send any used buffer
notifications to the driver before DRIVER_OK.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com >
Link: https://lore.kernel.org/r/1589270444-3669-1-git-send-email-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Acked-by: Jason Wang <jasowang@redhat.com >
2020-06-04 15:36:51 -04:00
425a507023
vdpa: allow a 32 bit vq alignment
...
get_vq_align returns u16 now, but that's not enough for
systems/devices with 64K pages. All callers assign it to
a u32 variable anyway, so let's just change the return
value type to u32.
Reported-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-04-17 06:05:30 -04:00
cf29b1ceb6
vdpa: remove unused variables 'ifcvf' and 'ifcvf_lm'
...
drivers/vdpa/ifcvf/ifcvf_main.c:34:24:
warning: variable ‘ifcvf’ set but not used [-Wunused-but-set-variable]
drivers/vdpa/ifcvf/ifcvf_base.c:304:31:
warning: variable ‘ifcvf_lm’ set but not used [-Wunused-but-set-variable]
Reported-by: Hulk Robot <hulkci@huawei.com >
Signed-off-by: YueHaibing <yuehaibing@huawei.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Link: https://lore.kernel.org/r/20200402024626.32944-1-yuehaibing@huawei.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-04-16 18:31:04 -04:00
c9b9f5f8c0
vdpa: move to drivers/vdpa
...
We have both vhost and virtio drivers that depend on vdpa.
It's easier to locate it at a top level directory otherwise
we run into issues e.g. if vhost is built-in but virtio
is modular. Let's just move it up a level.
Reported-by: Randy Dunlap <rdunlap@infradead.org >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-04-02 10:41:40 -04:00