hw: arm: use logging rather than hw_error
cover hw: arm: use logging rather than hw_error
These patches switch a couple of older devices away from hw_error() for "guest can do something wrong" or "guest uses some feature QEMU doesn't implement" cases, replacing it with qemu_log_mask().
These aren't really very important, but I was at a loose end this afternoon and they do let us close out a couple of gitlab issues.
-- PMM
Peter Maydell (2):
hw/intc/exynos4210_combiner: Avoid hw_error for guest errors hw/dma/pl080: Don't use hw_error() for unimplemented features
hw/dma/pl080.c | 6 +++--- hw/intc/exynos4210_combiner.c | 29 ++++++++++++++++++----------- 2 files changed, 21 insertions(+), 14 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 hw/intc/exynos4210_combiner: Avoid hw_error for guest errors
In the exynos4210_combiner device, several cases of bad register offsets passed by the guest are handled by calling hw_error(). This causes QEMU to abort with a guest register dump. These days we prefer to handle "guest does something wrong" by logging it and continuing.
Update the hw_error() calls to qemu_log_mask(LOG_GUEST_ERROR).
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3396
--- hw/intc/exynos4210_combiner.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
hw/intc/exynos4210_combiner.c +18 -11
@@ -28,12 +28,12 @@*/ #include "qemu/osdep.h" +#include "qemu/log.h" #include "hw/core/sysbus.h" #include "migration/vmstate.h" #include "qemu/module.h" #include "hw/intc/exynos4210_combiner.h" #include "hw/arm/exynos4210.h" -#include "hw/core/hw-error.h" #include "hw/core/irq.h" #include "hw/core/qdev-properties.h" #include "qom/object.h"
@@ -119,8 +119,10 @@ exynos4210_combiner_read(void *opaque, hwaddr offset, unsigned size)break ;default :if (offset >>2 >=IIC_REGSET_SIZE ) { -hw_error ("exynos4210.combiner: overflow of reg_set by 0x" - HWADDR_FMT_plx"offset\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"exynos4210.combiner: overflow of reg_set by 0x" + HWADDR_FMT_plx"offset\n" , offset); +return 0 ; } val = s->reg_set[offset >>2 ]; }
@@ -183,20 +185,24 @@ static void exynos4210_combiner_write(void *opaque, hwaddr offset, reg_n = (offset - (req_quad_base_n <<4 )) >>2 ;if (req_quad_base_n >=IIC_NGRP ) { -hw_error ("exynos4210.combiner: unallowed write access at offset 0x" - HWADDR_FMT_plx"\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"exynos4210.combiner: unallowed write access at offset 0x" + HWADDR_FMT_plx"\n" , offset);return ; }if (reg_n >1 ) { -hw_error ("exynos4210.combiner: unallowed write access at offset 0x" - HWADDR_FMT_plx"\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"exynos4210.combiner: unallowed write access at offset 0x" + HWADDR_FMT_plx"\n" , offset);return ; }if (offset >>2 >=IIC_REGSET_SIZE ) { -hw_error ("exynos4210.combiner: overflow of reg_set by 0x" - HWADDR_FMT_plx"offset\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"exynos4210.combiner: overflow of reg_set by 0x" + HWADDR_FMT_plx"offset\n" , offset); +return ; } s->reg_set[offset >>2 ] = val;
@@ -245,8 +251,9 @@ static void exynos4210_combiner_write(void *opaque, hwaddr offset,exynos4210_combiner_update (s, grp_quad_base_n +3 );break ;default : -hw_error ("exynos4210.combiner: unallowed write access at offset 0x" - HWADDR_FMT_plx"\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"exynos4210.combiner: unallowed write access at offset 0x" + HWADDR_FMT_plx"\n" , offset);break ; } }
Signature · 1 line
2.43.0
Re: [PATCH 1/2] hw/intc/exynos4210_combiner: Avoid hw_error for guest errors
Quoted 6 lines · Peter Maydell
In the
exynos4210_combinerdevice, several cases of bad register offsets passed by the guest are handled by callinghw_error(). This causes QEMU to abort with a guest register dump. These days we prefer to handle "guest does something wrong" by logging it and continuing.
Quoted 7 lines
Update the
hw_error()calls toqemu_log_mask(LOG_GUEST_ERROR).Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3396
Signed-off-by Peter Maydell <[email protected]>--- hw/intc/exynos4210_combiner.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
PATCH 2/2 hw/dma/pl080: Don't use hw_error() for unimplemented features
In reply to Peter MaydellIn the pl080 device, we don't implement "peripheral flow control", which is where the DMA engine can be programmed to transfer data until a source or destination peripheral tells it to stop. We currently call hw_error() if the guest tries to use this missing feature, which prints a register dump and aborts QEMU.
Change the hw_error() call to the LOG_UNIMP log-and-continue, which is how we prefer to report guest attempts to use unimplemented features these days.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3409
--- hw/dma/pl080.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/dma/pl080.c +3 -3
@@ -13,7 +13,6 @@#include "qemu/log.h" #include "qemu/module.h" #include "hw/dma/pl080.h" -#include "hw/core/hw-error.h" #include "hw/core/irq.h" #include "hw/core/qdev-properties.h" #include "qapi/error.h"
@@ -132,8 +131,9 @@ again:continue ; flow = (ch->conf >>11 ) &7 ;if (flow >=4 ) { -hw_error ( -"pl080_run: Peripheral flow control not implemented\n" ); +qemu_log_mask (LOG_UNIMP , +"pl080_run: Peripheral flow control not implemented\n" ); +continue ; } src_id = (ch->conf >>1 ) &0x1f ; dest_id = (ch->conf >>6 ) &0x1f ;
Signature · 1 line
2.43.0
Quoted 10 lines · Peter Maydell
These patches switch a couple of older devices away from
hw_error()for "guest can do something wrong" or "guest uses some feature QEMU doesn't implement" cases, replacing it withqemu_log_mask().These aren't really very important, but I was at a loose end this afternoon and they do let us close out a couple of gitlab issues.
-- PMM
Quoted 8 lines
Peter Maydell (2):
hw/intc/exynos4210_combiner: Avoidhw_errorfor guest errors hw/dma/pl080: Don't usehw_error()for unimplemented featureshw/dma/pl080.c | 6 +++--- hw/intc/exynos4210_combiner.c | 29 ++++++++++++++++++----------- 2 files changed, 21 insertions(+), 14 deletions(-)
r~