mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
vdpa: add vdpa-dev support
Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Longpeng <longpeng2@huawei.com> Message-Id: <20221215134944.2809-3-longpeng2@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
2273324540
commit
b430a2bd23
4 changed files with 425 additions and 0 deletions
43
include/hw/virtio/vdpa-dev.h
Normal file
43
include/hw/virtio/vdpa-dev.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Vhost Vdpa Device
|
||||
*
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2022. All Rights Reserved.
|
||||
*
|
||||
* Authors:
|
||||
* Longpeng <longpeng2@huawei.com>
|
||||
*
|
||||
* Largely based on the "vhost-user-blk.h" implemented by:
|
||||
* Changpeng Liu <changpeng.liu@intel.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*/
|
||||
#ifndef _VHOST_VDPA_DEVICE_H
|
||||
#define _VHOST_VDPA_DEVICE_H
|
||||
|
||||
#include "hw/virtio/vhost.h"
|
||||
#include "hw/virtio/vhost-vdpa.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
|
||||
#define TYPE_VHOST_VDPA_DEVICE "vhost-vdpa-device"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(VhostVdpaDevice, VHOST_VDPA_DEVICE)
|
||||
|
||||
struct VhostVdpaDevice {
|
||||
VirtIODevice parent_obj;
|
||||
char *vhostdev;
|
||||
int vhostfd;
|
||||
int32_t bootindex;
|
||||
uint32_t vdev_id;
|
||||
uint32_t num_queues;
|
||||
struct vhost_dev dev;
|
||||
struct vhost_vdpa vdpa;
|
||||
VirtQueue **virtqs;
|
||||
uint8_t *config;
|
||||
int config_size;
|
||||
uint16_t queue_size;
|
||||
bool started;
|
||||
int (*post_init)(VhostVdpaDevice *v, Error **errp);
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue