diff options
Diffstat (limited to 'hw')
69 files changed, 588 insertions, 1454 deletions
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index cbacea5fbd..397e2dcdc7 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -664,8 +664,8 @@ static bool window_translate(TyphoonWindow *win, hwaddr addr, pte_addr |= (addr & (wsm | 0xfe000)) >> 10; return pte_translate(pte_addr, ret); } else { - /* Direct-mapped translation. */ - return make_iommu_tlbe(tba & ~wsm_ext, wsm_ext, ret); + /* Direct-mapped translation. */ + return make_iommu_tlbe(tba & ~wsm_ext, wsm_ext, ret); } } @@ -700,7 +700,7 @@ static IOMMUTLBEntry typhoon_translate_iommu(IOMMUMemoryRegion *iommu, /* Check the fourth window for DAC disable. */ if ((pchip->win[3].wba & 0x80000000000ull) == 0 - && window_translate(&pchip->win[3], addr, &ret)) { + && window_translate(&pchip->win[3], addr, &ret)) { goto success; } } else { @@ -711,7 +711,7 @@ static IOMMUTLBEntry typhoon_translate_iommu(IOMMUMemoryRegion *iommu, if (pchip->ctl & 0x40) { /* See 10.1.4.4; in particular <39:35> is ignored. */ make_iommu_tlbe(0, 0x007ffffffffull, &ret); - goto success; + goto success; } } @@ -723,8 +723,8 @@ static IOMMUTLBEntry typhoon_translate_iommu(IOMMUMemoryRegion *iommu, pte_addr = pchip->win[3].tba & 0x7ffc00000ull; pte_addr |= (addr & 0xffffe000u) >> 10; if (pte_translate(pte_addr, &ret)) { - goto success; - } + goto success; + } } } } diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 6c69ce79b2..442529cc65 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -131,7 +131,7 @@ static void gptm_tick(void *opaque) s->state |= 1; if ((s->control & 0x20)) { /* Output trigger. */ - qemu_irq_pulse(s->trigger); + qemu_irq_pulse(s->trigger); } if (s->mode[0] & 1) { /* One-shot. */ diff --git a/hw/block/nvme.h b/hw/block/nvme.h index cabcf20c32..56c9d4b4b1 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -29,8 +29,8 @@ typedef struct NvmeSQueue { uint64_t dma_addr; QEMUTimer *timer; NvmeRequest *io_req; - QTAILQ_HEAD(sq_req_list, NvmeRequest) req_list; - QTAILQ_HEAD(out_req_list, NvmeRequest) out_req_list; + QTAILQ_HEAD(, NvmeRequest) req_list; + QTAILQ_HEAD(, NvmeRequest) out_req_list; QTAILQ_ENTRY(NvmeSQueue) entry; } NvmeSQueue; @@ -45,8 +45,8 @@ typedef struct NvmeCQueue { uint32_t size; uint64_t dma_addr; QEMUTimer *timer; - QTAILQ_HEAD(sq_list, NvmeSQueue) sq_list; - QTAILQ_HEAD(cq_req_list, NvmeRequest) req_list; + QTAILQ_HEAD(, NvmeSQueue) sq_list; + QTAILQ_HEAD(, NvmeRequest) req_list; } NvmeCQueue; typedef struct NvmeNamespace { diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 36eff94f84..2a254b99d0 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -82,9 +82,9 @@ struct XenBlkDev { int more_work; /* request lists */ - QLIST_HEAD(inflight_head, ioreq) inflight; - QLIST_HEAD(finished_head, ioreq) finished; - QLIST_HEAD(freelist_head, ioreq) freelist; + QLIST_HEAD(, ioreq) inflight; + QLIST_HEAD(, ioreq) finished; + QLIST_HEAD(, ioreq) freelist; int requests_total; int requests_inflight; int requests_finished; diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c index 12831561a6..67740b7ee6 100644 --- a/hw/char/sh_serial.c +++ b/hw/char/sh_serial.c @@ -90,7 +90,7 @@ static void sh_serial_write(void *opaque, hwaddr offs, #ifdef DEBUG_SERIAL printf("sh_serial: write offs=0x%02x val=0x%02x\n", - offs, val); + offs, val); #endif switch(offs) { case 0x00: /* SMR */ @@ -98,17 +98,17 @@ static void sh_serial_write(void *opaque, hwaddr offs, return; case 0x04: /* BRR */ s->brr = val; - return; + return; case 0x08: /* SCR */ /* TODO : For SH7751, SCIF mask should be 0xfb. */ s->scr = val & ((s->feat & SH_SERIAL_FEAT_SCIF) ? 0xfa : 0xff); if (!(val & (1 << 5))) s->flags |= SH_SERIAL_FLAG_TEND; if ((s->feat & SH_SERIAL_FEAT_SCIF) && s->txi) { - qemu_set_irq(s->txi, val & (1 << 7)); + qemu_set_irq(s->txi, val & (1 << 7)); } if (!(val & (1 << 6))) { - qemu_set_irq(s->rxi, 0); + qemu_set_irq(s->rxi, 0); } return; case 0x0c: /* FTDR / TDR */ @@ -117,9 +117,9 @@ static void sh_serial_write(void *opaque, hwaddr offs, /* XXX this blocks entire thread. Rewrite to use * qemu_chr_fe_write and background I/O callbacks */ qemu_chr_fe_write_all(&s->chr, &ch, 1); - } - s->dr = val; - s->flags &= ~SH_SERIAL_FLAG_TDE; + } + s->dr = val; + s->flags &= ~SH_SERIAL_FLAG_TDE; return; #if 0 case 0x14: /* FRDR / RDR */ @@ -210,7 +210,7 @@ static uint64_t sh_serial_read(void *opaque, hwaddr offs, break; case 0x04: ret = s->brr; - break; + break; case 0x08: ret = s->scr; break; @@ -288,7 +288,7 @@ static uint64_t sh_serial_read(void *opaque, hwaddr offs, } #ifdef DEBUG_SERIAL printf("sh_serial: read offs=0x%02x val=0x%x\n", - offs, ret); + offs, ret); #endif if (ret & ~((1 << 16) - 1)) { diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 04e3ebe352..d76351d748 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -696,7 +696,7 @@ static void virtio_serial_save_device(VirtIODevice *vdev, QEMUFile *f) qemu_put_byte(f, port->guest_connected); qemu_put_byte(f, port->host_connected); - elem_popped = 0; + elem_popped = 0; if (port->elem) { elem_popped = 1; } diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index 44f7236382..b1a1e66d5a 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -60,34 +60,34 @@ static void buffer_append(struct XenConsole *con) size = prod - cons; if ((size == 0) || (size > sizeof(intf->out))) - return; + return; if ((buffer->capacity - buffer->size) < size) { - buffer->capacity += (size + 1024); - buffer->data = g_realloc(buffer->data, buffer->capacity); + buffer->capacity += (size + 1024); + buffer->data = g_realloc(buffer->data, buffer->capacity); } while (cons != prod) - buffer->data[buffer->size++] = intf->out[ - MASK_XENCONS_IDX(cons++, intf->out)]; + buffer->data[buffer->size++] = intf->out[ + MASK_XENCONS_IDX(cons++, intf->out)]; xen_mb(); intf->out_cons = cons; xen_pv_send_notify(&con->xendev); if (buffer->max_capacity && - buffer->size > buffer->max_capacity) { - /* Discard the middle of the data. */ + buffer->size > buffer->max_capacity) { + /* Discard the middle of the data. */ - size_t over = buffer->size - buffer->max_capacity; - uint8_t *maxpos = buffer->data + buffer->max_capacity; + size_t over = buffer->size - buffer->max_capacity; + uint8_t *maxpos = buffer->data + buffer->max_capacity; - memmove(maxpos - over, maxpos, over); - buffer->data = g_realloc(buffer->data, buffer->max_capacity); - buffer->size = buffer->capacity = buffer->max_capacity; + memmove(maxpos - over, maxpos, over); + buffer->data = g_realloc(buffer->data, buffer->max_capacity); + buffer->size = buffer->capacity = buffer->max_capacity; - if (buffer->consumed > buffer->max_capacity - over) - buffer->consumed = buffer->max_capacity - over; + if (buffer->consumed > buffer->max_capacity - over) + buffer->consumed = buffer->max_capacity - over; } } @@ -95,8 +95,8 @@ static void buffer_advance(struct buffer *buffer, size_t len) { buffer->consumed += len; if (buffer->consumed == buffer->size) { - buffer->consumed = 0; - buffer->size = 0; + buffer->consumed = 0; + buffer->size = 0; } } @@ -111,7 +111,7 @@ static int ring_free_bytes(struct XenConsole *con) space = prod - cons; if (space > sizeof(intf->in)) - return 0; /* ring is screwed: ignore it */ + return 0; /* ring is screwed: ignore it */ return (sizeof(intf->in) - space); } @@ -132,12 +132,12 @@ static void xencons_receive(void *opaque, const uint8_t *buf, int len) max = ring_free_bytes(con); /* The can_receive() func limits this, but check again anyway */ if (max < len) - len = max; + len = max; prod = intf->in_prod; for (i = 0; i < len; i++) { - intf->in[MASK_XENCONS_IDX(prod++, intf->in)] = - buf[i]; + intf->in[MASK_XENCONS_IDX(prod++, intf->in)] = + buf[i]; } xen_wmb(); intf->in_prod = prod; @@ -228,11 +228,11 @@ static int con_initialise(struct XenDevice *xendev) int limit; if (xenstore_read_int(con->console, "ring-ref", &con->ring_ref) == -1) - return -1; + return -1; if (xenstore_read_int(con->console, "port", &con->xendev.remote_port) == -1) - return -1; + return -1; if (xenstore_read_int(con->console, "limit", &limit) == 0) - con->buffer.max_capacity = limit; + con->buffer.max_capacity = limit; if (!xendev->dev) { xen_pfn_t mfn = con->ring_ref; @@ -244,7 +244,7 @@ static int con_initialise(struct XenDevice *xendev) PROT_READ | PROT_WRITE); } if (!con->sring) - return -1; + return -1; xen_be_bind_evtchn(&con->xendev); qemu_chr_fe_set_handlers(&con->chr, xencons_can_receive, @@ -252,10 +252,10 @@ static int con_initialise(struct XenDevice *xendev) xen_pv_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n", - con->ring_ref, - con->xendev.remote_port, - con->xendev.local_port, - con->buffer.max_capacity); + con->ring_ref, + con->xendev.remote_port, + con->xendev.local_port, + con->buffer.max_capacity); return 0; } @@ -282,7 +282,7 @@ static void con_event(struct XenDevice *xendev) buffer_append(con); if (con->buffer.size - con->buffer.consumed) - xencons_send(con); + xencons_send(con); } /* -------------------------------------------------------------------- */ diff --git a/hw/core/loader.c b/hw/core/loader.c index c7182dfa64..c4f62fe427 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -244,26 +244,26 @@ int load_aout(const char *filename, hwaddr addr, int max_sz, case OMAGIC: if (e.a_text + e.a_data > max_sz) goto fail; - lseek(fd, N_TXTOFF(e), SEEK_SET); - size = read_targphys(filename, fd, addr, e.a_text + e.a_data); - if (size < 0) - goto fail; - break; + lseek(fd, N_TXTOFF(e), SEEK_SET); + size = read_targphys(filename, fd, addr, e.a_text + e.a_data); + if (size < 0) + goto fail; + break; case NMAGIC: if (N_DATADDR(e, target_page_size) + e.a_data > max_sz) goto fail; - lseek(fd, N_TXTOFF(e), SEEK_SET); - size = read_targphys(filename, fd, addr, e.a_text); - if (size < 0) - goto fail; + lseek(fd, N_TXTOFF(e), SEEK_SET); + size = read_targphys(filename, fd, addr, e.a_text); + if (size < 0) + goto fail; ret = read_targphys(filename, fd, addr + N_DATADDR(e, target_page_size), e.a_data); - if (ret < 0) - goto fail; - size += ret; - break; + if (ret < 0) + goto fail; + size += ret; + break; default: - goto fail; + goto fail; } close(fd); return size; diff --git a/hw/core/machine.c b/hw/core/machine.c index 1a0a9ab111..95dc7c3913 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -24,23 +24,10 @@ #include "hw/pci/pci.h" GlobalProperty hw_compat_3_1[] = { - { - .driver = "pcie-root-port", - .property = "x-speed", - .value = "2_5", - },{ - .driver = "pcie-root-port", - .property = "x-width", - .value = "1", - },{ - .driver = "memory-backend-file", - .property = "x-use-canonical-path-for-ramblock-id", - .value = "true", - },{ - .driver = "memory-backend-memfd", - .property = "x-use-canonical-path-for-ramblock-id", - .value = "true", - }, + { "pcie-root-port", "x-speed", "2_5" }, + { "pcie-root-port", "x-width", "1" }, + { "memory-backend-file", "x-use-canonical-path-for-ramblock-id", "true" }, + { "memory-backend-memfd", "x-use-canonical-path-for-ramblock-id", "true" }, }; const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1); @@ -48,269 +35,96 @@ GlobalProperty hw_compat_3_0[] = {}; const size_t hw_compat_3_0_len = G_N_ELEMENTS(hw_compat_3_0); GlobalProperty hw_compat_2_12[] = { - { - .driver = "migration", - .property = "decompress-error-check", - .value = "off", - },{ - .driver = "hda-audio", - .property = "use-timer", - .value = "false", - },{ - .driver = "cirrus-vga", - .property = "global-vmstate", - .value = "true", - },{ - .driver = "VGA", - .property = "global-vmstate", - .value = "true", - },{ - .driver = "vmware-svga", - .property = "global-vmstate", - .value = "true", - },{ - .driver = "qxl-vga", - .property = "global-vmstate", - .value = "true", - }, + { "migration", "decompress-error-check", "off" }, + { "hda-audio", "use-timer", "false" }, + { "cirrus-vga", "global-vmstate", "true" }, + { "VGA", "global-vmstate", "true" }, + { "vmware-svga", "global-vmstate", "true" }, + { "qxl-vga", "global-vmstate", "true" }, }; const size_t hw_compat_2_12_len = G_N_ELEMENTS(hw_compat_2_12); GlobalProperty hw_compat_2_11[] = { - { - .driver = "hpet", - .property = "hpet-offset-saved", - .value = "false", - },{ - .driver = "virtio-blk-pci", - .property = "vectors", - .value = "2", - },{ - .driver = "vhost-user-blk-pci", - .property = "vectors", - .value = "2", - },{ - .driver = "e1000", - .property = "migrate_tso_props", - .value = "off", - }, + { "hpet", "hpet-offset-saved", "false" }, + { "virtio-blk-pci", "vectors", "2" }, + { "vhost-user-blk-pci", "vectors", "2" }, + { "e1000", "migrate_tso_props", "off" }, }; const size_t hw_compat_2_11_len = G_N_ELEMENTS(hw_compat_2_11); GlobalProperty hw_compat_2_10[] = { - { - .driver = "virtio-mouse-device", - .property = "wheel-axis", - .value = "false", - },{ - .driver = "virtio-tablet-device", - .property = "wheel-axis", - .value = "false", - }, + { "virtio-mouse-device", "wheel-axis", "false" }, + { "virtio-tablet-device", "wheel-axis", "false" }, }; const size_t hw_compat_2_10_len = G_N_ELEMENTS(hw_compat_2_10); GlobalProperty hw_compat_2_9[] = { - { - .driver = "pci-bridge", - .property = "shpc", - .value = "off", - },{ - .driver = "intel-iommu", - .property = "pt", - .value = "off", - },{ - .driver = "virtio-net-device", - .property = "x-mtu-bypass-backend", - .value = "off", - },{ - .driver = "pcie-root-port", - .property = "x-migrate-msix", - .value = "false", - }, + { "pci-bridge", "shpc", "off" }, + { "intel-iommu", "pt", "off" }, + { "virtio-net-device", "x-mtu-bypass-backend", "off" }, + { "pcie-root-port", "x-migrate-msix", "false" }, }; const size_t hw_compat_2_9_len = G_N_ELEMENTS(hw_compat_2_9); GlobalProperty hw_compat_2_8[] = { - { - .driver = "fw_cfg_mem", - .property = "x-file-slots", - .value = stringify(0x10), - },{ - .driver = "fw_cfg_io", - .property = "x-file-slots", - .value = stringify(0x10), - },{ - .driver = "pflash_cfi01", - .property = "old-multiple-chip-handling", - .value = "on", - },{ - .driver = "pci-bridge", - .property = "shpc", - .value = "on", - },{ - .driver = TYPE_PCI_DEVICE, - .property = "x-pcie-extcap-init", - .value = "off", - },{ - .driver = "virtio-pci", - .property = "x-pcie-deverr-init", - .value = "off", - },{ - .driver = "virtio-pci", - .property = "x-pcie-lnkctl-init", - .value = "off", - },{ - .driver = "virtio-pci", - .property = "x-pcie-pm-init", - .value = "off", - },{ - .driver = "cirrus-vga", - .property = "vgamem_mb", - .value = "8", - },{ - .driver = "isa-cirrus-vga", - .property = "vgamem_mb", - .value = "8", - }, + { "fw_cfg_mem", "x-file-slots", "0x10" }, + { "fw_cfg_io", "x-file-slots", "0x10" }, + { "pflash_cfi01", "old-multiple-chip-handling", "on" }, + { "pci-bridge", "shpc", "on" }, + { TYPE_PCI_DEVICE, "x-pcie-extcap-init", "off" }, + { "virtio-pci", "x-pcie-deverr-init", "off" }, + { "virtio-pci", "x-pcie-lnkctl-init", "off" }, + { "virtio-pci", "x-pcie-pm-init", "off" }, + { "cirrus-vga", "vgamem_mb", "8" }, + { "isa-cirrus-vga", "vgamem_mb", "8" }, }; const size_t hw_compat_2_8_len = G_N_ELEMENTS(hw_compat_2_8); GlobalProperty hw_compat_2_7[] = { - { - .driver = "virtio-pci", - .property = "page-per-vq", - .value = "on", - },{ - .driver = "virtio-serial-device", - .property = "emergency-write", - .value = "off", - },{ - .driver = "ioapic", - .property = "version", - .value = "0x11", - },{ - .driver = "intel-iommu", - .property = "x-buggy-eim", - .value = "true", - },{ - .driver = "virtio-pci", - .property = "x-ignore-backend-features", - .value = "on", - }, + { "virtio-pci", "page-per-vq", "on" }, + { "virtio-serial-device", "emergency-write", "off" }, + { "ioapic", "version", "0x11" }, + { "intel-iommu", "x-buggy-eim", "true" }, + { "virtio-pci", "x-ignore-backend-features", "on" }, }; const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7); GlobalProperty hw_compat_2_6[] = { - { - .driver = "virtio-mmio", - .property = "format_transport_address", - .value = "off", - },{ - .driver = "virtio-pci", - .property = "disable-modern", - .value = "on", - },{ - .driver = "virtio-pci", - .property = "disable-legacy", - .value = "off", - }, + { "virtio-mmio", "format_transport_address", "off" }, + { "virtio-pci", "disable-modern", "on" }, + { "virtio-pci", "disable-legacy", "off" }, }; const size_t hw_compat_2_6_len = G_N_ELEMENTS(hw_compat_2_6); GlobalProperty hw_compat_2_5[] = { - { - .driver = "isa-fdc", - .property = "fallback", - .value = "144", - },{ - .driver = "pvscsi", - .property = "x-old-pci-configuration", - .value = "on", - },{ - .driver = "pvscsi", - .property = "x-disable-pcie", - .value = "on", - }, - { - .driver = "vmxnet3", - .property = "x-old-msi-offsets", - .value = "on", - },{ - .driver = "vmxnet3", - .property = "x-disable-pcie", - .value = "on", - }, + { "isa-fdc", "fallback", "144" }, + { "pvscsi", "x-old-pci-configuration", "on" }, + { "pvscsi", "x-disable-pcie", "on" }, + { "vmxnet3", "x-old-msi-offsets", "on" }, + { "vmxnet3", "x-disable-pcie", "on" }, }; const size_t hw_compat_2_5_len = G_N_ELEMENTS(hw_compat_2_5); GlobalProperty hw_compat_2_4[] = { - { - .driver = "virtio-blk-device", - .property = "scsi", - .value = "true", - },{ - .driver = "e1000", - .property = "extra_mac_registers", - .value = "off", - },{ - .driver = "virtio-pci", - .property = "x-disable-pcie", - .value = "on", - },{ - .driver = "virtio-pci", - .property = "migrate-extra", - .value = "off", - },{ - .driver = "fw_cfg_mem", - .property = "dma_enabled", - .value = "off", - },{ - .driver = "fw_cfg_io", - .property = "dma_enabled", - .value = "off", - } + { "virtio-blk-device", "scsi", "true" }, + { "e1000", "extra_mac_registers", "off" }, + { "virtio-pci", "x-disable-pcie", "on" }, + { "virtio-pci", "migrate-extra", "off" }, + { "fw_cfg_mem", "dma_enabled", "off" }, + { "fw_cfg_io", "dma_enabled", "off" } }; const size_t hw_compat_2_4_len = G_N_ELEMENTS(hw_compat_2_4); GlobalProperty hw_compat_2_3[] = { - { - .driver = "virtio-blk-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "virtio-balloon-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "virtio-serial-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "virtio-9p-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "virtio-rng-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = TYPE_PCI_DEVICE, - .property = "x-pcie-lnksta-dllla", - .value = "off", - },{ - .driver = "migration", - .property = "send-configuration", - .value = "off", - },{ - .driver = "migration", - .property = "send-section-footer", - .value = "off", - },{ - .driver = "migration", - .property = "store-global-state", - .value = "off", - }, + { "virtio-blk-pci", "any_layout", "off" }, + { "virtio-balloon-pci", "any_layout", "off" }, + { "virtio-serial-pci", "any_layout", "off" }, + { "virtio-9p-pci", "any_layout", "off" }, + { "virtio-rng-pci", "any_layout", "off" }, + { TYPE_PCI_DEVICE, "x-pcie-lnksta-dllla", "off" }, + { "migration", "send-configuration", "off" }, + { "migration", "send-section-footer", "off" }, + { "migration", "store-global-state", "off" }, }; const size_t hw_compat_2_3_len = G_N_ELEMENTS(hw_compat_2_3); @@ -318,35 +132,13 @@ GlobalProperty hw_compat_2_2[] = {}; const size_t hw_compat_2_2_len = G_N_ELEMENTS(hw_compat_2_2); GlobalProperty hw_compat_2_1[] = { - { - .driver = "intel-hda", - .property = "old_msi_addr", - .value = "on", - },{ - .driver = "VGA", - .property = "qemu-extended-regs", - .value = "off", - },{ - .driver = "secondary-vga", - .property = "qemu-extended-regs", - .value = "off", - },{ - .driver = "virtio-scsi-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "usb-mouse", - .property = "usb_version", - .value = stringify(1), - },{ - .driver = "usb-kbd", - .property = "usb_version", - .value = stringify(1), - },{ - .driver = "virtio-pci", - .property = "virtio-pci-bus-master-bug-migration", - .value = "on", - }, + { "intel-hda", "old_msi_addr", "on" }, + { "VGA", "qemu-extended-regs", "off" }, + { "secondary-vga", "qemu-extended-regs", "off" }, + { "virtio-scsi-pci", "any_layout", "off" }, + { "usb-mouse", "usb_version", "1" }, + { "usb-kbd", "usb_version", "1" }, + { "virtio-pci", "virtio-pci-bus-master-bug-migration", "on" }, }; const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1); diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 3769a2bccb..d59071b8ed 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -158,7 +158,7 @@ DeviceState *qdev_try_create(BusState *bus, const char *type) return dev; } -static QTAILQ_HEAD(device_listeners, DeviceListener) device_listeners +static QTAILQ_HEAD(, DeviceListener) device_listeners = QTAILQ_HEAD_INITIALIZER(device_listeners); enum ListenerDirection { Forward, Reverse }; @@ -177,7 +177,7 @@ enum ListenerDirection { Forward, Reverse }; break; \ case Reverse: \ QTAILQ_FOREACH_REVERSE(_listener, &device_listeners, \ - device_listeners, link) { \ + link) { \ if (_listener->_callback) { \ _listener->_callback(_listener, ##_args); \ } \ @@ -975,10 +975,13 @@ void object_apply_compat_props(Object *obj) if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) { MachineState *m = MACHINE(qdev_get_machine()); MachineClass *mc = MACHINE_GET_CLASS(m); - AccelClass *ac = ACCEL_GET_CLASS(m->accelerator); - if (ac->compat_props) { - object_apply_global_props(obj, ac->compat_props, &error_abort); + if (m->accelerator) { + AccelClass *ac = ACCEL_GET_CLASS(m->accelerator); + + if (ac->compat_props) { + object_apply_global_props(obj, ac->compat_props, &error_abort); + } } object_apply_global_props(obj, mc->compat_props, &error_abort); } diff --git a/hw/core/reset.c b/hw/core/reset.c index 84c8869371..9c477f2bf5 100644 --- a/hw/core/reset.c +++ b/hw/core/reset.c @@ -35,7 +35,7 @@ typedef struct QEMUResetEntry { void *opaque; } QEMUResetEntry; -static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = +static QTAILQ_HEAD(, QEMUResetEntry) reset_handlers = QTAILQ_HEAD_INITIALIZER(reset_handlers); void qemu_register_reset(QEMUResetHandler *func, void *opaque) diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c index 3360be6f84..e1b1e302f2 100644 --- a/hw/display/tc6393xb.c +++ b/hw/display/tc6393xb.c @@ -319,7 +319,7 @@ static void tc6393xb_scr_writeb(TC6393xbState *s, hwaddr addr, uint32_t value) SCR_REG_B(DEBUG); } fprintf(stderr, "tc6393xb_scr: unhandled write at %08x: %02x\n", - (uint32_t) addr, value & 0xff); + (uint32_t) addr, value & 0xff); } #undef SCR_REG_B #undef SCR_REG_W @@ -358,7 +358,7 @@ static void tc6393xb_nand_cfg_writeb(TC6393xbState *s, hwaddr addr, uint32_t val return; } fprintf(stderr, "tc6393xb_nand_cfg: unhandled write at %08x: %02x\n", - (uint32_t) addr, value & 0xff); + (uint32_t) addr, value & 0xff); } static uint32_t tc6393xb_nand_readb(TC6393xbState *s, hwaddr addr) { @@ -421,7 +421,7 @@ static void tc6393xb_nand_writeb(TC6393xbState *s, hwaddr addr, uint32_t value) return; } fprintf(stderr, "tc6393xb_nand: unhandled write at %08x: %02x\n", - (uint32_t) addr, value & 0xff); + (uint32_t) addr, value & 0xff); } #define BITS 8 diff --git a/hw/display/vga.c b/hw/display/vga.c index 3ba3f6853c..910a23c12e 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -85,10 +85,10 @@ const uint8_t gr_mask[16] = { #define cbswap_32(__x) \ ((uint32_t)( \ - (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ - (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ - (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ - (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )) + (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ + (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ + (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ + (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )) #ifdef HOST_WORDS_BIGENDIAN #define PAT(x) cbswap_32(x) diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index 55d76405a9..bc6e99c943 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -498,9 +498,9 @@ static void virgl_write_fence(void *opaque, uint32_t fence) QTAILQ_FOREACH_SAFE(cmd, &g->fenceq, next, tmp) { /* - * the guest can end up emitting fences out of order - * so we should check all fenced cmds not just the first one. - */ + * the guest can end up emitting fences out of order + * so we should check all fenced cmds not just the first one. + */ if (cmd->cmd_hdr.fence_id > fence) { continue; } diff --git a/hw/dma/pxa2xx_dma.c b/hw/dma/pxa2xx_dma.c index f4eb26cf17..d498de8ffe 100644 --- a/hw/dma/pxa2xx_dma.c +++ b/hw/dma/pxa2xx_dma.c @@ -228,7 +228,7 @@ static void pxa2xx_dma_run(PXA2xxDMAState *s) !(ch->state & DCSR_NODESCFETCH)) pxa2xx_dma_descriptor_fetch(s, c); break; - } + } } ch->cmd = (ch->cmd & ~DCMD_LEN) | length; @@ -283,7 +283,7 @@ static uint64_t pxa2xx_dma_read(void *opaque, hwaddr offset, case DCSR0 ... DCSR31: channel = offset >> 2; - if (s->chan[channel].request) + if (s->chan[channel].request) return s->chan[channel].state | DCSR_REQPEND; return s->chan[channel].state; diff --git a/hw/dma/soc_dma.c b/hw/dma/soc_dma.c index 45516241c6..58502721fa 100644 --- a/hw/dma/soc_dma.c +++ b/hw/dma/soc_dma.c @@ -345,7 +345,7 @@ void soc_dma_port_add_mem(struct soc_dma_s *soc, uint8_t *phys_base, while (entry < dma->memmap + dma->memmap_size && entry->addr <= virt_base) entry ++; - } + } memmove(entry + 1, entry, (uint8_t *) (dma->memmap + dma->memmap_size ++) - diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c index a560e3afd2..1a2478b5a9 100644 --- a/hw/gpio/max7310.c +++ b/hw/gpio/max7310.c @@ -118,7 +118,7 @@ static int max7310_tx(I2CSlave *i2c, uint8_t data) break; case 0x00: /* Input port - ignore writes */ - break; + break; default: #ifdef VERBOSE printf("%s: unknown register %02x\n", __func__, s->command); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 3c9e20ad9c..fc65049e1d 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -111,174 +111,67 @@ static unsigned e820_entries; struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX}; GlobalProperty pc_compat_3_1[] = { - { - .driver = "intel-iommu", - .property = "dma-drain", - .value = "off", - }, + { "intel-iommu", "dma-drain", "off" }, }; const size_t pc_compat_3_1_len = G_N_ELEMENTS(pc_compat_3_1); GlobalProperty pc_compat_3_0[] = { - { - .driver = TYPE_X86_CPU, - .property = "x-hv-synic-kvm-only", - .value = "on", - },{ - .driver = "Skylake-Server" "-" TYPE_X86_CPU, - .property = "pku", - .value = "off", - },{ - .driver = "Skylake-Server-IBRS" "-" TYPE_X86_CPU, - .property = "pku", - .value = "off", - }, + { TYPE_X86_CPU, "x-hv-synic-kvm-only", "on" }, + { "Skylake-Server" "-" TYPE_X86_CPU, "pku", "off" }, + { "Skylake-Server-IBRS" "-" TYPE_X86_CPU, "pku", "off" }, }; const size_t pc_compat_3_0_len = G_N_ELEMENTS(pc_compat_3_0); GlobalProperty pc_compat_2_12[] = { - { - .driver = TYPE_X86_CPU, - .property = "legacy-cache", - .value = "on", - },{ - .driver = TYPE_X86_CPU, - .property = "topoext", - .value = "off", - },{ - .driver = "EPYC-" TYPE_X86_CPU, - .property = "xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "EPYC-IBPB-" TYPE_X86_CPU, - .property = "xlevel", - .value = stringify(0x8000000a), - }, + { TYPE_X86_CPU, "legacy-cache", "on" }, + { TYPE_X86_CPU, "topoext", "off" }, + { "EPYC-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, + { "EPYC-IBPB-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, }; const size_t pc_compat_2_12_len = G_N_ELEMENTS(pc_compat_2_12); GlobalProperty pc_compat_2_11[] = { - { - .driver = TYPE_X86_CPU, - .property = "x-migrate-smi-count", - .value = "off", - },{ - .driver = "Skylake-Server" "-" TYPE_X86_CPU, - .property = "clflushopt", - .value = "off", - }, + { TYPE_X86_CPU, "x-migrate-smi-count", "off" }, + { "Skylake-Server" "-" TYPE_X86_CPU, "clflushopt", "off" }, }; const size_t pc_compat_2_11_len = G_N_ELEMENTS(pc_compat_2_11); GlobalProperty pc_compat_2_10[] = { - { - .driver = TYPE_X86_CPU, - .property = "x-hv-max-vps", - .value = "0x40", - },{ - .driver = "i440FX-pcihost", - .property = "x-pci-hole64-fix", - .value = "off", - },{ - .driver = "q35-pcihost", - .property = "x-pci-hole64-fix", - .value = "off", - }, + { TYPE_X86_CPU, "x-hv-max-vps", "0x40" }, + { "i440FX-pcihost", "x-pci-hole64-fix", "off" }, + { "q35-pcihost", "x-pci-hole64-fix", "off" }, }; const size_t pc_compat_2_10_len = G_N_ELEMENTS(pc_compat_2_10); GlobalProperty pc_compat_2_9[] = { - { - .driver = "mch", - .property = "extended-tseg-mbytes", - .value = stringify(0), - }, + { "mch", "extended-tseg-mbytes", "0" }, }; const size_t pc_compat_2_9_len = G_N_ELEMENTS(pc_compat_2_9); GlobalProperty pc_compat_2_8[] = { - { - .driver = TYPE_X86_CPU, - .property = "tcg-cpuid", - .value = "off", - }, - { - .driver = "kvmclock", - .property = "x-mach-use-reliable-get-clock", - .value = "off", - }, - { - .driver = "ICH9-LPC", - .property = "x-smi-broadcast", - .value = "off", - }, - { - .driver = TYPE_X86_CPU, - .property = "vmware-cpuid-freq", - .value = "off", - }, - { - .driver = "Haswell-" TYPE_X86_CPU, - .property = "stepping", - .value = "1", - }, + { TYPE_X86_CPU, "tcg-cpuid", "off" }, + { "kvmclock", "x-mach-use-reliable-get-clock", "off" }, + { "ICH9-LPC", "x-smi-broadcast", "off" }, + { TYPE_X86_CPU, "vmware-cpuid-freq", "off" }, + { "Haswell-" TYPE_X86_CPU, "stepping", "1" }, }; const size_t pc_compat_2_8_len = G_N_ELEMENTS(pc_compat_2_8); GlobalProperty pc_compat_2_7[] = { - { - .driver = TYPE_X86_CPU, - .property = "l3-cache", - .value = "off", - }, - { - .driver = TYPE_X86_CPU, - .property = "full-cpuid-auto-level", - .value = "off", - }, - { - .driver = "Opteron_G3" "-" TYPE_X86_CPU, - .property = "family", - .value = "15", - }, - { - .driver = "Opteron_G3" "-" TYPE_X86_CPU, - .property = "model", - .value = "6", - }, - { - .driver = "Opteron_G3" "-" TYPE_X86_CPU, - .property = "stepping", - .value = "1", - }, - { - .driver = "isa-pcspk", - .property = "migrate", - .value = "off", - }, + { TYPE_X86_CPU, "l3-cache", "off" }, + { TYPE_X86_CPU, "full-cpuid-auto-level", "off" }, + { "Opteron_G3" "-" TYPE_X86_CPU, "family", "15" }, + { "Opteron_G3" "-" TYPE_X86_CPU, "model", "6" }, + { "Opteron_G3" "-" TYPE_X86_CPU, "stepping", "1" }, + { "isa-pcspk", "migrate", "off" }, }; const size_t pc_compat_2_7_len = G_N_ELEMENTS(pc_compat_2_7); GlobalProperty pc_compat_2_6[] = { - { - .driver = TYPE_X86_CPU, - .property = "cpuid-0xb", - .value = "off", - },{ - .driver = "vmxnet3", - .property = "romfile", - .value = "", - }, - { - .driver = TYPE_X86_CPU, - .property = "fill-mtrr-mask", - .value = "off", - }, - { - .driver = "apic-common", - .property = "legacy-instance-id", - .value = "on", - } + { TYPE_X86_CPU, "cpuid-0xb", "off" }, + { "vmxnet3", "romfile", "" }, + { TYPE_X86_CPU, "fill-mtrr-mask", "off" }, + { "apic-common", "legacy-instance-id", "on", } }; const size_t pc_compat_2_6_len = G_N_ELEMENTS(pc_compat_2_6); @@ -287,499 +180,148 @@ const size_t pc_compat_2_5_len = G_N_ELEMENTS(pc_compat_2_5); GlobalProperty pc_compat_2_4[] = { PC_CPU_MODEL_IDS("2.4.0") - { - .driver = "Haswell-" TYPE_X86_CPU, - .property = "abm", - .value = "off", - }, - { - .driver = "Haswell-noTSX-" TYPE_X86_CPU, - .property = "abm", - .value = "off", - }, - { - .driver = "Broadwell-" TYPE_X86_CPU, - .property = "abm", - .value = "off", - }, - { - .driver = "Broadwell-noTSX-" TYPE_X86_CPU, - .property = "abm", - .value = "off", - }, - { - .driver = "host" "-" TYPE_X86_CPU, - .property = "host-cache-info", - .value = "on", - }, - { - .driver = TYPE_X86_CPU, - .property = "check", - .value = "off", - }, - { - .driver = "qemu64" "-" TYPE_X86_CPU, - .property = "sse4a", - .value = "on", - }, - { - .driver = "qemu64" "-" TYPE_X86_CPU, - .property = "abm", - .value = "on", - }, - { - .driver = "qemu64" "-" TYPE_X86_CPU, - .property = "popcnt", - .value = "on", - }, - { - .driver = "qemu32" "-" TYPE_X86_CPU, - .property = "popcnt", - .value = "on", - },{ - .driver = "Opteron_G2" "-" TYPE_X86_CPU, - .property = "rdtscp", - .value = "on", - },{ - .driver = "Opteron_G3" "-" TYPE_X86_CPU, - .property = "rdtscp", - .value = "on", - },{ - .driver = "Opteron_G4" "-" TYPE_X86_CPU, - .property = "rdtscp", - .value = "on", - },{ - .driver = "Opteron_G5" "-" TYPE_X86_CPU, - .property = "rdtscp", - .value = "on", - } + { "Haswell-" TYPE_X86_CPU, "abm", "off" }, + { "Haswell-noTSX-" TYPE_X86_CPU, "abm", "off" }, + { "Broadwell-" TYPE_X86_CPU, "abm", "off" }, + { "Broadwell-noTSX-" TYPE_X86_CPU, "abm", "off" }, + { "host" "-" TYPE_X86_CPU, "host-cache-info", "on" }, + { TYPE_X86_CPU, "check", "off" }, + { "qemu64" "-" TYPE_X86_CPU, "sse4a", "on" }, + { "qemu64" "-" TYPE_X86_CPU, "abm", "on" }, + { "qemu64" "-" TYPE_X86_CPU, "popcnt", "on" }, + { "qemu32" "-" TYPE_X86_CPU, "popcnt", "on" }, + { "Opteron_G2" "-" TYPE_X86_CPU, "rdtscp", "on" }, + { "Opteron_G3" "-" TYPE_X86_CPU, "rdtscp", "on" }, + { "Opteron_G4" "-" TYPE_X86_CPU, "rdtscp", "on" }, + { "Opteron_G5" "-" TYPE_X86_CPU, "rdtscp", "on", } }; const size_t pc_compat_2_4_len = G_N_ELEMENTS(pc_compat_2_4); GlobalProperty pc_compat_2_3[] = { PC_CPU_MODEL_IDS("2.3.0") - { - .driver = TYPE_X86_CPU, - .property = "arat", - .value = "off", - },{ - .driver = "qemu64" "-" TYPE_X86_CPU, - .property = "min-level", - .value = stringify(4), - },{ - .driver = "kvm64" "-" TYPE_X86_CPU, - .property = "min-level", - .value = stringify(5), - },{ - .driver = "pentium3" "-" TYPE_X86_CPU, - .property = "min-level", - .value = stringify(2), - },{ - .driver = "n270" "-" TYPE_X86_CPU, - .property = "min-level", - .value = stringify(5), - },{ - .driver = "Conroe" "-" TYPE_X86_CPU, - .property = "min-level", - .value = stringify(4), - },{ - .driver = "Penryn" "-" TYPE_X86_CPU, - .property = "min-level", - .value = stringify(4), - },{ - .driver = "Nehalem" "-" TYPE_X86_CPU, - .property = "min-level", - .value = stringify(4), - },{ - .driver = "n270" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "Penryn" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "Conroe" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "Nehalem" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "Westmere" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "SandyBridge" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "IvyBridge" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "Haswell" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "Haswell-noTSX" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "Broadwell" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = stringify(0x8000000a), - },{ - .driver = TYPE_X86_CPU, - .property = "kvm-no-smi-migration", - .value = "on", - }, + { TYPE_X86_CPU, "arat", "off" }, + { "qemu64" "-" TYPE_X86_CPU, "min-level", "4" }, + { "kvm64" "-" TYPE_X86_CPU, "min-level", "5" }, + { "pentium3" "-" TYPE_X86_CPU, "min-level", "2" }, + { "n270" "-" TYPE_X86_CPU, "min-level", "5" }, + { "Conroe" "-" TYPE_X86_CPU, "min-level", "4" }, + { "Penryn" "-" TYPE_X86_CPU, "min-level", "4" }, + { "Nehalem" "-" TYPE_X86_CPU, "min-level", "4" }, + { "n270" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Penryn" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Conroe" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Nehalem" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Westmere" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "SandyBridge" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "IvyBridge" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Haswell" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Haswell-noTSX" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Broadwell" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Broadwell-noTSX" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { TYPE_X86_CPU, "kvm-no-smi-migration", "on" }, }; const size_t pc_compat_2_3_len = G_N_ELEMENTS(pc_compat_2_3); GlobalProperty pc_compat_2_2[] = { PC_CPU_MODEL_IDS("2.2.0") - { - .driver = "kvm64" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "kvm32" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Conroe" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Penryn" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Nehalem" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Westmere" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "SandyBridge" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Haswell" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Broadwell" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Opteron_G1" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Opteron_G2" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Opteron_G3" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Opteron_G4" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Opteron_G5" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Haswell" "-" TYPE_X86_CPU, - .property = "f16c", - .value = "off", - }, - { - .driver = "Haswell" "-" TYPE_X86_CPU, - .property = "rdrand", - .value = "off", - }, - { - .driver = "Broadwell" "-" TYPE_X86_CPU, - .property = "f16c", - .value = "off", - }, - { - .driver = "Broadwell" "-" TYPE_X86_CPU, - .property = "rdrand", - .value = "off", - }, + { "kvm64" "-" TYPE_X86_CPU, "vme", "off" }, + { "kvm32" "-" TYPE_X86_CPU, "vme", "off" }, + { "Conroe" "-" TYPE_X86_CPU, "vme", "off" }, + { "Penryn" "-" TYPE_X86_CPU, "vme", "off" }, + { "Nehalem" "-" TYPE_X86_CPU, "vme", "off" }, + { "Westmere" "-" TYPE_X86_CPU, "vme", "off" }, + { "SandyBridge" "-" TYPE_X86_CPU, "vme", "off" }, + { "Haswell" "-" TYPE_X86_CPU, "vme", "off" }, + { "Broadwell" "-" TYPE_X86_CPU, "vme", "off" }, + { "Opteron_G1" "-" TYPE_X86_CPU, "vme", "off" }, + { "Opteron_G2" "-" TYPE_X86_CPU, "vme", "off" }, + { "Opteron_G3" "-" TYPE_X86_CPU, "vme", "off" }, + { "Opteron_G4" "-" TYPE_X86_CPU, "vme", "off" }, + { "Opteron_G5" "-" TYPE_X86_CPU, "vme", "off" }, + { "Haswell" "-" TYPE_X86_CPU, "f16c", "off" }, + { "Haswell" "-" TYPE_X86_CPU, "rdrand", "off" }, + { "Broadwell" "-" TYPE_X86_CPU, "f16c", "off" }, + { "Broadwell" "-" TYPE_X86_CPU, "rdrand", "off" }, }; const size_t pc_compat_2_2_len = G_N_ELEMENTS(pc_compat_2_2); GlobalProperty pc_compat_2_1[] = { PC_CPU_MODEL_IDS("2.1.0") - { - .driver = "coreduo" "-" TYPE_X86_CPU, - .property = "vmx", - .value = "on", - }, - { - .driver = "core2duo" "-" TYPE_X86_CPU, - .property = "vmx", - .value = "on", - }, + { "coreduo" "-" TYPE_X86_CPU, "vmx", "on" }, + { "core2duo" "-" TYPE_X86_CPU, "vmx", "on" }, }; const size_t pc_compat_2_1_len = G_N_ELEMENTS(pc_compat_2_1); GlobalProperty pc_compat_2_0[] = { PC_CPU_MODEL_IDS("2.0.0") - { - .driver = "virtio-scsi-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "PIIX4_PM", - .property = "memory-hotplug-support", - .value = "off", - }, - { - .driver = "apic", - .property = "version", - .value = stringify(0x11), - }, - { - .driver = "nec-usb-xhci", - .property = "superspeed-ports-first", - .value = "off", - }, - { - .driver = "nec-usb-xhci", - .property = "force-pcie-endcap", - .value = "on", - }, - { - .driver = "pci-serial", - .property = "prog_if", - .value = stringify(0), - }, - { - .driver = "pci-serial-2x", - .property = "prog_if", - .value = stringify(0), - }, - { - .driver = "pci-serial-4x", - .property = "prog_if", - .value = stringify(0), - }, - { - .driver = "virtio-net-pci", - .property = "guest_announce", - .value = "off", - }, - { - .driver = "ICH9-LPC", - .property = "memory-hotplug-support", - .value = "off", - },{ - .driver = "xio3130-downstream", - .property = COMPAT_PROP_PCP, - .value = "off", - },{ - .driver = "ioh3420", - .property = COMPAT_PROP_PCP, - .value = "off", - }, + { "virtio-scsi-pci", "any_layout", "off" }, + { "PIIX4_PM", "memory-hotplug-support", "off" }, + { "apic", "version", "0x11" }, + { "nec-usb-xhci", "superspeed-ports-first", "off" }, + { "nec-usb-xhci", "force-pcie-endcap", "on" }, + { "pci-serial", "prog_if", "0" }, + { "pci-serial-2x", "prog_if", "0" }, + { "pci-serial-4x", "prog_if", "0" }, + { "virtio-net-pci", "guest_announce", "off" }, + { "ICH9-LPC", "memory-hotplug-support", "off" }, + { "xio3130-downstream", COMPAT_PROP_PCP, "off" }, + { "ioh3420", COMPAT_PROP_PCP, "off" }, }; const size_t pc_compat_2_0_len = G_N_ELEMENTS(pc_compat_2_0); GlobalProperty pc_compat_1_7[] = { PC_CPU_MODEL_IDS("1.7.0") - { - .driver = TYPE_USB_DEVICE, - .property = "msos-desc", - .value = "no", - }, - { - .driver = "PIIX4_PM", - .property = "acpi-pci-hotplug-with-bridge-support", - .value = "off", - }, - { - .driver = "hpet", - .property = HPET_INTCAP, - .value = stringify(4), - }, + { TYPE_USB_DEVICE, "msos-desc", "no" }, + { "PIIX4_PM", "acpi-pci-hotplug-with-bridge-support", "off" }, + { "hpet", HPET_INTCAP, "4" }, }; const size_t pc_compat_1_7_len = G_N_ELEMENTS(pc_compat_1_7); GlobalProperty pc_compat_1_6[] = { PC_CPU_MODEL_IDS("1.6.0") - { - .driver = "e1000", - .property = "mitigation", - .value = "off", - },{ - .driver = "qemu64-" TYPE_X86_CPU, - .property = "model", - .value = stringify(2), - },{ - .driver = "qemu32-" TYPE_X86_CPU, - .property = "model", - .value = stringify(3), - },{ - .driver = "i440FX-pcihost", - .property = "short_root_bus", - .value = stringify(1), - },{ - .driver = "q35-pcihost", - .property = "short_root_bus", - .value = stringify(1), - }, + { "e1000", "mitigation", "off" }, + { "qemu64-" TYPE_X86_CPU, "model", "2" }, + { "qemu32-" TYPE_X86_CPU, "model", "3" }, + { "i440FX-pcihost", "short_root_bus", "1" }, + { "q35-pcihost", "short_root_bus", "1" }, }; const size_t pc_compat_1_6_len = G_N_ELEMENTS(pc_compat_1_6); GlobalProperty pc_compat_1_5[] = { PC_CPU_MODEL_IDS("1.5.0") - { - .driver = "Conroe-" TYPE_X86_CPU, - .property = "model", - .value = stringify(2), - },{ - .driver = "Conroe-" TYPE_X86_CPU, - .property = "min-level", - .value = stringify(2), - },{ - .driver = "Penryn-" TYPE_X86_CPU, - .property = "model", - .value = stringify(2), - },{ - .driver = "Penryn-" TYPE_X86_CPU, - .property = "min-level", - .value = stringify(2), - },{ - .driver = "Nehalem-" TYPE_X86_CPU, - .property = "model", - .value = stringify(2), - },{ - .driver = "Nehalem-" TYPE_X86_CPU, - .property = "min-level", - .value = stringify(2), - },{ - .driver = "virtio-net-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = TYPE_X86_CPU, - .property = "pmu", - .value = "on", - },{ - .driver = "i440FX-pcihost", - .property = "short_root_bus", - .value = stringify(0), - },{ - .driver = "q35-pcihost", - .property = "short_root_bus", - .value = stringify(0), - }, + { "Conroe-" TYPE_X86_CPU, "model", "2" }, + { "Conroe-" TYPE_X86_CPU, "min-level", "2" }, + { "Penryn-" TYPE_X86_CPU, "model", "2" }, + { "Penryn-" TYPE_X86_CPU, "min-level", "2" }, + { "Nehalem-" TYPE_X86_CPU, "model", "2" }, + { "Nehalem-" TYPE_X86_CPU, "min-level", "2" }, + { "virtio-net-pci", "any_layout", "off" }, + { TYPE_X86_CPU, "pmu", "on" }, + { "i440FX-pcihost", "short_root_bus", "0" }, + { "q35-pcihost", "short_root_bus", "0" }, }; const size_t pc_compat_1_5_len = G_N_ELEMENTS(pc_compat_1_5); GlobalProperty pc_compat_1_4[] = { PC_CPU_MODEL_IDS("1.4.0") - { - .driver = "scsi-hd", - .property = "discard_granularity", - .value = stringify(0), - },{ - .driver = "scsi-cd", - .property = "discard_granularity", - .value = stringify(0), - },{ - .driver = "scsi-disk", - .property = "discard_granularity", - .value = stringify(0), - },{ - .driver = "ide-hd", - .property = "discard_granularity", - .value = stringify(0), - },{ - .driver = "ide-cd", - .property = "discard_granularity", - .value = stringify(0), - },{ - .driver = "ide-drive", - .property = "discard_granularity", - .value = stringify(0), - },{ - .driver = "virtio-blk-pci", - .property = "discard_granularity", - .value = stringify(0), - },{ - .driver = "virtio-serial-pci", - .property = "vectors", - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */ - .value = stringify(0xFFFFFFFF), - },{ - .driver = "virtio-net-pci", - .property = "ctrl_guest_offloads", - .value = "off", - },{ - .driver = "e1000", - .property = "romfile", - .value = "pxe-e1000.rom", - },{ - .driver = "ne2k_pci", - .property = "romfile", - .value = "pxe-ne2k_pci.rom", - },{ - .driver = "pcnet", - .property = "romfile", - .value = "pxe-pcnet.rom", - },{ - .driver = "rtl8139", - .property = "romfile", - .value = "pxe-rtl8139.rom", - },{ - .driver = "virtio-net-pci", - .property = "romfile", - .value = "pxe-virtio.rom", - },{ - .driver = "486-" TYPE_X86_CPU, - .property = "model", - .value = stringify(0), - }, - { - .driver = "n270" "-" TYPE_X86_CPU, - .property = "movbe", - .value = "off", - }, - { - .driver = "Westmere" "-" TYPE_X86_CPU, - .property = "pclmulqdq", - .value = "off", - }, + { "scsi-hd", "discard_granularity", "0" }, + { "scsi-cd", "discard_granularity", "0" }, + { "scsi-disk", "discard_granularity", "0" }, + { "ide-hd", "discard_granularity", "0" }, + { "ide-cd", "discard_granularity", "0" }, + { "ide-drive", "discard_granularity", "0" }, + { "virtio-blk-pci", "discard_granularity", "0" }, + /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string: */ + { "virtio-serial-pci", "vectors", "0xFFFFFFFF" }, + { "virtio-net-pci", "ctrl_guest_offloads", "off" }, + { "e1000", "romfile", "pxe-e1000.rom" }, + { "ne2k_pci", "romfile", "pxe-ne2k_pci.rom" }, + { "pcnet", "romfile", "pxe-pcnet.rom" }, + { "rtl8139", "romfile", "pxe-rtl8139.rom" }, + { "virtio-net-pci", "romfile", "pxe-virtio.rom" }, + { "486-" TYPE_X86_CPU, "model", "0" }, + { "n270" "-" TYPE_X86_CPU, "movbe", "off" }, + { "Westmere" "-" TYPE_X86_CPU, "pclmulqdq", "off" }, }; const size_t pc_compat_1_4_len = G_N_ELEMENTS(pc_compat_1_4); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index ed6984638e..5088e2f492 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -694,23 +694,10 @@ static void pc_i440fx_1_3_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("1.3.0") - { - .driver = "usb-tablet", - .property = "usb_version", - .value = stringify(1), - },{ - .driver = "virtio-net-pci", - .property = "ctrl_mac_addr", - .value = "off", - },{ - .driver = "virtio-net-pci", - .property = "mq", - .value = "off", - }, { - .driver = "e1000", - .property = "autonegotiation", - .value = "off", - }, + { "usb-tablet", "usb_version", "1" }, + { "virtio-net-pci", "ctrl_mac_addr", "off" }, + { "virtio-net-pci", "mq", "off" }, + { "e1000", "autonegotiation", "off" }, }; pc_i440fx_1_4_machine_options(m); @@ -726,31 +713,12 @@ static void pc_i440fx_1_2_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("1.2.0") - { - .driver = "nec-usb-xhci", - .property = "msi", - .value = "off", - },{ - .driver = "nec-usb-xhci", - .property = "msix", - .value = "off", - },{ - .driver = "ivshmem", - .property = "use64", - .value = "0", - },{ - .driver = "qxl", - .property = "revision", - .value = stringify(3), - },{ - .driver = "qxl-vga", - .property = "revision", - .value = stringify(3), - },{ - .driver = "VGA", - .property = "mmio", - .value = "off", - }, + { "nec-usb-xhci", "msi", "off" }, + { "nec-usb-xhci", "msix", "off" }, + { "ivshmem", "use64", "0" }, + { "qxl", "revision", "3" }, + { "qxl-vga", "revision", "3" }, + { "VGA", "mmio", "off" }, }; pc_i440fx_1_3_machine_options(m); @@ -766,35 +734,13 @@ static void pc_i440fx_1_1_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("1.1.0") - { - .driver = "virtio-scsi-pci", - .property = "hotplug", - .value = "off", - },{ - .driver = "virtio-scsi-pci", - .property = "param_change", - .value = "off", - },{ - .driver = "VGA", - .property = "vgamem_mb", - .value = stringify(8), - },{ - .driver = "vmware-svga", - .property = "vgamem_mb", - .value = stringify(8), - },{ - .driver = "qxl-vga", - .property = "vgamem_mb", - .value = stringify(8), - },{ - .driver = "qxl", - .property = "vgamem_mb", - .value = stringify(8), - },{ - .driver = "virtio-blk-pci", - .property = "config-wce", - .value = "off", - }, + { "virtio-scsi-pci", "hotplug", "off" }, + { "virtio-scsi-pci", "param_change", "off" }, + { "VGA", "vgamem_mb", "8" }, + { "vmware-svga", "vgamem_mb", "8" }, + { "qxl-vga", "vgamem_mb", "8" }, + { "qxl", "vgamem_mb", "8" }, + { "virtio-blk-pci", "config-wce", "off" }, }; pc_i440fx_1_2_machine_options(m); @@ -809,23 +755,10 @@ static void pc_i440fx_1_0_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("1.0") - { - .driver = TYPE_ISA_FDC, - .property = "check_media_rate", - .value = "off", - },{ - .driver = "virtio-balloon-pci", - .property = "class", - .value = stringify(PCI_CLASS_MEMORY_RAM), - },{ - .driver = "apic-common", - .property = "vapic", - .value = "off", - },{ - .driver = TYPE_USB_DEVICE, - .property = "full-path", - .value = "no", - }, + { TYPE_ISA_FDC, "check_media_rate", "off" }, + { "virtio-balloon-pci", "class", stringify(PCI_CLASS_MEMORY_RAM) }, + { "apic-common", "vapic", "off" }, + { TYPE_USB_DEVICE, "full-path", "no" }, }; pc_i440fx_1_1_machine_options(m); @@ -857,31 +790,12 @@ static void pc_i440fx_0_14_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("0.14") - { - .driver = "virtio-blk-pci", - .property = "event_idx", - .value = "off", - },{ - .driver = "virtio-serial-pci", - .property = "event_idx", - .value = "off", - },{ - .driver = "virtio-net-pci", - .property = "event_idx", - .value = "off", - },{ - .driver = "virtio-balloon-pci", - .property = "event_idx", - .value = "off", - },{ - .driver = "qxl", - .property = "revision", - .value = stringify(2), - },{ - .driver = "qxl-vga", - .property = "revision", - .value = stringify(2), - }, + { "virtio-blk-pci", "event_idx", "off" }, + { "virtio-serial-pci", "event_idx", "off" }, + { "virtio-net-pci", "event_idx", "off" }, + { "virtio-balloon-pci", "event_idx", "off" }, + { "qxl", "revision", "2" }, + { "qxl-vga", "revision", "2" }, }; pc_i440fx_0_15_machine_options(m); @@ -897,27 +811,11 @@ static void pc_i440fx_0_13_machine_options(MachineClass *m) PCMachineClass *pcmc = PC_MACHINE_CLASS(m); static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("0.13") - { - .driver = TYPE_PCI_DEVICE, - .property = "command_serr_enable", - .value = "off", - },{ - .driver = "AC97", - .property = "use_broken_id", - .value = stringify(1), - },{ - .driver = "virtio-9p-pci", - .property = "vectors", - .value = stringify(0), - },{ - .driver = "VGA", - .property = "rombar", - .value = stringify(0), - },{ - .driver = "vmware-svga", - .property = "rombar", - .value = stringify(0), - }, + { TYPE_PCI_DEVICE, "command_serr_enable", "off" }, + { "AC97", "use_broken_id", "1" }, + { "virtio-9p-pci", "vectors", "0" }, + { "VGA", "rombar", "0" }, + { "vmware-svga", "rombar", "0" }, }; pc_i440fx_0_14_machine_options(m); @@ -933,27 +831,11 @@ static void pc_i440fx_0_12_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("0.12") - { - .driver = "virtio-serial-pci", - .property = "max_ports", - .value = stringify(1), - },{ - .driver = "virtio-serial-pci", - .property = "vectors", - .value = stringify(0), - },{ - .driver = "usb-mouse", - .property = "serial", - .value = "1", - },{ - .driver = "usb-tablet", - .property = "serial", - .value = "1", - },{ - .driver = "usb-kbd", - .property = "serial", - .value = "1", - }, + { "virtio-serial-pci", "max_ports", "1" }, + { "virtio-serial-pci", "vectors", "0" }, + { "usb-mouse", "serial", "1" }, + { "usb-tablet", "serial", "1" }, + { "usb-kbd", "serial", "1" }, }; pc_i440fx_0_13_machine_options(m); diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 2143d33b18..8c8562f359 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -570,7 +570,7 @@ static void xen_io_del(MemoryListener *listener, } static void xen_device_realize(DeviceListener *listener, - DeviceState *dev) + DeviceState *dev) { XenIOState *state = container_of(listener, XenIOState, device_listener); @@ -588,7 +588,7 @@ static void xen_device_realize(DeviceListener *listener, } static void xen_device_unrealize(DeviceListener *listener, - DeviceState *dev) + DeviceState *dev) { XenIOState *state = container_of(listener, XenIOState, device_listener); diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c index 4e4f069a24..02e823c5a2 100644 --- a/hw/i386/xen/xen-mapcache.c +++ b/hw/i386/xen/xen-mapcache.c @@ -71,7 +71,7 @@ typedef struct MapCacheRev { typedef struct MapCache { MapCacheEntry *entry; unsigned long nr_buckets; - QTAILQ_HEAD(map_cache_head, MapCacheRev) locked_entries; + QTAILQ_HEAD(, MapCacheRev) locked_entries; /* For most cases (>99.9%), the page address is the same. */ MapCacheEntry *last_entry; diff --git a/hw/ide/core.c b/hw/ide/core.c index 04e22e751d..c3d779db6e 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -575,16 +575,16 @@ int64_t ide_get_sector(IDEState *s) int64_t sector_num; if (s->select & 0x40) { /* lba */ - if (!s->lba48) { - sector_num = ((s->select & 0x0f) << 24) | (s->hcyl << 16) | - (s->lcyl << 8) | s->sector; - } else { - sector_num = ((int64_t)s->hob_hcyl << 40) | - ((int64_t) s->hob_lcyl << 32) | - ((int64_t) s->hob_sector << 24) | - ((int64_t) s->hcyl << 16) | - ((int64_t) s->lcyl << 8) | s->sector; - } + if (!s->lba48) { + sector_num = ((s->select & 0x0f) << 24) | (s->hcyl << 16) | + (s->lcyl << 8) | s->sector; + } else { + sector_num = ((int64_t)s->hob_hcyl << 40) | + ((int64_t) s->hob_lcyl << 32) | + ((int64_t) s->hob_sector << 24) | + ((int64_t) s->hcyl << 16) | + ((int64_t) s->lcyl << 8) | s->sector; + } } else { sector_num = ((s->hcyl << 8) | s->lcyl) * s->heads * s->sectors + (s->select & 0x0f) * s->sectors + (s->sector - 1); @@ -596,19 +596,19 @@ void ide_set_sector(IDEState *s, int64_t sector_num) { unsigned int cyl, r; if (s->select & 0x40) { - if (!s->lba48) { + if (!s->lba48) { s->select = (s->select & 0xf0) | (sector_num >> 24); s->hcyl = (sector_num >> 16); s->lcyl = (sector_num >> 8); s->sector = (sector_num); - } else { - s->sector = sector_num; - s->lcyl = sector_num >> 8; - s->hcyl = sector_num >> 16; - s->hob_sector = sector_num >> 24; - s->hob_lcyl = sector_num >> 32; - s->hob_hcyl = sector_num >> 40; - } + } else { + s->sector = sector_num; + s->lcyl = sector_num >> 8; + s->hcyl = sector_num >> 16; + s->hob_sector = sector_num >> 24; + s->hob_lcyl = sector_num >> 32; + s->hob_hcyl = sector_num >> 40; + } } else { cyl = sector_num / (s->heads * s->sectors); r = sector_num % (s->heads * s->sectors); @@ -1188,17 +1188,17 @@ static void ide_cmd_lba48_transform(IDEState *s, int lba48) * full sector count in ->nsector and ignore ->hob_nsector from now */ if (!s->lba48) { - if (!s->nsector) - s->nsector = 256; + if (!s->nsector) + s->nsector = 256; } else { - if (!s->nsector && !s->hob_nsector) - s->nsector = 65536; - else { - int lo = s->nsector; - int hi = s->hob_nsector; + if (!s->nsector && !s->hob_nsector) + s->nsector = 65536; + else { + int lo = s->nsector; + int hi = s->hob_nsector; - s->nsector = (hi << 8) | lo; - } + s->nsector = (hi << 8) | lo; + } } } @@ -1258,35 +1258,35 @@ void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val) bus->ifs[1].feature = val; break; case ATA_IOPORT_WR_SECTOR_COUNT: - ide_clear_hob(bus); - bus->ifs[0].hob_nsector = bus->ifs[0].nsector; - bus->ifs[1].hob_nsector = bus->ifs[1].nsector; + ide_clear_hob(bus); + bus->ifs[0].hob_nsector = bus->ifs[0].nsector; + bus->ifs[1].hob_nsector = bus->ifs[1].nsector; bus->ifs[0].nsector = val; bus->ifs[1].nsector = val; break; case ATA_IOPORT_WR_SECTOR_NUMBER: - ide_clear_hob(bus); - bus->ifs[0].hob_sector = bus->ifs[0].sector; - bus->ifs[1].hob_sector = bus->ifs[1].sector; + ide_clear_hob(bus); + bus->ifs[0].hob_sector = bus->ifs[0].sector; + bus->ifs[1].hob_sector = bus->ifs[1].sector; bus->ifs[0].sector = val; bus->ifs[1].sector = val; break; case ATA_IOPORT_WR_CYLINDER_LOW: - ide_clear_hob(bus); - bus->ifs[0].hob_lcyl = bus->ifs[0].lcyl; - bus->ifs[1].hob_lcyl = bus->ifs[1].lcyl; + ide_clear_hob(bus); + bus->ifs[0].hob_lcyl = bus->ifs[0].lcyl; + bus->ifs[1].hob_lcyl = bus->ifs[1].lcyl; bus->ifs[0].lcyl = val; bus->ifs[1].lcyl = val; break; case ATA_IOPORT_WR_CYLINDER_HIGH: - ide_clear_hob(bus); - bus->ifs[0].hob_hcyl = bus->ifs[0].hcyl; - bus->ifs[1].hob_hcyl = bus->ifs[1].hcyl; + ide_clear_hob(bus); + bus->ifs[0].hob_hcyl = bus->ifs[0].hcyl; + bus->ifs[1].hob_hcyl = bus->ifs[1].hcyl; bus->ifs[0].hcyl = val; bus->ifs[1].hcyl = val; break; case ATA_IOPORT_WR_DEVICE_HEAD: - /* FIXME: HOB readback uses bit 7 */ + /* FIXME: HOB readback uses bit 7 */ bus->ifs[0].select = (val & ~0x10) | 0xa0; bus->ifs[1].select = (val | 0x10) | 0xa0; /* select drive */ @@ -2146,7 +2146,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr) } else if (!hob) { ret = s->error; } else { - ret = s->hob_feature; + ret = s->hob_feature; } break; case ATA_IOPORT_RR_SECTOR_COUNT: @@ -2155,7 +2155,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr) } else if (!hob) { ret = s->nsector & 0xff; } else { - ret = s->hob_nsector; + ret = s->hob_nsector; } break; case ATA_IOPORT_RR_SECTOR_NUMBER: @@ -2164,7 +2164,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr) } else if (!hob) { ret = s->sector; } else { - ret = s->hob_sector; + ret = s->hob_sector; } break; case ATA_IOPORT_RR_CYLINDER_LOW: @@ -2173,7 +2173,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr) } else if (!hob) { ret = s->lcyl; } else { - ret = s->hob_lcyl; + ret = s->hob_lcyl; } break; case ATA_IOPORT_RR_CYLINDER_HIGH: @@ -2182,7 +2182,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr) } else if (!hob) { ret = s->hcyl; } else { - ret = s->hob_hcyl; + ret = s->hob_hcyl; } break; case ATA_IOPORT_RR_DEVICE_HEAD: @@ -2847,7 +2847,7 @@ static const VMStateDescription vmstate_ide_drive_pio_state = { .fields = (VMStateField[]) { VMSTATE_INT32(req_nb_sectors, IDEState), VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len, 1, - vmstate_info_uint8, uint8_t), + vmstate_info_uint8, uint8_t), VMSTATE_INT32(cur_io_buffer_offset, IDEState), VMSTATE_INT32(cur_io_buffer_len, IDEState), VMSTATE_UINT8(end_transfer_fn_idx, IDEState), diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c index 74da30d9ca..cffbf586d4 100644 --- a/hw/input/lm832x.c +++ b/hw/input/lm832x.c @@ -66,7 +66,7 @@ typedef struct { struct { uint16_t file[256]; - uint8_t faddr; + uint8_t faddr; uint8_t addr[3]; QEMUTimer *tm[3]; } pwm; diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 07c8801387..3e66713b47 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -55,7 +55,7 @@ #define KBD_CCMD_WRITE_OUTPORT 0xD1 /* write output port */ #define KBD_CCMD_WRITE_OBUF 0xD2 #define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if - initiated by the auxiliary device */ + initiated by the auxiliary device */ #define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */ #define KBD_CCMD_DISABLE_A20 0xDD /* HP vectra only ? */ #define KBD_CCMD_ENABLE_A20 0xDF /* HP vectra only ? */ diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c index 1cad57f644..ded0db9351 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -577,7 +577,7 @@ static void tsc2102_control_register_write( case 0x01: /* Status / Keypad Control */ if ((s->model & 0xff00) == 0x2100) s->pin_func = value >> 14; - else { + else { s->kb.scan = (value >> 14) & 1; s->kb.debounce = (value >> 11) & 7; if (s->kb.intr && s->kb.scan) { diff --git a/hw/intc/apic.c b/hw/intc/apic.c index c9dd65b3a0..6ea619c360 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -442,7 +442,7 @@ static int apic_find_dest(uint8_t dest) for (i = 0; i < MAX_APICS; i++) { apic = local_apics[i]; - if (apic && apic->id == dest) + if (apic && apic->id == dest) return i; if (!apic) break; diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c index 8be63c8032..5f2c408036 100644 --- a/hw/mem/memory-device.c +++ b/hw/mem/memory-device.c @@ -100,9 +100,8 @@ static uint64_t memory_device_get_free_addr(MachineState *ms, uint64_t align, uint64_t size, Error **errp) { - uint64_t address_space_start, address_space_end; GSList *list = NULL, *item; - uint64_t new_addr = 0; + Range as, new = range_empty; if (!ms->device_memory) { error_setg(errp, "memory devices (e.g. for memory hotplug) are not " @@ -115,13 +114,11 @@ static uint64_t memory_device_get_free_addr(MachineState *ms, "enabled, please specify the maxmem option"); return 0; } - address_space_start = ms->device_memory->base; - address_space_end = address_space_start + - memory_region_size(&ms->device_memory->mr); - g_assert(address_space_end >= address_space_start); + range_init_nofail(&as, ms->device_memory->base, + memory_region_size(&ms->device_memory->mr)); - /* address_space_start indicates the maximum alignment we expect */ - if (!QEMU_IS_ALIGNED(address_space_start, align)) { + /* start of address space indicates the maximum alignment we expect */ + if (!QEMU_IS_ALIGNED(range_lob(&as), align)) { error_setg(errp, "the alignment (0x%" PRIx64 ") is not supported", align); return 0; @@ -145,20 +142,18 @@ static uint64_t memory_device_get_free_addr(MachineState *ms, } if (hint) { - new_addr = *hint; - if (new_addr < address_space_start) { + if (range_init(&new, *hint, size) || !range_contains_range(&as, &new)) { error_setg(errp, "can't add memory device [0x%" PRIx64 ":0x%" PRIx64 - "] before 0x%" PRIx64, new_addr, size, - address_space_start); - return 0; - } else if ((new_addr + size) > address_space_end) { - error_setg(errp, "can't add memory device [0x%" PRIx64 ":0x%" PRIx64 - "] beyond 0x%" PRIx64, new_addr, size, - address_space_end); + "], usable range for memory devices [0x%" PRIx64 ":0x%" + PRIx64 "]", *hint, size, range_lob(&as), + range_size(&as)); return 0; } } else { - new_addr = address_space_start; + if (range_init(&new, range_lob(&as), size)) { + error_setg(errp, "can't add memory device, device too big"); + return 0; + } } /* find address range that will fit new memory device */ @@ -166,30 +161,36 @@ static uint64_t memory_device_get_free_addr(MachineState *ms, for (item = list; item; item = g_slist_next(item)) { const MemoryDeviceState *md = item->data; const MemoryDeviceClass *mdc = MEMORY_DEVICE_GET_CLASS(OBJECT(md)); - uint64_t md_size, md_addr; + uint64_t next_addr; + Range tmp; - md_addr = mdc->get_addr(md); - md_size = memory_device_get_region_size(md, &error_abort); + range_init_nofail(&tmp, mdc->get_addr(md), + memory_device_get_region_size(md, &error_abort)); - if (ranges_overlap(md_addr, md_size, new_addr, size)) { + if (range_overlaps_range(&tmp, &new)) { if (hint) { const DeviceState *d = DEVICE(md); error_setg(errp, "address range conflicts with memory device" " id='%s'", d->id ? d->id : "(unnamed)"); goto out; } - new_addr = QEMU_ALIGN_UP(md_addr + md_size, align); + + next_addr = QEMU_ALIGN_UP(range_upb(&tmp) + 1, align); + if (!next_addr || range_init(&new, next_addr, range_size(&new))) { + range_make_empty(&new); + break; + } } } - if (new_addr + size > address_space_end) { + if (!range_contains_range(&as, &new)) { error_setg(errp, "could not find position in guest address space for " "memory device - memory fragmented due to alignments"); goto out; } out: g_slist_free(list); - return new_addr; + return range_lob(&new); } MemoryDeviceInfoList *qmp_memory_device_list(void) diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index 1cd8aac658..f707e59c7a 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -395,7 +395,7 @@ static void gt64120_writel (void *opaque, hwaddr addr, s->regs[GT_CPU] = val; break; case GT_MULTI: - /* Read-only register as only one GT64xxx is present on the CPU bus */ + /* Read-only register as only one GT64xxx is present on the CPU bus */ break; /* CPU Address Decode */ @@ -457,13 +457,13 @@ static void gt64120_writel (void *opaque, hwaddr addr, case GT_CPUERR_DATALO: case GT_CPUERR_DATAHI: case GT_CPUERR_PARITY: - /* Read-only registers, do nothing */ + /* Read-only registers, do nothing */ break; /* CPU Sync Barrier */ case GT_PCI0SYNC: case GT_PCI1SYNC: - /* Read-only registers, do nothing */ + /* Read-only registers, do nothing */ break; /* SDRAM and Device Address Decode */ diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 3e852e98cf..1922407394 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -239,7 +239,7 @@ void mips_r4k_init(MachineState *machine) sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0, be)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); - } + } } else if (!qtest_enabled()) { /* not fatal */ warn_report("could not load MIPS bios '%s'", bios_name); @@ -285,7 +285,7 @@ void mips_r4k_init(MachineState *machine) for(i = 0; i < MAX_IDE_BUS; i++) isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], - hd[MAX_IDE_DEVS * i + 1]); + hd[MAX_IDE_DEVS * i + 1]); isa_create_simple(isa_bus, TYPE_I8042); } diff --git a/hw/misc/max111x.c b/hw/misc/max111x.c index 6dbdc03677..ac6d35a81d 100644 --- a/hw/misc/max111x.c +++ b/hw/misc/max111x.c @@ -43,9 +43,9 @@ typedef struct { #define CB_START (1 << 7) #define CHANNEL_NUM(v, b0, b1, b2) \ - ((((v) >> (2 + (b0))) & 4) | \ - (((v) >> (3 + (b1))) & 2) | \ - (((v) >> (4 + (b2))) & 1)) + ((((v) >> (2 + (b0))) & 4) | \ + (((v) >> (3 + (b1))) & 2) | \ + (((v) >> (4 + (b2))) & 1)) static uint32_t max111x_read(MAX111xState *s) { diff --git a/hw/misc/omap_l4.c b/hw/misc/omap_l4.c index 96fc057b4e..c217728c78 100644 --- a/hw/misc/omap_l4.c +++ b/hw/misc/omap_l4.c @@ -112,8 +112,8 @@ static const MemoryRegionOps omap_l4ta_ops = { struct omap_target_agent_s *omap_l4ta_get(struct omap_l4_s *bus, const struct omap_l4_region_s *regions, - const struct omap_l4_agent_info_s *agents, - int cs) + const struct omap_l4_agent_info_s *agents, + int cs) { int i; struct omap_target_agent_s *ta = NULL; diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c index 03b3104278..5ec13105df 100644 --- a/hw/net/mipsnet.c +++ b/hw/net/mipsnet.c @@ -112,27 +112,27 @@ static uint64_t mipsnet_ioport_read(void *opaque, hwaddr addr, addr &= 0x3f; switch (addr) { case MIPSNET_DEV_ID: - ret = be32_to_cpu(0x4d495053); /* MIPS */ + ret = be32_to_cpu(0x4d495053); /* MIPS */ break; case MIPSNET_DEV_ID + 4: - ret = be32_to_cpu(0x4e455430); /* NET0 */ + ret = be32_to_cpu(0x4e455430); /* NET0 */ break; case MIPSNET_BUSY: - ret = s->busy; + ret = s->busy; break; case MIPSNET_RX_DATA_COUNT: - ret = s->rx_count; + ret = s->rx_count; break; case MIPSNET_TX_DATA_COUNT: - ret = s->tx_count; + ret = s->tx_count; break; case MIPSNET_INT_CTL: - ret = s->intctl; + ret = s->intctl; s->intctl &= ~MIPSNET_INTCTL_TESTBIT; break; case MIPSNET_INTERRUPT_INFO: /* XXX: This seems to be a per-VPE interrupt number. */ - ret = 0; + ret = 0; break; case MIPSNET_RX_DATA_BUFFER: if (s->rx_count) { @@ -161,7 +161,7 @@ static void mipsnet_ioport_write(void *opaque, hwaddr addr, trace_mipsnet_write(addr, val); switch (addr) { case MIPSNET_TX_DATA_COUNT: - s->tx_count = (val <= MAX_ETH_FRAME_SIZE) ? val : 0; + s->tx_count = (val <= MAX_ETH_FRAME_SIZE) ? val : 0; s->tx_written = 0; break; case MIPSNET_INT_CTL: diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c index 869518ee06..037afc8052 100644 --- a/hw/net/ne2000.c +++ b/hw/net/ne2000.c @@ -145,7 +145,7 @@ static void ne2000_update_irq(NE2000State *s) isr = (s->isr & s->imr) & 0x7f; #if defined(DEBUG_NE2000) printf("NE2000: Set IRQ to %d (%02x %02x)\n", - isr ? 1 : 0, s->isr, s->imr); + isr ? 1 : 0, s->isr, s->imr); #endif qemu_set_irq(s->irq, (isr != 0)); } @@ -396,12 +396,12 @@ static uint32_t ne2000_ioport_read(void *opaque, uint32_t addr) case EN0_ISR: ret = s->isr; break; - case EN0_RSARLO: - ret = s->rsar & 0x00ff; - break; - case EN0_RSARHI: - ret = s->rsar >> 8; - break; + case EN0_RSARLO: + ret = s->rsar & 0x00ff; + break; + case EN0_RSARHI: + ret = s->rsar >> 8; + break; case EN1_PHYS ... EN1_PHYS + 5: ret = s->phys[offset - EN1_PHYS]; break; @@ -420,21 +420,21 @@ static uint32_t ne2000_ioport_read(void *opaque, uint32_t addr) case EN2_STOPPG: ret = s->stop >> 8; break; - case EN0_RTL8029ID0: - ret = 0x50; - break; - case EN0_RTL8029ID1: - ret = 0x43; - break; - case EN3_CONFIG0: - ret = 0; /* 10baseT media */ - break; - case EN3_CONFIG2: - ret = 0x40; /* 10baseT active */ - break; - case EN3_CONFIG3: - ret = 0x40; /* Full duplex */ - break; + case EN0_RTL8029ID0: + ret = 0x50; + break; + case EN0_RTL8029ID1: + ret = 0x43; + break; + case EN3_CONFIG0: + ret = 0; /* 10baseT media */ + break; + case EN3_CONFIG2: + ret = 0x40; /* 10baseT active */ + break; + case EN3_CONFIG3: + ret = 0x40; /* Full duplex */ + break; default: ret = 0x00; break; diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c index c02cbefece..5266f9b7dd 100644 --- a/hw/net/rocker/rocker.c +++ b/hw/net/rocker/rocker.c @@ -1279,7 +1279,7 @@ static World *rocker_world_type_by_name(Rocker *r, const char *name) for (i = 0; i < ROCKER_WORLD_TYPE_MAX; i++) { if (strcmp(name, world_name(r->worlds[i])) == 0) { return r->worlds[i]; - } + } } return NULL; } diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 385b1a03e9..e37fc34839 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1375,10 +1375,10 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q) n->guest_hdr_len, -1); if (out_num == VIRTQUEUE_MAX_SIZE) { goto drop; - } + } out_num += 1; out_sg = sg2; - } + } } /* * If host wants to see the guest header as is, we can diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 54746a4030..4665dc95ad 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -137,7 +137,7 @@ typedef struct VMXNET3Class { OBJECT_GET_CLASS(VMXNET3Class, (obj), TYPE_VMXNET3) static inline void vmxnet3_ring_init(PCIDevice *d, - Vmxnet3Ring *ring, + Vmxnet3Ring *ring, hwaddr pa, uint32_t size, uint32_t cell_size, @@ -181,13 +181,13 @@ static inline hwaddr vmxnet3_ring_curr_cell_pa(Vmxnet3Ring *ring) } static inline void vmxnet3_ring_read_curr_cell(PCIDevice *d, Vmxnet3Ring *ring, - void *buff) + void *buff) { vmw_shmem_read(d, vmxnet3_ring_curr_cell_pa(ring), buff, ring->cell_size); } static inline void vmxnet3_ring_write_curr_cell(PCIDevice *d, Vmxnet3Ring *ring, - void *buff) + void *buff) { vmw_shmem_write(d, vmxnet3_ring_curr_cell_pa(ring), buff, ring->cell_size); } diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c index e361ecb7ee..aa5ecfd0c2 100644 --- a/hw/pci-host/pam.c +++ b/hw/pci-host/pam.c @@ -52,11 +52,13 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory, memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", ram_memory, start, size); + memory_region_transaction_begin(); for (i = 0; i < 4; ++i) { memory_region_set_enabled(&mem->alias[i], false); memory_region_add_subregion_overlap(system_memory, start, &mem->alias[i], 1); } + memory_region_transaction_commit(); mem->current = 0; } diff --git a/hw/pci/msix.c b/hw/pci/msix.c index 702dac4ec7..c7bdbeda9e 100644 --- a/hw/pci/msix.c +++ b/hw/pci/msix.c @@ -501,7 +501,7 @@ void msix_reset(PCIDevice *dev) } msix_clear_all_vectors(dev); dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &= - ~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET]; + ~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET]; memset(dev->msix_table, 0, dev->msix_entries_nr * PCI_MSIX_ENTRY_SIZE); memset(dev->msix_pba, 0, QEMU_ALIGN_UP(dev->msix_entries_nr, 64) / 8); msix_mask_all(dev, dev->msix_entries_nr); diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 46d5010fac..c9fc2fbe19 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -211,13 +211,13 @@ int pci_bar(PCIDevice *d, int reg) static inline int pci_irq_state(PCIDevice *d, int irq_num) { - return (d->irq_state >> irq_num) & 0x1; + return (d->irq_state >> irq_num) & 0x1; } static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level) { - d->irq_state &= ~(0x1 << irq_num); - d->irq_state |= level << irq_num; + d->irq_state &= ~(0x1 << irq_num); + d->irq_state |= level << irq_num; } static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change) @@ -604,8 +604,8 @@ const VMStateDescription vmstate_pci_device = { 0, vmstate_info_pci_config, PCIE_CONFIG_SPACE_SIZE), VMSTATE_BUFFER_UNSAFE_INFO(irq_state, PCIDevice, 2, - vmstate_info_pci_irq_state, - PCI_NUM_PINS * sizeof(int32_t)), + vmstate_info_pci_irq_state, + PCI_NUM_PINS * sizeof(int32_t)), VMSTATE_END_OF_LIST() } }; @@ -657,21 +657,21 @@ static int pci_parse_devaddr(const char *addr, int *domp, int *busp, p = addr; val = strtoul(p, &e, 16); if (e == p) - return -1; + return -1; if (*e == ':') { - bus = val; - p = e + 1; - val = strtoul(p, &e, 16); - if (e == p) - return -1; - if (*e == ':') { - dom = bus; - bus = val; - p = e + 1; - val = strtoul(p, &e, 16); - if (e == p) - return -1; - } + bus = val; + p = e + 1; + val = strtoul(p, &e, 16); + if (e == p) + return -1; + if (*e == ':') { + dom = bus; + bus = val; + p = e + 1; + val = strtoul(p, &e, 16); + if (e == p) + return -1; + } } slot = val; @@ -690,10 +690,10 @@ static int pci_parse_devaddr(const char *addr, int *domp, int *busp, /* if funcp == NULL func is 0 */ if (dom > 0xffff || bus > 0xff || slot > 0x1f || func > 7) - return -1; + return -1; if (*e) - return -1; + return -1; *domp = dom; *busp = bus; @@ -1250,7 +1250,7 @@ pcibus_t pci_get_bar_addr(PCIDevice *pci_dev, int region_num) } static pcibus_t pci_bar_address(PCIDevice *d, - int reg, uint8_t type, pcibus_t size) + int reg, uint8_t type, pcibus_t size) { pcibus_t new_addr, last_addr; int bar = pci_bar(d, reg); diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c index b9143ac88b..c6d9ded320 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -369,7 +369,7 @@ void pci_bridge_initfn(PCIDevice *dev, const char *typename) * let users address the bus using the device name. */ if (!br->bus_name && dev->qdev.id && *dev->qdev.id) { - br->bus_name = dev->qdev.id; + br->bus_name = dev->qdev.id; } qbus_create_inplace(sec_bus, sizeof(br->sec_bus), typename, DEVICE(dev), diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c index e1aadf126d..8d3a797cb8 100644 --- a/hw/ppc/ppc405_uc.c +++ b/hw/ppc/ppc405_uc.c @@ -1885,7 +1885,7 @@ CPUPPCState *ppc405ep_init(MemoryRegion *address_space_mem, pic = ppcuic_init(env, irqs, 0x0C0, 0, 1); *picp = pic; /* SDRAM controller */ - /* XXX 405EP has no ECC interrupt */ + /* XXX 405EP has no ECC interrupt */ ppc4xx_sdram_init(env, pic[17], 2, ram_memories, ram_bases, ram_sizes, do_init); /* External bus controller */ diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 2afb7f437e..7bda86a7d0 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -538,7 +538,7 @@ static void ppc_prep_init(MachineState *machine) nb_nics1 = NE2000_NB_MAX; for(i = 0; i < nb_nics1; i++) { if (nd_table[i].model == NULL) { - nd_table[i].model = g_strdup("ne2k_isa"); + nd_table[i].model = g_strdup("ne2k_isa"); } if (strcmp(nd_table[i].model, "ne2k_isa") == 0) { isa_ne2000_init(isa_bus, ne2000_io[i], ne2000_irq[i], @@ -552,7 +552,7 @@ static void ppc_prep_init(MachineState *machine) for(i = 0; i < MAX_IDE_BUS; i++) { isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[2 * i], - hd[2 * i + 1]); + hd[2 * i + 1]); } cpu = POWERPC_CPU(first_cpu); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 83081defde..0942f35bf8 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4113,16 +4113,8 @@ static void spapr_machine_2_12_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = TYPE_POWERPC_CPU, - .property = "pre-3.0-migration", - .value = "on", - }, - { - .driver = TYPE_SPAPR_CPU_CORE, - .property = "pre-3.0-migration", - .value = "on", - }, + { TYPE_POWERPC_CPU, "pre-3.0-migration", "on" }, + { TYPE_SPAPR_CPU_CORE, "pre-3.0-migration", "on" }, }; spapr_machine_3_0_class_options(mc); @@ -4186,11 +4178,7 @@ static void spapr_machine_2_9_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = TYPE_POWERPC_CPU, - .property = "pre-2.10-migration", - .value = "on", - }, + { TYPE_POWERPC_CPU, "pre-2.10-migration", "on" }, }; spapr_machine_2_10_class_options(mc); @@ -4210,11 +4198,7 @@ DEFINE_SPAPR_MACHINE(2_9, "2.9", false); static void spapr_machine_2_8_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "pcie-extended-configuration-space", - .value = "off", - }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "pcie-extended-configuration-space", "off" }, }; spapr_machine_2_9_class_options(mc); @@ -4282,26 +4266,10 @@ static void spapr_machine_2_7_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "mem_win_size", - .value = stringify(SPAPR_PCI_2_7_MMIO_WIN_SIZE), - }, - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "mem64_win_size", - .value = "0", - }, - { - .driver = TYPE_POWERPC_CPU, - .property = "pre-2.8-migration", - .value = "on", - }, - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "pre-2.8-migration", - .value = "on", - }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "mem_win_size", "0xf80000000", }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "mem64_win_size", "0", }, + { TYPE_POWERPC_CPU, "pre-2.8-migration", "on", }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "pre-2.8-migration", "on", }, }; spapr_machine_2_8_class_options(mc); @@ -4321,11 +4289,7 @@ DEFINE_SPAPR_MACHINE(2_7, "2.7", false); static void spapr_machine_2_6_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "ddw", - .value = stringify(off), - }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "ddw", "off" }, }; spapr_machine_2_7_class_options(mc); @@ -4344,11 +4308,7 @@ static void spapr_machine_2_5_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = "spapr-vlan", - .property = "use-rx-buffer-pools", - .value = "off", - }, + { "spapr-vlan", "use-rx-buffer-pools", "off" }, }; spapr_machine_2_6_class_options(mc); @@ -4381,11 +4341,7 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false); static void spapr_machine_2_3_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = "spapr-pci-host-bridge", - .property = "dynamic-reconfiguration", - .value = "off", - }, + { "spapr-pci-host-bridge", "dynamic-reconfiguration", "off" }, }; spapr_machine_2_4_class_options(mc); compat_props_add(mc->compat_props, hw_compat_2_3, hw_compat_2_3_len); @@ -4400,11 +4356,7 @@ DEFINE_SPAPR_MACHINE(2_3, "2.3", false); static void spapr_machine_2_2_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "mem_win_size", - .value = "0x20000000", - }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "mem_win_size", "0x20000000" }, }; spapr_machine_2_3_class_options(mc); diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index b56466f89a..37e98f9321 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -42,7 +42,7 @@ enum sPAPRTCEAccess { #define IOMMU_PAGE_SIZE(shift) (1ULL << (shift)) #define IOMMU_PAGE_MASK(shift) (~(IOMMU_PAGE_SIZE(shift) - 1)) -static QLIST_HEAD(spapr_tce_tables, sPAPRTCETable) spapr_tce_tables; +static QLIST_HEAD(, sPAPRTCETable) spapr_tce_tables; sPAPRTCETable *spapr_tce_find_by_liobn(target_ulong liobn) { diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index c737507053..811fdf913d 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -712,11 +712,7 @@ static void ccw_machine_2_11_instance_options(MachineState *machine) static void ccw_machine_2_11_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_SCLP_EVENT_FACILITY, - .property = "allow_all_mask_sizes", - .value = "off", - }, + { TYPE_SCLP_EVENT_FACILITY, "allow_all_mask_sizes", "off", }, }; ccw_machine_2_12_class_options(mc); @@ -751,11 +747,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = TYPE_S390_STATTRIB, - .property = "migration-enabled", - .value = "off", - }, + { TYPE_S390_STATTRIB, "migration-enabled", "off", }, }; ccw_machine_2_10_class_options(mc); @@ -773,11 +765,7 @@ static void ccw_machine_2_8_instance_options(MachineState *machine) static void ccw_machine_2_8_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_S390_FLIC_COMMON, - .property = "adapter_routes_max_batch", - .value = "64", - }, + { TYPE_S390_FLIC_COMMON, "adapter_routes_max_batch", "64", }, }; ccw_machine_2_9_class_options(mc); @@ -810,15 +798,8 @@ static void ccw_machine_2_6_class_options(MachineClass *mc) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = TYPE_S390_IPL, - .property = "iplbext_migration", - .value = "off", - }, { - .driver = TYPE_VIRTUAL_CSS_BRIDGE, - .property = "css_dev_path", - .value = "off", - }, + { TYPE_S390_IPL, "iplbext_migration", "off", }, + { TYPE_VIRTUAL_CSS_BRIDGE, "css_dev_path", "off", }, }; s390mc->ri_allowed = false; @@ -848,43 +829,15 @@ static void ccw_machine_2_4_instance_options(MachineState *machine) static void ccw_machine_2_4_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_S390_SKEYS, - .property = "migration-enabled", - .value = "off", - },{ - .driver = "virtio-blk-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-balloon-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-serial-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-9p-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-rng-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-net-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-scsi-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "vhost-scsi-ccw", - .property = "max_revision", - .value = "0", - }, + { TYPE_S390_SKEYS, "migration-enabled", "off", }, + { "virtio-blk-ccw", "max_revision", "0", }, + { "virtio-balloon-ccw", "max_revision", "0", }, + { "virtio-serial-ccw", "max_revision", "0", }, + { "virtio-9p-ccw", "max_revision", "0", }, + { "virtio-rng-ccw", "max_revision", "0", }, + { "virtio-net-ccw", "max_revision", "0", }, + { "virtio-scsi-ccw", "max_revision", "0", }, + { "vhost-scsi-ccw", "max_revision", "0", }, }; ccw_machine_2_5_class_options(mc); diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c index 419fc668ac..6b0bbb9b7f 100644 --- a/hw/scsi/esp-pci.c +++ b/hw/scsi/esp-pci.c @@ -59,7 +59,7 @@ #define DMA_STAT_SCSIINT 0x10 #define DMA_STAT_BCMBLT 0x20 -#define SBAC_STATUS 0x1000 +#define SBAC_STATUS (1 << 24) typedef struct PCIESPState { /*< private >*/ @@ -136,7 +136,7 @@ static void esp_pci_dma_write(PCIESPState *pci, uint32_t saddr, uint32_t val) pci->dma_regs[saddr] = val; break; case DMA_STAT: - if (!(pci->sbac & SBAC_STATUS)) { + if (pci->sbac & SBAC_STATUS) { /* clear some bits on write */ uint32_t mask = DMA_STAT_ERROR | DMA_STAT_ABORT | DMA_STAT_DONE; pci->dma_regs[DMA_STAT] &= ~(val & mask); @@ -157,7 +157,7 @@ static uint32_t esp_pci_dma_read(PCIESPState *pci, uint32_t saddr) if (pci->esp.rregs[ESP_RSTAT] & STAT_INT) { val |= DMA_STAT_SCSIINT; } - if (pci->sbac & SBAC_STATUS) { + if (!(pci->sbac & SBAC_STATUS)) { pci->dma_regs[DMA_STAT] &= ~(DMA_STAT_ERROR | DMA_STAT_ABORT | DMA_STAT_DONE); } @@ -313,8 +313,8 @@ static void esp_pci_hard_reset(DeviceState *dev) static const VMStateDescription vmstate_esp_pci_scsi = { .name = "pciespscsi", - .version_id = 0, - .minimum_version_id = 0, + .version_id = 1, + .minimum_version_id = 1, .fields = (VMStateField[]) { VMSTATE_PCI_DEVICE(parent_obj, PCIESPState), VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)), diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 630d923623..ca8b36c0c5 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -286,11 +286,8 @@ static void esp_do_dma(ESPState *s) esp_dma_done(s); } -void esp_command_complete(SCSIRequest *req, uint32_t status, - size_t resid) +static void esp_report_command_complete(ESPState *s, uint32_t status) { - ESPState *s = req->hba_private; - trace_esp_command_complete(); if (s->ti_size != 0) { trace_esp_command_complete_unexpected(); @@ -311,6 +308,23 @@ void esp_command_complete(SCSIRequest *req, uint32_t status, } } +void esp_command_complete(SCSIRequest *req, uint32_t status, + size_t resid) +{ + ESPState *s = req->hba_private; + + if (s->rregs[ESP_RSTAT] & STAT_INT) { + /* Defer handling command complete until the previous + * interrupt has been handled. + */ + trace_esp_command_complete_deferred(); + s->deferred_status = status; + s->deferred_complete = true; + return; + } + esp_report_command_complete(s, status); +} + void esp_transfer_data(SCSIRequest *req, uint32_t len) { ESPState *s = req->hba_private; @@ -422,7 +436,10 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr) s->rregs[ESP_RSTAT] &= ~STAT_TC; s->rregs[ESP_RSEQ] = SEQ_CD; esp_lower_irq(s); - + if (s->deferred_complete) { + esp_report_command_complete(s, s->deferred_status); + s->deferred_complete = false; + } return old_val; case ESP_TCHI: /* Return the unique id if the value has never been written */ @@ -582,6 +599,8 @@ const VMStateDescription vmstate_esp = { VMSTATE_UINT32(ti_wptr, ESPState), VMSTATE_BUFFER(ti_buf, ESPState), VMSTATE_UINT32(status, ESPState), + VMSTATE_UINT32(deferred_status, ESPState), + VMSTATE_BOOL(deferred_complete, ESPState), VMSTATE_UINT32(dma, ESPState), VMSTATE_PARTIAL_BUFFER(cmdbuf, ESPState, 16), VMSTATE_BUFFER_START_MIDDLE_V(cmdbuf, ESPState, 16, 4), @@ -671,8 +690,8 @@ static void sysbus_esp_hard_reset(DeviceState *dev) static const VMStateDescription vmstate_sysbus_esp_scsi = { .name = "sysbusespscsi", - .version_id = 0, - .minimum_version_id = 0, + .version_id = 1, + .minimum_version_id = 1, .fields = (VMStateField[]) { VMSTATE_STRUCT(esp, SysBusESPState, 0, vmstate_esp, ESPState), VMSTATE_END_OF_LIST() diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 52a38933b6..89def1421f 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -1850,7 +1850,7 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val) break; case 0x0a: case 0x0b: /* Openserver writes to these readonly registers on startup */ - return; + return; case 0x0c: case 0x0d: case 0x0e: case 0x0f: /* Linux writes to these readonly registers on startup. */ return; @@ -1884,8 +1884,8 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val) /* nothing to do */ break; case 0x1a: /* CTEST2 */ - s->ctest2 = val & LSI_CTEST2_PCICIE; - break; + s->ctest2 = val & LSI_CTEST2_PCICIE; + break; case 0x1b: /* CTEST3 */ s->ctest3 = val & 0x0f; break; diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 97cd167114..c480553083 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -1554,7 +1554,7 @@ SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int id, int lun) BusChild *kid; SCSIDevice *target_dev = NULL; - QTAILQ_FOREACH_REVERSE(kid, &bus->qbus.children, ChildrenHead, sibling) { + QTAILQ_FOREACH_REVERSE(kid, &bus->qbus.children, sibling) { DeviceState *qdev = kid->child; SCSIDevice *dev = SCSI_DEVICE(qdev); diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 0fb6a99616..2fe8a7c062 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -167,6 +167,7 @@ esp_handle_satn_stop(uint32_t cmdlen) "cmdlen %d" esp_write_response(uint32_t status) "Transfer status (status=%d)" esp_do_dma(uint32_t cmdlen, uint32_t len) "command len %d + %d" esp_command_complete(void) "SCSI Command complete" +esp_command_complete_deferred(void) "SCSI Command complete deferred" esp_command_complete_unexpected(void) "SCSI command completed unexpectedly" esp_command_complete_fail(void) "Command failed" esp_transfer_data(uint32_t dma_left, int32_t ti_size) "transfer %d/%d" diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 6a5fc46a47..5b399e7161 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -139,11 +139,11 @@ static uint64_t r2d_fpga_read(void *opaque, hwaddr addr, unsigned int size) case PA_IRLMSK: return s->irlmsk; case PA_OUTPORT: - return s->outport; + return s->outport; case PA_POWOFF: - return 0x00; + return 0x00; case PA_VERREG: - return 0x10; + return 0x10; } return 0; @@ -158,18 +158,18 @@ r2d_fpga_write(void *opaque, hwaddr addr, uint64_t value, unsigned int size) case PA_IRLMSK: s->irlmsk = value; update_irl(s); - break; + break; case PA_OUTPORT: - s->outport = value; - break; + s->outport = value; + break; case PA_POWOFF: if (value & 1) { qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); } break; case PA_VERREG: - /* Discard writes */ - break; + /* Discard writes */ + break; } } diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index e0457d305b..963373ba95 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -119,11 +119,11 @@ struct EmulatedState { char *db; uint8_t atr[MAX_ATR_SIZE]; uint8_t atr_length; - QSIMPLEQ_HEAD(event_list, EmulEvent) event_list; + QSIMPLEQ_HEAD(, EmulEvent) event_list; QemuMutex event_list_mutex; QemuThread event_thread_id; VReader *reader; - QSIMPLEQ_HEAD(guest_apdu_list, EmulEvent) guest_apdu_list; + QSIMPLEQ_HEAD(, EmulEvent) guest_apdu_list; QemuMutex vreader_mutex; /* and guest_apdu_list mutex */ QemuMutex handle_apdu_mutex; QemuCond handle_apdu_cond; diff --git a/hw/usb/combined-packet.c b/hw/usb/combined-packet.c index 01a7ed0848..fc98383d30 100644 --- a/hw/usb/combined-packet.c +++ b/hw/usb/combined-packet.c @@ -64,7 +64,7 @@ void usb_combined_input_packet_complete(USBDevice *dev, USBPacket *p) status = combined->first->status; actual_length = combined->first->actual_length; - short_not_ok = QTAILQ_LAST(&combined->packets, packets_head)->short_not_ok; + short_not_ok = QTAILQ_LAST(&combined->packets)->short_not_ok; QTAILQ_FOREACH_SAFE(p, &combined->packets, combined_entry, next) { if (!done) { diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c index eac7365b0a..c539a1afc6 100644 --- a/hw/usb/dev-bluetooth.c +++ b/hw/usb/dev-bluetooth.c @@ -46,7 +46,7 @@ struct USBBtState { struct usb_hci_out_fifo_s { uint8_t data[4096]; - int len; + int len; } outcmd, outacl, outsco; }; diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index 62d18290dc..90cd745f06 100644 --- a/hw/usb/dev-hid.c +++ b/hw/usb/dev-hid.c @@ -592,12 +592,12 @@ static void usb_hid_handle_control(USBDevice *dev, USBPacket *p, switch (value >> 8) { case 0x22: if (hs->kind == HID_MOUSE) { - memcpy(data, qemu_mouse_hid_report_descriptor, - sizeof(qemu_mouse_hid_report_descriptor)); + memcpy(data, qemu_mouse_hid_report_descriptor, + sizeof(qemu_mouse_hid_report_descriptor)); p->actual_length = sizeof(qemu_mouse_hid_report_descriptor); } else if (hs->kind == HID_TABLET) { memcpy(data, qemu_tablet_hid_report_descriptor, - sizeof(qemu_tablet_hid_report_descriptor)); + sizeof(qemu_tablet_hid_report_descriptor)); p->actual_length = sizeof(qemu_tablet_hid_report_descriptor); } else if (hs->kind == HID_KEYBOARD) { memcpy(data, qemu_keyboard_hid_report_descriptor, diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index dc368179d1..7e9339b8a8 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -147,13 +147,13 @@ static const USBDesc desc_hub = { static const uint8_t qemu_hub_hub_descriptor[] = { - 0x00, /* u8 bLength; patched in later */ - 0x29, /* u8 bDescriptorType; Hub-descriptor */ - 0x00, /* u8 bNbrPorts; (patched later) */ - 0x0a, /* u16 wHubCharacteristics; */ - 0x00, /* (per-port OC, no power switching) */ - 0x01, /* u8 bPwrOn2pwrGood; 2ms */ - 0x00 /* u8 bHubContrCurrent; 0 mA */ + 0x00, /* u8 bLength; patched in later */ + 0x29, /* u8 bDescriptorType; Hub-descriptor */ + 0x00, /* u8 bNbrPorts; (patched later) */ + 0x0a, /* u16 wHubCharacteristics; */ + 0x00, /* (per-port OC, no power switching) */ + 0x01, /* u8 bPwrOn2pwrGood; 2ms */ + 0x00 /* u8 bHubContrCurrent; 0 mA */ /* DeviceRemovable and PortPwrCtrlMask patched in later */ }; diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index b19b576278..68c5eb8eaa 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -191,7 +191,7 @@ struct MTPState { #ifdef CONFIG_INOTIFY1 /* inotify descriptor */ int inotifyfd; - QTAILQ_HEAD(events, MTPMonEntry) events; + QTAILQ_HEAD(, MTPMonEntry) events; #endif /* Responder is expecting a write operation */ bool write_pending; @@ -1989,7 +1989,7 @@ static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p) case EP_EVENT: #ifdef CONFIG_INOTIFY1 if (!QTAILQ_EMPTY(&s->events)) { - struct MTPMonEntry *e = QTAILQ_LAST(&s->events, events); + struct MTPMonEntry *e = QTAILQ_LAST(&s->events); uint32_t handle; int len = sizeof(container) + sizeof(uint32_t); diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 385e090336..ffab3fabee 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -648,7 +648,7 @@ typedef struct USBNetState { char usbstring_mac[13]; NICState *nic; NICConf conf; - QTAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp; + QTAILQ_HEAD(, rndis_response) rndis_resp; } USBNetState; #define TYPE_USB_NET "usb-net" diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 8d44d483df..e233681962 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -1823,7 +1823,7 @@ static int ehci_state_fetchqtd(EHCIQueue *q) break; case EHCI_ASYNC_INFLIGHT: /* Check if the guest has added new tds to the queue */ - again = ehci_fill_queue(QTAILQ_LAST(&q->packets, pkts_head)); + again = ehci_fill_queue(QTAILQ_LAST(&q->packets)); /* Unfinished async handled packet, go horizontal */ ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH); break; diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index cd30b5d5e0..d6601706ee 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -247,7 +247,7 @@ struct EHCIQueue { uint32_t qtdaddr; /* address QTD read from */ int last_pid; /* pid of last packet executed */ USBDevice *dev; - QTAILQ_HEAD(pkts_head, EHCIPacket) packets; + QTAILQ_HEAD(, EHCIPacket) packets; }; typedef QTAILQ_HEAD(EHCIQueueHead, EHCIQueue) EHCIQueueHead; diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 836b11f177..e694b62086 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -99,7 +99,7 @@ struct UHCIQueue { UHCIState *uhci; USBEndpoint *ep; QTAILQ_ENTRY(UHCIQueue) next; - QTAILQ_HEAD(asyncs_head, UHCIAsync) asyncs; + QTAILQ_HEAD(, UHCIAsync) asyncs; int8_t valid; }; @@ -837,7 +837,7 @@ static int uhci_handle_td(UHCIState *s, UHCIQueue *q, uint32_t qh_addr, } if (!async->done) { UHCI_TD last_td; - UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs, asyncs_head); + UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs); /* * While we are waiting for the current td to complete, the guest * may have added more tds to the queue. Note we re-read the td @@ -1056,8 +1056,8 @@ static void uhci_process_frame(UHCIState *s) link = qh.link; } else { /* QH with elements */ - curr_qh = link; - link = qh.el_link; + curr_qh = link; + link = qh.el_link; } continue; } diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c index f5d5c91094..5758a105a2 100644 --- a/hw/usb/xen-usb.c +++ b/hw/usb/xen-usb.c @@ -72,7 +72,7 @@ struct usbback_stub { USBPort port; unsigned int speed; bool attached; - QTAILQ_HEAD(submit_q_head, usbback_req) submit_q; + QTAILQ_HEAD(, usbback_req) submit_q; }; struct usbback_req { @@ -108,8 +108,8 @@ struct usbback_info { int num_ports; int usb_ver; bool ring_error; - QTAILQ_HEAD(req_free_q_head, usbback_req) req_free_q; - QSIMPLEQ_HEAD(hotplug_q_head, usbback_hotplug) hotplug_q; + QTAILQ_HEAD(, usbback_req) req_free_q; + QSIMPLEQ_HEAD(, usbback_hotplug) hotplug_q; struct usbback_stub ports[USBBACK_MAXPORTS]; struct usbback_stub *addr_table[USB_DEV_ADDR_SIZE]; QEMUBH *bh; diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 7c185e5a2e..4262b80c44 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -37,9 +37,9 @@ #include "trace.h" #include "qapi/error.h" -struct vfio_group_head vfio_group_list = +VFIOGroupList vfio_group_list = QLIST_HEAD_INITIALIZER(vfio_group_list); -struct vfio_as_head vfio_address_spaces = +static QLIST_HEAD(, VFIOAddressSpace) vfio_address_spaces = QLIST_HEAD_INITIALIZER(vfio_address_spaces); #ifdef CONFIG_KVM diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c index 33e6c20184..dce7c1db14 100644 --- a/hw/watchdog/watchdog.c +++ b/hw/watchdog/watchdog.c @@ -32,7 +32,7 @@ #include "qemu/help_option.h" static WatchdogAction watchdog_action = WATCHDOG_ACTION_RESET; -static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list; +static QLIST_HEAD(, WatchdogTimerModel) watchdog_list; void watchdog_add_model(WatchdogTimerModel *model) { diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index 7b59469888..1c6eddf86a 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -449,7 +449,6 @@ static void i6300esb_realize(PCIDevice *dev, Error **errp) memory_region_init_io(&d->io_mem, OBJECT(d), &i6300esb_ops, d, "i6300esb", 0x10); pci_register_bar(&d->dev, 0, 0, &d->io_mem); - /* qemu_register_coalesced_mmio (addr, 0x10); ? */ } static void i6300esb_exit(PCIDevice *dev) diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c index d51148b6b3..18a9045556 100644 --- a/hw/xen/xen-common.c +++ b/hw/xen/xen-common.c @@ -163,21 +163,9 @@ static void xen_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac = ACCEL_CLASS(oc); static GlobalProperty compat[] = { - { - .driver = "migration", - .property = "store-global-state", - .value = "off", - }, - { - .driver = "migration", - .property = "send-configuration", - .value = "off", - }, - { - .driver = "migration", - .property = "send-section-footer", - .value = "off", - } + { "migration", "store-global-state", "off" }, + { "migration", "send-configuration", "off" }, + { "migration", "send-section-footer", "off" }, }; ac->name = "Xen"; diff --git a/hw/xen/xen_devconfig.c b/hw/xen/xen_devconfig.c index aebc19bd71..3500d88a3e 100644 --- a/hw/xen/xen_devconfig.c +++ b/hw/xen/xen_devconfig.c @@ -6,7 +6,7 @@ /* ------------------------------------------------------------- */ static int xen_config_dev_dirs(const char *ftype, const char *btype, int vdev, - char *fe, char *be, int len) + char *fe, char *be, int len) { char *dom; diff --git a/hw/xen/xen_pvdev.c b/hw/xen/xen_pvdev.c index aed783e844..f026556f62 100644 --- a/hw/xen/xen_pvdev.c +++ b/hw/xen/xen_pvdev.c @@ -31,10 +31,10 @@ struct xs_dirs { QTAILQ_ENTRY(xs_dirs) list; }; -static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup = +static QTAILQ_HEAD(, xs_dirs) xs_cleanup = QTAILQ_HEAD_INITIALIZER(xs_cleanup); -static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = +static QTAILQ_HEAD(, XenDevice) xendevs = QTAILQ_HEAD_INITIALIZER(xendevs); /* ------------------------------------------------------------- */ diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c index 188acaca16..2859280a6a 100644 --- a/hw/xenpv/xen_domainbuild.c +++ b/hw/xenpv/xen_domainbuild.c @@ -27,11 +27,11 @@ static int xenstore_domain_mkdir(char *path) if (!xs_mkdir(xenstore, 0, path)) { fprintf(stderr, "%s: xs_mkdir %s: failed\n", __func__, path); - return -1; + return -1; } if (!xs_set_permissions(xenstore, 0, path, perms_ro, 2)) { fprintf(stderr, "%s: xs_set_permissions failed\n", __func__); - return -1; + return -1; } for (i = 0; writable[i]; i++) { @@ -82,8 +82,8 @@ int xenstore_domain_init1(const char *kernel, const char *ramdisk, /* cpus */ for (i = 0; i < smp_cpus; i++) { - snprintf(path, sizeof(path), "cpu/%d/availability",i); - xenstore_write_str(dom, path, "online"); + snprintf(path, sizeof(path), "cpu/%d/availability",i); + xenstore_write_str(dom, path, "online"); } xenstore_write_int(vm, "vcpu_avail", smp_cpus); xenstore_write_int(vm, "vcpus", smp_cpus); |