[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/36] hw/xen: convert stderr prints to error/warn reports
From: |
Peter Maydell |
Subject: |
[PULL 28/36] hw/xen: convert stderr prints to error/warn reports |
Date: |
Fri, 2 Feb 2024 15:36:29 +0000 |
From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
According to the QEMU Coding Style document:
> Do not use printf(), fprintf() or monitor_printf(). Instead, use
> error_report() or error_vreport() from error-report.h. This ensures the
> error is reported in the right place (current monitor or stderr), and in
> a uniform format.
> Use error_printf() & friends to print additional information.
This commit changes fprintfs that report warnings and errors to the
appropriate report functions.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id:
42a8953553cf68e8bacada966f93af4fbce45919.1706544115.git.manos.pitsidianakis@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/xen/xen-hvm-common.c | 12 ++++++------
hw/xen/xen-mapcache.c | 5 ++---
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c
index 05a29c6f11a..baa1adb9f23 100644
--- a/hw/xen/xen-hvm-common.c
+++ b/hw/xen/xen-hvm-common.c
@@ -20,8 +20,8 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
MemoryRegion *mr,
if (runstate_check(RUN_STATE_INMIGRATE)) {
/* RAM already populated in Xen */
- fprintf(stderr, "%s: do not alloc "RAM_ADDR_FMT
- " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRATE\n",
+ warn_report("%s: do not alloc "RAM_ADDR_FMT
+ " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRATE",
__func__, size, ram_addr);
return;
}
@@ -552,9 +552,9 @@ static void cpu_handle_ioreq(void *opaque)
req->data = copy.data;
if (req->state != STATE_IOREQ_INPROCESS) {
- fprintf(stderr, "Badness in I/O request ... not in service?!: "
+ warn_report("Badness in I/O request ... not in service?!: "
"%x, ptr: %x, port: %"PRIx64", "
- "data: %"PRIx64", count: %u, size: %u, type: %u\n",
+ "data: %"PRIx64", count: %u, size: %u, type: %u",
req->state, req->data_is_ptr, req->addr,
req->data, req->count, req->size, req->type);
destroy_hvm_domain(false);
@@ -758,9 +758,9 @@ void xen_shutdown_fatal_error(const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
+ error_vreport(fmt, ap);
va_end(ap);
- fprintf(stderr, "Will destroy the domain.\n");
+ error_report("Will destroy the domain.");
/* destroy the domain */
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR);
}
diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c
index 336c2123767..4f956d048ee 100644
--- a/hw/xen/xen-mapcache.c
+++ b/hw/xen/xen-mapcache.c
@@ -347,9 +347,8 @@ tryagain:
MapCacheRev *reventry = g_new0(MapCacheRev, 1);
entry->lock++;
if (entry->lock == 0) {
- fprintf(stderr,
- "mapcache entry lock overflow: "HWADDR_FMT_plx" -> %p\n",
- entry->paddr_index, entry->vaddr_base);
+ error_report("mapcache entry lock overflow: "HWADDR_FMT_plx" ->
%p",
+ entry->paddr_index, entry->vaddr_base);
abort();
}
reventry->dma = dma;
--
2.34.1
- [PULL 20/36] hw/arm/vexpress: Check for CPU types in machine_run_board_init(), (continued)
- [PULL 20/36] hw/arm/vexpress: Check for CPU types in machine_run_board_init(), Peter Maydell, 2024/02/02
- [PULL 18/36] hw/arm/musca: Simplify setting MachineClass::valid_cpu_types[], Peter Maydell, 2024/02/02
- [PULL 17/36] hw/arm/msf2: Simplify setting MachineClass::valid_cpu_types[], Peter Maydell, 2024/02/02
- [PULL 12/36] doc/sphinx/hxtool.py: add optional label argument to SRST directive, Peter Maydell, 2024/02/02
- [PULL 19/36] hw/arm/npcm7xx_boards: Simplify setting MachineClass::valid_cpu_types[], Peter Maydell, 2024/02/02
- [PULL 22/36] pci-host: designware: Limit value range of iATU viewport register, Peter Maydell, 2024/02/02
- [PULL 24/36] hw/arm/z2: convert DPRINTF to trace events and guest errors, Peter Maydell, 2024/02/02
- [PULL 26/36] hw/xen/xen-mapcache.c: convert DPRINTF to tracepoints, Peter Maydell, 2024/02/02
- [PULL 27/36] hw/xen/xen-hvm-common.c: convert DPRINTF to tracepoints, Peter Maydell, 2024/02/02
- [PULL 21/36] hw/arm/zynq: Check for CPU types in machine_run_board_init(), Peter Maydell, 2024/02/02
- [PULL 28/36] hw/xen: convert stderr prints to error/warn reports,
Peter Maydell <=
- [PULL 30/36] hw/arm: Add GMAC devices to NPCM7XX SoC, Peter Maydell, 2024/02/02
- [PULL 32/36] hw/net: GMAC Rx Implementation, Peter Maydell, 2024/02/02
- [PULL 29/36] hw/net: Add NPCMXXX GMAC device, Peter Maydell, 2024/02/02
- [PULL 31/36] tests/qtest: Creating qtest for GMAC Module, Peter Maydell, 2024/02/02
- [PULL 23/36] hw/arm/strongarm.c: convert DPRINTF to trace events and guest errors, Peter Maydell, 2024/02/02
- [PULL 25/36] hw/arm/xen_arm.c: convert DPRINTF to trace events and error/warn reports, Peter Maydell, 2024/02/02
- [PULL 33/36] hw/net: GMAC Tx Implementation, Peter Maydell, 2024/02/02
- [PULL 36/36] hw/arm: Connect SPI Controller to BCM2835, Peter Maydell, 2024/02/02
- [PULL 35/36] hw/ssi: Implement BCM2835 SPI Controller, Peter Maydell, 2024/02/02
- [PULL 34/36] tests/qtest: Adding PCS Module test to GMAC Qtest, Peter Maydell, 2024/02/02