diff mbox series

hw/net/lan9118: log [read|write]b when mode_16bit is enabled rather than abort

Message ID 20230111070518.994646-1-cyruscyliu@gmail.com
State New
Headers show
Series hw/net/lan9118: log [read|write]b when mode_16bit is enabled rather than abort | expand

Commit Message

Qiang Liu Jan. 11, 2023, 7:05 a.m. UTC
This patch replaces hw_error to guest error log for [read|write]b
accesses when mode_16bit is enabled. This avoids aborting qemu.

Fixes: 1248f8d4cbc3 ("hw/lan9118: Add basic 16-bit mode support.")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1433
Reported-by: Qiang Liu <cyruscyliu@gmail.com>
Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
---
 hw/net/lan9118.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé Jan. 11, 2023, 8:44 a.m. UTC | #1
Hi Qiang,

On 11/1/23 08:05, Qiang Liu wrote:
> This patch replaces hw_error to guest error log for [read|write]b
> accesses when mode_16bit is enabled. This avoids aborting qemu.
> 
> Fixes: 1248f8d4cbc3 ("hw/lan9118: Add basic 16-bit mode support.")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1433
> Reported-by: Qiang Liu <cyruscyliu@gmail.com>
> Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
> ---
>   hw/net/lan9118.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
> index f1cba55967..7f35715f27 100644
> --- a/hw/net/lan9118.c
> +++ b/hw/net/lan9118.c
> @@ -1209,7 +1209,8 @@ static void lan9118_16bit_mode_write(void *opaque, hwaddr offset,
>           return;
>       }
>   
> -    hw_error("lan9118_write: Bad size 0x%x\n", size);
> +    qemu_log_mask(LOG_GUEST_ERROR,
> +                  "lan9118_16bit_mode_write: Bad size 0x%x\n", size);
>   }

There are two other uses via BADF(), then we can remove the BADF() macro
and the "hw/hw.h" inclusion.

Regards,

Phil.
Qiang Liu Jan. 11, 2023, 8:49 a.m. UTC | #2
On Wed, Jan 11, 2023 at 4:44 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> Hi Qiang,
>
> On 11/1/23 08:05, Qiang Liu wrote:
> > This patch replaces hw_error to guest error log for [read|write]b
> > accesses when mode_16bit is enabled. This avoids aborting qemu.
> >
> > Fixes: 1248f8d4cbc3 ("hw/lan9118: Add basic 16-bit mode support.")
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1433
> > Reported-by: Qiang Liu <cyruscyliu@gmail.com>
> > Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
> > ---
> >   hw/net/lan9118.c | 6 ++++--
> >   1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
> > index f1cba55967..7f35715f27 100644
> > --- a/hw/net/lan9118.c
> > +++ b/hw/net/lan9118.c
> > @@ -1209,7 +1209,8 @@ static void lan9118_16bit_mode_write(void *opaque,
> hwaddr offset,
> >           return;
> >       }
> >
> > -    hw_error("lan9118_write: Bad size 0x%x\n", size);
> > +    qemu_log_mask(LOG_GUEST_ERROR,
> > +                  "lan9118_16bit_mode_write: Bad size 0x%x\n", size);
> >   }
>
> There are two other uses via BADF(), then we can remove the BADF() macro
> and the "hw/hw.h" inclusion.

 I see. Sounds nice! Let me resend the patch.

Best,
Qiang
diff mbox series

Patch

diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
index f1cba55967..7f35715f27 100644
--- a/hw/net/lan9118.c
+++ b/hw/net/lan9118.c
@@ -1209,7 +1209,8 @@  static void lan9118_16bit_mode_write(void *opaque, hwaddr offset,
         return;
     }
 
-    hw_error("lan9118_write: Bad size 0x%x\n", size);
+    qemu_log_mask(LOG_GUEST_ERROR,
+                  "lan9118_16bit_mode_write: Bad size 0x%x\n", size);
 }
 
 static uint64_t lan9118_readl(void *opaque, hwaddr offset,
@@ -1324,7 +1325,8 @@  static uint64_t lan9118_16bit_mode_read(void *opaque, hwaddr offset,
         return lan9118_readl(opaque, offset, size);
     }
 
-    hw_error("lan9118_read: Bad size 0x%x\n", size);
+    qemu_log_mask(LOG_GUEST_ERROR,
+                  "lan9118_16bit_mode_read: Bad size 0x%x\n", size);
     return 0;
 }