All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: "Qiang Liu" <cyruscyliu@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Jason Wang" <jasowang@redhat.com>
Subject: [PULL 04/11] hw/net/lan9118: log [read|write]b when mode_16bit is enabled rather than abort
Date: Thu,  2 Feb 2023 14:21:19 +0800	[thread overview]
Message-ID: <20230202062126.67550-5-jasowang@redhat.com> (raw)
In-Reply-To: <20230202062126.67550-1-jasowang@redhat.com>

From: Qiang Liu <cyruscyliu@gmail.com>

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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/net/lan9118.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
index f1cba55..e5c4af1 100644
--- a/hw/net/lan9118.c
+++ b/hw/net/lan9118.c
@@ -15,7 +15,6 @@
 #include "migration/vmstate.h"
 #include "net/net.h"
 #include "net/eth.h"
-#include "hw/hw.h"
 #include "hw/irq.h"
 #include "hw/net/lan9118.h"
 #include "hw/ptimer.h"
@@ -32,12 +31,8 @@
 #ifdef DEBUG_LAN9118
 #define DPRINTF(fmt, ...) \
 do { printf("lan9118: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { hw_error("lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
 #else
 #define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
 #endif
 
 /* The tx and rx fifo ports are a range of aliased 32-bit registers */
@@ -848,7 +843,8 @@ static uint32_t do_phy_read(lan9118_state *s, int reg)
     case 30: /* Interrupt mask */
         return s->phy_int_mask;
     default:
-        BADF("PHY read reg %d\n", reg);
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "do_phy_read: PHY read reg %d\n", reg);
         return 0;
     }
 }
@@ -876,7 +872,8 @@ static void do_phy_write(lan9118_state *s, int reg, uint32_t val)
         phy_update_irq(s);
         break;
     default:
-        BADF("PHY write reg %d = 0x%04x\n", reg, val);
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "do_phy_write: PHY write reg %d = 0x%04x\n", reg, val);
     }
 }
 
@@ -1209,7 +1206,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 +1322,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;
 }
 
-- 
2.7.4



  parent reply	other threads:[~2023-02-02  6:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02  6:21 [PULL 00/11] Net patches Jason Wang
2023-02-02  6:21 ` [PULL 01/11] net: Move the code to collect available NIC models to a separate function Jason Wang
2023-02-02  6:21 ` [PULL 02/11] net: Restore printing of the help text with "-nic help" Jason Wang
2023-02-02  6:21 ` [PULL 03/11] net: Replace "Supported NIC models" with "Available NIC models" Jason Wang
2023-02-02  6:21 ` Jason Wang [this message]
2023-02-02  6:21 ` [PULL 05/11] hw/net/vmxnet3: allow VMXNET3_MAX_MTU itself as a value Jason Wang
2023-02-02  6:21 ` [PULL 06/11] net: Increase L2TPv3 buffer to fit jumboframes Jason Wang
2023-02-02  6:21 ` [PULL 07/11] vmnet: stop recieving events when VM is stopped Jason Wang
2023-02-02  6:21 ` [PULL 08/11] hw/net/can/xlnx-zynqmp-can: fix assertion failures in transfer_fifo() Jason Wang
2023-02-02  6:21 ` [PULL 09/11] tests/qtest: netdev: test stream and dgram backends Jason Wang
2023-02-02  6:21 ` [PULL 10/11] net: stream: add a new option to automatically reconnect Jason Wang
2023-02-02  6:21 ` [PULL 11/11] vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check Jason Wang
2023-02-04 14:57 ` [PULL 00/11] Net patches Peter Maydell
2023-02-04 20:09   ` Laurent Vivier
2023-02-05 12:36     ` Peter Maydell
2023-02-06  8:23       ` Laurent Vivier
2023-02-13  3:59         ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230202062126.67550-5-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=cyruscyliu@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.