mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
virtio,vhost,pci,pc: features, fixes and cleanups - new stats in virtio balloon - virtio eventfd rework for boot speedup - vhost memory rework for boot speedup - fixes and cleanups all over the place Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 13 Feb 2018 16:29:55 GMT # gpg: using RSA key 281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" # 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) virtio-balloon: include statistics of disk/file caches acpi-test: update FADT lpc: drop pcie host dependency tests: acpi: fix FADT not being compared to reference table hw/pci-bridge: fix pcie root port's IO hints capability libvhost-user: Support across-memory-boundary access libvhost-user: Fix resource leak virtio-balloon: unref the memory region before continuing pci: removed the is_express field since a uniform interface was inserted virtio-blk: enable multiple vectors when using multiple I/O queues pci/bus: let it has higher migration priority pci-bridge/i82801b11: clear bridge registers on platform reset vhost: Move log_dirty check vhost: Merge and delete unused callbacks vhost: Clean out old vhost_set_memory and friends vhost: Regenerate region list from changed sections list vhost: Merge sections added to temporary list vhost: Simplify ring verification checks vhost: Build temporary section list and deref after commit virtio: improve virtio devices initialization time ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -118,15 +118,22 @@ vu_panic(VuDev *dev, const char *msg, ...)
|
||||
|
||||
/* Translate guest physical address to our virtual address. */
|
||||
void *
|
||||
vu_gpa_to_va(VuDev *dev, uint64_t guest_addr)
|
||||
vu_gpa_to_va(VuDev *dev, uint64_t *plen, uint64_t guest_addr)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (*plen == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find matching memory region. */
|
||||
for (i = 0; i < dev->nregions; i++) {
|
||||
VuDevRegion *r = &dev->regions[i];
|
||||
|
||||
if ((guest_addr >= r->gpa) && (guest_addr < (r->gpa + r->size))) {
|
||||
if ((guest_addr + *plen) > (r->gpa + r->size)) {
|
||||
*plen = r->gpa + r->size - guest_addr;
|
||||
}
|
||||
return (void *)(uintptr_t)
|
||||
guest_addr - r->gpa + r->mmap_addr + r->mmap_offset;
|
||||
}
|
||||
@@ -407,6 +414,15 @@ vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)
|
||||
{
|
||||
int i;
|
||||
VhostUserMemory *memory = &vmsg->payload.memory;
|
||||
|
||||
for (i = 0; i < dev->nregions; i++) {
|
||||
VuDevRegion *r = &dev->regions[i];
|
||||
void *m = (void *) (uintptr_t) r->mmap_addr;
|
||||
|
||||
if (m) {
|
||||
munmap(m, r->size + r->mmap_offset);
|
||||
}
|
||||
}
|
||||
dev->nregions = memory->nregions;
|
||||
|
||||
DPRINT("Nregions: %d\n", memory->nregions);
|
||||
@@ -472,9 +488,14 @@ vu_set_log_base_exec(VuDev *dev, VhostUserMsg *vmsg)
|
||||
|
||||
rc = mmap(0, log_mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
|
||||
log_mmap_offset);
|
||||
close(fd);
|
||||
if (rc == MAP_FAILED) {
|
||||
perror("log mmap error");
|
||||
}
|
||||
|
||||
if (dev->log_table) {
|
||||
munmap(dev->log_table, dev->log_size);
|
||||
}
|
||||
dev->log_table = rc;
|
||||
dev->log_size = log_mmap_size;
|
||||
|
||||
@@ -1102,6 +1123,37 @@ virtqueue_get_head(VuDev *dev, VuVirtq *vq,
|
||||
return true;
|
||||
}
|
||||
|
||||
static int
|
||||
virtqueue_read_indirect_desc(VuDev *dev, struct vring_desc *desc,
|
||||
uint64_t addr, size_t len)
|
||||
{
|
||||
struct vring_desc *ori_desc;
|
||||
uint64_t read_len;
|
||||
|
||||
if (len > (VIRTQUEUE_MAX_SIZE * sizeof(struct vring_desc))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (len) {
|
||||
read_len = len;
|
||||
ori_desc = vu_gpa_to_va(dev, &read_len, addr);
|
||||
if (!ori_desc) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(desc, ori_desc, read_len);
|
||||
len -= read_len;
|
||||
addr += read_len;
|
||||
desc += read_len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum {
|
||||
VIRTQUEUE_READ_DESC_ERROR = -1,
|
||||
VIRTQUEUE_READ_DESC_DONE = 0, /* end of chain */
|
||||
@@ -1148,8 +1200,10 @@ vu_queue_get_avail_bytes(VuDev *dev, VuVirtq *vq, unsigned int *in_bytes,
|
||||
}
|
||||
|
||||
while ((rc = virtqueue_num_heads(dev, vq, idx)) > 0) {
|
||||
unsigned int max, num_bufs, indirect = 0;
|
||||
unsigned int max, desc_len, num_bufs, indirect = 0;
|
||||
uint64_t desc_addr, read_len;
|
||||
struct vring_desc *desc;
|
||||
struct vring_desc desc_buf[VIRTQUEUE_MAX_SIZE];
|
||||
unsigned int i;
|
||||
|
||||
max = vq->vring.num;
|
||||
@@ -1173,8 +1227,24 @@ vu_queue_get_avail_bytes(VuDev *dev, VuVirtq *vq, unsigned int *in_bytes,
|
||||
|
||||
/* loop over the indirect descriptor table */
|
||||
indirect = 1;
|
||||
max = desc[i].len / sizeof(struct vring_desc);
|
||||
desc = vu_gpa_to_va(dev, desc[i].addr);
|
||||
desc_addr = desc[i].addr;
|
||||
desc_len = desc[i].len;
|
||||
max = desc_len / sizeof(struct vring_desc);
|
||||
read_len = desc_len;
|
||||
desc = vu_gpa_to_va(dev, &read_len, desc_addr);
|
||||
if (unlikely(desc && read_len != desc_len)) {
|
||||
/* Failed to use zero copy */
|
||||
desc = NULL;
|
||||
if (!virtqueue_read_indirect_desc(dev, desc_buf,
|
||||
desc_addr,
|
||||
desc_len)) {
|
||||
desc = desc_buf;
|
||||
}
|
||||
}
|
||||
if (!desc) {
|
||||
vu_panic(dev, "Invalid indirect buffer table");
|
||||
goto err;
|
||||
}
|
||||
num_bufs = i = 0;
|
||||
}
|
||||
|
||||
@@ -1372,9 +1442,24 @@ virtqueue_map_desc(VuDev *dev,
|
||||
return;
|
||||
}
|
||||
|
||||
iov[num_sg].iov_base = vu_gpa_to_va(dev, pa);
|
||||
iov[num_sg].iov_len = sz;
|
||||
num_sg++;
|
||||
while (sz) {
|
||||
uint64_t len = sz;
|
||||
|
||||
if (num_sg == max_num_sg) {
|
||||
vu_panic(dev, "virtio: too many descriptors in indirect table");
|
||||
return;
|
||||
}
|
||||
|
||||
iov[num_sg].iov_base = vu_gpa_to_va(dev, &len, pa);
|
||||
if (iov[num_sg].iov_base == NULL) {
|
||||
vu_panic(dev, "virtio: invalid address for buffers");
|
||||
return;
|
||||
}
|
||||
iov[num_sg].iov_len = len;
|
||||
num_sg++;
|
||||
sz -= len;
|
||||
pa += len;
|
||||
}
|
||||
|
||||
*p_num_sg = num_sg;
|
||||
}
|
||||
@@ -1406,10 +1491,12 @@ virtqueue_alloc_element(size_t sz,
|
||||
void *
|
||||
vu_queue_pop(VuDev *dev, VuVirtq *vq, size_t sz)
|
||||
{
|
||||
unsigned int i, head, max;
|
||||
unsigned int i, head, max, desc_len;
|
||||
uint64_t desc_addr, read_len;
|
||||
VuVirtqElement *elem;
|
||||
unsigned out_num, in_num;
|
||||
struct iovec iov[VIRTQUEUE_MAX_SIZE];
|
||||
struct vring_desc desc_buf[VIRTQUEUE_MAX_SIZE];
|
||||
struct vring_desc *desc;
|
||||
int rc;
|
||||
|
||||
@@ -1450,8 +1537,24 @@ vu_queue_pop(VuDev *dev, VuVirtq *vq, size_t sz)
|
||||
}
|
||||
|
||||
/* loop over the indirect descriptor table */
|
||||
max = desc[i].len / sizeof(struct vring_desc);
|
||||
desc = vu_gpa_to_va(dev, desc[i].addr);
|
||||
desc_addr = desc[i].addr;
|
||||
desc_len = desc[i].len;
|
||||
max = desc_len / sizeof(struct vring_desc);
|
||||
read_len = desc_len;
|
||||
desc = vu_gpa_to_va(dev, &read_len, desc_addr);
|
||||
if (unlikely(desc && read_len != desc_len)) {
|
||||
/* Failed to use zero copy */
|
||||
desc = NULL;
|
||||
if (!virtqueue_read_indirect_desc(dev, desc_buf,
|
||||
desc_addr,
|
||||
desc_len)) {
|
||||
desc = desc_buf;
|
||||
}
|
||||
}
|
||||
if (!desc) {
|
||||
vu_panic(dev, "Invalid indirect buffer table");
|
||||
return NULL;
|
||||
}
|
||||
i = 0;
|
||||
}
|
||||
|
||||
@@ -1527,7 +1630,9 @@ vu_log_queue_fill(VuDev *dev, VuVirtq *vq,
|
||||
unsigned int len)
|
||||
{
|
||||
struct vring_desc *desc = vq->vring.desc;
|
||||
unsigned int i, max, min;
|
||||
unsigned int i, max, min, desc_len;
|
||||
uint64_t desc_addr, read_len;
|
||||
struct vring_desc desc_buf[VIRTQUEUE_MAX_SIZE];
|
||||
unsigned num_bufs = 0;
|
||||
|
||||
max = vq->vring.num;
|
||||
@@ -1539,8 +1644,24 @@ vu_log_queue_fill(VuDev *dev, VuVirtq *vq,
|
||||
}
|
||||
|
||||
/* loop over the indirect descriptor table */
|
||||
max = desc[i].len / sizeof(struct vring_desc);
|
||||
desc = vu_gpa_to_va(dev, desc[i].addr);
|
||||
desc_addr = desc[i].addr;
|
||||
desc_len = desc[i].len;
|
||||
max = desc_len / sizeof(struct vring_desc);
|
||||
read_len = desc_len;
|
||||
desc = vu_gpa_to_va(dev, &read_len, desc_addr);
|
||||
if (unlikely(desc && read_len != desc_len)) {
|
||||
/* Failed to use zero copy */
|
||||
desc = NULL;
|
||||
if (!virtqueue_read_indirect_desc(dev, desc_buf,
|
||||
desc_addr,
|
||||
desc_len)) {
|
||||
desc = desc_buf;
|
||||
}
|
||||
}
|
||||
if (!desc) {
|
||||
vu_panic(dev, "Invalid indirect buffer table");
|
||||
return;
|
||||
}
|
||||
i = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -327,11 +327,12 @@ bool vu_dispatch(VuDev *dev);
|
||||
/**
|
||||
* vu_gpa_to_va:
|
||||
* @dev: a VuDev context
|
||||
* @plen: guest memory size
|
||||
* @guest_addr: guest address
|
||||
*
|
||||
* Translate a guest address to a pointer. Returns NULL on failure.
|
||||
*/
|
||||
void *vu_gpa_to_va(VuDev *dev, uint64_t guest_addr);
|
||||
void *vu_gpa_to_va(VuDev *dev, uint64_t *plen, uint64_t guest_addr);
|
||||
|
||||
/**
|
||||
* vu_get_queue:
|
||||
|
||||
@@ -110,5 +110,5 @@ To enable device hot-plug into the bridge on Linux there're 3 ways:
|
||||
Implementation
|
||||
==============
|
||||
The PCIE-PCI bridge is based on PCI-PCI bridge, but also accumulates PCI Express
|
||||
features as a PCI Express device (is_express=1).
|
||||
features as a PCI Express device.
|
||||
|
||||
|
||||
@@ -192,6 +192,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
|
||||
fprintf(stderr, "virtio-blk failed to set host notifier (%d)\n", r);
|
||||
while (i--) {
|
||||
virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
|
||||
virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
|
||||
}
|
||||
goto fail_guest_notifiers;
|
||||
}
|
||||
@@ -267,6 +268,7 @@ void virtio_blk_data_plane_stop(VirtIODevice *vdev)
|
||||
|
||||
for (i = 0; i < nvqs; i++) {
|
||||
virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
|
||||
virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
|
||||
}
|
||||
|
||||
/* Clean up guest notifier (irq) */
|
||||
|
||||
@@ -1360,7 +1360,6 @@ static void nvme_class_init(ObjectClass *oc, void *data)
|
||||
pc->vendor_id = PCI_VENDOR_ID_INTEL;
|
||||
pc->device_id = 0x5845;
|
||||
pc->revision = 2;
|
||||
pc->is_express = 1;
|
||||
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
dc->desc = "Non-Volatile Memory Express";
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "hw/isa/apm.h"
|
||||
#include "hw/i386/ioapic.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/pci/pcie_host.h"
|
||||
#include "hw/pci/pci_bridge.h"
|
||||
#include "hw/i386/ich9.h"
|
||||
#include "hw/acpi/acpi.h"
|
||||
|
||||
@@ -675,7 +675,6 @@ static void e1000e_class_init(ObjectClass *class, void *data)
|
||||
c->revision = 0;
|
||||
c->romfile = "efi-e1000e.rom";
|
||||
c->class_id = PCI_CLASS_NETWORK_ETHERNET;
|
||||
c->is_express = 1;
|
||||
|
||||
dc->desc = "Intel 82574L GbE Controller";
|
||||
dc->reset = e1000e_qdev_reset;
|
||||
|
||||
@@ -101,6 +101,7 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
static const VMStateDescription vmstate_rp_dev = {
|
||||
.name = "pcie-root-port",
|
||||
.priority = MIG_PRI_PCI_BUS,
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.post_load = pcie_cap_slot_post_load,
|
||||
|
||||
@@ -78,6 +78,7 @@ err_bridge:
|
||||
|
||||
static const VMStateDescription i82801b11_bridge_dev_vmstate = {
|
||||
.name = "i82801b11_bridge",
|
||||
.priority = MIG_PRI_PCI_BUS,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
|
||||
VMSTATE_END_OF_LIST()
|
||||
@@ -96,6 +97,7 @@ static void i82801b11_bridge_class_init(ObjectClass *klass, void *data)
|
||||
k->realize = i82801b11_bridge_realize;
|
||||
k->config_write = pci_bridge_write_config;
|
||||
dc->vmsd = &i82801b11_bridge_dev_vmstate;
|
||||
dc->reset = pci_bridge_reset;
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ static void ioh3420_interrupts_uninit(PCIDevice *d)
|
||||
|
||||
static const VMStateDescription vmstate_ioh3420 = {
|
||||
.name = "ioh-3240-express-root-port",
|
||||
.priority = MIG_PRI_PCI_BUS,
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.post_load = pcie_cap_slot_post_load,
|
||||
|
||||
@@ -174,6 +174,7 @@ static bool pci_device_shpc_present(void *opaque, int version_id)
|
||||
|
||||
static const VMStateDescription pci_bridge_dev_vmstate = {
|
||||
.name = "pci_bridge",
|
||||
.priority = MIG_PRI_PCI_BUS,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
|
||||
SHPC_VMSTATE(shpc, PCIDevice, pci_device_shpc_present),
|
||||
|
||||
@@ -129,6 +129,7 @@ static Property pcie_pci_bridge_dev_properties[] = {
|
||||
|
||||
static const VMStateDescription pcie_pci_bridge_dev_vmstate = {
|
||||
.name = TYPE_PCIE_PCI_BRIDGE_DEV,
|
||||
.priority = MIG_PRI_PCI_BUS,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
|
||||
SHPC_VMSTATE(shpc, PCIDevice, NULL),
|
||||
@@ -169,7 +170,6 @@ static void pcie_pci_bridge_class_init(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
|
||||
|
||||
k->is_express = 1;
|
||||
k->is_bridge = 1;
|
||||
k->vendor_id = PCI_VENDOR_ID_REDHAT;
|
||||
k->device_id = PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE;
|
||||
@@ -178,7 +178,6 @@ static void pcie_pci_bridge_class_init(ObjectClass *klass, void *data)
|
||||
k->config_write = pcie_pci_bridge_write_config;
|
||||
dc->vmsd = &pcie_pci_bridge_dev_vmstate;
|
||||
dc->props = pcie_pci_bridge_dev_properties;
|
||||
dc->vmsd = &pcie_pci_bridge_dev_vmstate;
|
||||
dc->reset = &pcie_pci_bridge_reset;
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
hc->plug = pcie_pci_bridge_hotplug_cb;
|
||||
|
||||
@@ -145,7 +145,6 @@ static void rp_class_init(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||
|
||||
k->is_express = 1;
|
||||
k->is_bridge = 1;
|
||||
k->config_write = rp_write_config;
|
||||
k->realize = rp_realize;
|
||||
|
||||
@@ -161,6 +161,7 @@ static Property xio3130_downstream_props[] = {
|
||||
|
||||
static const VMStateDescription vmstate_xio3130_downstream = {
|
||||
.name = "xio3130-express-downstream-port",
|
||||
.priority = MIG_PRI_PCI_BUS,
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.post_load = pcie_cap_slot_post_load,
|
||||
@@ -177,7 +178,6 @@ static void xio3130_downstream_class_init(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||
|
||||
k->is_express = 1;
|
||||
k->is_bridge = 1;
|
||||
k->config_write = xio3130_downstream_write_config;
|
||||
k->realize = xio3130_downstream_realize;
|
||||
|
||||
@@ -132,6 +132,7 @@ PCIEPort *xio3130_upstream_init(PCIBus *bus, int devfn, bool multifunction,
|
||||
|
||||
static const VMStateDescription vmstate_xio3130_upstream = {
|
||||
.name = "xio3130-express-upstream-port",
|
||||
.priority = MIG_PRI_PCI_BUS,
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
@@ -147,7 +148,6 @@ static void xio3130_upstream_class_init(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||
|
||||
k->is_express = 1;
|
||||
k->is_bridge = 1;
|
||||
k->config_write = xio3130_upstream_write_config;
|
||||
k->realize = xio3130_upstream_realize;
|
||||
|
||||
@@ -297,7 +297,6 @@ static void xilinx_pcie_root_class_init(ObjectClass *klass, void *data)
|
||||
k->device_id = 0x7021;
|
||||
k->revision = 0;
|
||||
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
||||
k->is_express = true;
|
||||
k->is_bridge = true;
|
||||
k->realize = xilinx_pcie_root_realize;
|
||||
k->exit = pci_bridge_exitfn;
|
||||
|
||||
+6
-2
@@ -2007,11 +2007,15 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
|
||||
{
|
||||
PCIDevice *pci_dev = (PCIDevice *)qdev;
|
||||
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);
|
||||
ObjectClass *klass = OBJECT_CLASS(pc);
|
||||
Error *local_err = NULL;
|
||||
bool is_default_rom;
|
||||
|
||||
/* initialize cap_present for pci_is_express() and pci_config_size() */
|
||||
if (pc->is_express) {
|
||||
/* initialize cap_present for pci_is_express() and pci_config_size(),
|
||||
* Note that hybrid PCIs are not set automatically and need to manage
|
||||
* QEMU_PCI_CAP_EXPRESS manually */
|
||||
if (object_class_dynamic_cast(klass, INTERFACE_PCIE_DEVICE) &&
|
||||
!object_class_dynamic_cast(klass, INTERFACE_CONVENTIONAL_PCI_DEVICE)) {
|
||||
pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
|
||||
}
|
||||
|
||||
|
||||
+19
-5
@@ -412,22 +412,36 @@ void pci_bridge_map_irq(PCIBridge *br, const char* bus_name,
|
||||
|
||||
int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,
|
||||
uint32_t bus_reserve, uint64_t io_reserve,
|
||||
uint32_t mem_non_pref_reserve,
|
||||
uint32_t mem_pref_32_reserve,
|
||||
uint64_t mem_non_pref_reserve,
|
||||
uint64_t mem_pref_32_reserve,
|
||||
uint64_t mem_pref_64_reserve,
|
||||
Error **errp)
|
||||
{
|
||||
if (mem_pref_32_reserve != (uint32_t)-1 &&
|
||||
if (mem_pref_32_reserve != (uint64_t)-1 &&
|
||||
mem_pref_64_reserve != (uint64_t)-1) {
|
||||
error_setg(errp,
|
||||
"PCI resource reserve cap: PREF32 and PREF64 conflict");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (mem_non_pref_reserve != (uint64_t)-1 &&
|
||||
mem_non_pref_reserve >= (1ULL << 32)) {
|
||||
error_setg(errp,
|
||||
"PCI resource reserve cap: mem-reserve must be less than 4G");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (mem_pref_32_reserve != (uint64_t)-1 &&
|
||||
mem_pref_32_reserve >= (1ULL << 32)) {
|
||||
error_setg(errp,
|
||||
"PCI resource reserve cap: pref32-reserve must be less than 4G");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (bus_reserve == (uint32_t)-1 &&
|
||||
io_reserve == (uint64_t)-1 &&
|
||||
mem_non_pref_reserve == (uint32_t)-1 &&
|
||||
mem_pref_32_reserve == (uint32_t)-1 &&
|
||||
mem_non_pref_reserve == (uint64_t)-1 &&
|
||||
mem_pref_32_reserve == (uint64_t)-1 &&
|
||||
mem_pref_64_reserve == (uint64_t)-1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2447,7 +2447,6 @@ typedef struct MegasasInfo {
|
||||
uint16_t subsystem_id;
|
||||
int ioport_bar;
|
||||
int mmio_bar;
|
||||
bool is_express;
|
||||
int osts;
|
||||
const VMStateDescription *vmsd;
|
||||
Property *props;
|
||||
@@ -2465,7 +2464,6 @@ static struct MegasasInfo megasas_devices[] = {
|
||||
.ioport_bar = 2,
|
||||
.mmio_bar = 0,
|
||||
.osts = MFI_1078_RM | 1,
|
||||
.is_express = false,
|
||||
.vmsd = &vmstate_megasas_gen1,
|
||||
.props = megasas_properties_gen1,
|
||||
.interfaces = (InterfaceInfo[]) {
|
||||
@@ -2482,7 +2480,6 @@ static struct MegasasInfo megasas_devices[] = {
|
||||
.ioport_bar = 0,
|
||||
.mmio_bar = 1,
|
||||
.osts = MFI_GEN2_RM,
|
||||
.is_express = true,
|
||||
.vmsd = &vmstate_megasas_gen2,
|
||||
.props = megasas_properties_gen2,
|
||||
.interfaces = (InterfaceInfo[]) {
|
||||
@@ -2506,7 +2503,6 @@ static void megasas_class_init(ObjectClass *oc, void *data)
|
||||
pc->subsystem_vendor_id = PCI_VENDOR_ID_LSI_LOGIC;
|
||||
pc->subsystem_id = info->subsystem_id;
|
||||
pc->class_id = PCI_CLASS_STORAGE_RAID;
|
||||
pc->is_express = info->is_express;
|
||||
e->mmio_bar = info->mmio_bar;
|
||||
e->ioport_bar = info->ioport_bar;
|
||||
e->osts = info->osts;
|
||||
|
||||
@@ -175,6 +175,7 @@ fail_vrings:
|
||||
aio_context_release(s->ctx);
|
||||
for (i = 0; i < vs->conf.num_queues + 2; i++) {
|
||||
virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
|
||||
virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
|
||||
}
|
||||
k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false);
|
||||
fail_guest_notifiers:
|
||||
@@ -213,6 +214,7 @@ void virtio_scsi_dataplane_stop(VirtIODevice *vdev)
|
||||
|
||||
for (i = 0; i < vs->conf.num_queues + 2; i++) {
|
||||
virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
|
||||
virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
|
||||
}
|
||||
|
||||
/* Clean up guest notifier (irq) */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user