qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Jean-Christophe Dubois <jcd@tribudubois.net>
Cc: qemu-arm <qemu-arm@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] Versatile memory should not exceed 256MB.
Date: Tue, 25 Oct 2016 13:12:17 +0100	[thread overview]
Message-ID: <CAFEAcA-j5gisXFovTbLiBQTL4wKd0KRD1HjcZCdSorpWj7aEtA@mail.gmail.com> (raw)
In-Reply-To: <20161025093711.17407-1-jcd@tribudubois.net>

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

      reply	other threads:[~2016-10-25 12:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFEAcA-j5gisXFovTbLiBQTL4wKd0KRD1HjcZCdSorpWj7aEtA@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=jcd@tribudubois.net \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).