[v2,18/86] arm:kzm: drop RAM size fixup
diff mbox series

Message ID 1579100861-73692-19-git-send-email-imammedo@redhat.com
State New
Headers show
Series
  • refactor main RAM allocation to use hostmem backend
Related show

Commit Message

Igor Mammedov Jan. 15, 2020, 3:06 p.m. UTC
If user provided non-sense RAM size, board will complain and
continue running with max RAM size supported.
Also RAM is going to be allocated by generic code, so it won't be
possible for board to fix things up for user.

Make it error message and exit to force user fix CLI,
instead of accepting non-sense CLI values.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
CC: peter.chubb@nicta.com.au
CC: peter.maydell@linaro.org
CC: qemu-arm@nongnu.org
---
 hw/arm/kzm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Chubb, Peter (Data61, Kensington NSW) Jan. 15, 2020, 7:58 p.m. UTC | #1
>>>>> "Igor" == Igor Mammedov <imammedo@redhat.com> writes:

Igor> If user provided non-sense RAM size, board will complain and
Igor> continue running with max RAM size supported.  Also RAM is going
Igor> to be allocated by generic code, so it won't be possible for
Igor> board to fix things up for user.

Igor> Make it error message and exit to force user fix CLI, instead of
Igor> accepting non-sense CLI values.
 I think this comment needs rewording a little.  Maybe:
   If the user provided too large a RAM size, the code used to
   complain and trim it to the max size.  Now tht RAM is allocated by
   generic code, that's no longer possible, so generate an error and
   exit instead.


Igor>    /* Check the amount of memory is compatible with the SOC */
Igor>   if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE +
Igor>   FSL_IMX31_SDRAM1_SIZE)) {
Igor> - warn_report("RAM size " RAM_ADDR_FMT " above max supported, "
Igor> + error_report("RAM size " RAM_ADDR_FMT " above max supported, "
Igor>                "reduced to %x", machine->ram_size,
Igor>                FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE);

        This needs to be changed so it doesn't say that the RAM size
	is reduced, just what the maximum is.  Maybe:
	error_report("RAM size " RAM_ADDR_FMT " above max (%x) supported.",
	machine->ram_size, FSL_IMX31_SDRAM0_SIZE +
	FSL_IMX31_SDRAM1_SIZE);


Peter C

Patch
diff mbox series

diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c
index 1d5ef28..27800c5 100644
--- a/hw/arm/kzm.c
+++ b/hw/arm/kzm.c
@@ -78,10 +78,10 @@  static void kzm_init(MachineState *machine)
 
     /* Check the amount of memory is compatible with the SOC */
     if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE)) {
-        warn_report("RAM size " RAM_ADDR_FMT " above max supported, "
+        error_report("RAM size " RAM_ADDR_FMT " above max supported, "
                     "reduced to %x", machine->ram_size,
                     FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE);
-        machine->ram_size = FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE;
+        exit(EXIT_FAILURE);
     }
 
     memory_region_allocate_system_memory(&s->ram, NULL, "kzm.ram",