diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/audio/ac97.c | 1 | ||||
-rw-r--r-- | hw/audio/adlib.c | 1 | ||||
-rw-r--r-- | hw/audio/cs4231.c | 1 | ||||
-rw-r--r-- | hw/audio/cs4231a.c | 1 | ||||
-rw-r--r-- | hw/audio/es1370.c | 1 | ||||
-rw-r--r-- | hw/audio/fmopl.c | 5 | ||||
-rw-r--r-- | hw/audio/gus.c | 1 | ||||
-rw-r--r-- | hw/audio/gusemu_hal.c | 1 | ||||
-rw-r--r-- | hw/audio/gusemu_mixer.c | 1 | ||||
-rw-r--r-- | hw/audio/hda-codec.c | 1 | ||||
-rw-r--r-- | hw/audio/intel-hda.c | 1 | ||||
-rw-r--r-- | hw/audio/lm4549.c | 2 | ||||
-rw-r--r-- | hw/audio/marvell_88w8618.c | 1 | ||||
-rw-r--r-- | hw/audio/milkymist-ac97.c | 1 | ||||
-rw-r--r-- | hw/audio/pcspk.c | 1 | ||||
-rw-r--r-- | hw/audio/pl041.c | 1 | ||||
-rw-r--r-- | hw/audio/sb16.c | 1 | ||||
-rw-r--r-- | hw/audio/wm8750.c | 1 | ||||
-rw-r--r-- | hw/block/nvme.c | 40 | ||||
-rw-r--r-- | hw/misc/ivshmem.c | 81 |
20 files changed, 52 insertions, 92 deletions
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index b17383555e..cbd959e0bd 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -17,6 +17,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/audio/audio.h" #include "audio/audio.h" diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 334935f8d9..1270b19cc6 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/audio/audio.h" #include "audio/audio.h" diff --git a/hw/audio/cs4231.c b/hw/audio/cs4231.c index 6325a8cea7..caf97c1692 100644 --- a/hw/audio/cs4231.c +++ b/hw/audio/cs4231.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "trace.h" diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index f96f561c7f..b0c7c93e21 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -21,6 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/audio/audio.h" #include "audio/audio.h" diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 592578b142..96acbc6e2f 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -26,6 +26,7 @@ /* #define VERBOSE_ES1370 */ #define SILENT_ES1370 +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/audio/audio.h" #include "audio/audio.h" diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c index 81c0c1be20..731110fe86 100644 --- a/hw/audio/fmopl.c +++ b/hw/audio/fmopl.c @@ -32,10 +32,7 @@ #define HAS_YM3812 1 -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> +#include "qemu/osdep.h" #include <math.h> //#include "driver.h" /* use M.A.M.E. */ #include "fmopl.h" diff --git a/hw/audio/gus.c b/hw/audio/gus.c index e0c8a4ee1e..47c0fcfb4c 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -21,6 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/audio/audio.h" #include "audio/audio.h" diff --git a/hw/audio/gusemu_hal.c b/hw/audio/gusemu_hal.c index 6096690735..973d6b9f4f 100644 --- a/hw/audio/gusemu_hal.c +++ b/hw/audio/gusemu_hal.c @@ -26,6 +26,7 @@ * TODO: check mixer: see 7.20 of sdk for panning pos (applies to all gus models?)? */ +#include "qemu/osdep.h" #include "gustate.h" #include "gusemu.h" diff --git a/hw/audio/gusemu_mixer.c b/hw/audio/gusemu_mixer.c index 6d8d9ced11..701e8fb0ed 100644 --- a/hw/audio/gusemu_mixer.c +++ b/hw/audio/gusemu_mixer.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "gusemu.h" #include "gustate.h" diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index 3c03ff5668..52d4640e60 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -17,6 +17,7 @@ * along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "intel-hda.h" diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 433463e9c5..d372d4ab98 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -17,6 +17,7 @@ * along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/pci/msi.h" diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index 380ef603bd..a46f2301af 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -13,6 +13,7 @@ * It supports only one playback voice and no record voice. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "audio/audio.h" #include "lm4549.h" @@ -33,7 +34,6 @@ do { printf("lm4549: " fmt , ## __VA_ARGS__); } while (0) #endif #if defined(LM4549_DUMP_DAC_INPUT) -#include <stdio.h> static FILE *fp_dac_input; #endif diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c index 86992677e3..a6ca1806be 100644 --- a/hw/audio/marvell_88w8618.c +++ b/hw/audio/marvell_88w8618.c @@ -9,6 +9,7 @@ * Contributions after 2012-01-13 are licensed under the terms of the * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "hw/i2c/i2c.h" diff --git a/hw/audio/milkymist-ac97.c b/hw/audio/milkymist-ac97.c index 28f55e8535..6a3b53674e 100644 --- a/hw/audio/milkymist-ac97.c +++ b/hw/audio/milkymist-ac97.c @@ -21,6 +21,7 @@ * http://www.milkymist.org/socdoc/ac97.pdf */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/sysbus.h" #include "trace.h" diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 5266fb5457..f9afc8edad 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/isa/isa.h" diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c index 19982f2477..4717bc9b9c 100644 --- a/hw/audio/pl041.c +++ b/hw/audio/pl041.c @@ -20,6 +20,7 @@ * */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "pl041.h" diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 995435f240..3b2dcfdad9 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -21,6 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/audio/audio.h" #include "audio/audio.h" diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index b50b331402..0c6500e96a 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -7,6 +7,7 @@ * This file is licensed under GNU GPL. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/i2c/i2c.h" #include "audio/audio.h" diff --git a/hw/block/nvme.c b/hw/block/nvme.c index a5fedb2906..c68b62521a 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -916,45 +916,13 @@ static void nvme_class_init(ObjectClass *oc, void *data) dc->vmsd = &nvme_vmstate; } -static void nvme_get_bootindex(Object *obj, Visitor *v, void *opaque, - const char *name, Error **errp) -{ - NvmeCtrl *s = NVME(obj); - - visit_type_int32(v, &s->conf.bootindex, name, errp); -} - -static void nvme_set_bootindex(Object *obj, Visitor *v, void *opaque, - const char *name, Error **errp) +static void nvme_instance_init(Object *obj) { NvmeCtrl *s = NVME(obj); - int32_t boot_index; - Error *local_err = NULL; - - visit_type_int32(v, &boot_index, name, &local_err); - if (local_err) { - goto out; - } - /* check whether bootindex is present in fw_boot_order list */ - check_boot_index(boot_index, &local_err); - if (local_err) { - goto out; - } - /* change bootindex to a new one */ - s->conf.bootindex = boot_index; -out: - if (local_err) { - error_propagate(errp, local_err); - } -} - -static void nvme_instance_init(Object *obj) -{ - object_property_add(obj, "bootindex", "int32", - nvme_get_bootindex, - nvme_set_bootindex, NULL, NULL, NULL); - object_property_set_int(obj, -1, "bootindex", NULL); + device_add_bootindex_property(obj, &s->conf.bootindex, + "bootindex", "/namespace@1,0", + DEVICE(obj), &error_abort); } static const TypeInfo nvme_info = { diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index d5c89aeca1..48b7a34a8f 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -263,15 +263,6 @@ static const MemoryRegionOps ivshmem_mmio_ops = { }, }; -static void ivshmem_receive(void *opaque, const uint8_t *buf, int size) -{ - IVShmemState *s = opaque; - - IVSHMEM_DPRINTF("ivshmem_receive 0x%02x size: %d\n", *buf, size); - - ivshmem_IntrStatus_write(s, *buf); -} - static int ivshmem_can_receive(void * opaque) { return sizeof(int64_t); @@ -282,15 +273,24 @@ static void ivshmem_event(void *opaque, int event) IVSHMEM_DPRINTF("ivshmem_event %d\n", event); } -static void fake_irqfd(void *opaque, const uint8_t *buf, int size) { - +static void ivshmem_vector_notify(void *opaque) +{ MSIVector *entry = opaque; PCIDevice *pdev = entry->pdev; IVShmemState *s = IVSHMEM(pdev); int vector = entry - s->msi_vectors; + EventNotifier *n = &s->peers[s->vm_id].eventfds[vector]; + + if (!event_notifier_test_and_clear(n)) { + return; + } IVSHMEM_DPRINTF("interrupt on vector %p %d\n", pdev, vector); - msix_notify(pdev, vector); + if (ivshmem_has_feature(s, IVSHMEM_MSI)) { + msix_notify(pdev, vector); + } else { + ivshmem_IntrStatus_write(s, 1); + } } static int ivshmem_vector_unmask(PCIDevice *dev, unsigned vector, @@ -350,38 +350,16 @@ static void ivshmem_vector_poll(PCIDevice *dev, } } -static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *n, - int vector) +static void watch_vector_notifier(IVShmemState *s, EventNotifier *n, + int vector) { - /* create a event character device based on the passed eventfd */ - IVShmemState *s = opaque; - PCIDevice *pdev = PCI_DEVICE(s); int eventfd = event_notifier_get_fd(n); - CharDriverState *chr; - - s->msi_vectors[vector].pdev = pdev; - - chr = qemu_chr_open_eventfd(eventfd); - - if (chr == NULL) { - error_report("creating chardriver for eventfd %d failed", eventfd); - return NULL; - } - qemu_chr_fe_claim_no_fail(chr); /* if MSI is supported we need multiple interrupts */ - if (ivshmem_has_feature(s, IVSHMEM_MSI)) { - s->msi_vectors[vector].pdev = PCI_DEVICE(s); - - qemu_chr_add_handlers(chr, ivshmem_can_receive, fake_irqfd, - ivshmem_event, &s->msi_vectors[vector]); - } else { - qemu_chr_add_handlers(chr, ivshmem_can_receive, ivshmem_receive, - ivshmem_event, s); - } - - return chr; + s->msi_vectors[vector].pdev = PCI_DEVICE(s); + qemu_set_fd_handler(eventfd, ivshmem_vector_notify, + NULL, &s->msi_vectors[vector]); } static int check_shm_size(IVShmemState *s, int fd, Error **errp) @@ -591,7 +569,7 @@ static void setup_interrupt(IVShmemState *s, int vector) if (!with_irqfd) { IVSHMEM_DPRINTF("with eventfd"); - s->eventfd_chr[vector] = create_eventfd_chr_device(s, n, vector); + watch_vector_notifier(s, n, vector); } else if (msix_enabled(pdev)) { IVSHMEM_DPRINTF("with irqfd"); if (ivshmem_add_kvm_msi_virq(s, vector) < 0) { @@ -772,18 +750,20 @@ static void ivshmem_reset(DeviceState *d) ivshmem_use_msix(s); } -static int ivshmem_setup_msi(IVShmemState * s) +static int ivshmem_setup_interrupts(IVShmemState *s) { - if (msix_init_exclusive_bar(PCI_DEVICE(s), s->vectors, 1)) { - return -1; - } + /* allocate QEMU callback data for receiving interrupts */ + s->msi_vectors = g_malloc0(s->vectors * sizeof(MSIVector)); - IVSHMEM_DPRINTF("msix initialized (%d vectors)\n", s->vectors); + if (ivshmem_has_feature(s, IVSHMEM_MSI)) { + if (msix_init_exclusive_bar(PCI_DEVICE(s), s->vectors, 1)) { + return -1; + } - /* allocate QEMU char devices for receiving interrupts */ - s->msi_vectors = g_malloc0(s->vectors * sizeof(MSIVector)); + IVSHMEM_DPRINTF("msix initialized (%d vectors)\n", s->vectors); + ivshmem_use_msix(s); + } - ivshmem_use_msix(s); return 0; } @@ -950,9 +930,8 @@ static void pci_ivshmem_realize(PCIDevice *dev, Error **errp) IVSHMEM_DPRINTF("using shared memory server (socket = %s)\n", s->server_chr->filename); - if (ivshmem_has_feature(s, IVSHMEM_MSI) && - ivshmem_setup_msi(s)) { - error_setg(errp, "msix initialization failed"); + if (ivshmem_setup_interrupts(s) < 0) { + error_setg(errp, "failed to initialize interrupts"); return; } |