From a70716eb2c766d80f605abd42115b923fedaa1f7 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 8 Feb 2017 18:57:49 +0100 Subject: hw/core/or-irq: Mark the device with cannot_instantiate_with_device_add_yet The "or-irq" device needs to be wired up in source code, there is no way the user can make any real use of this device with the "-device" parameter or the "device_add" monitor command yet. Signed-off-by: Thomas Huth Reviewed-by: Markus Armbruster Reviewed-by: Alistair Francis Signed-off-by: Michael Tokarev --- hw/core/or-irq.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'hw') diff --git a/hw/core/or-irq.c b/hw/core/or-irq.c index 1ac090d1a4..1485d5b285 100644 --- a/hw/core/or-irq.c +++ b/hw/core/or-irq.c @@ -89,6 +89,9 @@ static void or_irq_class_init(ObjectClass *klass, void *data) dc->props = or_irq_properties; dc->realize = or_irq_realize; dc->vmsd = &vmstate_or_irq; + + /* Reason: Needs to be wired up to work, e.g. see stm32f205_soc.c */ + dc->cannot_instantiate_with_device_add_yet = true; } static const TypeInfo or_irq_type_info = { -- cgit v1.2.3-55-g7522 From a6e3707ece6b326e3fc5a086086a2ccac9710e67 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 8 Feb 2017 18:57:38 +0100 Subject: hw/core/register: Mark the device with cannot_instantiate_with_device_add_yet The "qemu,register" device needs to be wired up in source code, there is no way the user can make any real use of this device with the "-device" parameter or the "device_add" monitor command yet. Signed-off-by: Thomas Huth Reviewed-by: Markus Armbruster Reviewed-by: Alistair Francis Signed-off-by: Michael Tokarev --- hw/core/register.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'hw') diff --git a/hw/core/register.c b/hw/core/register.c index 4bfbc508de..be170dcb50 100644 --- a/hw/core/register.c +++ b/hw/core/register.c @@ -274,9 +274,18 @@ void register_finalize_block(RegisterInfoArray *r_array) g_free(r_array); } +static void register_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + + /* Reason: needs to be wired up to work */ + dc->cannot_instantiate_with_device_add_yet = true; +} + static const TypeInfo register_info = { .name = TYPE_REGISTER, .parent = TYPE_DEVICE, + .class_init = register_class_init, }; static void register_register_types(void) -- cgit v1.2.3-55-g7522 From 4729b3a41d11f053a6d03620ff12b266dd0ab330 Mon Sep 17 00:00:00 2001 From: Philippe Mathieu-Daudé Date: Tue, 14 Feb 2017 19:55:35 -0300 Subject: register: fix incorrect read mask The register_read() and register_write() functions expect a bitmask argument. To avoid duplicated code, a new inlined function register_enabled_mask() is introduced. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Signed-off-by: Michael Tokarev --- hw/core/register.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'hw') diff --git a/hw/core/register.c b/hw/core/register.c index be170dcb50..dc335a79a9 100644 --- a/hw/core/register.c +++ b/hw/core/register.c @@ -59,6 +59,15 @@ static inline uint64_t register_read_val(RegisterInfo *reg) return 0; /* unreachable */ } +static inline uint64_t register_enabled_mask(int data_size, unsigned size) +{ + if (data_size < size) { + size = data_size; + } + + return MAKE_64BIT_MASK(0, size * 8); +} + void register_write(RegisterInfo *reg, uint64_t val, uint64_t we, const char *prefix, bool debug) { @@ -192,11 +201,7 @@ void register_write_memory(void *opaque, hwaddr addr, } /* Generate appropriate write enable mask */ - if (reg->data_size < size) { - we = MAKE_64BIT_MASK(0, reg->data_size * 8); - } else { - we = MAKE_64BIT_MASK(0, size * 8); - } + we = register_enabled_mask(reg->data_size, size); register_write(reg, value, we, reg_array->prefix, reg_array->debug); @@ -208,6 +213,7 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, RegisterInfoArray *reg_array = opaque; RegisterInfo *reg = NULL; uint64_t read_val; + uint64_t re; int i; for (i = 0; i < reg_array->num_elements; i++) { @@ -223,7 +229,10 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, return 0; } - read_val = register_read(reg, size * 8, reg_array->prefix, + /* Generate appropriate read enable mask */ + re = register_enabled_mask(reg->data_size, size); + + read_val = register_read(reg, re, reg_array->prefix, reg_array->debug); return extract64(read_val, 0, size * 8); -- cgit v1.2.3-55-g7522 From 8ea1d056320dd5bbbd480c45e6cfb8e3689bcc7e Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Wed, 15 Feb 2017 17:31:47 +0800 Subject: cadence_gem: Remove unused parameter debug message Reported by cppcheck. Signed-off-by: Fam Zheng Signed-off-by: Michael Tokarev --- hw/net/cadence_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index e99d4544a2..d4de8ad9f1 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -508,7 +508,7 @@ static void gem_update_int_status(CadenceGEMState *s) if ((s->num_priority_queues == 1) && s->regs[GEM_ISR]) { /* No priority queues, just trigger the interrupt */ - DB_PRINT("asserting int.\n", i); + DB_PRINT("asserting int.\n"); qemu_set_irq(s->irq[0], 1); return; } -- cgit v1.2.3-55-g7522 From 3d74ee7dcae57b93a64737b954d76cf96236a367 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Thu, 16 Feb 2017 17:26:48 +0000 Subject: lm32: milkymist-tmu2: fix a third integer overflow Don't truncate the multiplication and do a 64 bit one instead because the result is stored in a 64 bit variable. This fixes a similar coverity warning to commits 237a8650d640 and 4382fa655498, in a similar way, and is the final third of the fix for coverity CID 1167561 (hopefully!). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Acked-by: Michael Walle Signed-off-by: Michael Tokarev --- hw/display/milkymist-tmu2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c index 7528665510..59120ddb67 100644 --- a/hw/display/milkymist-tmu2.c +++ b/hw/display/milkymist-tmu2.c @@ -293,7 +293,7 @@ static void tmu2_start(MilkymistTMU2State *s) cpu_physical_memory_unmap(mesh, mesh_len, 0, mesh_len); /* Write back the OpenGL framebuffer to the QEMU framebuffer */ - fb_len = 2 * s->regs[R_DSTHRES] * s->regs[R_DSTVRES]; + fb_len = 2ULL * s->regs[R_DSTHRES] * s->regs[R_DSTVRES]; fb = cpu_physical_memory_map(s->regs[R_DSTFBUF], &fb_len, 1); if (fb == NULL) { glDeleteTextures(1, &texture); -- cgit v1.2.3-55-g7522 From 6c608953a5512b556fd0913d740e932366d6bb5d Mon Sep 17 00:00:00 2001 From: Igor Pavlikevich Date: Mon, 6 Feb 2017 17:44:55 +0300 Subject: hw/acpi/tco.c: fix tco timer stop TCO timer does not actually stop Signed-off-by: Igor Pavlikevich Signed-off-by: Michael Tokarev --- hw/acpi/tco.c | 1 + 1 file changed, 1 insertion(+) (limited to 'hw') diff --git a/hw/acpi/tco.c b/hw/acpi/tco.c index 8ce7daf23a..b4adac88cd 100644 --- a/hw/acpi/tco.c +++ b/hw/acpi/tco.c @@ -49,6 +49,7 @@ static inline void tco_timer_reload(TCOIORegs *tr) static inline void tco_timer_stop(TCOIORegs *tr) { tr->expire_time = -1; + timer_del(tr->tco_timer); } static void tco_timer_expired(void *opaque) -- cgit v1.2.3-55-g7522