mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
virtio,pci: features, cleanups
vdpa:
shadow vq vlan support
net migration with cvq
cxl:
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-buf
Fixes, cleanups all over the place.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-----BEGIN PGP SIGNATURE-----
iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmUd4/YPHG1zdEByZWRo
YXQuY29tAAoJECgfDbjSjVRpyM8H/02cRbJcQOjYt7j68zPW6GaDXxBI/UmdWDyG
15LZZbGNOPjyjNd3Vz1M7stQ5rhoKcgo/RdI+0E60a78svgW5JvpXoXR3pksc3Dx
v28B/akXwHUErYFSZQ+2VHNc8OhCd0v2ehxZxbwPEAYIOAj3hcCIVoPGXTnKJmAJ
imr5hjH0wZUc0+xdsmn8Vfdv5NTzpwfVObbGiMZejeJsaoh0y6Rt8RANBMY67KQD
S7/HPlVuDYf/y43t4ZEHNYuV9RaCdZZYlLWwV1scdKaYcofgmtJOKbOdCjHRXgj+
004Afb3rggIoCfnCzOFzhGx+MLDtLjvEn2N4oLEWCLi+k/3huaA=
=GAvH
-----END PGP SIGNATURE-----
Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging
virtio,pci: features, cleanups
vdpa:
shadow vq vlan support
net migration with cvq
cxl:
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-buf
Fixes, cleanups all over the place.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu: (53 commits)
libvhost-user: handle shared_object msg
vhost-user: add shared_object msg
hw/display: introduce virtio-dmabuf
util/uuid: add a hash function
virtio: remove unused next argument from virtqueue_split_read_next_desc()
virtio: remove unnecessary thread fence while reading next descriptor
virtio: use shadow_avail_idx while checking number of heads
libvhost-user.c: add assertion to vu_message_read_default
pcie_sriov: unregister_vfs(): fix error path
hw/i386/pc: improve physical address space bound check for 32-bit x86 systems
amd_iommu: Fix APIC address check
vdpa net: follow VirtIO initialization properly at cvq isolation probing
vdpa net: stop probing if cannot set features
vdpa net: fix error message setting virtio status
hw/pci-bridge/cxl-upstream: Add serial number extended capability support
hw/cxl: Support 4 HDM decoders at all levels of topology
hw/cxl: Fix and use same calculation for HDM decoder block size everywhere
hw/cxl: Add utility functions decoder interleave ways and target count.
hw/cxl: Push cxl_decoder_count_enc() and cxl_decode_ig() into .c
vdpa net: zero vhost_vdpa iova_tree pointer at cleanup
...
Conflicts:
hw/core/machine.c
Context conflict with commit 314e0a84cd
("hw/core: remove needless
includes") because it removed an adjacent #include.
This commit is contained in:
commit
2f3913f4b2
71 changed files with 2025 additions and 450 deletions
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "qapi/qapi-types-acpi.h"
|
||||
#include "qom/object.h"
|
||||
#include "hw/boards.h"
|
||||
#include "hw/qdev-core.h"
|
||||
|
||||
/* These values are part of guest ABI, and can not be changed */
|
||||
|
@ -52,7 +51,5 @@ struct AcpiDeviceIfClass {
|
|||
/* <public> */
|
||||
void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
|
||||
void (*send_event)(AcpiDeviceIf *adev, AcpiEventStatusBits ev);
|
||||
void (*madt_cpu)(int uid, const CPUArchIdList *apic_ids, GArray *entry,
|
||||
bool force_enabled);
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "hw/qdev-core.h"
|
||||
#include "hw/acpi/acpi.h"
|
||||
#include "hw/acpi/aml-build.h"
|
||||
#include "hw/boards.h"
|
||||
#include "hw/hotplug.h"
|
||||
|
||||
typedef struct AcpiCpuStatus {
|
||||
|
@ -55,8 +56,11 @@ typedef struct CPUHotplugFeatures {
|
|||
const char *smi_path;
|
||||
} CPUHotplugFeatures;
|
||||
|
||||
typedef void (*build_madt_cpu_fn)(int uid, const CPUArchIdList *apic_ids,
|
||||
GArray *entry, bool force_enabled);
|
||||
|
||||
void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
|
||||
hwaddr io_base,
|
||||
build_madt_cpu_fn build_madt_cpu, hwaddr io_base,
|
||||
const char *res_root,
|
||||
const char *event_handler_method);
|
||||
|
||||
|
|
|
@ -69,8 +69,6 @@
|
|||
#define TYPE_ACPI_GED "acpi-ged"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(AcpiGedState, ACPI_GED)
|
||||
|
||||
#define TYPE_ACPI_GED_X86 "acpi-ged-x86"
|
||||
|
||||
#define ACPI_GED_EVT_SEL_OFFSET 0x0
|
||||
#define ACPI_GED_EVT_SEL_LEN 0x4
|
||||
|
||||
|
|
|
@ -135,6 +135,10 @@ REG32(CXL_RAS_ERR_HEADER0, CXL_RAS_REGISTERS_OFFSET + 0x18)
|
|||
REG32(CXL_HDM_DECODER##n##_TARGET_LIST_LO, \
|
||||
CXL_HDM_REGISTERS_OFFSET + (0x20 * n) + 0x24) \
|
||||
REG32(CXL_HDM_DECODER##n##_TARGET_LIST_HI, \
|
||||
CXL_HDM_REGISTERS_OFFSET + (0x20 * n) + 0x28) \
|
||||
REG32(CXL_HDM_DECODER##n##_DPA_SKIP_LO, \
|
||||
CXL_HDM_REGISTERS_OFFSET + (0x20 * n) + 0x24) \
|
||||
REG32(CXL_HDM_DECODER##n##_DPA_SKIP_HI, \
|
||||
CXL_HDM_REGISTERS_OFFSET + (0x20 * n) + 0x28)
|
||||
|
||||
REG32(CXL_HDM_DECODER_CAPABILITY, CXL_HDM_REGISTERS_OFFSET)
|
||||
|
@ -147,7 +151,13 @@ REG32(CXL_HDM_DECODER_GLOBAL_CONTROL, CXL_HDM_REGISTERS_OFFSET + 4)
|
|||
FIELD(CXL_HDM_DECODER_GLOBAL_CONTROL, POISON_ON_ERR_EN, 0, 1)
|
||||
FIELD(CXL_HDM_DECODER_GLOBAL_CONTROL, HDM_DECODER_ENABLE, 1, 1)
|
||||
|
||||
/* Support 4 decoders at all levels of topology */
|
||||
#define CXL_HDM_DECODER_COUNT 4
|
||||
|
||||
HDM_DECODER_INIT(0);
|
||||
HDM_DECODER_INIT(1);
|
||||
HDM_DECODER_INIT(2);
|
||||
HDM_DECODER_INIT(3);
|
||||
|
||||
/* 8.2.5.13 - CXL Extended Security Capability Structure (Root complex only) */
|
||||
#define EXTSEC_ENTRY_MAX 256
|
||||
|
@ -225,26 +235,14 @@ void cxl_component_create_dvsec(CXLComponentState *cxl_cstate,
|
|||
enum reg_type cxl_dev_type, uint16_t length,
|
||||
uint16_t type, uint8_t rev, uint8_t *body);
|
||||
|
||||
static inline int cxl_decoder_count_enc(int count)
|
||||
{
|
||||
switch (count) {
|
||||
case 1: return 0;
|
||||
case 2: return 1;
|
||||
case 4: return 2;
|
||||
case 6: return 3;
|
||||
case 8: return 4;
|
||||
case 10: return 5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int cxl_decoder_count_enc(int count);
|
||||
int cxl_decoder_count_dec(int enc_cnt);
|
||||
|
||||
uint8_t cxl_interleave_ways_enc(int iw, Error **errp);
|
||||
int cxl_interleave_ways_dec(uint8_t iw_enc, Error **errp);
|
||||
uint8_t cxl_interleave_granularity_enc(uint64_t gran, Error **errp);
|
||||
|
||||
static inline hwaddr cxl_decode_ig(int ig)
|
||||
{
|
||||
return 1ULL << (ig + 8);
|
||||
}
|
||||
hwaddr cxl_decode_ig(int ig);
|
||||
|
||||
CXLComponentState *cxl_get_hb_cstate(PCIHostState *hb);
|
||||
bool cxl_get_hb_passthrough(PCIHostState *hb);
|
||||
|
|
|
@ -129,6 +129,12 @@ struct PCMachineClass {
|
|||
|
||||
/* resizable acpi blob compat */
|
||||
bool resizable_acpi_blob;
|
||||
|
||||
/*
|
||||
* whether the machine type implements broken 32-bit address space bound
|
||||
* check for memory.
|
||||
*/
|
||||
bool broken_32bit_mem_addr_check;
|
||||
};
|
||||
|
||||
#define TYPE_PC_MACHINE "generic-pc-machine"
|
||||
|
|
|
@ -77,6 +77,9 @@ struct PCIBridge {
|
|||
|
||||
pci_map_irq_fn map_irq;
|
||||
const char *bus_name;
|
||||
|
||||
/* SLT is RO for PCIE to PCIE bridges, but old QEMU versions had it RW */
|
||||
bool pcie_writeable_slt_bug;
|
||||
};
|
||||
|
||||
#define PCI_BRIDGE_DEV_PROP_CHASSIS_NR "chassis_nr"
|
||||
|
|
|
@ -196,4 +196,7 @@ int vhost_backend_handle_iotlb_msg(struct vhost_dev *dev,
|
|||
|
||||
int vhost_user_gpu_set_socket(struct vhost_dev *dev, int fd);
|
||||
|
||||
int vhost_user_get_shared_object(struct vhost_dev *dev, unsigned char *uuid,
|
||||
int *dmabuf_fd);
|
||||
|
||||
#endif /* VHOST_BACKEND_H */
|
||||
|
|
46
include/hw/virtio/vhost-user-device.h
Normal file
46
include/hw/virtio/vhost-user-device.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Vhost-user generic virtio device
|
||||
*
|
||||
* Copyright (c) 2023 Linaro Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef QEMU_VHOST_USER_DEVICE_H
|
||||
#define QEMU_VHOST_USER_DEVICE_H
|
||||
|
||||
#include "hw/virtio/vhost.h"
|
||||
#include "hw/virtio/vhost-user.h"
|
||||
|
||||
#define TYPE_VHOST_USER_BASE "vhost-user-base"
|
||||
|
||||
OBJECT_DECLARE_TYPE(VHostUserBase, VHostUserBaseClass, VHOST_USER_BASE)
|
||||
|
||||
struct VHostUserBase {
|
||||
VirtIODevice parent;
|
||||
/* Properties */
|
||||
CharBackend chardev;
|
||||
uint16_t virtio_id;
|
||||
uint32_t num_vqs;
|
||||
uint32_t config_size;
|
||||
/* State tracking */
|
||||
VhostUserState vhost_user;
|
||||
struct vhost_virtqueue *vhost_vq;
|
||||
struct vhost_dev vhost_dev;
|
||||
GPtrArray *vqs;
|
||||
bool connected;
|
||||
};
|
||||
|
||||
/* needed so we can use the base realize after specialisation
|
||||
tweaks */
|
||||
struct VHostUserBaseClass {
|
||||
/*< private >*/
|
||||
VirtioDeviceClass parent_class;
|
||||
/*< public >*/
|
||||
DeviceRealize parent_realize;
|
||||
};
|
||||
|
||||
/* shared for the benefit of the derived pci class */
|
||||
#define TYPE_VHOST_USER_DEVICE "vhost-user-device"
|
||||
|
||||
#endif /* QEMU_VHOST_USER_DEVICE_H */
|
|
@ -11,6 +11,28 @@
|
|||
#include "chardev/char-fe.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
|
||||
enum VhostUserProtocolFeature {
|
||||
VHOST_USER_PROTOCOL_F_MQ = 0,
|
||||
VHOST_USER_PROTOCOL_F_LOG_SHMFD = 1,
|
||||
VHOST_USER_PROTOCOL_F_RARP = 2,
|
||||
VHOST_USER_PROTOCOL_F_REPLY_ACK = 3,
|
||||
VHOST_USER_PROTOCOL_F_NET_MTU = 4,
|
||||
VHOST_USER_PROTOCOL_F_BACKEND_REQ = 5,
|
||||
VHOST_USER_PROTOCOL_F_CROSS_ENDIAN = 6,
|
||||
VHOST_USER_PROTOCOL_F_CRYPTO_SESSION = 7,
|
||||
VHOST_USER_PROTOCOL_F_PAGEFAULT = 8,
|
||||
VHOST_USER_PROTOCOL_F_CONFIG = 9,
|
||||
VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD = 10,
|
||||
VHOST_USER_PROTOCOL_F_HOST_NOTIFIER = 11,
|
||||
VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD = 12,
|
||||
VHOST_USER_PROTOCOL_F_RESET_DEVICE = 13,
|
||||
VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS = 14,
|
||||
VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS = 15,
|
||||
VHOST_USER_PROTOCOL_F_STATUS = 16,
|
||||
VHOST_USER_PROTOCOL_F_SHARED_OBJECT = 17,
|
||||
VHOST_USER_PROTOCOL_F_MAX
|
||||
};
|
||||
|
||||
/**
|
||||
* VhostUserHostNotifier - notifier information for one queue
|
||||
* @rcu: rcu_head for cleanup
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef struct vhost_vdpa {
|
|||
} VhostVDPA;
|
||||
|
||||
int vhost_vdpa_get_iova_range(int fd, struct vhost_vdpa_iova_range *iova_range);
|
||||
int vhost_vdpa_set_vring_ready(struct vhost_vdpa *v, unsigned idx);
|
||||
|
||||
int vhost_vdpa_dma_map(struct vhost_vdpa *v, uint32_t asid, hwaddr iova,
|
||||
hwaddr size, void *vaddr, bool readonly);
|
||||
|
|
100
include/hw/virtio/virtio-dmabuf.h
Normal file
100
include/hw/virtio/virtio-dmabuf.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Virtio Shared dma-buf
|
||||
*
|
||||
* Copyright Red Hat, Inc. 2023
|
||||
*
|
||||
* Authors:
|
||||
* Albert Esteve <aesteve@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 VIRTIO_DMABUF_H
|
||||
#define VIRTIO_DMABUF_H
|
||||
|
||||
#include "qemu/uuid.h"
|
||||
#include "vhost.h"
|
||||
|
||||
typedef enum SharedObjectType {
|
||||
TYPE_INVALID = 0,
|
||||
TYPE_DMABUF,
|
||||
TYPE_VHOST_DEV,
|
||||
} SharedObjectType;
|
||||
|
||||
typedef struct VirtioSharedObject {
|
||||
SharedObjectType type;
|
||||
gpointer value;
|
||||
} VirtioSharedObject;
|
||||
|
||||
/**
|
||||
* virtio_add_dmabuf() - Add a new dma-buf resource to the lookup table
|
||||
* @uuid: new resource's UUID
|
||||
* @dmabuf_fd: the dma-buf descriptor that will be stored and shared with
|
||||
* other virtio devices. The caller retains ownership over the
|
||||
* descriptor and its lifecycle.
|
||||
*
|
||||
* Note: @dmabuf_fd must be a valid (non-negative) file descriptor.
|
||||
*
|
||||
* Return: true if the UUID did not exist and the resource has been added,
|
||||
* false if another resource with the same UUID already existed.
|
||||
* Note that if it finds a repeated UUID, the resource is not inserted in
|
||||
* the lookup table.
|
||||
*/
|
||||
bool virtio_add_dmabuf(QemuUUID *uuid, int dmabuf_fd);
|
||||
|
||||
/**
|
||||
* virtio_add_vhost_device() - Add a new exporter vhost device that holds the
|
||||
* resource with the associated UUID
|
||||
* @uuid: new resource's UUID
|
||||
* @dev: the pointer to the vhost device that holds the resource. The caller
|
||||
* retains ownership over the device struct and its lifecycle.
|
||||
*
|
||||
* Return: true if the UUID did not exist and the device has been tracked,
|
||||
* false if another resource with the same UUID already existed.
|
||||
* Note that if it finds a repeated UUID, the resource is not inserted in
|
||||
* the lookup table.
|
||||
*/
|
||||
bool virtio_add_vhost_device(QemuUUID *uuid, struct vhost_dev *dev);
|
||||
|
||||
/**
|
||||
* virtio_remove_resource() - Removes a resource from the lookup table
|
||||
* @uuid: resource's UUID
|
||||
*
|
||||
* Return: true if the UUID has been found and removed from the lookup table.
|
||||
*/
|
||||
bool virtio_remove_resource(const QemuUUID *uuid);
|
||||
|
||||
/**
|
||||
* virtio_lookup_dmabuf() - Looks for a dma-buf resource in the lookup table
|
||||
* @uuid: resource's UUID
|
||||
*
|
||||
* Return: the dma-buf file descriptor integer, or -1 if the key is not found.
|
||||
*/
|
||||
int virtio_lookup_dmabuf(const QemuUUID *uuid);
|
||||
|
||||
/**
|
||||
* virtio_lookup_vhost_device() - Looks for an exporter vhost device in the
|
||||
* lookup table
|
||||
* @uuid: resource's UUID
|
||||
*
|
||||
* Return: pointer to the vhost_dev struct, or NULL if the key is not found.
|
||||
*/
|
||||
struct vhost_dev *virtio_lookup_vhost_device(const QemuUUID *uuid);
|
||||
|
||||
/**
|
||||
* virtio_object_type() - Looks for the type of resource in the lookup table
|
||||
* @uuid: resource's UUID
|
||||
*
|
||||
* Return: the type of resource associated with the UUID, or TYPE_INVALID if
|
||||
* the key is not found.
|
||||
*/
|
||||
SharedObjectType virtio_object_type(const QemuUUID *uuid);
|
||||
|
||||
/**
|
||||
* virtio_free_resources() - Destroys all keys and values of the shared
|
||||
* resources lookup table, and frees them
|
||||
*/
|
||||
void virtio_free_resources(void);
|
||||
|
||||
#endif /* VIRTIO_DMABUF_H */
|
|
@ -38,6 +38,12 @@ OBJECT_DECLARE_SIMPLE_TYPE(VirtIONet, VIRTIO_NET)
|
|||
/* Maximum VIRTIO_NET_CTRL_MAC_TABLE_SET unicast + multicast entries. */
|
||||
#define MAC_TABLE_ENTRIES 64
|
||||
|
||||
/*
|
||||
* The maximum number of VLANs in the VLAN filter table
|
||||
* added by VIRTIO_NET_CTRL_VLAN_ADD
|
||||
*/
|
||||
#define MAX_VLAN (1 << 12) /* Per 802.1Q definition */
|
||||
|
||||
typedef struct virtio_net_conf
|
||||
{
|
||||
uint32_t txtimer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue