summaryrefslogtreecommitdiff
path: root/include/linux/virtio_pci_modern.h
diff options
context:
space:
mode:
authorShannon Nelson <shannon.nelson@amd.com>2023-05-19 14:56:22 -0700
committerMichael S. Tsirkin <mst@redhat.com>2023-06-27 10:47:08 -0400
commita37c0191acbd58efab4da43372585207f30e3102 (patch)
tree9af003f9c6de7acc51e3bde0e64fa168f3d950d6 /include/linux/virtio_pci_modern.h
parent4f0fc22534e3d81ebd470e899fed3c0dbb4aeb56 (diff)
virtio: allow caller to override device id in vp_modern
To add a bit of vendor flexibility with various virtio based devices, allow the caller to check for a different device id. This adds a function pointer field to struct virtio_pci_modern_device to specify an override device id check. If defined by the driver, this function will be called to check that the PCI device is the vendor's expected device, and will return the found device id to be stored in mdev->id.device. This allows vendors with alternative vendor device ids to use this library on their own device BAR. Note: A lot of the diff in this is simply indenting the existing code into an else block. Signed-off-by: Shannon Nelson <shannon.nelson@amd.com> Acked-by: Jason Wang <jasowang@redhat.com> Message-Id: <20230519215632.12343-2-shannon.nelson@amd.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/linux/virtio_pci_modern.h')
-rw-r--r--include/linux/virtio_pci_modern.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/virtio_pci_modern.h b/include/linux/virtio_pci_modern.h
index c4eeb79b0139..e7b1db1dd0bb 100644
--- a/include/linux/virtio_pci_modern.h
+++ b/include/linux/virtio_pci_modern.h
@@ -38,6 +38,9 @@ struct virtio_pci_modern_device {
int modern_bars;
struct virtio_device_id id;
+
+ /* optional check for vendor virtio device, returns dev_id or -ERRNO */
+ int (*device_id_check)(struct pci_dev *pdev);
};
/*