From a4969e90b8110d6880d1a7fcb3cab27c316a0d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 3 Jun 2015 14:22:41 +0100 Subject: [PATCH 01/21] configure: append --extra-ldflags to LDFLAGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The help text says --extra-ldflags is appended to LDFLAGS so make it so. Signed-off-by: Alex Bennée Signed-off-by: Michael Tokarev --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 6fed07b5e2..2fd958d956 100755 --- a/configure +++ b/configure @@ -355,7 +355,7 @@ for opt do --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" EXTRA_CFLAGS="$optarg" ;; - --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" + --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg" EXTRA_LDFLAGS="$optarg" ;; --enable-debug-info) debug_info="yes" From bfa3ab619731653e752c7cf0ab3395ec8e70fe79 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Wed, 3 Jun 2015 17:37:27 +0300 Subject: [PATCH 02/21] remove libdecnumber/dpd/decimal128Local.h Commit 72ac97cdfc added two equivalent versions of decimal128Local.h, one in libdecnumber/dpd/ and another in include/libdecnumber/dpd/. Being identical by the code, the two files however differs in the licensing terms. The one in libdecnumber/dpd/ (which is being removed by this patch) is licensed as GPL3.1 (plus gcc runtime exception), which, as far as I know, is not compatible with GPL-2. This file is not used (it is included from include/libdecnumber/dpd/decimal128.h, so version in include/ is used). More, the version in include/ can also be removed, since none of the 3 defines from that file are actually used by the code. Even more, one of the defines from there, decimal128SetSign, is redefined (to equivalent value) in libdecnumber/dpd/decimal128.c, but again, never used. What a mess... Signed-off-by: Michael Tokarev Reviewed-by: Peter Maydell --- libdecnumber/dpd/decimal128Local.h | 42 ------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 libdecnumber/dpd/decimal128Local.h diff --git a/libdecnumber/dpd/decimal128Local.h b/libdecnumber/dpd/decimal128Local.h deleted file mode 100644 index 1963678cdd..0000000000 --- a/libdecnumber/dpd/decimal128Local.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Local definitions for use with the decNumber C Library. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 3, or (at your option) any later - version. - - GCC is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -. */ - -#if !defined(DECIMAL128LOCAL) - -/* The compiler needs sign manipulation functions for decimal128 which - are not part of the decNumber package. */ - -/* Set sign; this assumes the sign was previously zero. */ -#define decimal128SetSign(d,b) \ - { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] |= ((unsigned) (b) << 7); } - -/* Clear sign. */ -#define decimal128ClearSign(d) \ - { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] &= ~0x80; } - -/* Flip sign. */ -#define decimal128FlipSign(d) \ - { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] ^= 0x80; } - -#endif From 4aab6282f8e1f7652b0470b078a08ab5678fb929 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Wed, 3 Jun 2015 19:43:56 +0100 Subject: [PATCH 03/21] Grammar: 'as to'->'as for' Fixup migrate-incoming text as requested by Eric in: http://lists.nongnu.org/archive/html/qemu-devel/2015-03/msg03362.html Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- qmp-commands.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmp-commands.hx b/qmp-commands.hx index 3ffa612f2c..a05d25ff60 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -686,7 +686,7 @@ Notes: (1) QEMU must be started with -incoming defer to allow migrate-incoming to be used -(2) The uri format is the same as to -incoming +(2) The uri format is the same as for -incoming EQMP { From 7c59364d0329d36a7759033962a469ca714f884d Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Wed, 3 Jun 2015 17:58:01 +0100 Subject: [PATCH 04/21] Print error when failing to load PCI config data When loading migration fails due to a disagreement about PCI config data we don't currently get any errors explaining that was the cause of the problem or which byte in the config data was at fault. Signed-off-by: Dr. David Alan Gilbert Signed-off-by: Michael Tokarev --- hw/pci/pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 45394cfe32..442f822f42 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -428,6 +428,10 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size) for (i = 0; i < size; ++i) { if ((config[i] ^ s->config[i]) & s->cmask[i] & ~s->wmask[i] & ~s->w1cmask[i]) { + error_report("%s: Bad config data: i=0x%x read: %x device: %x " + "cmask: %x wmask: %x w1cmask:%x", __func__, + i, config[i], s->config[i], + s->cmask[i], s->wmask[i], s->w1cmask[i]); g_free(config); return -EINVAL; } From 1ea6305a834a01bba55309d012ee1fdc46c3eff2 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Wed, 13 May 2015 08:43:22 +0800 Subject: [PATCH 05/21] pci-assign: QOMify Signed-off-by: Gonglei Signed-off-by: Michael Tokarev --- hw/i386/kvm/pci-assign.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index 9db7c77605..74d22f4fd2 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -141,6 +141,9 @@ typedef struct AssignedDevice { int32_t bootindex; } AssignedDevice; +#define TYPE_PCI_ASSIGN "kvm-pci-assign" +#define PCI_ASSIGN(obj) OBJECT_CHECK(AssignedDevice, (obj), TYPE_PCI_ASSIGN) + static void assigned_dev_update_irq_routing(PCIDevice *dev); static void assigned_dev_load_option_rom(AssignedDevice *dev); @@ -257,7 +260,7 @@ static const MemoryRegionOps slow_bar_ops = { static void assigned_dev_iomem_setup(PCIDevice *pci_dev, int region_num, pcibus_t e_size) { - AssignedDevice *r_dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *r_dev = PCI_ASSIGN(pci_dev); AssignedDevRegion *region = &r_dev->v_addrs[region_num]; PCIRegion *real_region = &r_dev->real_device.regions[region_num]; @@ -289,7 +292,7 @@ static const MemoryRegionOps assigned_dev_ioport_ops = { static void assigned_dev_ioport_setup(PCIDevice *pci_dev, int region_num, pcibus_t size) { - AssignedDevice *r_dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *r_dev = PCI_ASSIGN(pci_dev); AssignedDevRegion *region = &r_dev->v_addrs[region_num]; region->e_size = size; @@ -303,7 +306,7 @@ static void assigned_dev_ioport_setup(PCIDevice *pci_dev, int region_num, static uint32_t assigned_dev_pci_read(PCIDevice *d, int pos, int len) { - AssignedDevice *pci_dev = DO_UPCAST(AssignedDevice, dev, d); + AssignedDevice *pci_dev = PCI_ASSIGN(d); uint32_t val; ssize_t ret; int fd = pci_dev->real_device.config_fd; @@ -328,7 +331,7 @@ static uint8_t assigned_dev_pci_read_byte(PCIDevice *d, int pos) static void assigned_dev_pci_write(PCIDevice *d, int pos, uint32_t val, int len) { - AssignedDevice *pci_dev = DO_UPCAST(AssignedDevice, dev, d); + AssignedDevice *pci_dev = PCI_ASSIGN(d); ssize_t ret; int fd = pci_dev->real_device.config_fd; @@ -946,7 +949,7 @@ static void deassign_device(AssignedDevice *dev) */ static void assigned_dev_update_irq_routing(PCIDevice *dev) { - AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, dev); + AssignedDevice *assigned_dev = PCI_ASSIGN(dev); Error *err = NULL; int r; @@ -961,7 +964,7 @@ static void assigned_dev_update_irq_routing(PCIDevice *dev) static void assigned_dev_update_msi(PCIDevice *pci_dev) { - AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *assigned_dev = PCI_ASSIGN(pci_dev); uint8_t ctrl_byte = pci_get_byte(pci_dev->config + pci_dev->msi_cap + PCI_MSI_FLAGS); int r; @@ -1015,7 +1018,7 @@ static void assigned_dev_update_msi(PCIDevice *pci_dev) static void assigned_dev_update_msi_msg(PCIDevice *pci_dev) { - AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *assigned_dev = PCI_ASSIGN(pci_dev); uint8_t ctrl_byte = pci_get_byte(pci_dev->config + pci_dev->msi_cap + PCI_MSI_FLAGS); @@ -1048,7 +1051,7 @@ static bool assigned_dev_msix_skipped(MSIXTableEntry *entry) static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev) { - AssignedDevice *adev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *adev = PCI_ASSIGN(pci_dev); uint16_t entries_nr = 0; int i, r = 0; MSIXTableEntry *entry = adev->msix_table; @@ -1113,7 +1116,7 @@ static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev) static void assigned_dev_update_msix(PCIDevice *pci_dev) { - AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *assigned_dev = PCI_ASSIGN(pci_dev); uint16_t ctrl_word = pci_get_word(pci_dev->config + pci_dev->msix_cap + PCI_MSIX_FLAGS); int r; @@ -1163,7 +1166,7 @@ static void assigned_dev_update_msix(PCIDevice *pci_dev) static uint32_t assigned_dev_pci_read_config(PCIDevice *pci_dev, uint32_t address, int len) { - AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *assigned_dev = PCI_ASSIGN(pci_dev); uint32_t virt_val = pci_default_read_config(pci_dev, address, len); uint32_t real_val, emulate_mask, full_emulation_mask; @@ -1184,7 +1187,7 @@ static uint32_t assigned_dev_pci_read_config(PCIDevice *pci_dev, static void assigned_dev_pci_write_config(PCIDevice *pci_dev, uint32_t address, uint32_t val, int len) { - AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *assigned_dev = PCI_ASSIGN(pci_dev); uint16_t old_cmd = pci_get_word(pci_dev->config + PCI_COMMAND); uint32_t emulate_mask, full_emulation_mask; int ret; @@ -1244,7 +1247,7 @@ static void assigned_dev_setup_cap_read(AssignedDevice *dev, uint32_t offset, static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp) { - AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *dev = PCI_ASSIGN(pci_dev); PCIRegion *pci_region = dev->real_device.regions; int ret, pos; Error *local_err = NULL; @@ -1684,8 +1687,8 @@ static const VMStateDescription vmstate_assigned_device = { static void reset_assigned_device(DeviceState *dev) { - PCIDevice *pci_dev = DO_UPCAST(PCIDevice, qdev, dev); - AssignedDevice *adev = DO_UPCAST(AssignedDevice, dev, pci_dev); + PCIDevice *pci_dev = PCI_DEVICE(dev); + AssignedDevice *adev = PCI_ASSIGN(pci_dev); char reset_file[64]; const char reset[] = "1"; int fd, ret; @@ -1740,7 +1743,7 @@ static void reset_assigned_device(DeviceState *dev) static void assigned_realize(struct PCIDevice *pci_dev, Error **errp) { - AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *dev = PCI_ASSIGN(pci_dev); uint8_t e_intx; int r; Error *local_err = NULL; @@ -1836,7 +1839,7 @@ exit_with_error: static void assigned_exitfn(struct PCIDevice *pci_dev) { - AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + AssignedDevice *dev = PCI_ASSIGN(pci_dev); deassign_device(dev); free_assigned_device(dev); @@ -1845,7 +1848,7 @@ static void assigned_exitfn(struct PCIDevice *pci_dev) static void assigned_dev_instance_init(Object *obj) { PCIDevice *pci_dev = PCI_DEVICE(obj); - AssignedDevice *d = DO_UPCAST(AssignedDevice, dev, PCI_DEVICE(obj)); + AssignedDevice *d = PCI_ASSIGN(pci_dev); device_add_bootindex_property(obj, &d->bootindex, "bootindex", NULL, @@ -1879,7 +1882,7 @@ static void assign_class_init(ObjectClass *klass, void *data) } static const TypeInfo assign_info = { - .name = "kvm-pci-assign", + .name = TYPE_PCI_ASSIGN, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(AssignedDevice), .class_init = assign_class_init, From b7c69719d21bea305b7cff6ecde0974edc5ff4b8 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Wed, 13 May 2015 08:43:23 +0800 Subject: [PATCH 06/21] piix: piix3 QOMify Signed-off-by: Gonglei Signed-off-by: Michael Tokarev --- hw/pci-host/piix.c | 57 +++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index ed2424c4cd..ad55f99663 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -91,6 +91,10 @@ typedef struct PIIX3State { MemoryRegion rcr_mem; } PIIX3State; +#define TYPE_PIIX3_PCI_DEVICE "pci-piix3" +#define PIIX3_PCI_DEVICE(obj) \ + OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE) + #define TYPE_I440FX_PCI_DEVICE "i440FX" #define I440FX_PCI_DEVICE(obj) \ OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE) @@ -368,13 +372,15 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, * connected to the IOAPIC directly. * These additional routes can be discovered through ACPI. */ if (xen_enabled()) { - piix3 = DO_UPCAST(PIIX3State, dev, - pci_create_simple_multifunction(b, -1, true, "PIIX3-xen")); + PCIDevice *pci_dev = pci_create_simple_multifunction(b, + -1, true, "PIIX3-xen"); + piix3 = PIIX3_PCI_DEVICE(pci_dev); pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq, piix3, XEN_PIIX_NUM_PIRQS); } else { - piix3 = DO_UPCAST(PIIX3State, dev, - pci_create_simple_multifunction(b, -1, true, "PIIX3")); + PCIDevice *pci_dev = pci_create_simple_multifunction(b, + -1, true, "PIIX3"); + piix3 = PIIX3_PCI_DEVICE(pci_dev); pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3, PIIX_NUM_PIRQS); pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq); @@ -480,7 +486,7 @@ static void piix3_write_config(PCIDevice *dev, { pci_default_write_config(dev, address, val, len); if (ranges_overlap(address, len, PIIX_PIRQC, 4)) { - PIIX3State *piix3 = DO_UPCAST(PIIX3State, dev, dev); + PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); int pic_irq; pci_bus_fire_intx_routing_notifier(piix3->dev.bus); @@ -634,7 +640,7 @@ static const MemoryRegionOps rcr_ops = { static void piix3_realize(PCIDevice *dev, Error **errp) { - PIIX3State *d = DO_UPCAST(PIIX3State, dev, dev); + PIIX3State *d = PIIX3_PCI_DEVICE(dev); isa_bus_new(DEVICE(d), get_system_memory(), pci_address_space_io(dev)); @@ -647,7 +653,7 @@ static void piix3_realize(PCIDevice *dev, Error **errp) qemu_register_reset(piix3_reset, d); } -static void piix3_class_init(ObjectClass *klass, void *data) +static void pci_piix3_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); @@ -656,7 +662,6 @@ static void piix3_class_init(ObjectClass *klass, void *data) dc->vmsd = &vmstate_piix3; dc->hotpluggable = false; k->realize = piix3_realize; - k->config_write = piix3_write_config; k->vendor_id = PCI_VENDOR_ID_INTEL; /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; @@ -668,38 +673,37 @@ static void piix3_class_init(ObjectClass *klass, void *data) dc->cannot_instantiate_with_device_add_yet = true; } +static const TypeInfo piix3_pci_type_info = { + .name = TYPE_PIIX3_PCI_DEVICE, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PIIX3State), + .abstract = true, + .class_init = pci_piix3_class_init, +}; + +static void piix3_class_init(ObjectClass *klass, void *data) +{ + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + + k->config_write = piix3_write_config; +} + static const TypeInfo piix3_info = { .name = "PIIX3", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PIIX3State), + .parent = TYPE_PIIX3_PCI_DEVICE, .class_init = piix3_class_init, }; static void piix3_xen_class_init(ObjectClass *klass, void *data) { - DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - dc->desc = "ISA bridge"; - dc->vmsd = &vmstate_piix3; - dc->hotpluggable = false; - k->realize = piix3_realize; k->config_write = piix3_write_config_xen; - k->vendor_id = PCI_VENDOR_ID_INTEL; - /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ - k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; - k->class_id = PCI_CLASS_BRIDGE_ISA; - /* - * Reason: part of PIIX3 southbridge, needs to be wired up by - * pc_piix.c's pc_init1() - */ - dc->cannot_instantiate_with_device_add_yet = true; }; static const TypeInfo piix3_xen_info = { .name = "PIIX3-xen", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PIIX3State), + .parent = TYPE_PIIX3_PCI_DEVICE, .class_init = piix3_xen_class_init, }; @@ -772,6 +776,7 @@ static const TypeInfo i440fx_pcihost_info = { static void i440fx_register_types(void) { type_register_static(&i440fx_info); + type_register_static(&piix3_pci_type_info); type_register_static(&piix3_info); type_register_static(&piix3_xen_info); type_register_static(&i440fx_pcihost_info); From acff3e48b7e1ac18e034cc612346bdc38ad96ee1 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Wed, 13 May 2015 08:43:24 +0800 Subject: [PATCH 07/21] piix4: QOMify Signed-off-by: Gonglei Signed-off-by: Michael Tokarev --- hw/isa/piix4.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index d9522b1f45..2c59e91fff 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -34,6 +34,10 @@ typedef struct PIIX4State { PCIDevice dev; } PIIX4State; +#define TYPE_PIIX4_PCI_DEVICE "PIIX4" +#define PIIX4_PCI_DEVICE(obj) \ + OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE) + static void piix4_reset(void *opaque) { PIIX4State *d = opaque; @@ -84,7 +88,7 @@ static const VMStateDescription vmstate_piix4 = { static void piix4_realize(PCIDevice *dev, Error **errp) { - PIIX4State *d = DO_UPCAST(PIIX4State, dev, dev); + PIIX4State *d = PIIX4_PCI_DEVICE(dev); isa_bus_new(DEVICE(d), pci_address_space(dev), pci_address_space_io(dev)); @@ -121,7 +125,7 @@ static void piix4_class_init(ObjectClass *klass, void *data) } static const TypeInfo piix4_info = { - .name = "PIIX4", + .name = TYPE_PIIX4_PCI_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PIIX4State), .class_init = piix4_class_init, From 41fc9050fed524d300062fd8fe7aecd5c7adf5ac Mon Sep 17 00:00:00 2001 From: Gonglei Date: Wed, 13 May 2015 08:43:25 +0800 Subject: [PATCH 08/21] wdt_i6300esb: QOMify Signed-off-by: Gonglei Signed-off-by: Michael Tokarev --- hw/watchdog/wdt_i6300esb.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index 4ebdbb8586..cfa2b1be13 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -103,6 +103,10 @@ struct I6300State { typedef struct I6300State I6300State; +#define TYPE_WATCHDOG_I6300ESB_DEVICE "i6300esb" +#define WATCHDOG_I6300ESB_DEVICE(obj) \ + OBJECT_CHECK(I6300State, (obj), TYPE_WATCHDOG_I6300ESB_DEVICE) + /* This function is called when the watchdog has either been enabled * (hence it starts counting down) or has been keep-alived. */ @@ -150,7 +154,7 @@ static void i6300esb_disable_timer(I6300State *d) static void i6300esb_reset(DeviceState *dev) { PCIDevice *pdev = PCI_DEVICE(dev); - I6300State *d = DO_UPCAST(I6300State, dev, pdev); + I6300State *d = WATCHDOG_I6300ESB_DEVICE(pdev); i6300esb_debug("I6300State = %p\n", d); @@ -213,7 +217,7 @@ static void i6300esb_timer_expired(void *vp) static void i6300esb_config_write(PCIDevice *dev, uint32_t addr, uint32_t data, int len) { - I6300State *d = DO_UPCAST(I6300State, dev, dev); + I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev); int old; i6300esb_debug("addr = %x, data = %x, len = %d\n", addr, data, len); @@ -241,7 +245,7 @@ static void i6300esb_config_write(PCIDevice *dev, uint32_t addr, static uint32_t i6300esb_config_read(PCIDevice *dev, uint32_t addr, int len) { - I6300State *d = DO_UPCAST(I6300State, dev, dev); + I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev); uint32_t data; i6300esb_debug ("addr = %x, len = %d\n", addr, len); @@ -416,7 +420,7 @@ static const VMStateDescription vmstate_i6300esb = { static void i6300esb_realize(PCIDevice *dev, Error **errp) { - I6300State *d = DO_UPCAST(I6300State, dev, dev); + I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev); i6300esb_debug("I6300State = %p\n", d); @@ -451,7 +455,7 @@ static void i6300esb_class_init(ObjectClass *klass, void *data) } static const TypeInfo i6300esb_info = { - .name = "i6300esb", + .name = TYPE_WATCHDOG_I6300ESB_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(I6300State), .class_init = i6300esb_class_init, From f9b9d292afcb55f23b8863c0388a4b3e42c79747 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Wed, 13 May 2015 08:43:26 +0800 Subject: [PATCH 09/21] xen_pt: QOMify Cc: Stefano Stabellini Signed-off-by: Gonglei Tested-by: Stefano Stabellini Signed-off-by: Michael Tokarev --- hw/xen/xen_pt.c | 10 +++++----- hw/xen/xen_pt.h | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 9afcda8e21..35ddacc5db 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -125,7 +125,7 @@ int xen_pt_bar_offset_to_index(uint32_t offset) static uint32_t xen_pt_pci_read_config(PCIDevice *d, uint32_t addr, int len) { - XenPCIPassthroughState *s = DO_UPCAST(XenPCIPassthroughState, dev, d); + XenPCIPassthroughState *s = XEN_PT_DEVICE(d); uint32_t val = 0; XenPTRegGroup *reg_grp_entry = NULL; XenPTReg *reg_entry = NULL; @@ -230,7 +230,7 @@ exit: static void xen_pt_pci_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int len) { - XenPCIPassthroughState *s = DO_UPCAST(XenPCIPassthroughState, dev, d); + XenPCIPassthroughState *s = XEN_PT_DEVICE(d); int index = 0; XenPTRegGroup *reg_grp_entry = NULL; int rc = 0; @@ -679,7 +679,7 @@ static const MemoryListener xen_pt_io_listener = { static int xen_pt_initfn(PCIDevice *d) { - XenPCIPassthroughState *s = DO_UPCAST(XenPCIPassthroughState, dev, d); + XenPCIPassthroughState *s = XEN_PT_DEVICE(d); int rc = 0; uint8_t machine_irq = 0; uint16_t cmd = 0; @@ -797,7 +797,7 @@ out: static void xen_pt_unregister_device(PCIDevice *d) { - XenPCIPassthroughState *s = DO_UPCAST(XenPCIPassthroughState, dev, d); + XenPCIPassthroughState *s = XEN_PT_DEVICE(d); uint8_t machine_irq = s->machine_irq; uint8_t intx = xen_pt_pci_intx(s); int rc; @@ -868,7 +868,7 @@ static void xen_pci_passthrough_class_init(ObjectClass *klass, void *data) }; static const TypeInfo xen_pci_passthrough_info = { - .name = "xen-pci-passthrough", + .name = TYPE_XEN_PT_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(XenPCIPassthroughState), .class_init = xen_pci_passthrough_class_init, diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h index 4bba559763..87a66770db 100644 --- a/hw/xen/xen_pt.h +++ b/hw/xen/xen_pt.h @@ -36,6 +36,10 @@ typedef struct XenPTReg XenPTReg; typedef struct XenPCIPassthroughState XenPCIPassthroughState; +#define TYPE_XEN_PT_DEVICE "xen-pci-passthrough" +#define XEN_PT_DEVICE(obj) \ + OBJECT_CHECK(XenPCIPassthroughState, (obj), TYPE_XEN_PT_DEVICE) + /* function type for config reg */ typedef int (*xen_pt_conf_reg_init) (XenPCIPassthroughState *, XenPTRegInfo *, uint32_t real_offset, From 417349e6e95d9aa4e0fbc01434de30e8d405ab56 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Wed, 13 May 2015 08:43:27 +0800 Subject: [PATCH 10/21] vt82c686: QOMify Signed-off-by: Gonglei Signed-off-by: Michael Tokarev --- hw/isa/vt82c686.c | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index b2ba870427..252e1d7145 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -47,6 +47,10 @@ typedef struct VT82C686BState { SuperIOConfig superio_conf; } VT82C686BState; +#define TYPE_VT82C686B_DEVICE "VT82C686B" +#define VT82C686B_DEVICE(obj) \ + OBJECT_CHECK(VT82C686BState, (obj), TYPE_VT82C686B_DEVICE) + static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, unsigned size) { @@ -114,7 +118,7 @@ static void vt82c686b_reset(void * opaque) { PCIDevice *d = opaque; uint8_t *pci_conf = d->config; - VT82C686BState *vt82c = DO_UPCAST(VT82C686BState, dev, d); + VT82C686BState *vt82c = VT82C686B_DEVICE(d); pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0); pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY | @@ -142,7 +146,7 @@ static void vt82c686b_reset(void * opaque) static void vt82c686b_write_config(PCIDevice * d, uint32_t address, uint32_t val, int len) { - VT82C686BState *vt686 = DO_UPCAST(VT82C686BState, dev, d); + VT82C686BState *vt686 = VT82C686B_DEVICE(d); DPRINTF("vt82c686b_write_config address 0x%x val 0x%x len 0x%x\n", address, val, len); @@ -172,6 +176,18 @@ typedef struct VT686MC97State { PCIDevice dev; } VT686MC97State; +#define TYPE_VT82C686B_PM_DEVICE "VT82C686B_PM" +#define VT82C686B_PM_DEVICE(obj) \ + OBJECT_CHECK(VT686PMState, (obj), TYPE_VT82C686B_PM_DEVICE) + +#define TYPE_VT82C686B_MC97_DEVICE "VT82C686B_MC97" +#define VT82C686B_MC97_DEVICE(obj) \ + OBJECT_CHECK(VT686MC97State, (obj), TYPE_VT82C686B_MC97_DEVICE) + +#define TYPE_VT82C686B_AC97_DEVICE "VT82C686B_AC97" +#define VT82C686B_AC97_DEVICE(obj) \ + OBJECT_CHECK(VT686AC97State, (obj), TYPE_VT82C686B_AC97_DEVICE) + static void pm_update_sci(VT686PMState *s) { int sci_level, pmsts; @@ -247,7 +263,7 @@ static const VMStateDescription vmstate_acpi = { static void vt82c686b_ac97_realize(PCIDevice *dev, Error **errp) { - VT686AC97State *s = DO_UPCAST(VT686AC97State, dev, dev); + VT686AC97State *s = VT82C686B_AC97_DEVICE(dev); uint8_t *pci_conf = s->dev.config; pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | @@ -261,7 +277,7 @@ void vt82c686b_ac97_init(PCIBus *bus, int devfn) { PCIDevice *dev; - dev = pci_create(bus, devfn, "VT82C686B_AC97"); + dev = pci_create(bus, devfn, TYPE_VT82C686B_AC97_DEVICE); qdev_init_nofail(&dev->qdev); } @@ -280,7 +296,7 @@ static void via_ac97_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_ac97_info = { - .name = "VT82C686B_AC97", + .name = TYPE_VT82C686B_AC97_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(VT686AC97State), .class_init = via_ac97_class_init, @@ -288,7 +304,7 @@ static const TypeInfo via_ac97_info = { static void vt82c686b_mc97_realize(PCIDevice *dev, Error **errp) { - VT686MC97State *s = DO_UPCAST(VT686MC97State, dev, dev); + VT686MC97State *s = VT82C686B_MC97_DEVICE(dev); uint8_t *pci_conf = s->dev.config; pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | @@ -301,7 +317,7 @@ void vt82c686b_mc97_init(PCIBus *bus, int devfn) { PCIDevice *dev; - dev = pci_create(bus, devfn, "VT82C686B_MC97"); + dev = pci_create(bus, devfn, TYPE_VT82C686B_MC97_DEVICE); qdev_init_nofail(&dev->qdev); } @@ -320,7 +336,7 @@ static void via_mc97_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_mc97_info = { - .name = "VT82C686B_MC97", + .name = TYPE_VT82C686B_MC97_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(VT686MC97State), .class_init = via_mc97_class_init, @@ -329,7 +345,7 @@ static const TypeInfo via_mc97_info = { /* vt82c686 pm init */ static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp) { - VT686PMState *s = DO_UPCAST(VT686PMState, dev, dev); + VT686PMState *s = VT82C686B_PM_DEVICE(dev); uint8_t *pci_conf; pci_conf = s->dev.config; @@ -365,10 +381,10 @@ I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, PCIDevice *dev; VT686PMState *s; - dev = pci_create(bus, devfn, "VT82C686B_PM"); + dev = pci_create(bus, devfn, TYPE_VT82C686B_PM_DEVICE); qdev_prop_set_uint32(&dev->qdev, "smb_io_base", smb_io_base); - s = DO_UPCAST(VT686PMState, dev, dev); + s = VT82C686B_PM_DEVICE(dev); qdev_init_nofail(&dev->qdev); @@ -398,7 +414,7 @@ static void via_pm_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_pm_info = { - .name = "VT82C686B_PM", + .name = TYPE_VT82C686B_PM_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(VT686PMState), .class_init = via_pm_class_init, @@ -417,7 +433,7 @@ static const VMStateDescription vmstate_via = { /* init the PCI-to-ISA bridge */ static void vt82c686b_realize(PCIDevice *d, Error **errp) { - VT82C686BState *vt82c = DO_UPCAST(VT82C686BState, dev, d); + VT82C686BState *vt82c = VT82C686B_DEVICE(d); uint8_t *pci_conf; ISABus *isa_bus; uint8_t *wmask; @@ -451,7 +467,8 @@ ISABus *vt82c686b_init(PCIBus *bus, int devfn) { PCIDevice *d; - d = pci_create_simple_multifunction(bus, devfn, true, "VT82C686B"); + d = pci_create_simple_multifunction(bus, devfn, true, + TYPE_VT82C686B_DEVICE); return ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0")); } @@ -477,7 +494,7 @@ static void via_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_info = { - .name = "VT82C686B", + .name = TYPE_VT82C686B_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(VT82C686BState), .class_init = via_class_init, From 1e4db0595777b9b9a5a6a9f49ac3d187dda341f9 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Wed, 17 Jun 2015 21:02:03 +0300 Subject: [PATCH 11/21] libcacard: pkgconfig: tidy dependent libs libcacard.pc file lists only one package in Requires field, which is nss, while glib-2.0 is also a requiriment. Furthermore, for libraries used internally by the library (this is the way nss and glib are used by libcacard), Requires.private shold be used instead of Requires. Fix both issues. This does not affect linking of qemu because it links with objects from libcacard directly. Signed-off-by: Michael Tokarev --- libcacard/libcacard.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcacard/libcacard.pc.in b/libcacard/libcacard.pc.in index b6859b0c1f..4b60023ce9 100644 --- a/libcacard/libcacard.pc.in +++ b/libcacard/libcacard.pc.in @@ -7,7 +7,7 @@ Name: cacard Description: CA Card library Version: @VERSION@ -Requires: nss +Requires.private: nss glib-2.0 Libs: -L${libdir} -lcacard Libs.private: Cflags: -I${includedir} From c23f23b970ae8ce75d2254c64cf23d95a757811e Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Wed, 17 Jun 2015 22:19:26 +0300 Subject: [PATCH 12/21] configure: rearrange --help and consolidate enable/disable together This is an attempt to rearrange configure --help output a bit and consolidate pairs of --enable/disable into its own section. After this, help text is easier to sort, manage and read. More descriptive text can be added as well, since we now have more space. While at it, mention en/dis-able-vte. Signed-off-by: Michael Tokarev --- configure | 199 ++++++++++++++++++++---------------------------------- 1 file changed, 75 insertions(+), 124 deletions(-) diff --git a/configure b/configure index 2fd958d956..f02510bc45 100755 --- a/configure +++ b/configure @@ -1282,29 +1282,10 @@ Advanced options (experts only): --sysconfdir=PATH install config in PATH$confsuffix --localstatedir=PATH install local state in PATH (set at runtime on win32) --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] - --enable-modules enable modules support - --enable-debug-tcg enable TCG debugging - --disable-debug-tcg disable TCG debugging (default) - --enable-debug-info enable debugging information (default) - --disable-debug-info disable debugging information --enable-debug enable common debug build options - --enable-sparse enable sparse checker - --disable-sparse disable sparse checker (default) --disable-strip disable stripping binaries --disable-werror disable compilation abort on warning --disable-stack-protector disable compiler-provided stack protection - --disable-sdl disable SDL - --enable-sdl enable SDL - --with-sdlabi select preferred SDL ABI 1.2 or 2.0 - --disable-gtk disable gtk UI - --enable-gtk enable gtk UI - --with-gtkabi select preferred GTK ABI 2.0 or 3.0 - --disable-virtfs disable VirtFS - --enable-virtfs enable VirtFS - --disable-vnc disable VNC - --enable-vnc enable VNC - --disable-cocoa disable Cocoa (Mac OS X only) - --enable-cocoa enable Cocoa (default on Mac OS X) --audio-drv-list=LIST set audio drivers list: Available drivers: $audio_possible_drivers --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L @@ -1314,119 +1295,89 @@ Advanced options (experts only): --block-drv-ro-whitelist=L set block driver read-only whitelist (affects only QEMU, not qemu-img) - --disable-xen disable xen backend driver support - --enable-xen enable xen backend driver support - --disable-xen-pci-passthrough - --enable-xen-pci-passthrough - --disable-brlapi disable BrlAPI - --enable-brlapi enable BrlAPI - --disable-vnc-tls disable TLS encryption for VNC server - --enable-vnc-tls enable TLS encryption for VNC server - --disable-vnc-sasl disable SASL encryption for VNC server - --enable-vnc-sasl enable SASL encryption for VNC server - --disable-vnc-jpeg disable JPEG lossy compression for VNC server - --enable-vnc-jpeg enable JPEG lossy compression for VNC server - --disable-vnc-png disable PNG compression for VNC server (default) - --enable-vnc-png enable PNG compression for VNC server - --disable-vnc-ws disable Websockets support for VNC server - --enable-vnc-ws enable Websockets support for VNC server - --disable-curses disable curses output - --enable-curses enable curses output - --disable-curl disable curl connectivity - --enable-curl enable curl connectivity - --disable-fdt disable fdt device tree - --enable-fdt enable fdt device tree - --disable-bluez disable bluez stack connectivity - --enable-bluez enable bluez stack connectivity - --disable-slirp disable SLIRP userspace network connectivity - --disable-kvm disable KVM acceleration support - --enable-kvm enable KVM acceleration support - --disable-rdma disable RDMA-based migration support - --enable-rdma enable RDMA-based migration support - --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) - --enable-system enable all system emulation targets - --disable-system disable all system emulation targets - --enable-user enable supported user emulation targets - --disable-user disable all user emulation targets - --enable-linux-user enable all linux usermode emulation targets - --disable-linux-user disable all linux usermode emulation targets - --enable-bsd-user enable all BSD usermode emulation targets - --disable-bsd-user disable all BSD usermode emulation targets - --enable-guest-base enable GUEST_BASE support for usermode - emulation targets - --disable-guest-base disable GUEST_BASE support - --enable-pie build Position Independent Executables - --disable-pie do not build Position Independent Executables - --oss-lib path to OSS library - --cpu=CPU Build for host CPU [$cpu] - --disable-uuid disable uuid support - --enable-uuid enable uuid support - --disable-vde disable support for vde network - --enable-vde enable support for vde network - --disable-netmap disable support for netmap network - --enable-netmap enable support for netmap network - --disable-linux-aio disable Linux AIO support - --enable-linux-aio enable Linux AIO support - --disable-cap-ng disable libcap-ng support - --enable-cap-ng enable libcap-ng support - --disable-attr disable attr and xattr support - --enable-attr enable attr and xattr support - --disable-blobs disable installing provided firmware blobs - --enable-docs enable documentation build - --disable-docs disable documentation build - --disable-vhost-net disable vhost-net acceleration support - --enable-vhost-net enable vhost-net acceleration support --enable-trace-backends=B Set trace backend Available backends: $($python $source_path/scripts/tracetool.py --list-backends) --with-trace-file=NAME Full PATH,NAME of file to store traces Default:trace- - --disable-spice disable spice - --enable-spice enable spice - --enable-rbd enable building the rados block device (rbd) - --disable-libiscsi disable iscsi support - --enable-libiscsi enable iscsi support - --disable-libnfs disable nfs support - --enable-libnfs enable nfs support - --disable-smartcard-nss disable smartcard nss support - --enable-smartcard-nss enable smartcard nss support - --disable-libusb disable libusb (for usb passthrough) - --enable-libusb enable libusb (for usb passthrough) - --disable-usb-redir disable usb network redirection support - --enable-usb-redir enable usb network redirection support - --enable-lzo enable the support of lzo compression library - --enable-snappy enable the support of snappy compression library - --enable-bzip2 enable the support of bzip2 compression library (for - reading bzip2-compressed dmg images) - --disable-guest-agent disable building of the QEMU Guest Agent - --enable-guest-agent enable building of the QEMU Guest Agent - --enable-guest-agent-msi enable building guest agent Windows MSI installation package - --disable-guest-agent-msi disable building guest agent Windows MSI installation - --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent - --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) - --disable-seccomp disable seccomp support - --enable-seccomp enable seccomp support + --disable-slirp disable SLIRP userspace network connectivity + --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) + --oss-lib path to OSS library + --cpu=CPU Build for host CPU [$cpu] --with-coroutine=BACKEND coroutine backend. Supported options: gthread, ucontext, sigaltstack, windows - --disable-coroutine-pool disable coroutine freelist (worse performance) - --enable-coroutine-pool enable coroutine freelist (better performance) - --enable-glusterfs enable GlusterFS backend - --disable-glusterfs disable GlusterFS backend - --enable-archipelago enable Archipelago backend - --disable-archipelago disable Archipelago backend --enable-gcov enable test coverage analysis with gcov --gcov=GCOV use specified gcov [$gcov_tool] - --disable-tpm disable TPM support - --enable-tpm enable TPM support - --disable-libssh2 disable ssh block device support - --enable-libssh2 enable ssh block device support - --disable-vhdx disable support for the Microsoft VHDX image format - --enable-vhdx enable support for the Microsoft VHDX image format - --disable-quorum disable quorum block filter support - --enable-quorum enable quorum block filter support - --disable-numa disable libnuma support - --enable-numa enable libnuma support - --disable-tcmalloc disable tcmalloc support - --enable-tcmalloc enable tcmalloc support + --disable-blobs disable installing provided firmware blobs + --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent + --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) + +Optional features, enabled with --enable-FEATURE and +disabled with --disable-FEATURE, default is enabled if available: + + system all system emulation targets + user supported user emulation targets + linux-user all linux usermode emulation targets + bsd-user all BSD usermode emulation targets + guest-base GUEST_BASE support for usermode emulation targets + docs build documentation + guest-agent build the QEMU Guest Agent + guest-agent-msi build guest agent Windows MSI installation package + pie Position Independent Executables + modules modules support + debug-tcg TCG debugging (default is disabled) + debug-info debugging information + sparse sparse checker + + sdl SDL UI + --with-sdlabi select preferred SDL ABI 1.2 or 2.0 + gtk gtk UI + --with-gtkabi select preferred GTK ABI 2.0 or 3.0 + vte vte support for the gtk UI + curses curses UI + vnc VNC UI support + vnc-tls TLS encryption for VNC server + vnc-sasl SASL encryption for VNC server + vnc-jpeg JPEG lossy compression for VNC server + vnc-png PNG compression for VNC server + vnc-ws Websockets support for VNC server + cocoa Cocoa UI (Mac OS X only) + virtfs VirtFS + xen xen backend driver support + xen-pci-passthrough + brlapi BrlAPI (Braile) + curl curl connectivity + fdt fdt device tree + bluez bluez stack connectivity + kvm KVM acceleration support + rdma RDMA-based migration support + uuid uuid support + vde support for vde network + netmap support for netmap network + linux-aio Linux AIO support + cap-ng libcap-ng support + attr attr and xattr support + vhost-net vhost-net acceleration support + spice spice + rbd rados block device (rbd) + libiscsi iscsi support + libnfs nfs support + smartcard-nss smartcard nss support + libusb libusb (for usb passthrough) + usb-redir usb network redirection support + lzo support of lzo compression library + snappy support of snappy compression library + bzip2 support of bzip2 compression library + (for reading bzip2-compressed dmg images) + seccomp seccomp support + coroutine-pool coroutine freelist (better performance) + glusterfs GlusterFS backend + archipelago Archipelago backend + tpm TPM support + libssh2 ssh block device support + vhdx support for the Microsoft VHDX image format + quorum quorum block filter support + numa libnuma support + tcmalloc tcmalloc support NOTE: The object files are built at the place where configure is launched EOF From a91e21186f81f712af8c02c7eec996ce25fb391f Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Thu, 11 Jun 2015 14:17:56 +0100 Subject: [PATCH 13/21] hw/display/qxl-logger.c: Constify some variable Signed-off-by: Frediano Ziglio Signed-off-by: Michael Tokarev --- hw/display/qxl-logger.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/display/qxl-logger.c b/hw/display/qxl-logger.c index c900c2ca4f..d944d3fdb5 100644 --- a/hw/display/qxl-logger.c +++ b/hw/display/qxl-logger.c @@ -22,7 +22,7 @@ #include "qemu/timer.h" #include "qxl.h" -static const char *qxl_type[] = { +static const char *const qxl_type[] = { [ QXL_CMD_NOP ] = "nop", [ QXL_CMD_DRAW ] = "draw", [ QXL_CMD_UPDATE ] = "update", @@ -31,7 +31,7 @@ static const char *qxl_type[] = { [ QXL_CMD_SURFACE ] = "surface", }; -static const char *qxl_draw_type[] = { +static const char *const qxl_draw_type[] = { [ QXL_DRAW_NOP ] = "nop", [ QXL_DRAW_FILL ] = "fill", [ QXL_DRAW_OPAQUE ] = "opaque", @@ -48,7 +48,7 @@ static const char *qxl_draw_type[] = { [ QXL_DRAW_ALPHA_BLEND ] = "alpha-blend", }; -static const char *qxl_draw_effect[] = { +static const char *const qxl_draw_effect[] = { [ QXL_EFFECT_BLEND ] = "blend", [ QXL_EFFECT_OPAQUE ] = "opaque", [ QXL_EFFECT_REVERT_ON_DUP ] = "revert-on-dup", @@ -59,12 +59,12 @@ static const char *qxl_draw_effect[] = { [ QXL_EFFECT_OPAQUE_BRUSH ] = "opaque-brush", }; -static const char *qxl_surface_cmd[] = { +static const char *const qxl_surface_cmd[] = { [ QXL_SURFACE_CMD_CREATE ] = "create", [ QXL_SURFACE_CMD_DESTROY ] = "destroy", }; -static const char *spice_surface_fmt[] = { +static const char *const spice_surface_fmt[] = { [ SPICE_SURFACE_FMT_INVALID ] = "invalid", [ SPICE_SURFACE_FMT_1_A ] = "alpha/1", [ SPICE_SURFACE_FMT_8_A ] = "alpha/8", @@ -74,14 +74,14 @@ static const char *spice_surface_fmt[] = { [ SPICE_SURFACE_FMT_32_ARGB ] = "ARGB/32", }; -static const char *qxl_cursor_cmd[] = { +static const char *const qxl_cursor_cmd[] = { [ QXL_CURSOR_SET ] = "set", [ QXL_CURSOR_MOVE ] = "move", [ QXL_CURSOR_HIDE ] = "hide", [ QXL_CURSOR_TRAIL ] = "trail", }; -static const char *spice_cursor_type[] = { +static const char *const spice_cursor_type[] = { [ SPICE_CURSOR_TYPE_ALPHA ] = "alpha", [ SPICE_CURSOR_TYPE_MONO ] = "mono", [ SPICE_CURSOR_TYPE_COLOR4 ] = "color4", @@ -91,7 +91,7 @@ static const char *spice_cursor_type[] = { [ SPICE_CURSOR_TYPE_COLOR32 ] = "color32", }; -static const char *qxl_v2n(const char *n[], size_t l, int v) +static const char *qxl_v2n(const char *const n[], size_t l, int v) { if (v >= l || !n[v]) { return "???"; From 6b932c0a5f951f1cfd3c459d8946074b9df8b829 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Mon, 15 Jun 2015 16:12:52 +0300 Subject: [PATCH 14/21] throttle: Fix typo in the documentation of block_set_io_throttle Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- qapi/block-core.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index afa9d3d1f3..793a01e970 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1083,7 +1083,7 @@ # # I/O limits can be disabled by setting all of them to 0. In this case # the device will be removed from its group and the rest of its -# members will no be affected. The 'group' parameter is ignored. +# members will not be affected. The 'group' parameter is ignored. # # @device: The name of the device # From ae08fd5a365e650d70acfe1d9027501707041b52 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 15 Jun 2015 14:35:58 +0200 Subject: [PATCH 15/21] qemu-options: Improve -global documentation Recent commit 3751d7c "vl: allow full-blown QemuOpts syntax for -global" overloaded its existing argument syntax DRIVER.PROP=VALUE with QemuOpts syntax. Unambigious as long as no DRIVER contains '='. Its documentation claims that "the two syntaxes are equivalent." Improve it to spell out how exactly the old syntax gets desugared into the new one. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- qemu-options.hx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index d1712f58af..328fbb4218 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -189,8 +189,9 @@ In particular, you can use this to set driver properties for devices which are created automatically by the machine model. To create a device which is not created automatically and set properties on it, use -@option{device}. -The two syntaxes are equivalent. The longer one works for drivers whose name -contains a dot. +-global @var{driver}.@var{prop}=@var{value} is shorthand for -global +driver=@var{driver},property=@var{prop},value=@var{value}. The +longhand syntax works even when @var{driver} contains a dot. ETEXI DEF("boot", HAS_ARG, QEMU_OPTION_boot, From f9cfd6555a3afb142a74a68438c6f4ee4c127e66 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 15 Jun 2015 14:35:59 +0200 Subject: [PATCH 16/21] qemu-options: Use @itemx where appropriate Doesn't appear to make a difference, but let's use it consistently. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- qemu-options.hx | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 328fbb4218..987dbf0a8a 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -118,7 +118,7 @@ DEF("numa", HAS_ARG, QEMU_OPTION_numa, "-numa node[,memdev=id][,cpus=cpu[-cpu]][,nodeid=node]\n", QEMU_ARCH_ALL) STEXI @item -numa node[,mem=@var{size}][,cpus=@var{cpu[-cpu]}][,nodeid=@var{node}] -@item -numa node[,memdev=@var{id}][,cpus=@var{cpu[-cpu]}][,nodeid=@var{node}] +@itemx -numa node[,memdev=@var{id}][,cpus=@var{cpu[-cpu]}][,nodeid=@var{node}] @findex -numa Simulate a multi node NUMA system. If @samp{mem}, @samp{memdev} and @samp{cpus} are omitted, resources are split equally. Also, note @@ -421,7 +421,7 @@ DEF("fda", HAS_ARG, QEMU_OPTION_fda, DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL) STEXI @item -fda @var{file} -@item -fdb @var{file} +@itemx -fdb @var{file} @findex -fda @findex -fdb Use @var{file} as floppy disk 0/1 image (@pxref{disk_images}). @@ -435,9 +435,9 @@ DEF("hdc", HAS_ARG, QEMU_OPTION_hdc, DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL) STEXI @item -hda @var{file} -@item -hdb @var{file} -@item -hdc @var{file} -@item -hdd @var{file} +@itemx -hdb @var{file} +@itemx -hdc @var{file} +@itemx -hdd @var{file} @findex -hda @findex -hdb @findex -hdc @@ -1009,8 +1009,8 @@ Set the TCP port spice is listening on for plaintext channels. Set the IP address spice is listening on. Default is any address. @item ipv4 -@item ipv6 -@item unix +@itemx ipv6 +@itemx unix Force using the specified IP version. @item password= @@ -1045,17 +1045,17 @@ Set the TCP port spice is listening on for encrypted channels. Set the x509 file directory. Expects same filenames as -vnc $display,x509=$dir @item x509-key-file= -@item x509-key-password= -@item x509-cert-file= -@item x509-cacert-file= -@item x509-dh-key-file= +@itemx x509-key-password= +@itemx x509-cert-file= +@itemx x509-cacert-file= +@itemx x509-dh-key-file= The x509 file names can also be configured individually. @item tls-ciphers= Specify which ciphers to use. @item tls-channel=[main|display|cursor|inputs|record|playback] -@item plaintext-channel=[main|display|cursor|inputs|record|playback] +@itemx plaintext-channel=[main|display|cursor|inputs|record|playback] Force specific channel to be used with or without TLS encryption. The options can be specified multiple times to configure multiple channels. The special name "default" can be used to set the default @@ -1067,7 +1067,7 @@ Configure image compression (lossless). Default is auto_glz. @item jpeg-wan-compression=[auto|never|always] -@item zlib-glz-wan-compression=[auto|never|always] +@itemx zlib-glz-wan-compression=[auto|never|always] Configure wan image compression (lossy for slow links). Default is auto. @@ -1605,7 +1605,7 @@ privilege to run. Valid options are: Connect user mode stack to VLAN @var{n} (@var{n} = 0 is the default). @item id=@var{id} -@item name=@var{name} +@itemx name=@var{name} Assign symbolic name for use in monitor commands. @item net=@var{addr}[/@var{mask}] @@ -1712,7 +1712,7 @@ Then when you use on the host @code{telnet localhost 5555}, you connect to the guest telnet server. @item guestfwd=[tcp]:@var{server}:@var{port}-@var{dev} -@item guestfwd=[tcp]:@var{server}:@var{port}-@var{cmd:command} +@itemx guestfwd=[tcp]:@var{server}:@var{port}-@var{cmd:command} Forward guest TCP connections to the IP address @var{server} on port @var{port} to the character device @var{dev} or to a program executed by @var{cmd:command} which gets spawned for each connection. This option can be given multiple times. @@ -1743,7 +1743,7 @@ syntax gives undefined results. Their use for new applications is discouraged as they will be removed from future versions. @item -netdev tap,id=@var{id}[,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}][,helper=@var{helper}] -@item -net tap[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}][,helper=@var{helper}] +@itemx -net tap[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}][,helper=@var{helper}] Connect the host TAP network interface @var{name} to VLAN @var{n}. Use the network script @var{file} to configure it and the network script @@ -1783,7 +1783,7 @@ qemu-system-i386 linux.img \ @end example @item -netdev bridge,id=@var{id}[,br=@var{bridge}][,helper=@var{helper}] -@item -net bridge[,vlan=@var{n}][,name=@var{name}][,br=@var{bridge}][,helper=@var{helper}] +@itemx -net bridge[,vlan=@var{n}][,name=@var{name}][,br=@var{bridge}][,helper=@var{helper}] Connect a host TAP network interface to a host bridge device. Use the network helper @var{helper} to configure the TAP interface and @@ -1806,7 +1806,7 @@ qemu-system-i386 linux.img -net bridge,br=qemubr0 -net nic,model=virtio @end example @item -netdev socket,id=@var{id}[,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}] -@item -net socket[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}] [,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}] +@itemx -net socket[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}] [,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}] Connect the VLAN @var{n} to a remote VLAN in another QEMU virtual machine using a TCP socket connection. If @option{listen} is @@ -1829,7 +1829,7 @@ qemu-system-i386 linux.img \ @end example @item -netdev socket,id=@var{id}[,fd=@var{h}][,mcast=@var{maddr}:@var{port}[,localaddr=@var{addr}]] -@item -net socket[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,mcast=@var{maddr}:@var{port}[,localaddr=@var{addr}]] +@itemx -net socket[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,mcast=@var{maddr}:@var{port}[,localaddr=@var{addr}]] Create a VLAN @var{n} shared with another QEMU virtual machines using a UDP multicast socket, effectively making a bus for @@ -1881,7 +1881,7 @@ qemu-system-i386 linux.img \ @end example @item -netdev l2tpv3,id=@var{id},src=@var{srcaddr},dst=@var{dstaddr}[,srcport=@var{srcport}][,dstport=@var{dstport}],txsession=@var{txsession}[,rxsession=@var{rxsession}][,ipv6][,udp][,cookie64][,counter][,pincounter][,txcookie=@var{txcookie}][,rxcookie=@var{rxcookie}][,offset=@var{offset}] -@item -net l2tpv3[,vlan=@var{n}][,name=@var{name}],src=@var{srcaddr},dst=@var{dstaddr}[,srcport=@var{srcport}][,dstport=@var{dstport}],txsession=@var{txsession}[,rxsession=@var{rxsession}][,ipv6][,udp][,cookie64][,counter][,pincounter][,txcookie=@var{txcookie}][,rxcookie=@var{rxcookie}][,offset=@var{offset}] +@itemx -net l2tpv3[,vlan=@var{n}][,name=@var{name}],src=@var{srcaddr},dst=@var{dstaddr}[,srcport=@var{srcport}][,dstport=@var{dstport}],txsession=@var{txsession}[,rxsession=@var{rxsession}][,ipv6][,udp][,cookie64][,counter][,pincounter][,txcookie=@var{txcookie}][,rxcookie=@var{rxcookie}][,offset=@var{offset}] Connect VLAN @var{n} to L2TPv3 pseudowire. L2TPv3 (RFC3391) is a popular protocol to transport Ethernet (and other Layer 2) data frames between two systems. It is present in routers, firewalls and the Linux kernel @@ -1902,7 +1902,7 @@ This transport allows a VM to communicate to another VM, router or firewall dire @item ipv6 force v6, otherwise defaults to v4. @item rxcookie=@var{rxcookie} -@item txcookie=@var{txcookie} +@itemx txcookie=@var{txcookie} Cookies are a weak form of security in the l2tpv3 specification. Their function is mostly to prevent misconfiguration. By default they are 32 bit. @@ -1940,7 +1940,7 @@ qemu-system-i386 linux.img -net nic -net l2tpv3,src=4.2.3.1,dst=1.2.3.4,udp,srcp @end example @item -netdev vde,id=@var{id}[,sock=@var{socketpath}][,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}] -@item -net vde[,vlan=@var{n}][,name=@var{name}][,sock=@var{socketpath}] [,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}] +@itemx -net vde[,vlan=@var{n}][,name=@var{name}][,sock=@var{socketpath}] [,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}] Connect VLAN @var{n} to PORT @var{n} of a vde switch running on host and listening for incoming connections on @var{socketpath}. Use GROUP @var{groupname} and MODE @var{octalmode} to change default ownership and permissions for @@ -2239,7 +2239,7 @@ DragonFlyBSD hosts. It is an alias for @option{serial}. @option{path} specifies the path to the tty. @option{path} is required. @item -chardev parallel ,id=@var{id} ,path=@var{path} -@item -chardev parport ,id=@var{id} ,path=@var{path} +@itemx -chardev parport ,id=@var{id} ,path=@var{path} @option{parallel} is only available on Linux, FreeBSD and DragonFlyBSD hosts. @@ -3212,7 +3212,7 @@ Examples: @table @code @item -watchdog i6300esb -watchdog-action pause -@item -watchdog ib700 +@itemx -watchdog ib700 @end table ETEXI @@ -3232,7 +3232,7 @@ instance you could use the either of the following to change the escape character to Control-t. @table @code @item -echr 0x14 -@item -echr 20 +@itemx -echr 20 @end table ETEXI @@ -3280,7 +3280,7 @@ DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \ QEMU_ARCH_ALL) STEXI @item -incoming tcp:[@var{host}]:@var{port}[,to=@var{maxport}][,ipv4][,ipv6] -@item -incoming rdma:@var{host}:@var{port}[,ipv4][,ipv6] +@itemx -incoming rdma:@var{host}:@var{port}[,ipv4][,ipv6] @findex -incoming Prepare for incoming migration, listen on a given tcp port. From eaa2ddbb76798ec70d12351c0db43a7728d29150 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 22 May 2015 13:35:07 +0800 Subject: [PATCH 17/21] Makefile: Fix "make cscope TAGS" Cscope and TAGS files work in source directory rather than the build directory, also, don't ask users to run configure first, because they may have an out of tree build. Signed-off-by: Fam Zheng Reviewed-by: John Snow Signed-off-by: Michael Tokarev --- Makefile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e7c5c3af6f..ea0b29239b 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,11 @@ # Always point to the root of the build tree (needs GNU make). BUILD_DIR=$(CURDIR) +# Before including a proper config-host.mak, assume we are in the source tree +SRC_PATH=. + +UNCHECKED_GOALS := %clean TAGS cscope + # All following code might depend on configuration variables ifneq ($(wildcard config-host.mak),) # Put the all: rule here so that config-host.mak can contain dependencies. @@ -38,7 +43,7 @@ config-host.mak: $(SRC_PATH)/configure fi else config-host.mak: -ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) +ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) @echo "Please call configure before running make!" @exit 1 endif @@ -455,9 +460,9 @@ TAGS: find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} + cscope: - rm -f ./cscope.* - find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files - cscope -b + rm -f "$(SRC_PATH)"/cscope.* + find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files" + cscope -b -i"$(SRC_PATH)/cscope.files" # opengl shader programs ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl @@ -600,7 +605,7 @@ endif # CONFIG_WIN # Add a dependency on the generated files, so that they are always # rebuilt before other object files -ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) +ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) Makefile: $(GENERATED_HEADERS) endif From ae5fdc81a16534ea04fc475f8723e81857c46ad4 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 22 May 2015 13:35:08 +0800 Subject: [PATCH 18/21] Makefile: Add "make ctags" This generates ctags file Signed-off-by: Fam Zheng Reviewed-by: John Snow Signed-off-by: Michael Tokarev --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ea0b29239b..c9be643ae3 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ BUILD_DIR=$(CURDIR) # Before including a proper config-host.mak, assume we are in the source tree SRC_PATH=. -UNCHECKED_GOALS := %clean TAGS cscope +UNCHECKED_GOALS := %clean TAGS cscope ctags # All following code might depend on configuration variables ifneq ($(wildcard config-host.mak),) @@ -454,6 +454,11 @@ endif test speed: all $(MAKE) -C tests/tcg $@ +.PHONY: ctags +ctags: + rm -f $@ + find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} + + .PHONY: TAGS TAGS: rm -f $@ From 22b2aeb82c811b227862c21e7a607087efbe5563 Mon Sep 17 00:00:00 2001 From: Shannon Zhao Date: Thu, 28 May 2015 19:13:42 +0800 Subject: [PATCH 19/21] hw/display/cg3.c: Fix memory leak Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao Signed-off-by: Michael Tokarev --- hw/display/cg3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/cg3.c b/hw/display/cg3.c index b94e5e0d78..34dcbc3119 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -303,6 +303,7 @@ static void cg3_realizefn(DeviceState *dev, Error **errp) if (fcode_filename) { ret = load_image_targphys(fcode_filename, s->prom_addr, FCODE_MAX_ROM_SIZE); + g_free(fcode_filename); if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) { error_report("cg3: could not load prom '%s'", CG3_ROM_FILE); } From 8684e85ca911b41d6a82ac5bcc5a0bfaba5eb7da Mon Sep 17 00:00:00 2001 From: Shannon Zhao Date: Thu, 28 May 2015 19:13:45 +0800 Subject: [PATCH 20/21] hw/display/tcx.c: Fix memory leak Signed-off-by: Shannon Zhao Signed-off-by: Michael Tokarev --- hw/display/tcx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/tcx.c b/hw/display/tcx.c index a0b6bc58de..6acdc2d282 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -1018,6 +1018,7 @@ static void tcx_realizefn(DeviceState *dev, Error **errp) if (fcode_filename) { ret = load_image_targphys(fcode_filename, s->prom_addr, FCODE_MAX_ROM_SIZE); + g_free(fcode_filename); if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) { error_report("tcx: could not load prom '%s'", TCX_ROM_FILE); } From 3de3d698d942d1116152417f882c897b26b44e41 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 21 May 2015 14:33:29 +0200 Subject: [PATCH 21/21] util/qemu-sockets: improve ai_flag hints for ipv6 hosts *) Do not use AI_ADDRCONFIG on listening sockets, because this flag makes it impossible to explicitly listen on '127.0.0.1' if no global ipv4 address is configured additionally, making this a very uncomfortable option. *) Add AI_V4MAPPED hint for connecting sockets. If your system is globally only connected via ipv6 you often still want to be able to use '127.0.0.1' and 'localhost' (even if localhost doesn't also have an ipv6 entry). For example, PVE - unless explicitly asking for insecure mode - uses ipv4 loopback addresses with QEMU for live migrations tunneled over SSH. These fail to start because AI_ADDRCONFIG makes getaddrinfo refuse to work with '127.0.0.1'. As for the AI_V4MAPPED flag: glibc uses it by default, and providing non-0 flags removes it. I think it makes sense to use it. I also want to point out that glibc explicitly sidesteps POSIX standards when passing 0 as hints by then assuming both AI_V4MAPPED and AI_ADDRCONFIG (the latter being a rather weird choice IMO), while according to POSIX.1-2001 it should be assumed 0. (glibc considers its choice an improvement.) Since either AI_CANONNAME or AI_PASSIVE are passed in our cases, glibc's default flags in turn are disabled again unless explicitly added, which I do with this patch. Signed-off-by: Wolfgang Bumiller Signed-off-by: Michael Tokarev --- util/qemu-sockets.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 4026314435..2add83a0fc 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -29,6 +29,9 @@ #ifndef AI_ADDRCONFIG # define AI_ADDRCONFIG 0 #endif +#ifndef AI_V4MAPPED +# define AI_V4MAPPED 0 +#endif /* used temporarily until all users are converted to QemuOpts */ QemuOptsList socket_optslist = { @@ -118,7 +121,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) int slisten, rc, to, port_min, port_max, p; memset(&ai,0, sizeof(ai)); - ai.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; + ai.ai_flags = AI_PASSIVE; ai.ai_family = PF_UNSPEC; ai.ai_socktype = SOCK_STREAM; @@ -335,7 +338,7 @@ static struct addrinfo *inet_parse_connect_opts(QemuOpts *opts, Error **errp) memset(&ai, 0, sizeof(ai)); - ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; + ai.ai_flags = AI_CANONNAME | AI_V4MAPPED | AI_ADDRCONFIG; ai.ai_family = PF_UNSPEC; ai.ai_socktype = SOCK_STREAM; @@ -435,7 +438,7 @@ int inet_dgram_opts(QemuOpts *opts, Error **errp) /* lookup peer addr */ memset(&ai,0, sizeof(ai)); - ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; + ai.ai_flags = AI_CANONNAME | AI_V4MAPPED | AI_ADDRCONFIG; ai.ai_family = PF_UNSPEC; ai.ai_socktype = SOCK_DGRAM;