* [PATCH] hw/misc: sifive_u_otp: Use error_report() when block operation fails
@ 2021-01-19 3:23 Bin Meng
2021-01-19 4:25 ` Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bin Meng @ 2021-01-19 3:23 UTC (permalink / raw)
To: Peter Maydell, Green Wan, Alistair Francis
Cc: Bin Meng, qemu-riscv, qemu-devel
From: Bin Meng <bin.meng@windriver.com>
At present when blk_pread() / blk_pwrite() fails, a guest error
is logged, but this is not really a guest error. Change to use
error_report() instead.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
hw/misc/sifive_u_otp.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
index f921c67..4d8f793 100644
--- a/hw/misc/sifive_u_otp.c
+++ b/hw/misc/sifive_u_otp.c
@@ -23,6 +23,7 @@
#include "hw/qdev-properties.h"
#include "hw/qdev-properties-system.h"
#include "hw/sysbus.h"
+#include "qemu/error-report.h"
#include "qemu/log.h"
#include "qemu/module.h"
#include "hw/misc/sifive_u_otp.h"
@@ -65,8 +66,7 @@ static uint64_t sifive_u_otp_read(void *opaque, hwaddr addr, unsigned int size)
if (blk_pread(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD, &buf,
SIFIVE_U_OTP_FUSE_WORD) < 0) {
- qemu_log_mask(LOG_GUEST_ERROR,
- "read error index<%d>\n", s->pa);
+ error_report("read error index<%d>", s->pa);
return 0xff;
}
@@ -169,8 +169,7 @@ static void sifive_u_otp_write(void *opaque, hwaddr addr,
if (blk_pwrite(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD,
&s->fuse[s->pa], SIFIVE_U_OTP_FUSE_WORD,
0) < 0) {
- qemu_log_mask(LOG_GUEST_ERROR,
- "write error index<%d>\n", s->pa);
+ error_report("write error index<%d>", s->pa);
}
}
@@ -260,15 +259,13 @@ static void sifive_u_otp_reset(DeviceState *dev)
serial_data = s->serial;
if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD,
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
- qemu_log_mask(LOG_GUEST_ERROR,
- "write error index<%d>\n", index);
+ error_report("write error index<%d>", index);
}
serial_data = ~(s->serial);
if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD,
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
- qemu_log_mask(LOG_GUEST_ERROR,
- "write error index<%d>\n", index + 1);
+ error_report("write error index<%d>", index + 1);
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/misc: sifive_u_otp: Use error_report() when block operation fails
2021-01-19 3:23 [PATCH] hw/misc: sifive_u_otp: Use error_report() when block operation fails Bin Meng
@ 2021-01-19 4:25 ` Philippe Mathieu-Daudé
2021-01-19 17:10 ` Alistair Francis
2021-01-19 19:16 ` Alistair Francis
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-19 4:25 UTC (permalink / raw)
To: Bin Meng, Peter Maydell, Green Wan, Alistair Francis
Cc: Bin Meng, qemu-riscv, qemu-devel
On 1/19/21 4:23 AM, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
>
> At present when blk_pread() / blk_pwrite() fails, a guest error
> is logged, but this is not really a guest error. Change to use
> error_report() instead.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
> hw/misc/sifive_u_otp.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/misc: sifive_u_otp: Use error_report() when block operation fails
2021-01-19 3:23 [PATCH] hw/misc: sifive_u_otp: Use error_report() when block operation fails Bin Meng
2021-01-19 4:25 ` Philippe Mathieu-Daudé
@ 2021-01-19 17:10 ` Alistair Francis
2021-01-19 19:16 ` Alistair Francis
2 siblings, 0 replies; 4+ messages in thread
From: Alistair Francis @ 2021-01-19 17:10 UTC (permalink / raw)
To: Bin Meng
Cc: Peter Maydell, open list:RISC-V, Bin Meng,
qemu-devel@nongnu.org Developers, Green Wan, Alistair Francis
On Mon, Jan 18, 2021 at 7:23 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> From: Bin Meng <bin.meng@windriver.com>
>
> At present when blk_pread() / blk_pwrite() fails, a guest error
> is logged, but this is not really a guest error. Change to use
> error_report() instead.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>
> hw/misc/sifive_u_otp.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
> index f921c67..4d8f793 100644
> --- a/hw/misc/sifive_u_otp.c
> +++ b/hw/misc/sifive_u_otp.c
> @@ -23,6 +23,7 @@
> #include "hw/qdev-properties.h"
> #include "hw/qdev-properties-system.h"
> #include "hw/sysbus.h"
> +#include "qemu/error-report.h"
> #include "qemu/log.h"
> #include "qemu/module.h"
> #include "hw/misc/sifive_u_otp.h"
> @@ -65,8 +66,7 @@ static uint64_t sifive_u_otp_read(void *opaque, hwaddr addr, unsigned int size)
>
> if (blk_pread(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD, &buf,
> SIFIVE_U_OTP_FUSE_WORD) < 0) {
> - qemu_log_mask(LOG_GUEST_ERROR,
> - "read error index<%d>\n", s->pa);
> + error_report("read error index<%d>", s->pa);
> return 0xff;
> }
>
> @@ -169,8 +169,7 @@ static void sifive_u_otp_write(void *opaque, hwaddr addr,
> if (blk_pwrite(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD,
> &s->fuse[s->pa], SIFIVE_U_OTP_FUSE_WORD,
> 0) < 0) {
> - qemu_log_mask(LOG_GUEST_ERROR,
> - "write error index<%d>\n", s->pa);
> + error_report("write error index<%d>", s->pa);
> }
> }
>
> @@ -260,15 +259,13 @@ static void sifive_u_otp_reset(DeviceState *dev)
> serial_data = s->serial;
> if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD,
> &serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
> - qemu_log_mask(LOG_GUEST_ERROR,
> - "write error index<%d>\n", index);
> + error_report("write error index<%d>", index);
> }
>
> serial_data = ~(s->serial);
> if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD,
> &serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
> - qemu_log_mask(LOG_GUEST_ERROR,
> - "write error index<%d>\n", index + 1);
> + error_report("write error index<%d>", index + 1);
> }
> }
>
> --
> 2.7.4
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/misc: sifive_u_otp: Use error_report() when block operation fails
2021-01-19 3:23 [PATCH] hw/misc: sifive_u_otp: Use error_report() when block operation fails Bin Meng
2021-01-19 4:25 ` Philippe Mathieu-Daudé
2021-01-19 17:10 ` Alistair Francis
@ 2021-01-19 19:16 ` Alistair Francis
2 siblings, 0 replies; 4+ messages in thread
From: Alistair Francis @ 2021-01-19 19:16 UTC (permalink / raw)
To: Bin Meng
Cc: Peter Maydell, open list:RISC-V, Bin Meng,
qemu-devel@nongnu.org Developers, Green Wan, Alistair Francis
On Mon, Jan 18, 2021 at 7:23 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> From: Bin Meng <bin.meng@windriver.com>
>
> At present when blk_pread() / blk_pwrite() fails, a guest error
> is logged, but this is not really a guest error. Change to use
> error_report() instead.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
Thanks!
Applied to riscv-to-apply.next
Alistair
> ---
>
> hw/misc/sifive_u_otp.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
> index f921c67..4d8f793 100644
> --- a/hw/misc/sifive_u_otp.c
> +++ b/hw/misc/sifive_u_otp.c
> @@ -23,6 +23,7 @@
> #include "hw/qdev-properties.h"
> #include "hw/qdev-properties-system.h"
> #include "hw/sysbus.h"
> +#include "qemu/error-report.h"
> #include "qemu/log.h"
> #include "qemu/module.h"
> #include "hw/misc/sifive_u_otp.h"
> @@ -65,8 +66,7 @@ static uint64_t sifive_u_otp_read(void *opaque, hwaddr addr, unsigned int size)
>
> if (blk_pread(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD, &buf,
> SIFIVE_U_OTP_FUSE_WORD) < 0) {
> - qemu_log_mask(LOG_GUEST_ERROR,
> - "read error index<%d>\n", s->pa);
> + error_report("read error index<%d>", s->pa);
> return 0xff;
> }
>
> @@ -169,8 +169,7 @@ static void sifive_u_otp_write(void *opaque, hwaddr addr,
> if (blk_pwrite(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD,
> &s->fuse[s->pa], SIFIVE_U_OTP_FUSE_WORD,
> 0) < 0) {
> - qemu_log_mask(LOG_GUEST_ERROR,
> - "write error index<%d>\n", s->pa);
> + error_report("write error index<%d>", s->pa);
> }
> }
>
> @@ -260,15 +259,13 @@ static void sifive_u_otp_reset(DeviceState *dev)
> serial_data = s->serial;
> if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD,
> &serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
> - qemu_log_mask(LOG_GUEST_ERROR,
> - "write error index<%d>\n", index);
> + error_report("write error index<%d>", index);
> }
>
> serial_data = ~(s->serial);
> if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD,
> &serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
> - qemu_log_mask(LOG_GUEST_ERROR,
> - "write error index<%d>\n", index + 1);
> + error_report("write error index<%d>", index + 1);
> }
> }
>
> --
> 2.7.4
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-19 20:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 3:23 [PATCH] hw/misc: sifive_u_otp: Use error_report() when block operation fails Bin Meng
2021-01-19 4:25 ` Philippe Mathieu-Daudé
2021-01-19 17:10 ` Alistair Francis
2021-01-19 19:16 ` Alistair Francis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).