aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.d/crossbuilds.yml8
-rw-r--r--docs/system/multi-process.rst2
-rw-r--r--hw/i386/kvm/xen_evtchn.c40
-rw-r--r--hw/i386/kvm/xen_evtchn.h3
-rw-r--r--hw/i386/kvm/xen_xenstore.c2
-rw-r--r--hw/i386/pc.c13
-rw-r--r--hw/i386/pc_piix.c36
-rw-r--r--hw/i386/xen/xen-hvm.c2
-rw-r--r--hw/isa/piix3.c60
-rw-r--r--hw/pci/pci.c2
-rw-r--r--hw/remote/vfio-user-obj.c14
-rw-r--r--hw/xen/xen-bus.c6
-rw-r--r--hw/xen/xen-operations.c59
-rw-r--r--include/hw/southbridge/piix.h1
-rw-r--r--include/hw/xen/xen.h2
-rw-r--r--include/hw/xen/xen_native.h107
-rw-r--r--meson.build5
-rw-r--r--scripts/xen-detect.c60
-rw-r--r--stubs/xen-hw-stub.c2
-rw-r--r--target/arm/ptw.c5
-rw-r--r--tcg/tci.c30
-rw-r--r--tcg/tci/tcg-target.c.inc30
-rwxr-xr-xtests/qemu-iotests/1945
-rw-r--r--tests/qemu-iotests/194.out1
24 files changed, 123 insertions, 372 deletions
diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index 61b8ac86ee..1e0e6c7f2c 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -29,6 +29,14 @@ cross-arm64-user:
variables:
IMAGE: debian-arm64-cross
+cross-arm64-kvm-only:
+ extends: .cross_accel_build_job
+ needs:
+ job: arm64-debian-cross-container
+ variables:
+ IMAGE: debian-arm64-cross
+ EXTRA_CONFIGURE_OPTS: --disable-tcg --without-default-features
+
cross-i386-user:
extends:
- .cross_user_build_job
diff --git a/docs/system/multi-process.rst b/docs/system/multi-process.rst
index 16f0352416..2008a67809 100644
--- a/docs/system/multi-process.rst
+++ b/docs/system/multi-process.rst
@@ -4,7 +4,7 @@ Multi-process QEMU
==================
This document describes how to configure and use multi-process qemu.
-For the design document refer to docs/devel/qemu-multiprocess.
+For the design document refer to docs/devel/multi-process.rst.
1) Configuration
----------------
diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c
index 3048329474..3d810dbd59 100644
--- a/hw/i386/kvm/xen_evtchn.c
+++ b/hw/i386/kvm/xen_evtchn.c
@@ -147,7 +147,10 @@ struct XenEvtchnState {
QemuMutex port_lock;
uint32_t nr_ports;
XenEvtchnPort port_table[EVTCHN_2L_NR_CHANNELS];
- qemu_irq gsis[IOAPIC_NUM_PINS];
+
+ /* Connected to the system GSIs for raising callback as GSI / INTx */
+ unsigned int nr_callback_gsis;
+ qemu_irq *callback_gsis;
struct xenevtchn_handle *be_handles[EVTCHN_2L_NR_CHANNELS];
@@ -299,7 +302,7 @@ static void gsi_assert_bh(void *opaque)
}
}
-void xen_evtchn_create(void)
+void xen_evtchn_create(unsigned int nr_gsis, qemu_irq *system_gsis)
{
XenEvtchnState *s = XEN_EVTCHN(sysbus_create_simple(TYPE_XEN_EVTCHN,
-1, NULL));
@@ -310,8 +313,19 @@ void xen_evtchn_create(void)
qemu_mutex_init(&s->port_lock);
s->gsi_bh = aio_bh_new(qemu_get_aio_context(), gsi_assert_bh, s);
- for (i = 0; i < IOAPIC_NUM_PINS; i++) {
- sysbus_init_irq(SYS_BUS_DEVICE(s), &s->gsis[i]);
+ /*
+ * These are the *output* GSI from event channel support, for
+ * signalling CPU0's events via GSI or PCI INTx instead of the
+ * per-CPU vector. We create a *set* of irqs and connect one to
+ * each of the system GSIs which were passed in from the platform
+ * code, and then just trigger the right one as appropriate from
+ * xen_evtchn_set_callback_level().
+ */
+ s->nr_callback_gsis = nr_gsis;
+ s->callback_gsis = g_new0(qemu_irq, nr_gsis);
+ for (i = 0; i < nr_gsis; i++) {
+ sysbus_init_irq(SYS_BUS_DEVICE(s), &s->callback_gsis[i]);
+ sysbus_connect_irq(SYS_BUS_DEVICE(s), i, system_gsis[i]);
}
/*
@@ -336,20 +350,6 @@ void xen_evtchn_create(void)
xen_evtchn_ops = &emu_evtchn_backend_ops;
}
-void xen_evtchn_connect_gsis(qemu_irq *system_gsis)
-{
- XenEvtchnState *s = xen_evtchn_singleton;
- int i;
-
- if (!s) {
- return;
- }
-
- for (i = 0; i < IOAPIC_NUM_PINS; i++) {
- sysbus_connect_irq(SYS_BUS_DEVICE(s), i, system_gsis[i]);
- }
-}
-
static void xen_evtchn_register_types(void)
{
type_register_static(&xen_evtchn_info);
@@ -430,8 +430,8 @@ void xen_evtchn_set_callback_level(int level)
return;
}
- if (s->callback_gsi && s->callback_gsi < IOAPIC_NUM_PINS) {
- qemu_set_irq(s->gsis[s->callback_gsi], level);
+ if (s->callback_gsi && s->callback_gsi < s->nr_callback_gsis) {
+ qemu_set_irq(s->callback_gsis[s->callback_gsi], level);
if (level) {
/* Ensure the vCPU polls for deassertion */
kvm_xen_set_callback_asserted();
diff --git a/hw/i386/kvm/xen_evtchn.h b/hw/i386/kvm/xen_evtchn.h
index bfb67ac2bc..b740acfc0d 100644
--- a/hw/i386/kvm/xen_evtchn.h
+++ b/hw/i386/kvm/xen_evtchn.h
@@ -16,10 +16,9 @@
typedef uint32_t evtchn_port_t;
-void xen_evtchn_create(void);
+void xen_evtchn_create(unsigned int nr_gsis, qemu_irq *system_gsis);
int xen_evtchn_soft_reset(void);
int xen_evtchn_set_callback_param(uint64_t param);
-void xen_evtchn_connect_gsis(qemu_irq *system_gsis);
void xen_evtchn_set_callback_level(int level);
int xen_evtchn_set_port(uint16_t port);
diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c
index 0b189c6ab8..133d89e953 100644
--- a/hw/i386/kvm/xen_xenstore.c
+++ b/hw/i386/kvm/xen_xenstore.c
@@ -1688,7 +1688,7 @@ static struct qemu_xs_handle *xs_be_open(void)
XenXenstoreState *s = xen_xenstore_singleton;
struct qemu_xs_handle *h;
- if (!s && !s->impl) {
+ if (!s || !s->impl) {
errno = -ENOSYS;
return NULL;
}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index bb62c994fa..fc52772fdd 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1332,7 +1332,10 @@ void pc_basic_device_init(struct PCMachineState *pcms,
#ifdef CONFIG_XEN_EMU
if (xen_mode == XEN_EMULATE) {
- xen_evtchn_connect_gsis(gsi);
+ xen_overlay_create();
+ xen_evtchn_create(IOAPIC_NUM_PINS, gsi);
+ xen_gnttab_create();
+ xen_xenstore_create();
if (pcms->bus) {
pci_create_simple(pcms->bus, -1, "xen-platform");
}
@@ -1882,14 +1885,6 @@ static void pc_machine_initfn(Object *obj)
int pc_machine_kvm_type(MachineState *machine, const char *kvm_type)
{
-#ifdef CONFIG_XEN_EMU
- if (xen_mode == XEN_EMULATE) {
- xen_overlay_create();
- xen_evtchn_create();
- xen_gnttab_create();
- xen_xenstore_create();
- }
-#endif
return 0;
}
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index d5b0dcd1fe..42af03dbb4 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -71,6 +71,7 @@
#include "kvm/kvm-cpu.h"
#define MAX_IDE_BUS 2
+#define XEN_IOAPIC_NUM_PIRQS 128ULL
#ifdef CONFIG_IDE_ISA
static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
@@ -89,6 +90,21 @@ static int pc_pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
return (pci_intx + slot_addend) & 3;
}
+static void piix_intx_routing_notifier_xen(PCIDevice *dev)
+{
+ int i;
+
+ /* Scan for updates to PCI link routes (0x60-0x63). */
+ for (i = 0; i < PIIX_NUM_PIRQS; i++) {
+ uint8_t v = dev->config_read(dev, PIIX_PIRQCA + i, 1);
+ if (v & 0x80) {
+ v = 0;
+ }
+ v &= 0xf;
+ xen_set_pci_link_route(i, v);
+ }
+}
+
/* PC hardware initialisation */
static void pc_init1(MachineState *machine,
const char *host_type, const char *pci_type)
@@ -223,8 +239,6 @@ static void pc_init1(MachineState *machine,
if (pcmc->pci_enabled) {
PIIX3State *piix3;
PCIDevice *pci_dev;
- const char *type = xen_enabled() ? TYPE_PIIX3_XEN_DEVICE
- : TYPE_PIIX3_DEVICE;
pci_bus = i440fx_init(pci_type,
i440fx_host,
@@ -237,7 +251,23 @@ static void pc_init1(MachineState *machine,
: pc_pci_slot_get_pirq);
pcms->bus = pci_bus;
- pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type);
+ pci_dev = pci_create_simple_multifunction(pci_bus, -1, true,
+ TYPE_PIIX3_DEVICE);
+
+ if (xen_enabled()) {
+ pci_device_set_intx_routing_notifier(
+ pci_dev, piix_intx_routing_notifier_xen);
+
+ /*
+ * Xen supports additional interrupt routes from the PCI devices to
+ * the IOAPIC: the four pins of each PCI device on the bus are also
+ * connected to the IOAPIC directly.
+ * These additional routes can be discovered through ACPI.
+ */
+ pci_bus_irqs(pci_bus, xen_intx_set_irq, pci_dev,
+ XEN_IOAPIC_NUM_PIRQS);
+ }
+
piix3 = PIIX3_PCI_DEVICE(pci_dev);
piix3->pic = x86ms->gsi;
piix3_devfn = piix3->dev.devfn;
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 56641a550e..ab8f1b61ee 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -143,7 +143,7 @@ int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
return irq_num + (PCI_SLOT(pci_dev->devfn) << 2);
}
-void xen_piix3_set_irq(void *opaque, int irq_num, int level)
+void xen_intx_set_irq(void *opaque, int irq_num, int level)
{
xen_set_pci_intx_level(xen_domid, 0, 0, irq_num >> 2,
irq_num & 3, level);
diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c
index f9103ea45a..117024e450 100644
--- a/hw/isa/piix3.c
+++ b/hw/isa/piix3.c
@@ -30,13 +30,10 @@
#include "hw/irq.h"
#include "hw/qdev-properties.h"
#include "hw/isa/isa.h"
-#include "hw/xen/xen.h"
#include "sysemu/runstate.h"
#include "migration/vmstate.h"
#include "hw/acpi/acpi_aml_interface.h"
-#define XEN_PIIX_NUM_PIRQS 128ULL
-
static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq)
{
qemu_set_irq(piix3->pic[pic_irq],
@@ -124,26 +121,6 @@ static void piix3_write_config(PCIDevice *dev,
}
}
-static void piix3_write_config_xen(PCIDevice *dev,
- uint32_t address, uint32_t val, int len)
-{
- int i;
-
- /* Scan for updates to PCI link routes (0x60-0x63). */
- for (i = 0; i < len; i++) {
- uint8_t v = (val >> (8 * i)) & 0xff;
- if (v & 0x80) {
- v = 0;
- }
- v &= 0xf;
- if (((address + i) >= PIIX_PIRQCA) && ((address + i) <= PIIX_PIRQCD)) {
- xen_set_pci_link_route(address + i - PIIX_PIRQCA, v);
- }
- }
-
- piix3_write_config(dev, address, val, len);
-}
-
static void piix3_reset(DeviceState *dev)
{
PIIX3State *d = PIIX3_PCI_DEVICE(dev);
@@ -344,6 +321,7 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data)
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass);
+ k->config_write = piix3_write_config;
dc->reset = piix3_reset;
dc->desc = "ISA bridge";
dc->vmsd = &vmstate_piix3;
@@ -393,7 +371,6 @@ static void piix3_class_init(ObjectClass *klass, void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
- k->config_write = piix3_write_config;
k->realize = piix3_realize;
}
@@ -403,45 +380,10 @@ static const TypeInfo piix3_info = {
.class_init = piix3_class_init,
};
-static void piix3_xen_realize(PCIDevice *dev, Error **errp)
-{
- ERRP_GUARD();
- PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev);
- PCIBus *pci_bus = pci_get_bus(dev);
-
- pci_piix3_realize(dev, errp);
- if (*errp) {
- return;
- }
-
- /*
- * Xen supports additional interrupt routes from the PCI devices to
- * the IOAPIC: the four pins of each PCI device on the bus are also
- * connected to the IOAPIC directly.
- * These additional routes can be discovered through ACPI.
- */
- pci_bus_irqs(pci_bus, xen_piix3_set_irq, piix3, XEN_PIIX_NUM_PIRQS);
-}
-
-static void piix3_xen_class_init(ObjectClass *klass, void *data)
-{
- PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-
- k->config_write = piix3_write_config_xen;
- k->realize = piix3_xen_realize;
-}
-
-static const TypeInfo piix3_xen_info = {
- .name = TYPE_PIIX3_XEN_DEVICE,
- .parent = TYPE_PIIX3_PCI_DEVICE,
- .class_init = piix3_xen_class_init,
-};
-
static void piix3_register_types(void)
{
type_register_static(&piix3_pci_type_info);
type_register_static(&piix3_info);
- type_register_static(&piix3_xen_info);
}
type_init(piix3_register_types)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 1cc7c89036..9b7b4d7c18 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -560,6 +560,7 @@ void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq,
bus->set_irq = set_irq;
bus->irq_opaque = irq_opaque;
bus->nirq = nirq;
+ g_free(bus->irq_count);
bus->irq_count = g_malloc0(nirq * sizeof(bus->irq_count[0]));
}
@@ -575,6 +576,7 @@ void pci_bus_irqs_cleanup(PCIBus *bus)
bus->irq_opaque = NULL;
bus->nirq = 0;
g_free(bus->irq_count);
+ bus->irq_count = NULL;
}
PCIBus *pci_register_root_bus(DeviceState *parent, const char *name,
diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c
index 88ffafc73e..8b10c32a3c 100644
--- a/hw/remote/vfio-user-obj.c
+++ b/hw/remote/vfio-user-obj.c
@@ -30,6 +30,11 @@
*
* notes - x-vfio-user-server could block IO and monitor during the
* initialization phase.
+ *
+ * When x-remote machine has the auto-shutdown property
+ * enabled (default), x-vfio-user-server terminates after the last
+ * client disconnects. Otherwise, it will continue running until
+ * explicitly killed.
*/
#include "qemu/osdep.h"
@@ -61,9 +66,12 @@
OBJECT_DECLARE_TYPE(VfuObject, VfuObjectClass, VFU_OBJECT)
/**
- * VFU_OBJECT_ERROR - reports an error message. If auto_shutdown
- * is set, it aborts the machine on error. Otherwise, it logs an
- * error message without aborting.
+ * VFU_OBJECT_ERROR - reports an error message.
+ *
+ * If auto_shutdown is set, it aborts the machine on error. Otherwise,
+ * it logs an error message without aborting. auto_shutdown is disabled
+ * when the server serves clients from multiple VMs; as such, an error
+ * from one VM shouldn't be able to disrupt other VM's services.
*/
#define VFU_OBJECT_ERROR(o, fmt, ...) \
{ \
diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c
index 1e08cf027a..ece8ec40cd 100644
--- a/hw/xen/xen-bus.c
+++ b/hw/xen/xen-bus.c
@@ -923,8 +923,10 @@ void xen_device_unbind_event_channel(XenDevice *xendev,
QLIST_REMOVE(channel, list);
- aio_set_fd_handler(channel->ctx, qemu_xen_evtchn_fd(channel->xeh),
- NULL, NULL, NULL, NULL, NULL);
+ if (channel->ctx) {
+ aio_set_fd_handler(channel->ctx, qemu_xen_evtchn_fd(channel->xeh),
+ NULL, NULL, NULL, NULL, NULL);
+ }
if (qemu_xen_evtchn_unbind(channel->xeh, channel->local_port) < 0) {
error_setg_errno(errp, errno, "xenevtchn_unbind failed");
diff --git a/hw/xen/xen-operations.c b/hw/xen/xen-operations.c
index 4b78fbf4bd..e00983ec44 100644
--- a/hw/xen/xen-operations.c
+++ b/hw/xen/xen-operations.c
@@ -28,46 +28,13 @@
#include <xenctrl.h>
/*
- * We don't support Xen prior to 4.2.0.
+ * We don't support Xen prior to 4.7.1.
*/
-/* Xen 4.2 through 4.6 */
-#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40701
-
-typedef xc_evtchn xenevtchn_handle;
-typedef evtchn_port_or_error_t xenevtchn_port_or_error_t;
-
-#define xenevtchn_open(l, f) xc_evtchn_open(l, f);
-#define xenevtchn_close(h) xc_evtchn_close(h)
-#define xenevtchn_fd(h) xc_evtchn_fd(h)
-#define xenevtchn_pending(h) xc_evtchn_pending(h)
-#define xenevtchn_notify(h, p) xc_evtchn_notify(h, p)
-#define xenevtchn_bind_interdomain(h, d, p) xc_evtchn_bind_interdomain(h, d, p)
-#define xenevtchn_unmask(h, p) xc_evtchn_unmask(h, p)
-#define xenevtchn_unbind(h, p) xc_evtchn_unbind(h, p)
-
-typedef xc_gnttab xengnttab_handle;
-
-#define xengnttab_open(l, f) xc_gnttab_open(l, f)
-#define xengnttab_close(h) xc_gnttab_close(h)
-#define xengnttab_set_max_grants(h, n) xc_gnttab_set_max_grants(h, n)
-#define xengnttab_map_grant_ref(h, d, r, p) xc_gnttab_map_grant_ref(h, d, r, p)
-#define xengnttab_unmap(h, a, n) xc_gnttab_munmap(h, a, n)
-#define xengnttab_map_grant_refs(h, c, d, r, p) \
- xc_gnttab_map_grant_refs(h, c, d, r, p)
-#define xengnttab_map_domain_grant_refs(h, c, d, r, p) \
- xc_gnttab_map_domain_grant_refs(h, c, d, r, p)
-
-typedef xc_interface xenforeignmemory_handle;
-
-#else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40701 */
-
#include <xenevtchn.h>
#include <xengnttab.h>
#include <xenforeignmemory.h>
-#endif
-
/* Xen before 4.8 */
static int libxengnttab_fallback_grant_copy(xengnttab_handle *xgt,
@@ -223,26 +190,6 @@ static struct gnttab_backend_ops libxengnttab_backend_ops = {
.unmap = libxengnttab_backend_unmap,
};
-#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40701
-
-static void *libxenforeignmem_backend_map(uint32_t dom, void *addr, int prot,
- size_t pages, xfn_pfn_t *pfns,
- int *errs)
-{
- if (errs) {
- return xc_map_foreign_bulk(xen_xc, dom, prot, pfns, errs, pages);
- } else {
- return xc_map_foreign_pages(xen_xc, dom, prot, pfns, pages);
- }
-}
-
-static int libxenforeignmem_backend_unmap(void *addr, size_t pages)
-{
- return munmap(addr, pages * XC_PAGE_SIZE);
-}
-
-#else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40701 */
-
static void *libxenforeignmem_backend_map(uint32_t dom, void *addr, int prot,
size_t pages, xen_pfn_t *pfns,
int *errs)
@@ -256,8 +203,6 @@ static int libxenforeignmem_backend_unmap(void *addr, size_t pages)
return xenforeignmemory_unmap(xen_fmem, addr, pages);
}
-#endif
-
struct foreignmem_backend_ops libxenforeignmem_backend_ops = {
.map = libxenforeignmem_backend_map,
.unmap = libxenforeignmem_backend_unmap,
@@ -287,7 +232,7 @@ static void watch_event(void *opaque)
static struct qemu_xs_handle *libxenstore_open(void)
{
struct xs_handle *xsh = xs_open(0);
- struct qemu_xs_handle *h = g_new0(struct qemu_xs_handle, 1);
+ struct qemu_xs_handle *h;
if (!xsh) {
return NULL;
diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h
index a840340308..278171752f 100644
--- a/include/hw/southbridge/piix.h
+++ b/include/hw/southbridge/piix.h
@@ -67,7 +67,6 @@ DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE,
TYPE_PIIX3_PCI_DEVICE)
#define TYPE_PIIX3_DEVICE "PIIX3"
-#define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen"
#define TYPE_PIIX4_PCI_DEVICE "piix4-isa"
#endif
diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
index 2bd8ec742d..37ecc91fc3 100644
--- a/include/hw/xen/xen.h
+++ b/include/hw/xen/xen.h
@@ -39,7 +39,7 @@ extern bool xen_domid_restrict;
int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num);
int xen_set_pci_link_route(uint8_t link, uint8_t irq);
-void xen_piix3_set_irq(void *opaque, int irq_num, int level);
+void xen_intx_set_irq(void *opaque, int irq_num, int level);
void xen_hvm_inject_msi(uint64_t addr, uint32_t data);
int xen_is_pirq_msi(uint32_t msi_data);
diff --git a/include/hw/xen/xen_native.h b/include/hw/xen/xen_native.h
index 6bcc83baf9..f11eb423e3 100644
--- a/include/hw/xen/xen_native.h
+++ b/include/hw/xen/xen_native.h
@@ -24,23 +24,11 @@
extern xc_interface *xen_xc;
/*
- * We don't support Xen prior to 4.2.0.
+ * We don't support Xen prior to 4.7.1.
*/
-/* Xen 4.2 through 4.6 */
-#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40701
-
-typedef xc_interface xenforeignmemory_handle;
-
-#define xenforeignmemory_open(l, f) xen_xc
-#define xenforeignmemory_close(h)
-
-#else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40701 */
-
#include <xenforeignmemory.h>
-#endif
-
extern xenforeignmemory_handle *xen_fmem;
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40900
@@ -148,8 +136,6 @@ static inline xendevicemodel_handle *xendevicemodel_open(
return xen_xc;
}
-#if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40500
-
static inline int xendevicemodel_create_ioreq_server(
xendevicemodel_handle *dmod, domid_t domid, int handle_bufioreq,
ioservid_t *id)
@@ -211,8 +197,6 @@ static inline int xendevicemodel_set_ioreq_server_state(
return xc_hvm_set_ioreq_server_state(dmod, domid, id, enabled);
}
-#endif /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40500 */
-
static inline int xendevicemodel_set_pci_intx_level(
xendevicemodel_handle *dmod, domid_t domid, uint16_t segment,
uint8_t bus, uint8_t device, uint8_t intx, unsigned int level)
@@ -340,15 +324,6 @@ static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom,
}
#endif
-/* Xen before 4.6 */
-#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40600
-
-#ifndef HVM_IOREQSRV_BUFIOREQ_ATOMIC
-#define HVM_IOREQSRV_BUFIOREQ_ATOMIC 2
-#endif
-
-#endif
-
static inline int xen_get_default_ioreq_server_info(domid_t dom,
xen_pfn_t *ioreq_pfn,
xen_pfn_t *bufioreq_pfn,
@@ -386,84 +361,6 @@ static inline int xen_get_default_ioreq_server_info(domid_t dom,
return 0;
}
-/* Xen before 4.5 */
-#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40500
-
-#ifndef HVM_PARAM_BUFIOREQ_EVTCHN
-#define HVM_PARAM_BUFIOREQ_EVTCHN 26
-#endif
-
-#define IOREQ_TYPE_PCI_CONFIG 2
-
-typedef uint16_t ioservid_t;
-
-static inline void xen_map_memory_section(domid_t dom,
- ioservid_t ioservid,
- MemoryRegionSection *section)
-{
-}
-
-static inline void xen_unmap_memory_section(domid_t dom,
- ioservid_t ioservid,
- MemoryRegionSection *section)
-{
-}
-
-static inline void xen_map_io_section(domid_t dom,
- ioservid_t ioservid,
- MemoryRegionSection *section)
-{
-}
-
-static inline void xen_unmap_io_section(domid_t dom,
- ioservid_t ioservid,
- MemoryRegionSection *section)
-{
-}
-
-static inline void xen_map_pcidev(domid_t dom,
- ioservid_t ioservid,
- PCIDevice *pci_dev)
-{
-}
-
-static inline void xen_unmap_pcidev(domid_t dom,
- ioservid_t ioservid,
- PCIDevice *pci_dev)
-{
-}
-
-static inline void xen_create_ioreq_server(domid_t dom,
- ioservid_t *ioservid)
-{
-}
-
-static inline void xen_destroy_ioreq_server(domid_t dom,
- ioservid_t ioservid)
-{
-}
-
-static inline int xen_get_ioreq_server_info(domid_t dom,
- ioservid_t ioservid,
- xen_pfn_t *ioreq_pfn,
- xen_pfn_t *bufioreq_pfn,
- evtchn_port_t *bufioreq_evtchn)
-{
- return xen_get_default_ioreq_server_info(dom, ioreq_pfn,
- bufioreq_pfn,
- bufioreq_evtchn);
-}
-
-static inline int xen_set_ioreq_server_state(domid_t dom,
- ioservid_t ioservid,
- bool enable)
-{
- return 0;
-}
-
-/* Xen 4.5 */
-#else
-
static bool use_default_ioreq_server;
static inline void xen_map_memory_section(domid_t dom,
@@ -624,6 +521,4 @@ static inline int xen_set_ioreq_server_state(domid_t dom,
enable);
}
-#endif
-
#endif /* QEMU_HW_XEN_NATIVE_H */
diff --git a/meson.build b/meson.build
index c03326c922..34306a6205 100644
--- a/meson.build
+++ b/meson.build
@@ -1683,16 +1683,13 @@ if get_option('xen').enabled() or (get_option('xen').auto() and have_system)
endif
endif
if not xen.found()
- xen_tests = [ '4.11.0', '4.10.0', '4.9.0', '4.8.0', '4.7.1', '4.6.0', '4.5.0', '4.2.0' ]
+ xen_tests = [ '4.11.0', '4.10.0', '4.9.0', '4.8.0', '4.7.1' ]
xen_libs = {
'4.11.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn', 'xentoolcore' ],
'4.10.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn', 'xentoolcore' ],
'4.9.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ],
'4.8.0': [ 'xenstore', 'xenctrl', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ],
'4.7.1': [ 'xenstore', 'xenctrl', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ],
- '4.6.0': [ 'xenstore', 'xenctrl' ],
- '4.5.0': [ 'xenstore', 'xenctrl' ],
- '4.2.0': [ 'xenstore', 'xenctrl' ],
}
xen_deps = {}
foreach ver: xen_tests
diff --git a/scripts/xen-detect.c b/scripts/xen-detect.c
index 85e8206490..db049e605c 100644
--- a/scripts/xen-detect.c
+++ b/scripts/xen-detect.c
@@ -138,66 +138,6 @@
return 0;
}
-#elif CONFIG_XEN_CTRL_INTERFACE_VERSION == 40600
- #include <xenctrl.h>
- #include <xenstore.h>
- #include <stdint.h>
- #include <xen/hvm/hvm_info_table.h>
- #if !defined(HVM_MAX_VCPUS)
- # error HVM_MAX_VCPUS not defined
- #endif
- int main(void) {
- xc_interface *xc;
- xs_daemon_open();
- xc = xc_interface_open(0, 0, 0);
- xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
- xc_gnttab_open(NULL, 0);
- xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
- xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
- xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
- xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
- return 0;
- }
-
-#elif CONFIG_XEN_CTRL_INTERFACE_VERSION == 40500
- #include <xenctrl.h>
- #include <xenstore.h>
- #include <stdint.h>
- #include <xen/hvm/hvm_info_table.h>
- #if !defined(HVM_MAX_VCPUS)
- # error HVM_MAX_VCPUS not defined
- #endif
- int main(void) {
- xc_interface *xc;
- xs_daemon_open();
- xc = xc_interface_open(0, 0, 0);
- xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
- xc_gnttab_open(NULL, 0);
- xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
- xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
- xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
- return 0;
- }
-
-#elif CONFIG_XEN_CTRL_INTERFACE_VERSION == 40200
- #include <xenctrl.h>
- #include <xenstore.h>
- #include <stdint.h>
- #include <xen/hvm/hvm_info_table.h>
- #if !defined(HVM_MAX_VCPUS)
- # error HVM_MAX_VCPUS not defined
- #endif
- int main(void) {
- xc_interface *xc;
- xs_daemon_open();
- xc = xc_interface_open(0, 0, 0);
- xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
- xc_gnttab_open(NULL, 0);
- xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
- xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
- return 0;
- }
-
#else
#error invalid CONFIG_XEN_CTRL_INTERFACE_VERSION
#endif
diff --git a/stubs/xen-hw-stub.c b/stubs/xen-hw-stub.c
index 34a22f2ad7..7d7ffe83a9 100644
--- a/stubs/xen-hw-stub.c
+++ b/stubs/xen-hw-stub.c
@@ -15,7 +15,7 @@ int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
return -1;
}
-void xen_piix3_set_irq(void *opaque, int irq_num, int level)
+void xen_intx_set_irq(void *opaque, int irq_num, int level)
{
}
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index b2dc223525..37bcb17a9e 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -14,8 +14,9 @@
#include "cpu.h"
#include "internals.h"
#include "idau.h"
-#include "tcg/oversized-guest.h"
-
+#ifdef CONFIG_TCG
+# include "tcg/oversized-guest.h"
+#endif
typedef struct S1Translate {
ARMMMUIdx in_mmu_idx;
diff --git a/tcg/tci.c b/tcg/tci.c
index 813572ff39..4640902c88 100644
--- a/tcg/tci.c
+++ b/tcg/tci.c
@@ -106,7 +106,7 @@ static void tci_args_rrm(uint32_t insn, TCGReg *r0,
{
*r0 = extract32(insn, 8, 4);
*r1 = extract32(insn, 12, 4);
- *m2 = extract32(insn, 20, 12);
+ *m2 = extract32(insn, 16, 16);
}
static void tci_args_rrr(uint32_t insn, TCGReg *r0, TCGReg *r1, TCGReg *r2)
@@ -141,15 +141,6 @@ static void tci_args_rrrc(uint32_t insn,
*c3 = extract32(insn, 20, 4);
}
-static void tci_args_rrrm(uint32_t insn,
- TCGReg *r0, TCGReg *r1, TCGReg *r2, MemOpIdx *m3)
-{
- *r0 = extract32(insn, 8, 4);
- *r1 = extract32(insn, 12, 4);
- *r2 = extract32(insn, 16, 4);
- *m3 = extract32(insn, 20, 12);
-}
-
static void tci_args_rrrbb(uint32_t insn, TCGReg *r0, TCGReg *r1,
TCGReg *r2, uint8_t *i3, uint8_t *i4)
{
@@ -929,8 +920,9 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
tci_args_rrm(insn, &r0, &r1, &oi);
taddr = regs[r1];
} else {
- tci_args_rrrm(insn, &r0, &r1, &r2, &oi);
+ tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
taddr = tci_uint64(regs[r2], regs[r1]);
+ oi = regs[r3];
}
do_ld_i32:
regs[r0] = tci_qemu_ld(env, taddr, oi, tb_ptr);
@@ -941,8 +933,9 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
tci_args_rrm(insn, &r0, &r1, &oi);
taddr = (uint32_t)regs[r1];
} else {
- tci_args_rrrm(insn, &r0, &r1, &r2, &oi);
+ tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
taddr = (uint32_t)regs[r2];
+ oi = regs[r3];
}
goto do_ld_i64;
case INDEX_op_qemu_ld_a64_i64:
@@ -972,8 +965,9 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
tci_args_rrm(insn, &r0, &r1, &oi);
taddr = regs[r1];
} else {
- tci_args_rrrm(insn, &r0, &r1, &r2, &oi);
+ tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
taddr = tci_uint64(regs[r2], regs[r1]);
+ oi = regs[r3];
}
do_st_i32:
tci_qemu_st(env, taddr, regs[r0], oi, tb_ptr);
@@ -985,9 +979,10 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
tmp64 = regs[r0];
taddr = (uint32_t)regs[r1];
} else {
- tci_args_rrrm(insn, &r0, &r1, &r2, &oi);
+ tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
tmp64 = tci_uint64(regs[r1], regs[r0]);
taddr = (uint32_t)regs[r2];
+ oi = regs[r3];
}
goto do_st_i64;
case INDEX_op_qemu_st_a64_i64:
@@ -1293,9 +1288,10 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info)
op_name, str_r(r0), str_r(r1), oi);
break;
case 3:
- tci_args_rrrm(insn, &r0, &r1, &r2, &oi);
- info->fprintf_func(info->stream, "%-12s %s, %s, %s, %x",
- op_name, str_r(r0), str_r(r1), str_r(r2), oi);
+ tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
+ info->fprintf_func(info->stream, "%-12s %s, %s, %s, %s",
+ op_name, str_r(r0), str_r(r1),
+ str_r(r2), str_r(r3));
break;
case 4:
tci_args_rrrrr(insn, &r0, &r1, &r2, &r3, &r4);
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
index c9516a5e8b..0037f904f1 100644
--- a/tcg/tci/tcg-target.c.inc
+++ b/tcg/tci/tcg-target.c.inc
@@ -179,8 +179,6 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
}
static const int tcg_target_reg_alloc_order[] = {
- TCG_REG_R2,
- TCG_REG_R3,
TCG_REG_R4,
TCG_REG_R5,
TCG_REG_R6,
@@ -193,6 +191,9 @@ static const int tcg_target_reg_alloc_order[] = {
TCG_REG_R13,
TCG_REG_R14,
TCG_REG_R15,
+ /* Either 2 or 4 of these are call clobbered, so use them last. */
+ TCG_REG_R3,
+ TCG_REG_R2,
TCG_REG_R1,
TCG_REG_R0,
};
@@ -331,11 +332,11 @@ static void tcg_out_op_rrm(TCGContext *s, TCGOpcode op,
{
tcg_insn_unit insn = 0;
- tcg_debug_assert(m2 == extract32(m2, 0, 12));
+ tcg_debug_assert(m2 == extract32(m2, 0, 16));
insn = deposit32(insn, 0, 8, op);
insn = deposit32(insn, 8, 4, r0);
insn = deposit32(insn, 12, 4, r1);
- insn = deposit32(insn, 20, 12, m2);
+ insn = deposit32(insn, 16, 16, m2);
tcg_out32(s, insn);
}
@@ -392,20 +393,6 @@ static void tcg_out_op_rrrc(TCGContext *s, TCGOpcode op,
tcg_out32(s, insn);
}
-static void tcg_out_op_rrrm(TCGContext *s, TCGOpcode op,
- TCGReg r0, TCGReg r1, TCGReg r2, TCGArg m3)
-{
- tcg_insn_unit insn = 0;
-
- tcg_debug_assert(m3 == extract32(m3, 0, 12));
- insn = deposit32(insn, 0, 8, op);
- insn = deposit32(insn, 8, 4, r0);
- insn = deposit32(insn, 12, 4, r1);
- insn = deposit32(insn, 16, 4, r2);
- insn = deposit32(insn, 20, 12, m3);
- tcg_out32(s, insn);
-}
-
static void tcg_out_op_rrrbb(TCGContext *s, TCGOpcode op, TCGReg r0,
TCGReg r1, TCGReg r2, uint8_t b3, uint8_t b4)
{
@@ -860,7 +847,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
if (TCG_TARGET_REG_BITS == 64) {
tcg_out_op_rrm(s, opc, args[0], args[1], args[2]);
} else {
- tcg_out_op_rrrm(s, opc, args[0], args[1], args[2], args[3]);
+ tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_TMP, args[4]);
+ tcg_out_op_rrrr(s, opc, args[0], args[1], args[2], TCG_REG_TMP);
}
break;
case INDEX_op_qemu_ld_a64_i64:
@@ -947,11 +935,11 @@ static void tcg_target_init(TCGContext *s)
/*
* The interpreter "registers" are in the local stack frame and
* cannot be clobbered by the called helper functions. However,
- * the interpreter assumes a 64-bit return value and assigns to
+ * the interpreter assumes a 128-bit return value and assigns to
* the return value registers.
*/
tcg_target_call_clobber_regs =
- MAKE_64BIT_MASK(TCG_REG_R0, 64 / TCG_TARGET_REG_BITS);
+ MAKE_64BIT_MASK(TCG_REG_R0, 128 / TCG_TARGET_REG_BITS);
s->reserved_regs = 0;
tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP);
diff --git a/tests/qemu-iotests/194 b/tests/qemu-iotests/194
index 68894371f5..c0ce82dd25 100755
--- a/tests/qemu-iotests/194
+++ b/tests/qemu-iotests/194
@@ -74,6 +74,11 @@ with iotests.FilePath('source.img') as source_img_path, \
while True:
event1 = source_vm.event_wait('MIGRATION')
+ if event1['data']['status'] == 'postcopy-active':
+ # This event is racy, it depends do we really do postcopy or bitmap
+ # was migrated during downtime (and no data to migrate in postcopy
+ # phase). So, don't log it.
+ continue
iotests.log(event1, filters=[iotests.filter_qmp_event])
if event1['data']['status'] in ('completed', 'failed'):
iotests.log('Gracefully ending the `drive-mirror` job on source...')
diff --git a/tests/qemu-iotests/194.out b/tests/qemu-iotests/194.out
index 4e6df1565a..376ed1d2e6 100644
--- a/tests/qemu-iotests/194.out
+++ b/tests/qemu-iotests/194.out
@@ -14,7 +14,6 @@ Starting migration...
{"return": {}}
{"data": {"status": "setup"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
{"data": {"status": "active"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
-{"data": {"status": "postcopy-active"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
{"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
Gracefully ending the `drive-mirror` job on source...
{"return": {}}