use LOG_GUEST_ERROR in more ARM devices
cover use LOG_GUEST_ERROR in more ARM devices
Another batch of a dozen random ARM devices updated to use LOG_GUEST_ERROR and LOG_UNIMP rather than hw_error(). [Some hw_error() uses remain in these devices, for cases which are diagnosing genuine qemu bugs or bad device property values.]
Since this isn't a particularly urgent cleanup I left it at a dozen patches to avoid code reviewer fatigue; More may follow next time I want an easy task :-)
Peter Maydell (12):
hw/pl050: Use LOG_GUEST_ERROR
hw/pl061: Use LOG_GUEST_ERROR
hw/pl080: Use LOG_GUEST_ERROR and LOG_UNIMP hw/pl110: Use LOG_GUEST_ERROR rather than hw_error() hw/pl190: Use LOG_UNIMP rather than hw_error() hw/arm11mpcore: Use LOG_GUEST_ERROR rather than hw_error() hw/arm_gic: Use LOG_GUEST_ERROR
hw/arm_timer: Use LOG_GUEST_ERROR and LOG_UNIMP hw/armv7m_nvic: Use LOG_GUEST_ERROR and LOG_UNIMP hw/arm_sysctl: Use LOG_GUEST_ERROR
hw/arm_l2x0: Use LOG_GUEST_ERROR hw/versatile_i2c: Use LOG_GUEST_ERROR
hw/arm11mpcore.c | 7 +++++-- hw/arm_gic.c | 12 ++++++++---- hw/arm_l2x0.c | 6 ++++-- hw/arm_sysctl.c | 8 ++++++-- hw/arm_timer.c | 19 +++++++++++++------ hw/armv7m_nvic.c | 31 +++++++++++++++++++------------ hw/pl050.c | 6 ++++-- hw/pl061.c | 6 ++++-- hw/pl080.c | 11 +++++++---- hw/pl110.c | 6 ++++-- hw/pl190.c | 2 +- hw/versatile_i2c.c | 6 ++++-- 12 files changed, 79 insertions(+), 41 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/12 hw/pl050: Use LOG_GUEST_ERROR
Use LOG_GUEST_ERROR for reporting guest attempts to access invalid register offsets.
--- hw/pl050.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/pl050.c +4 -2
@@ -95,7 +95,8 @@ static uint64_t pl050_read(void *opaque, hwaddr offset,case 4 :/* KMIIR */ return s->pending |2 ;default : -hw_error ("pl050_read: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"pl050_read: Bad offset %x\n" , (int )offset);return 0 ; } }
@@ -123,7 +124,8 @@ static void pl050_write(void *opaque, hwaddr offset, s->clk = value;return ;default : -hw_error ("pl050_write: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"pl050_write: Bad offset %x\n" , (int )offset); } }static const MemoryRegionOps pl050_ops = {
Signature · 1 line
1.7.9.5
PATCH 2/12 hw/pl061: Use LOG_GUEST_ERROR
In reply to Peter MaydellUse LOG_GUEST_ERROR to report guest attempts to access bad register offsets.
--- hw/pl061.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/pl061.c +4 -2
@@ -164,7 +164,8 @@ static uint64_t pl061_read(void *opaque, hwaddr offset,case 0x528 :/* Analog mode select */ return s->amsel;default : -hw_error ("pl061_read: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"pl061_read: Bad offset %x\n" , (int )offset);return 0 ; } }
@@ -239,7 +240,8 @@ static void pl061_write(void *opaque, hwaddr offset, s->amsel = value &0xff ;break ;default : -hw_error ("pl061_write: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"pl061_write: Bad offset %x\n" , (int )offset); }pl061_update (s); }
Signature · 1 line
1.7.9.5
PATCH 3/12 hw/pl080: Use LOG_GUEST_ERROR and LOG_UNIMP
In reply to Peter MaydellUse LOG_GUEST_ERROR and LOG_UNIMP in preference to hw_error().
--- hw/pl080.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
hw/pl080.c +7 -4
@@ -281,7 +281,8 @@ static uint64_t pl080_read(void *opaque, hwaddr offset,return s->sync;default : bad_offset: -hw_error ("pl080_read: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"pl080_read: Bad offset %x\n" , (int )offset);return 0 ; } }
@@ -327,12 +328,13 @@ static void pl080_write(void *opaque, hwaddr offset,case 10 :/* SoftLBReq */ case 11 :/* SoftLSReq */ /* ??? Implement these. */ -hw_error ("pl080_write: Soft DMA not implemented\n" ); +qemu_log_mask (LOG_UNIMP ,"pl080_write: Soft DMA not implemented\n" );break ;case 12 :/* Configuration */ s->conf = value;if (s->conf & (PL080_CONF_M1 |PL080_CONF_M1 )) { -hw_error ("pl080_write: Big-endian DMA not implemented\n" ); +qemu_log_mask (LOG_UNIMP , +"pl080_write: Big-endian DMA not implemented\n" ); }pl080_run (s);break ;
@@ -341,7 +343,8 @@ static void pl080_write(void *opaque, hwaddr offset,break ;default : bad_offset: -hw_error ("pl080_write: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"pl080_write: Bad offset %x\n" , (int )offset); }pl080_update (s); }
Signature · 1 line
1.7.9.5
Re: [Qemu-devel] [PATCH 03/12] hw/pl080: Use LOG_GUEST_ERROR and LOG_UNIMP
Quoted 1 line · Peter Maydell
Use
LOG_GUEST_ERRORandLOG_UNIMPin preference tohw_error().
It's weird that printing something + abort is replaced by just printing a message and the commit message doesn't really reflect the fact.
[..snip..]
Signature · 1 line
mailto:[email protected]
Re: [Qemu-devel] [PATCH 03/12] hw/pl080: Use LOG_GUEST_ERROR and LOG_UNIMP
Quoted 6 lines · malc
Quoted 1 line · Peter Maydell
Use
LOG_GUEST_ERRORandLOG_UNIMPin preference tohw_error().It's weird that printing something + abort is replaced by just printing a message and the commit message doesn't really reflect the fact.
I assume that the reader knows that hw_error() is fatal; the point of the series is that these shouldn't be fatal errors...
-- PMM
PATCH 4/12 hw/pl110: Use LOG_GUEST_ERROR rather than hw_error()
In reply to Peter MaydellUse LOG_GUEST_ERROR to report guest accesses to invalid register offsets.
--- hw/pl110.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/pl110.c +4 -2
@@ -349,7 +349,8 @@ static uint64_t pl110_read(void *opaque, hwaddr offset,case 12 :/* LCDLPCURR */ return s->lpbase;default : -hw_error ("pl110_read: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"pl110_read: Bad offset %x\n" , (int )offset);return 0 ; } }
@@ -417,7 +418,8 @@ static void pl110_write(void *opaque, hwaddr offset,pl110_update (s);break ;default : -hw_error ("pl110_write: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"pl110_write: Bad offset %x\n" , (int )offset); } }
Signature · 1 line
1.7.9.5
PATCH 5/12 hw/pl190: Use LOG_UNIMP rather than hw_error()
In reply to Peter MaydellUse LOG_UNIMP to report attempts to use the unimplemented test mode.
--- hw/pl190.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pl190.c +1 -1
@@ -199,7 +199,7 @@ static void pl190_write(void *opaque, hwaddr offset,break ;case 0xc0 :/* ITCR */ if (val) { -hw_error ("pl190: Test mode not implemented\n" ); +qemu_log_mask (LOG_UNIMP ,"pl190: Test mode not implemented\n" ); }break ;default :
Signature · 1 line
1.7.9.5
PATCH 6/12 hw/arm11mpcore: Use LOG_GUEST_ERROR rather than hw_error()
In reply to Peter MaydellUse LOG_GUEST_ERROR to report guest accesses to bad offsets.
--- hw/arm11mpcore.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
hw/arm11mpcore.c +5 -2
@@ -44,7 +44,9 @@ static uint64_t mpcore_scu_read(void *opaque, hwaddr offset,case 0x0c :/* Invalidate all. */ return 0 ;default : -hw_error ("mpcore_priv_read: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"mpcore_priv_read: Bad offset %x\n" , (int )offset); +return 0 ; } }
@@ -61,7 +63,8 @@ static void mpcore_scu_write(void *opaque, hwaddr offset,/* This is a no-op as cache is not emulated. */ break ;default : -hw_error ("mpcore_priv_read: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"mpcore_priv_read: Bad offset %x\n" , (int )offset); } }
Signature · 1 line
1.7.9.5
PATCH 7/12 hw/arm_gic: Use LOG_GUEST_ERROR
In reply to Peter MaydellUse LOG_GUEST_ERROR to report guest accesses to bad offsets.
--- hw/arm_gic.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
hw/arm_gic.c +8 -4
@@ -324,7 +324,8 @@ static uint32_t gic_dist_readb(void *opaque, hwaddr offset) }return res; bad_reg: -hw_error ("gic_dist_readb: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"gic_dist_readb: Bad offset %x\n" , (int )offset);return 0 ; }
@@ -487,7 +488,8 @@ static void gic_dist_writeb(void *opaque, hwaddr offset,gic_update (s);return ; bad_reg: -hw_error ("gic_dist_writeb: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"gic_dist_writeb: Bad offset %x\n" , (int )offset); } static void gic_dist_writew(void *opaque, hwaddr offset,
@@ -556,7 +558,8 @@ static uint32_t gic_cpu_read(GICState *s, int cpu, int offset)case 0x18 :/* Highest Pending Interrupt */ return s->current_pending[cpu];default : -hw_error ("gic_cpu_read: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"gic_cpu_read: Bad offset %x\n" , (int )offset);return 0 ; } }
@@ -577,7 +580,8 @@ static void gic_cpu_write(GICState *s, int cpu, int offset, uint32_t value)case 0x10 :/* End Of Interrupt */ return gic_complete_irq (s, cpu, value &0x3ff );default : -hw_error ("gic_cpu_write: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"gic_cpu_write: Bad offset %x\n" , (int )offset);return ; }gic_update (s);
Signature · 1 line
1.7.9.5
PATCH 8/12 hw/arm_timer: Use LOG_GUEST_ERROR and LOG_UNIMP
In reply to Peter MaydellUse LOG_GUEST_ERROR to report guest accesses to bad register offsets, and LOG_UNIMP for access to the unimplemented test registers.
--- hw/arm_timer.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
hw/arm_timer.c +13 -6
@@ -64,7 +64,8 @@ static uint32_t arm_timer_read(void *opaque, hwaddr offset)return 0 ;return s->int_level;default : -hw_error ("%s: Bad offset %x\n" , __func__, (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Bad offset %x\n" , __func__, (int )offset);return 0 ; } }
@@ -131,7 +132,8 @@ static void arm_timer_write(void *opaque, hwaddr offset,arm_timer_recalibrate (s,0 );break ;default : -hw_error ("%s: Bad offset %x\n" , __func__, (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Bad offset %x\n" , __func__, (int )offset); }arm_timer_update (s); }
@@ -223,10 +225,14 @@ static uint64_t sp804_read(void *opaque, hwaddr offset,/* Integration Test control registers, which we won't support */ case 0xf00 :/* TimerITCR */ case 0xf04 :/* TimerITOP (strictly write only but..) */ +qemu_log_mask (LOG_UNIMP , +"%s: integration test registers unimplemented\n" , + __func__);return 0 ; } -hw_error ("%s: Bad offset %x\n" , __func__, (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Bad offset %x\n" , __func__, (int )offset);return 0 ; }
@@ -246,7 +252,8 @@ static void sp804_write(void *opaque, hwaddr offset, }/* Technically we could be writing to the Test Registers, but not likely */ -hw_error ("%s: Bad offset %x\n" , __func__, (int )offset); +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Bad offset %x\n" , + __func__, (int )offset); }static const MemoryRegionOps sp804_ops = {
@@ -300,7 +307,7 @@ static uint64_t icp_pit_read(void *opaque, hwaddr offset,/* ??? Don't know the PrimeCell ID for this device. */ n = offset >>8 ;if (n >2 ) { -hw_error ("%s: Bad timer %d\n" , __func__, n); +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Bad timer %d\n" , __func__, n); }return arm_timer_read (s->timer[n], offset &0xff );
@@ -314,7 +321,7 @@ static void icp_pit_write(void *opaque, hwaddr offset, n = offset >>8 ;if (n >2 ) { -hw_error ("%s: Bad timer %d\n" , __func__, n); +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Bad timer %d\n" , __func__, n); }arm_timer_write (s->timer[n], offset &0xff , value);
Signature · 1 line
1.7.9.5
PATCH 9/12 hw/armv7m_nvic: Use LOG_GUEST_ERROR and LOG_UNIMP
In reply to Peter MaydellUse LOG_GUEST_ERROR and LOG_UNIMP rather than hw_error() where appropriate.
--- hw/armv7m_nvic.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
hw/armv7m_nvic.c +19 -12
@@ -243,7 +243,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)return val;case 0xd28 :/* Configurable Fault Status. */ /* TODO: Implement Fault Status. */ -hw_error ("Not implemented: Configurable Fault Status." ); +qemu_log_mask (LOG_UNIMP ,"Configurable Fault Status unimplemented\n" );return 0 ;case 0xd2c :/* Hard Fault Status. */ case 0xd30 :/* Debug Fault Status. */
@@ -251,7 +251,8 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)case 0xd38 :/* Bus Fault Address. */ case 0xd3c :/* Aux Fault Status. */ /* TODO: Implement fault status registers. */ - goto bad_reg; +qemu_log_mask (LOG_UNIMP ,"Fault status registers unimplemented\n" ); +return 0 ;case 0xd40 :/* PFR0. */ return 0x00000030 ;case 0xd44 :/* PRF1. */
@@ -280,8 +281,8 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)return 0x01310102 ;/* TODO: Implement debug registers. */ default : - bad_reg: -hw_error ("NVIC: Bad read offset 0x%x\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR ,"NVIC: Bad read offset 0x%x\n" , offset); +return 0 ; } }
@@ -345,17 +346,18 @@ static void nvic_writel(void *opaque, uint32_t offset, uint32_t value)case 0xd0c :/* Application Interrupt/Reset Control. */ if ((value >>16 ) ==0x05fa ) {if (value &2 ) { -hw_error ("VECTCLRACTIVE not implemented" ); +qemu_log_mask (LOG_UNIMP ,"VECTCLRACTIVE unimplemented\n" ); }if (value &5 ) { -hw_error ("System reset" ); +qemu_log_mask (LOG_UNIMP ,"AIRCR system reset unimplemented\n" ); } }break ;case 0xd10 :/* System Control. */ case 0xd14 :/* Configuration Control. */ /* TODO: Implement control registers. */ - goto bad_reg; +qemu_log_mask (LOG_UNIMP ,"NVIC: SCR and CCR unimplemented\n" ); +break ;case 0xd18 :case 0xd1c :case 0xd20 :/* System Handler Priority. */ {int irq;
@@ -380,15 +382,17 @@ static void nvic_writel(void *opaque, uint32_t offset, uint32_t value)case 0xd34 :/* Mem Manage Address. */ case 0xd38 :/* Bus Fault Address. */ case 0xd3c :/* Aux Fault Status. */ - goto bad_reg; +qemu_log_mask (LOG_UNIMP , +"NVIC: fault status registers unimplemented\n" ); +break ;case 0xf00 :/* Software Triggered Interrupt Register */ if ((value &0x1ff ) < s->num_irq) {gic_set_pending_private (&s->gic,0 , value &0x1ff ); }break ;default : - bad_reg: -hw_error ("NVIC: Bad write offset 0x%x\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"NVIC: Bad write offset 0x%x\n" , offset); } }
@@ -409,7 +413,9 @@ static uint64_t nvic_sysreg_read(void *opaque, hwaddr addr,if (size ==4 ) {return nvic_readl (opaque, offset); } -hw_error ("NVIC: Bad read of size %d at offset 0x%x\n" , size, offset); +qemu_log_mask (LOG_GUEST_ERROR , +"NVIC: Bad read of size %d at offset 0x%x\n" , size, offset); +return 0 ; } static void nvic_sysreg_write(void *opaque, hwaddr addr,
@@ -420,7 +426,8 @@ static void nvic_sysreg_write(void *opaque, hwaddr addr,nvic_writel (opaque, offset, value);return ; } -hw_error ("NVIC: Bad write of size %d at offset 0x%x\n" , size, offset); +qemu_log_mask (LOG_GUEST_ERROR , +"NVIC: Bad write of size %d at offset 0x%x\n" , size, offset); }static const MemoryRegionOps nvic_sysreg_ops = {
Signature · 1 line
1.7.9.5
PATCH 10/12 hw/arm_sysctl: Use LOG_GUEST_ERROR
In reply to Peter MaydellUse LOG_GUEST_ERROR to report bad guest accesses.
--- hw/arm_sysctl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
hw/arm_sysctl.c +6 -2
@@ -184,7 +184,9 @@ static uint64_t arm_sysctl_read(void *opaque, hwaddr offset,return s->sys_cfgstat;default : bad_reg: -printf ("arm_sysctl_read: Bad register offset 0x%x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"arm_sysctl_read: Bad register offset 0x%x\n" , + (int )offset);return 0 ; } }
@@ -339,7 +341,9 @@ static void arm_sysctl_write(void *opaque, hwaddr offset,return ;default : bad_reg: -printf ("arm_sysctl_write: Bad register offset 0x%x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"arm_sysctl_write: Bad register offset 0x%x\n" , + (int )offset);return ; } }
Signature · 1 line
1.7.9.5
PATCH 11/12 hw/arm_l2x0: Use LOG_GUEST_ERROR
In reply to Peter MaydellUse LOG_GUEST_ERROR to report bad guest accesses.
--- hw/arm_l2x0.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/arm_l2x0.c +4 -2
@@ -87,7 +87,8 @@ static uint64_t l2x0_priv_read(void *opaque, hwaddr offset,case 0xF80 :return 0 ;default : -fprintf (stderr,"l2x0_priv_read: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"l2x0_priv_read: Bad offset %x\n" , (int )offset);break ; }return 0 ;
@@ -128,7 +129,8 @@ static void l2x0_priv_write(void *opaque, hwaddr offset,case 0xF80 :return ;default : -fprintf (stderr,"l2x0_priv_write: Bad offset %x\n" , (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"l2x0_priv_write: Bad offset %x\n" , (int )offset);break ; } }
Signature · 1 line
1.7.9.5
PATCH 12/12 hw/versatile_i2c: Use LOG_GUEST_ERROR
In reply to Peter MaydellUse LOG_GUEST_ERROR to report bad guest accesses.
--- hw/versatile_i2c.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/versatile_i2c.c +4 -2
@@ -40,7 +40,8 @@ static uint64_t versatile_i2c_read(void *opaque, hwaddr offset,if (offset ==0 ) {return (s->out &1 ) | (s->in <<1 ); }else { -hw_error ("%s: Bad offset 0x%x\n" , __func__, (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Bad offset 0x%x\n" , __func__, (int )offset);return -1 ; } }
@@ -58,7 +59,8 @@ static void versatile_i2c_write(void *opaque, hwaddr offset, s->out &= ~value;break ;default : -hw_error ("%s: Bad offset 0x%x\n" , __func__, (int )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Bad offset 0x%x\n" , __func__, (int )offset); }bitbang_i2c_set (s->bitbang,BITBANG_I2C_SCL , (s->out &1 ) !=0 ); s->in =bitbang_i2c_set (s->bitbang,BITBANG_I2C_SDA , (s->out &2 ) !=0 );
Signature · 1 line
1.7.9.5