mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
virtio, pc, pci: features, fixes, cleanups
virtio-pmem support. libvhost user mq support. A bunch of fixes all over the place. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- iQEbBAABAgAGBQJdHmkBAAoJECgfDbjSjVRpEAIH+Kmy8n5Et9NzsnmNqHAiC/pg 3V5wGyp9M4ZJVPXC0z/Q1sYJ3YYP6dBd4tjj2/7LzYZSlqlQIs83UlQCo0XTiliH /jZD/IaAZABnfB7vAeZW67WNT2a20xG2Jr83083lSaDUI/pfIdvbMelIbBLmo/kd tWdAAWT0kcGYjyz4xQQgtAH6zAQUleKE7ECUJ2TpJQbSMLxdI/YTaoYqek471YdP ju5OLBO3WbNkSE9JYz4MJqTudYK0sKu568UqBVF8JdpFd5Cv+X/OI+bCsc4QK8KN DTtFVVvbm1KGPSceqc9rwsDjO4Wd8ThvuZxrB029AahD6vT82F13IHpi/S29Fw== =WAFb -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging virtio, pc, pci: features, fixes, cleanups virtio-pmem support. libvhost user mq support. A bunch of fixes all over the place. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Thu 04 Jul 2019 22:00:49 BST # gpg: using RSA key 281F0DB8D28D5469 # 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: (22 commits) docs: avoid vhost-user-net specifics in multiqueue section libvhost-user: implement VHOST_USER_PROTOCOL_F_MQ libvhost-user: support many virtqueues libvhost-user: add vmsg_set_reply_u64() helper pc: Move compat_apic_id_mode variable to PCMachineClass virtio: Don't change "started" flag on virtio_vmstate_change() virtio: Make sure we get correct state of device on handle_aio_output() virtio: Set "start_on_kick" on virtio_set_features() virtio: Set "start_on_kick" for legacy devices virtio: add "use-started" property virtio-pci: fix missing device properties pc: Support for virtio-pmem-pci numa: Handle virtio-pmem in NUMA stats hmp: Handle virtio-pmem when printing memory device infos virtio-pci: Proxy for virtio-pmem virtio-pmem: sync linux headers virtio-pci: Allow to specify additional interfaces for the base type virtio-pmem: add virtio device pcie: minor cleanups for slot control/status pcie: work around for racy guest init ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
c35d17cabc
36 changed files with 843 additions and 161 deletions
|
@ -134,6 +134,9 @@ typedef struct PCMachineClass {
|
|||
|
||||
/* use PVH to load kernels that support this feature */
|
||||
bool pvh_enabled;
|
||||
|
||||
/* Enables contiguous-apic-ID mode */
|
||||
bool compat_apic_id_mode;
|
||||
} PCMachineClass;
|
||||
|
||||
#define TYPE_PC_MACHINE "generic-pc-machine"
|
||||
|
|
|
@ -85,6 +85,7 @@ extern bool pci_available;
|
|||
#define PCI_DEVICE_ID_VIRTIO_RNG 0x1005
|
||||
#define PCI_DEVICE_ID_VIRTIO_9P 0x1009
|
||||
#define PCI_DEVICE_ID_VIRTIO_VSOCK 0x1012
|
||||
#define PCI_DEVICE_ID_VIRTIO_PMEM 0x1013
|
||||
|
||||
#define PCI_VENDOR_ID_REDHAT 0x1b36
|
||||
#define PCI_DEVICE_ID_REDHAT_BRIDGE 0x0001
|
||||
|
|
|
@ -107,7 +107,9 @@ void pcie_cap_lnkctl_reset(PCIDevice *dev);
|
|||
|
||||
void pcie_cap_slot_init(PCIDevice *dev, uint16_t slot);
|
||||
void pcie_cap_slot_reset(PCIDevice *dev);
|
||||
void pcie_cap_slot_get(PCIDevice *dev, uint16_t *slot_ctl, uint16_t *slt_sta);
|
||||
void pcie_cap_slot_write_config(PCIDevice *dev,
|
||||
uint16_t old_slot_ctl, uint16_t old_slt_sta,
|
||||
uint32_t addr, uint32_t val, int len);
|
||||
int pcie_cap_slot_post_load(void *opaque, int version_id);
|
||||
void pcie_cap_slot_push_attention_button(PCIDevice *dev);
|
||||
|
|
49
include/hw/virtio/virtio-pmem.h
Normal file
49
include/hw/virtio/virtio-pmem.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Virtio PMEM device
|
||||
*
|
||||
* Copyright (C) 2018-2019 Red Hat, Inc.
|
||||
*
|
||||
* Authors:
|
||||
* Pankaj Gupta <pagupta@redhat.com>
|
||||
* 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_PMEM_H
|
||||
#define HW_VIRTIO_PMEM_H
|
||||
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "sysemu/hostmem.h"
|
||||
|
||||
#define TYPE_VIRTIO_PMEM "virtio-pmem"
|
||||
|
||||
#define VIRTIO_PMEM(obj) \
|
||||
OBJECT_CHECK(VirtIOPMEM, (obj), TYPE_VIRTIO_PMEM)
|
||||
#define VIRTIO_PMEM_CLASS(oc) \
|
||||
OBJECT_CLASS_CHECK(VirtIOPMEMClass, (oc), TYPE_VIRTIO_PMEM)
|
||||
#define VIRTIO_PMEM_GET_CLASS(obj) \
|
||||
OBJECT_GET_CLASS(VirtIOPMEMClass, (obj), TYPE_VIRTIO_PMEM)
|
||||
|
||||
#define VIRTIO_PMEM_ADDR_PROP "memaddr"
|
||||
#define VIRTIO_PMEM_MEMDEV_PROP "memdev"
|
||||
|
||||
typedef struct VirtIOPMEM {
|
||||
VirtIODevice parent_obj;
|
||||
|
||||
VirtQueue *rq_vq;
|
||||
uint64_t start;
|
||||
HostMemoryBackend *memdev;
|
||||
} VirtIOPMEM;
|
||||
|
||||
typedef struct VirtIOPMEMClass {
|
||||
/* private */
|
||||
VirtIODevice parent;
|
||||
|
||||
/* public */
|
||||
void (*fill_device_info)(const VirtIOPMEM *pmem, VirtioPMEMDeviceInfo *vi);
|
||||
MemoryRegion *(*get_memory_region)(VirtIOPMEM *pmem, Error **errp);
|
||||
} VirtIOPMEMClass;
|
||||
|
||||
#endif
|
|
@ -105,8 +105,9 @@ struct VirtIODevice
|
|||
uint16_t device_id;
|
||||
bool vm_running;
|
||||
bool broken; /* device in invalid state, needs reset */
|
||||
bool use_started;
|
||||
bool started;
|
||||
bool start_on_kick; /* virtio 1.0 transitional devices support that */
|
||||
bool start_on_kick; /* when virtio 1.0 feature has not been negotiated */
|
||||
VMChangeStateEntry *vmstate;
|
||||
char *bus_name;
|
||||
uint8_t device_endian;
|
||||
|
@ -351,4 +352,24 @@ static inline bool virtio_is_big_endian(VirtIODevice *vdev)
|
|||
/* Devices conforming to VIRTIO 1.0 or later are always LE. */
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
|
||||
{
|
||||
if (vdev->use_started) {
|
||||
return vdev->started;
|
||||
}
|
||||
|
||||
return status & VIRTIO_CONFIG_S_DRIVER_OK;
|
||||
}
|
||||
|
||||
static inline void virtio_set_started(VirtIODevice *vdev, bool started)
|
||||
{
|
||||
if (started) {
|
||||
vdev->start_on_kick = false;
|
||||
}
|
||||
|
||||
if (vdev->use_started) {
|
||||
vdev->started = started;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue