mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
vhost-vdpa: introduce vhost-vdpa backend
Currently we have 2 types of vhost backends in QEMU: vhost kernel and vhost-user. The above patch provides a generic device for vDPA purpose, this vDPA device exposes to user space a non-vendor-specific configuration interface for setting up a vhost HW accelerator, this patch set introduces a third vhost backend called vhost-vdpa based on the vDPA interface. Vhost-vdpa usage: qemu-system-x86_64 -cpu host -enable-kvm \ ...... -netdev type=vhost-vdpa,vhostdev=/dev/vhost-vdpa-id,id=vhost-vdpa0 \ -device virtio-net-pci,netdev=vhost-vdpa0,page-per-vq=on \ Signed-off-by: Lingshan zhu <lingshan.zhu@intel.com> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com> Signed-off-by: Cindy Lu <lulu@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20200701145538.22333-14-lulu@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
38140cc4d9
commit
108a64818e
12 changed files with 600 additions and 7 deletions
|
@ -17,7 +17,8 @@ typedef enum VhostBackendType {
|
|||
VHOST_BACKEND_TYPE_NONE = 0,
|
||||
VHOST_BACKEND_TYPE_KERNEL = 1,
|
||||
VHOST_BACKEND_TYPE_USER = 2,
|
||||
VHOST_BACKEND_TYPE_MAX = 3,
|
||||
VHOST_BACKEND_TYPE_VDPA = 3,
|
||||
VHOST_BACKEND_TYPE_MAX = 4,
|
||||
} VhostBackendType;
|
||||
|
||||
typedef enum VhostSetConfigType {
|
||||
|
@ -170,6 +171,7 @@ typedef struct VhostOps {
|
|||
} VhostOps;
|
||||
|
||||
extern const VhostOps user_ops;
|
||||
extern const VhostOps vdpa_ops;
|
||||
|
||||
int vhost_set_backend_type(struct vhost_dev *dev,
|
||||
VhostBackendType backend_type);
|
||||
|
|
26
include/hw/virtio/vhost-vdpa.h
Normal file
26
include/hw/virtio/vhost-vdpa.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* vhost-vdpa.h
|
||||
*
|
||||
* Copyright(c) 2017-2018 Intel Corporation.
|
||||
* Copyright(c) 2020 Red Hat, Inc.
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HW_VIRTIO_VHOST_VDPA_H
|
||||
#define HW_VIRTIO_VHOST_VDPA_H
|
||||
|
||||
#include "hw/virtio/virtio.h"
|
||||
|
||||
typedef struct vhost_vdpa {
|
||||
int device_fd;
|
||||
uint32_t msg_type;
|
||||
MemoryListener listener;
|
||||
} VhostVDPA;
|
||||
|
||||
extern AddressSpace address_space_memory;
|
||||
extern int vhost_vdpa_get_device_id(struct vhost_dev *dev,
|
||||
uint32_t *device_id);
|
||||
#endif
|
|
@ -92,6 +92,13 @@ struct vhost_dev {
|
|||
const VhostDevConfigOps *config_ops;
|
||||
};
|
||||
|
||||
struct vhost_net {
|
||||
struct vhost_dev dev;
|
||||
struct vhost_virtqueue vqs[2];
|
||||
int backend;
|
||||
NetClientState *nc;
|
||||
};
|
||||
|
||||
int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
|
||||
VhostBackendType backend_type,
|
||||
uint32_t busyloop_timeout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue