mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-09 02:24:45 +00:00
dm: virtio: remove hv_caps from virtio_ops
currently, each virtio device has their own virtio_ops implementation.
Take virtio-blk for example:
static struct virtio_ops virtio_blk_ops = {
"virtio_blk",
1,
sizeof(struct virtio_blk_config),
virtio_blk_reset,
virtio_blk_notify,
virtio_blk_cfgread,
virtio_blk_cfgwrite,
NULL,
NULL,
VIRTIO_BLK_S_HOSTCAPS,
};
If start DM with two virtio-blk, this global variable will be
assigined to two virtio-blk instances. Changing hv_caps for one
instance will affect others. But different instances may need
different capabilities.
To support this requirement, we suggest to move hv_caps to
virtio_base structure, and each instance can return their own
capabilities.
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
@@ -143,7 +143,6 @@ static struct virtio_ops virtio_blk_ops = {
|
||||
virtio_blk_cfgwrite, /* write PCI config */
|
||||
NULL, /* apply negotiated features */
|
||||
NULL, /* called on guest set status */
|
||||
VIRTIO_BLK_S_HOSTCAPS, /* our capabilities */
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -339,6 +338,7 @@ virtio_blk_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||
/* init virtio struct and virtqueues */
|
||||
virtio_linkup(&blk->base, &virtio_blk_ops, blk, dev, &blk->vq);
|
||||
blk->base.mtx = &blk->mtx;
|
||||
blk->base.device_caps = VIRTIO_BLK_S_HOSTCAPS;
|
||||
|
||||
blk->vq.qsize = VIRTIO_BLK_RINGSZ;
|
||||
/* blk->vq.vq_notify = we have no per-queue notify */
|
||||
|
||||
Reference in New Issue
Block a user