mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
virtio,acpi: features, fixes, cleanups.
vdpa support virtio-mem support a handy script for disassembling acpi tables misc fixes and cleanups Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAl8EY+MPHG1zdEByZWRo YXQuY29tAAoJECgfDbjSjVRpOMkIAMMhfbzZXlwv1xiQ/pMTtEqXDnLeic7NK6xF RJkAFlMM+eEXBRZLYJXhPAFjneTA813vR0xlygHn2pYhCF3ozTfLqEABfQsG0w+d VDSYTnFHAx2GwGGQBNYltsIs+8lAADYhlo9VG/qC5nAsNaoVBeTJLuF96un1WGDz vWH0Cx/AG+yhiKvlSHA/CCSXMVGVTkRfUCjGF8Yq0mVtx23OZ9blQkJRkGfHWctB GxQlh/b+4YLaXhy+V1+/Iu2U45KgKN7qrsyKvHBMgKd2qazowr/D8Aexh4hN/eg5 jibmxurDHXze+VUDCySy6qLBBySNkz++qLKfPOQ0iszDHLXQzOQ= =H/KL -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging virtio,acpi: features, fixes, cleanups. vdpa support virtio-mem support a handy script for disassembling acpi tables misc fixes and cleanups Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 07 Jul 2020 13:00:35 BST # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: (41 commits) vhost-vdpa: introduce vhost-vdpa net client vhost-vdpa: introduce vhost-vdpa backend vhost_net: introduce set_config & get_config vhost: implement vhost_force_iommu method vhost: introduce new VhostOps vhost_force_iommu vhost: implement vhost_vq_get_addr method vhost: introduce new VhostOps vhost_vq_get_addr vhost: implement vhost_dev_start method vhost: introduce new VhostOps vhost_dev_start vhost: check the existence of vhost_set_iotlb_callback virtio-pci: implement queue_enabled method virtio-bus: introduce queue_enabled method vhost_net: use the function qemu_get_peer net: introduce qemu_get_peer MAINTAINERS: add VT-d entry docs: vhost-user: add Virtio status protocol feature tests/acpi: remove stale allowed tables numa: Auto-enable NUMA when any memory devices are possible virtio-mem: Exclude unplugged memory during migration virtio-mem: Add trace events ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> # Conflicts: # hw/arm/virt.c # hw/virtio/trace-events
This commit is contained in:
commit
c8eaf81fd2
67 changed files with 2639 additions and 169 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 {
|
||||
|
@ -34,6 +35,7 @@ struct vhost_vring_state;
|
|||
struct vhost_vring_addr;
|
||||
struct vhost_scsi_target;
|
||||
struct vhost_iotlb_msg;
|
||||
struct vhost_virtqueue;
|
||||
|
||||
typedef int (*vhost_backend_init)(struct vhost_dev *dev, void *opaque);
|
||||
typedef int (*vhost_backend_cleanup)(struct vhost_dev *dev);
|
||||
|
@ -112,6 +114,16 @@ typedef int (*vhost_get_inflight_fd_op)(struct vhost_dev *dev,
|
|||
typedef int (*vhost_set_inflight_fd_op)(struct vhost_dev *dev,
|
||||
struct vhost_inflight *inflight);
|
||||
|
||||
typedef int (*vhost_dev_start_op)(struct vhost_dev *dev, bool started);
|
||||
|
||||
typedef int (*vhost_vq_get_addr_op)(struct vhost_dev *dev,
|
||||
struct vhost_vring_addr *addr,
|
||||
struct vhost_virtqueue *vq);
|
||||
|
||||
typedef int (*vhost_get_device_id_op)(struct vhost_dev *dev, uint32_t *dev_id);
|
||||
|
||||
typedef bool (*vhost_force_iommu_op)(struct vhost_dev *dev);
|
||||
|
||||
typedef struct VhostOps {
|
||||
VhostBackendType backend_type;
|
||||
vhost_backend_init vhost_backend_init;
|
||||
|
@ -152,9 +164,14 @@ typedef struct VhostOps {
|
|||
vhost_backend_mem_section_filter_op vhost_backend_mem_section_filter;
|
||||
vhost_get_inflight_fd_op vhost_get_inflight_fd;
|
||||
vhost_set_inflight_fd_op vhost_set_inflight_fd;
|
||||
vhost_dev_start_op vhost_dev_start;
|
||||
vhost_vq_get_addr_op vhost_vq_get_addr;
|
||||
vhost_get_device_id_op vhost_get_device_id;
|
||||
vhost_force_iommu_op vhost_force_iommu;
|
||||
} 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);
|
||||
|
|
|
@ -83,6 +83,10 @@ typedef struct VirtioBusClass {
|
|||
*/
|
||||
int (*ioeventfd_assign)(DeviceState *d, EventNotifier *notifier,
|
||||
int n, bool assign);
|
||||
/*
|
||||
* Whether queue number n is enabled.
|
||||
*/
|
||||
bool (*queue_enabled)(DeviceState *d, int n);
|
||||
/*
|
||||
* Does the transport have variable vring alignment?
|
||||
* (ie can it ever call virtio_queue_set_align()?)
|
||||
|
|
86
include/hw/virtio/virtio-mem.h
Normal file
86
include/hw/virtio/virtio-mem.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Virtio MEM device
|
||||
*
|
||||
* Copyright (C) 2020 Red Hat, Inc.
|
||||
*
|
||||
* Authors:
|
||||
* David Hildenbrand <david@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef HW_VIRTIO_MEM_H
|
||||
#define HW_VIRTIO_MEM_H
|
||||
|
||||
#include "standard-headers/linux/virtio_mem.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "qapi/qapi-types-misc.h"
|
||||
#include "sysemu/hostmem.h"
|
||||
|
||||
#define TYPE_VIRTIO_MEM "virtio-mem"
|
||||
|
||||
#define VIRTIO_MEM(obj) \
|
||||
OBJECT_CHECK(VirtIOMEM, (obj), TYPE_VIRTIO_MEM)
|
||||
#define VIRTIO_MEM_CLASS(oc) \
|
||||
OBJECT_CLASS_CHECK(VirtIOMEMClass, (oc), TYPE_VIRTIO_MEM)
|
||||
#define VIRTIO_MEM_GET_CLASS(obj) \
|
||||
OBJECT_GET_CLASS(VirtIOMEMClass, (obj), TYPE_VIRTIO_MEM)
|
||||
|
||||
#define VIRTIO_MEM_MEMDEV_PROP "memdev"
|
||||
#define VIRTIO_MEM_NODE_PROP "node"
|
||||
#define VIRTIO_MEM_SIZE_PROP "size"
|
||||
#define VIRTIO_MEM_REQUESTED_SIZE_PROP "requested-size"
|
||||
#define VIRTIO_MEM_BLOCK_SIZE_PROP "block-size"
|
||||
#define VIRTIO_MEM_ADDR_PROP "memaddr"
|
||||
|
||||
typedef struct VirtIOMEM {
|
||||
VirtIODevice parent_obj;
|
||||
|
||||
/* guest -> host request queue */
|
||||
VirtQueue *vq;
|
||||
|
||||
/* bitmap used to track unplugged memory */
|
||||
int32_t bitmap_size;
|
||||
unsigned long *bitmap;
|
||||
|
||||
/* assigned memory backend and memory region */
|
||||
HostMemoryBackend *memdev;
|
||||
|
||||
/* NUMA node */
|
||||
uint32_t node;
|
||||
|
||||
/* assigned address of the region in guest physical memory */
|
||||
uint64_t addr;
|
||||
|
||||
/* usable region size (<= region_size) */
|
||||
uint64_t usable_region_size;
|
||||
|
||||
/* actual size (how much the guest plugged) */
|
||||
uint64_t size;
|
||||
|
||||
/* requested size */
|
||||
uint64_t requested_size;
|
||||
|
||||
/* block size and alignment */
|
||||
uint64_t block_size;
|
||||
|
||||
/* notifiers to notify when "size" changes */
|
||||
NotifierList size_change_notifiers;
|
||||
|
||||
/* don't migrate unplugged memory */
|
||||
NotifierWithReturn precopy_notifier;
|
||||
} VirtIOMEM;
|
||||
|
||||
typedef struct VirtIOMEMClass {
|
||||
/* private */
|
||||
VirtIODevice parent;
|
||||
|
||||
/* public */
|
||||
void (*fill_device_info)(const VirtIOMEM *vmen, VirtioMEMDeviceInfo *vi);
|
||||
MemoryRegion *(*get_memory_region)(VirtIOMEM *vmem, Error **errp);
|
||||
void (*add_size_change_notifier)(VirtIOMEM *vmem, Notifier *notifier);
|
||||
void (*remove_size_change_notifier)(VirtIOMEM *vmem, Notifier *notifier);
|
||||
} VirtIOMEMClass;
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue