diff options
author | Yishai Hadas <yishaih@nvidia.com> | 2024-11-13 13:51:56 +0200 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2024-11-13 15:25:41 -0700 |
commit | bfcad518605d927eff17ffb8ce0a828d7b7ac79f (patch) | |
tree | facfd68aa9222df5b4ba56cd5f546ff6af28b494 /drivers/virtio/virtio_pci_common.h | |
parent | 704806ca400e5daa86c110f14bfdda9d28203bb7 (diff) | |
download | linux-bfcad518605d927eff17ffb8ce0a828d7b7ac79f.tar.gz linux-bfcad518605d927eff17ffb8ce0a828d7b7ac79f.tar.bz2 linux-bfcad518605d927eff17ffb8ce0a828d7b7ac79f.zip |
virtio: Manage device and driver capabilities via the admin commands
Manage device and driver capabilities via the admin commands.
The device exposes its supported features and resource object limits via
an administrative command called VIRTIO_ADMIN_CMD_CAP_ID_LIST_QUERY,
using the 'self group type.'
Each capability is identified by a unique ID, and the driver
communicates the functionality and resource limits it plans to utilize.
The capability VIRTIO_DEV_PARTS_CAP specifically represents the device's
parts resource object limit.
Manage the device's parts resource object ID using a common IDA for both
get and set operations.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://lore.kernel.org/r/20241113115200.209269-4-yishaih@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/virtio/virtio_pci_common.h')
-rw-r--r-- | drivers/virtio/virtio_pci_common.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/virtio/virtio_pci_common.h b/drivers/virtio/virtio_pci_common.h index 1d9c49947f52..04b1d17663b3 100644 --- a/drivers/virtio/virtio_pci_common.h +++ b/drivers/virtio/virtio_pci_common.h @@ -48,6 +48,9 @@ struct virtio_pci_admin_vq { /* Protects virtqueue access. */ spinlock_t lock; u64 supported_cmds; + u64 supported_caps; + u8 max_dev_parts_objects; + struct ida dev_parts_ida; /* Name of the admin queue: avq.$vq_index. */ char name[10]; u16 vq_index; @@ -167,15 +170,21 @@ struct virtio_device *virtio_pci_vf_get_pf_dev(struct pci_dev *pdev); BIT_ULL(VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ) | \ BIT_ULL(VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO)) +#define VIRTIO_DEV_PARTS_ADMIN_CMD_BITMAP \ + (BIT_ULL(VIRTIO_ADMIN_CMD_CAP_ID_LIST_QUERY) | \ + BIT_ULL(VIRTIO_ADMIN_CMD_DRIVER_CAP_SET) | \ + BIT_ULL(VIRTIO_ADMIN_CMD_DEVICE_CAP_GET)) + /* Unlike modern drivers which support hardware virtio devices, legacy drivers * assume software-based devices: e.g. they don't use proper memory barriers * on ARM, use big endian on PPC, etc. X86 drivers are mostly ok though, more * or less by chance. For now, only support legacy IO on X86. */ #ifdef CONFIG_VIRTIO_PCI_ADMIN_LEGACY -#define VIRTIO_ADMIN_CMD_BITMAP VIRTIO_LEGACY_ADMIN_CMD_BITMAP +#define VIRTIO_ADMIN_CMD_BITMAP (VIRTIO_LEGACY_ADMIN_CMD_BITMAP | \ + VIRTIO_DEV_PARTS_ADMIN_CMD_BITMAP) #else -#define VIRTIO_ADMIN_CMD_BITMAP 0 +#define VIRTIO_ADMIN_CMD_BITMAP VIRTIO_DEV_PARTS_ADMIN_CMD_BITMAP #endif void vp_modern_avq_done(struct virtqueue *vq); |