diff options
Diffstat (limited to 'hw')
32 files changed, 119 insertions, 106 deletions
diff --git a/hw/9pfs/trace-events b/hw/9pfs/trace-events index 63efa27..48d3d8a 100644 --- a/hw/9pfs/trace-events +++ b/hw/9pfs/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/9pfs/virtio-9p.c v9fs_rerror(uint16_t tag, uint8_t id, int err) "tag %d id %d err %d" diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events index 5aa3ba6..c379607 100644 --- a/hw/acpi/trace-events +++ b/hw/acpi/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/acpi/memory_hotplug.c mhp_acpi_invalid_slot_selected(uint32_t slot) "0x%"PRIx32 diff --git a/hw/alpha/trace-events b/hw/alpha/trace-events index 7d52b5d..e44ff01 100644 --- a/hw/alpha/trace-events +++ b/hw/alpha/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/alpha/pci.c alpha_pci_iack_write(void) "" diff --git a/hw/arm/trace-events b/hw/arm/trace-events index d0dad16..d5f33a2 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/arm/virt-acpi-build.c virt_acpi_setup(void) "No fw cfg or ACPI disabled. Bailing out." diff --git a/hw/audio/trace-events b/hw/audio/trace-events index 796f4a1..3210386 100644 --- a/hw/audio/trace-events +++ b/hw/audio/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/audio/cs4231.c cs4231_mem_readl_dreg(uint32_t reg, uint32_t ret) "read dreg %d: 0x%02x" diff --git a/hw/block/trace-events b/hw/block/trace-events index 31df44b..d0dd94f 100644 --- a/hw/block/trace-events +++ b/hw/block/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/block/virtio-blk.c virtio_blk_req_complete(void *req, int status) "req %p status %d" diff --git a/hw/char/trace-events b/hw/char/trace-events index 005fcd8..d53577c 100644 --- a/hw/char/trace-events +++ b/hw/char/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/char/virtio-serial-bus.c virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u" diff --git a/hw/display/trace-events b/hw/display/trace-events index 78f04657..332abab 100644 --- a/hw/display/trace-events +++ b/hw/display/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/display/jazz_led.c jazz_led_read(uint64_t addr, uint8_t val) "read addr=0x%"PRIx64": 0x%x" diff --git a/hw/dma/trace-events b/hw/dma/trace-events index d8a5674..22878df 100644 --- a/hw/dma/trace-events +++ b/hw/dma/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/dma/rc4030.c jazzio_read(uint64_t addr, uint32_t ret) "read reg[0x%"PRIx64"] = 0x%x" diff --git a/hw/i386/trace-events b/hw/i386/trace-events index b4882c1..7735e46 100644 --- a/hw/i386/trace-events +++ b/hw/i386/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/i386/xen/xen_platform.c xen_platform_log(char *s) "xen platform: %s" diff --git a/hw/input/trace-events b/hw/input/trace-events index f24dff2..8c4003f 100644 --- a/hw/input/trace-events +++ b/hw/input/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/input/ps2.c ps2_put_keycode(void *opaque, int keycode) "%p keycode %d" diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 376dd18..f12192c 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/intc/apic_common.c cpu_set_apic_base(uint64_t val) "%016"PRIx64 diff --git a/hw/isa/trace-events b/hw/isa/trace-events index 686282f..9faca41 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=%x val=%x" diff --git a/hw/misc/trace-events b/hw/misc/trace-events index ea52a14..0cc556c 100644 --- a/hw/misc/trace-events +++ b/hw/misc/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/misc/eccmemctl.c ecc_mem_writel_mer(uint32_t val) "Write memory enable %08x" diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index d001c96..bad43f4 100644 --- a/hw/net/e1000e.c +++ b/hw/net/e1000e.c @@ -69,7 +69,6 @@ typedef struct E1000EState { uint16_t subsys_ven_used; uint16_t subsys_used; - uint32_t intr_state; bool disable_vnet; E1000ECore core; @@ -89,8 +88,6 @@ typedef struct E1000EState { #define E1000E_MSIX_TABLE (0x0000) #define E1000E_MSIX_PBA (0x2000) -#define E1000E_USE_MSIX BIT(0) - static uint64_t e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size) { @@ -302,8 +299,6 @@ e1000e_init_msix(E1000EState *s) } else { if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) { msix_uninit(d, &s->msix, &s->msix); - } else { - s->intr_state |= E1000E_USE_MSIX; } } } @@ -311,7 +306,7 @@ e1000e_init_msix(E1000EState *s) static void e1000e_cleanup_msix(E1000EState *s) { - if (s->intr_state & E1000E_USE_MSIX) { + if (msix_enabled(PCI_DEVICE(s))) { e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM); msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix); } @@ -601,7 +596,6 @@ static const VMStateDescription e1000e_vmstate = { VMSTATE_MSIX(parent_obj, E1000EState), VMSTATE_UINT32(ioaddr, E1000EState), - VMSTATE_UINT32(intr_state, E1000EState), VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState), VMSTATE_UINT8(core.rx_desc_len, E1000EState), VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState, diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index 53dfaa2..20b2549 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -65,10 +65,9 @@ void net_tx_pkt_init(struct NetTxPkt **pkt, PCIDevice *pci_dev, p->pci_dev = pci_dev; - p->vec = g_malloc((sizeof *p->vec) * - (max_frags + NET_TX_PKT_PL_START_FRAG)); + p->vec = g_new(struct iovec, max_frags + NET_TX_PKT_PL_START_FRAG); - p->raw = g_malloc((sizeof *p->raw) * max_frags); + p->raw = g_new(struct iovec, max_frags); p->max_payload_frags = max_frags; p->max_raw_frags = max_frags; diff --git a/hw/net/trace-events b/hw/net/trace-events index aaa905f..8d38d77 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/net/lance.c lance_mem_readw(uint64_t addr, uint32_t ret) "addr=%"PRIx64"val=0x%04x" diff --git a/hw/nvram/trace-events b/hw/nvram/trace-events index 325447d..1f1e05a 100644 --- a/hw/nvram/trace-events +++ b/hw/nvram/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/nvram/ds1225y.c nvram_read(uint32_t addr, uint32_t ret) "read addr %d: 0x%02x" diff --git a/hw/pci/trace-events b/hw/pci/trace-events index 285338a..2b9cf24 100644 --- a/hw/pci/trace-events +++ b/hw/pci/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/pci/pci.c pci_update_mappings_del(void *d, uint32_t bus, uint32_t slot, uint32_t func, int bar, uint64_t addr, uint64_t size) "d=%p %02x:%02x.%x %d,%#"PRIx64"+%#"PRIx64 diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index e425252..8945869 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -33,6 +33,7 @@ #include "hw/timer/m48t59.h" #include "qemu/log.h" #include "qemu/error-report.h" +#include "qapi/error.h" #include "hw/loader.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" @@ -1350,3 +1351,28 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id) return NULL; } + +void ppc_cpu_parse_features(const char *cpu_model) +{ + CPUClass *cc; + ObjectClass *oc; + const char *typename; + gchar **model_pieces; + + model_pieces = g_strsplit(cpu_model, ",", 2); + if (!model_pieces[0]) { + error_report("Invalid/empty CPU model name"); + exit(1); + } + + oc = cpu_class_by_name(TYPE_POWERPC_CPU, model_pieces[0]); + if (oc == NULL) { + error_report("Unable to find CPU definition: %s", model_pieces[0]); + exit(1); + } + + typename = object_class_get_name(oc); + cc = CPU_CLASS(oc); + cc->parse_features(typename, model_pieces[1], &error_fatal); + g_strfreev(model_pieces); +} diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 0787c66..30d6800 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1812,6 +1812,8 @@ static void ppc_spapr_init(MachineState *machine) machine->cpu_model = kvm_enabled() ? "host" : "POWER7"; } + ppc_cpu_parse_features(machine->cpu_model); + if (mc->query_hotpluggable_cpus) { char *type = spapr_get_cpu_core_type(machine->cpu_model); diff --git a/hw/ppc/trace-events b/hw/ppc/trace-events index 900679b..dfeab93 100644 --- a/hw/ppc/trace-events +++ b/hw/ppc/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/ppc/spapr_pci.c spapr_pci_msi(const char *msg, uint32_t ca) "%s (cfg=%x)" diff --git a/hw/s390x/trace-events b/hw/s390x/trace-events index 72c4549..84ea964 100644 --- a/hw/s390x/trace-events +++ b/hw/s390x/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/s390x/css.c css_enable_facility(const char *facility) "CSS: enable %s" diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 5f19e32..ed64858 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/scsi/scsi-bus.c scsi_req_alloc(int target, int lun, int tag) "target %d lun %d tag %d" diff --git a/hw/sd/trace-events b/hw/sd/trace-events index b580a0f..b17e7ba 100644 --- a/hw/sd/trace-events +++ b/hw/sd/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/sd/milkymist-memcard.c milkymist_memcard_memory_read(uint32_t addr, uint32_t value) "addr %08x value %08x" diff --git a/hw/sparc/trace-events b/hw/sparc/trace-events index ab677a3..30fb037 100644 --- a/hw/sparc/trace-events +++ b/hw/sparc/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/sparc/sun4m.c sun4m_cpu_interrupt(unsigned int level) "Set CPU IRQ %d" diff --git a/hw/timer/trace-events b/hw/timer/trace-events index 19db4bf..3495c41 100644 --- a/hw/timer/trace-events +++ b/hw/timer/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/timer/slavio_timer.c slavio_timer_get_out(uint64_t limit, uint32_t counthigh, uint32_t count) "limit %"PRIx64" count %x%08x" diff --git a/hw/usb/trace-events b/hw/usb/trace-events index ac2d951..2d42fd4 100644 --- a/hw/usb/trace-events +++ b/hw/usb/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/usb/core.c usb_packet_state_change(int bus, const char *port, int ep, void *p, const char *o, const char *n) "bus %d, port %s, ep %d, packet %p, state %s -> %s" diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index 4bb7690..da13322 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/vfio/pci.c vfio_intx_interrupt(const char *name, char line) " (%s) Pin %c" diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 2853053..55184d3 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/virtio/virtio.c virtqueue_fill(void *vq, const void *elem, unsigned int len, unsigned int idx) "vq %p elem %p len %u idx %u" diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 1a7d53c..b57454a 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -263,6 +263,66 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base, return 0; } +static int vhost_user_set_mem_table(struct vhost_dev *dev, + struct vhost_memory *mem) +{ + int fds[VHOST_MEMORY_MAX_NREGIONS]; + int i, fd; + size_t fd_num = 0; + bool reply_supported = virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_REPLY_ACK); + + VhostUserMsg msg = { + .request = VHOST_USER_SET_MEM_TABLE, + .flags = VHOST_USER_VERSION, + }; + + if (reply_supported) { + msg.flags |= VHOST_USER_NEED_REPLY_MASK; + } + + for (i = 0; i < dev->mem->nregions; ++i) { + struct vhost_memory_region *reg = dev->mem->regions + i; + ram_addr_t offset; + MemoryRegion *mr; + + assert((uintptr_t)reg->userspace_addr == reg->userspace_addr); + mr = memory_region_from_host((void *)(uintptr_t)reg->userspace_addr, + &offset); + fd = memory_region_get_fd(mr); + if (fd > 0) { + msg.payload.memory.regions[fd_num].userspace_addr = reg->userspace_addr; + msg.payload.memory.regions[fd_num].memory_size = reg->memory_size; + msg.payload.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr; + msg.payload.memory.regions[fd_num].mmap_offset = offset; + assert(fd_num < VHOST_MEMORY_MAX_NREGIONS); + fds[fd_num++] = fd; + } + } + + msg.payload.memory.nregions = fd_num; + + if (!fd_num) { + error_report("Failed initializing vhost-user memory map, " + "consider using -object memory-backend-file share=on"); + return -1; + } + + msg.size = sizeof(msg.payload.memory.nregions); + msg.size += sizeof(msg.payload.memory.padding); + msg.size += fd_num * sizeof(VhostUserMemoryRegion); + + if (vhost_user_write(dev, &msg, fds, fd_num) < 0) { + return -1; + } + + if (reply_supported) { + return process_message_reply(dev, msg.request); + } + + return 0; +} + static int vhost_user_set_vring_addr(struct vhost_dev *dev, struct vhost_vring_addr *addr) { @@ -477,73 +537,6 @@ static int vhost_user_get_features(struct vhost_dev *dev, uint64_t *features) return vhost_user_get_u64(dev, VHOST_USER_GET_FEATURES, features); } -static int vhost_user_set_mem_table(struct vhost_dev *dev, - struct vhost_memory *mem) -{ - int fds[VHOST_MEMORY_MAX_NREGIONS]; - int i, fd; - size_t fd_num = 0; - uint64_t features; - bool reply_supported = virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_REPLY_ACK); - - VhostUserMsg msg = { - .request = VHOST_USER_SET_MEM_TABLE, - .flags = VHOST_USER_VERSION, - }; - - if (reply_supported) { - msg.flags |= VHOST_USER_NEED_REPLY_MASK; - } - - for (i = 0; i < dev->mem->nregions; ++i) { - struct vhost_memory_region *reg = dev->mem->regions + i; - ram_addr_t offset; - MemoryRegion *mr; - - assert((uintptr_t)reg->userspace_addr == reg->userspace_addr); - mr = memory_region_from_host((void *)(uintptr_t)reg->userspace_addr, - &offset); - fd = memory_region_get_fd(mr); - if (fd > 0) { - msg.payload.memory.regions[fd_num].userspace_addr - = reg->userspace_addr; - msg.payload.memory.regions[fd_num].memory_size = reg->memory_size; - msg.payload.memory.regions[fd_num].guest_phys_addr - = reg->guest_phys_addr; - msg.payload.memory.regions[fd_num].mmap_offset = offset; - assert(fd_num < VHOST_MEMORY_MAX_NREGIONS); - fds[fd_num++] = fd; - } - } - - msg.payload.memory.nregions = fd_num; - - if (!fd_num) { - error_report("Failed initializing vhost-user memory map, " - "consider using -object memory-backend-file share=on"); - return -1; - } - - msg.size = sizeof(msg.payload.memory.nregions); - msg.size += sizeof(msg.payload.memory.padding); - msg.size += fd_num * sizeof(VhostUserMemoryRegion); - - vhost_user_write(dev, &msg, fds, fd_num); - - if (reply_supported) { - return process_message_reply(dev, msg.request); - } else { - /* Note: It is (yet) unknown when the client application has finished - * remapping the GPA. - * Attempt to prevent a race by sending a command that requires a reply. - */ - vhost_user_get_features(dev, &features); - } - - return 0; -} - static int vhost_user_set_owner(struct vhost_dev *dev) { VhostUserMsg msg = { diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index 9869ffd..6f18366 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -2049,9 +2049,8 @@ void xen_pt_config_init(XenPCIPassthroughState *s, Error **errp) for (j = 0; regs->size != 0; j++, regs++) { xen_pt_config_reg_init(s, reg_grp_entry, regs, &err); if (err) { - error_append_hint(&err, "Failed to initialize %d/%zu" - " reg 0x%x in grp_type = 0x%x (%d/%zu)", - j, ARRAY_SIZE(xen_pt_emu_reg_grps[i].emu_regs), + error_append_hint(&err, "Failed to init register %d" + " offsets 0x%x in grp_type = 0x%x (%d/%zu)", j, regs->offset, xen_pt_emu_reg_grps[i].grp_type, i, ARRAY_SIZE(xen_pt_emu_reg_grps)); error_propagate(errp, err); |