All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Versatile memory should not exceed 256MB.
@ 2016-10-25  9:37 Jean-Christophe Dubois
  2016-10-25 12:12 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Jean-Christophe Dubois @ 2016-10-25  9:37 UTC (permalink / raw)
  To: qemu-arm, peter.maydell, qemu-devel; +Cc: Jean-Christophe Dubois

For now Qemu accpet a memory size greater than 256 MB but it would
crash afterward.

Versatile devices are starting at 256 MB bondary.

Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
---
 hw/arm/versatilepb.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index 8ae5392..7f11651 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -198,6 +198,14 @@ static void versatile_init(MachineState *machine, int board_id)
     int done_smc = 0;
     DriveInfo *dinfo;
 
+    if (machine->ram_size > 0x10000000) {
+        /* devices are starting at address 0x10000000,
+         * Memory cannot overlap with devices.
+         */ 
+        fprintf(stderr, "Memory size cannot exceed 256MB\n");
+        exit(1);
+    }
+
     if (!machine->cpu_model) {
         machine->cpu_model = "arm926";
     }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] Versatile memory should not exceed 256MB.
  2016-10-25  9:37 [Qemu-devel] [PATCH] Versatile memory should not exceed 256MB Jean-Christophe Dubois
@ 2016-10-25 12:12 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2016-10-25 12:12 UTC (permalink / raw)
  To: Jean-Christophe Dubois; +Cc: qemu-arm, QEMU Developers

On 25 October 2016 at 10:37, Jean-Christophe Dubois <jcd@tribudubois.net> wrote:
> For now Qemu accpet a memory size greater than 256 MB but it would
> crash afterward.
>
> Versatile devices are starting at 256 MB bondary.
>
> Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
> ---
>  hw/arm/versatilepb.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
> index 8ae5392..7f11651 100644
> --- a/hw/arm/versatilepb.c
> +++ b/hw/arm/versatilepb.c
> @@ -198,6 +198,14 @@ static void versatile_init(MachineState *machine, int board_id)
>      int done_smc = 0;
>      DriveInfo *dinfo;
>
> +    if (machine->ram_size > 0x10000000) {
> +        /* devices are starting at address 0x10000000,
> +         * Memory cannot overlap with devices.
> +         */
> +        fprintf(stderr, "Memory size cannot exceed 256MB\n");
> +        exit(1);
> +    }
> +
>      if (!machine->cpu_model) {
>          machine->cpu_model = "arm926";
>      }
> --

Ah, this is a long-standing bug. (I think I first tried to fix it
five years or so back but that ran aground on people not liking a
general approach where the MachineState indicated the maximum
limit for the board.) In any case we seem to have ended up with
each board model doing by-hand checks on the RAM size, so this
is better than doing nothing.

I've applied this to target-arm.next, but I've switched it to
use error_report() rather than fprintf(). I also took the liberty
of tidying up the commit message and comment text a bit.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-25 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25  9:37 [Qemu-devel] [PATCH] Versatile memory should not exceed 256MB Jean-Christophe Dubois
2016-10-25 12:12 ` Peter Maydell

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.