[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 13/40] pseries: Clean up error handling in spapr_valida
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 13/40] pseries: Clean up error handling in spapr_validate_node_memory() |
Date: |
Mon, 1 Feb 2016 13:30:41 +1100 |
Use error_setg() and return an error, rather than using an explicit exit().
Also improve messages, and be more explicit about which constraint failed.
Signed-off-by: David Gibson <address@hidden>
Reviewed-by: Bharata B Rao <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Reviewed-by: Alexey Kardashevskiy <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
---
hw/ppc/spapr.c | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 61653ae..4e6ee6d 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1699,27 +1699,34 @@ static void
spapr_create_lmb_dr_connectors(sPAPRMachineState *spapr)
* to SPAPR_MEMORY_BLOCK_SIZE(256MB), then refuse to start the guest
* since we can't support such unaligned sizes with DRCONF_MEMORY.
*/
-static void spapr_validate_node_memory(MachineState *machine)
+static void spapr_validate_node_memory(MachineState *machine, Error **errp)
{
int i;
- if (machine->maxram_size % SPAPR_MEMORY_BLOCK_SIZE ||
- machine->ram_size % SPAPR_MEMORY_BLOCK_SIZE) {
- error_report("Can't support memory configuration where RAM size "
- "0x" RAM_ADDR_FMT " or maxmem size "
- "0x" RAM_ADDR_FMT " isn't aligned to %llu MB",
- machine->ram_size, machine->maxram_size,
- SPAPR_MEMORY_BLOCK_SIZE/M_BYTE);
- exit(EXIT_FAILURE);
+ if (machine->ram_size % SPAPR_MEMORY_BLOCK_SIZE) {
+ error_setg(errp, "Memory size 0x" RAM_ADDR_FMT
+ " is not aligned to %llu MiB",
+ machine->ram_size,
+ SPAPR_MEMORY_BLOCK_SIZE / M_BYTE);
+ return;
+ }
+
+ if (machine->maxram_size % SPAPR_MEMORY_BLOCK_SIZE) {
+ error_setg(errp, "Maximum memory size 0x" RAM_ADDR_FMT
+ " is not aligned to %llu MiB",
+ machine->ram_size,
+ SPAPR_MEMORY_BLOCK_SIZE / M_BYTE);
+ return;
}
for (i = 0; i < nb_numa_nodes; i++) {
if (numa_info[i].node_mem % SPAPR_MEMORY_BLOCK_SIZE) {
- error_report("Can't support memory configuration where memory size"
- " %" PRIx64 " of node %d isn't aligned to %llu MB",
- numa_info[i].node_mem, i,
- SPAPR_MEMORY_BLOCK_SIZE/M_BYTE);
- exit(EXIT_FAILURE);
+ error_setg(errp,
+ "Node %d memory size 0x%" PRIx64
+ " is not aligned to %llu MiB",
+ i, numa_info[i].node_mem,
+ SPAPR_MEMORY_BLOCK_SIZE / M_BYTE);
+ return;
}
}
}
@@ -1809,7 +1816,7 @@ static void ppc_spapr_init(MachineState *machine)
XICS_IRQS);
if (smc->dr_lmb_enabled) {
- spapr_validate_node_memory(machine);
+ spapr_validate_node_memory(machine, &error_fatal);
}
/* init CPUs */
--
2.5.0
- [Qemu-ppc] [PULL 28/40] uninorth.c: add support for UniNorth kMacRISCPCIAddressSelect (0x48) register, (continued)
- [Qemu-ppc] [PULL 28/40] uninorth.c: add support for UniNorth kMacRISCPCIAddressSelect (0x48) register, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 37/40] target-ppc: Helper to determine page size information from hpte alone, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 39/40] target-ppc: Make every FPSCR_ macro have a corresponding FP_ macro, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 31/40] target-ppc: Rework ppc_store_slb, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 35/40] target-ppc: Split 44x tlbiva from ppc_tlb_invalidate_one(), David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 32/40] target-ppc: Rework SLB page size lookup, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 30/40] target-ppc: Convert mmu-hash{32, 64}.[ch] from CPUPPCState to PowerPCCPU, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 02/40] target-ppc: use cpu_write_xer() helper in cpu_post_load, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 09/40] spapr: Remove abuse of rtas_ld() in h_client_architecture_support, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 20/40] target-ppc: rename and export maybe_bswap_register(), David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 13/40] pseries: Clean up error handling in spapr_validate_node_memory(),
David Gibson <=
- [Qemu-ppc] [PULL 04/40] macio: add dma_active to VMStateDescription, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 14/40] pseries: Clean up error handling in spapr_vga_init(), David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 05/40] mac_dbdma: add DBDMA controller state to VMStateDescription, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 10/40] spapr: Don't create ibm, dynamic-reconfiguration-memory w/o DR LMBs, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 12/40] pseries: Clean up error handling of spapr_cpu_init(), David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 08/40] spapr: Remove rtas_st_buffer_direct(), David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 21/40] target-ppc: gdbstub: fix float registers for little-endian guests, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 38/40] target-ppc: Allow more page sizes for POWER7 & POWER8 in TCG, David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 16/40] pseries: Clean up error handling in xics_system_init(), David Gibson, 2016/01/31
- [Qemu-ppc] [PULL 34/40] target-ppc: Remove unused mmu models from ppc_tlb_invalidate_one, David Gibson, 2016/01/31