qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Niek Linnenbank <nieklinnenbank@gmail.com>
Cc: "Beniamino Galvani" <b.galvani@gmail.com>,
	qemu-arm <qemu-arm@nongnu.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v1 2/4] hw/arm/cubieboard: restrict allowed CPU type to ARM Cortex-A8
Date: Mon, 2 Mar 2020 15:33:01 +0000	[thread overview]
Message-ID: <CAFEAcA9cbCNYo_RP7VnHxuR7LNjdwViE6NCVCuoea1Q2SsrvEg@mail.gmail.com> (raw)
In-Reply-To: <20200227220149.6845-3-nieklinnenbank@gmail.com>

On Thu, 27 Feb 2020 at 22:01, Niek Linnenbank <nieklinnenbank@gmail.com> wrote:
>
> The Cubieboard has an ARM Cortex-A8. Prevent changing the CPU
> to a different type which could break user programs.
>
> Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com>
> ---
>  hw/arm/cubieboard.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
> index 0195925c73..010375f0a8 100644
> --- a/hw/arm/cubieboard.c
> +++ b/hw/arm/cubieboard.c
> @@ -30,9 +30,17 @@ static struct arm_boot_info cubieboard_binfo = {
>
>  static void cubieboard_init(MachineState *machine)
>  {
> -    AwA10State *a10 = AW_A10(object_new(TYPE_AW_A10));
> +    AwA10State *a10;
>      Error *err = NULL;
>
> +    /* Only allow Cortex-A8 for this board */
> +    if (strcmp(machine->cpu_type, ARM_CPU_TYPE_NAME("cortex-a8")) != 0) {
> +        error_report("This board can only be used with cortex-a8 CPU");
> +        exit(1);
> +    }
> +
> +    a10 = AW_A10(object_new(TYPE_AW_A10));
> +
>      object_property_set_int(OBJECT(&a10->emac), 1, "phy-addr", &err);
>      if (err != NULL) {
>          error_reportf_err(err, "Couldn't set phy address: ");

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

except that we're not preventing the user changing the
CPU type, we're just giving a helpful error message instead
of ignoring the bogus -cpu option.

thanks
-- PMM


  reply	other threads:[~2020-03-02 15:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 22:01 [PATCH v1 0/4] hw/arm/cubieboard: correct CPU type and add machine argument checks Niek Linnenbank
2020-02-27 22:01 ` [PATCH v1 1/4] hw/arm/cubieboard: use ARM Cortex-A8 as the default CPU in machine definition Niek Linnenbank
2020-03-02 15:32   ` Peter Maydell
2020-03-02 17:54     ` Philippe Mathieu-Daudé
2020-02-27 22:01 ` [PATCH v1 2/4] hw/arm/cubieboard: restrict allowed CPU type to ARM Cortex-A8 Niek Linnenbank
2020-03-02 15:33   ` Peter Maydell [this message]
2020-02-27 22:01 ` [PATCH v1 3/4] hw/arm/cubieboard: restrict allowed RAM size to 512MiB and 1GiB Niek Linnenbank
2020-03-02 15:41   ` Peter Maydell
2020-02-27 22:01 ` [PATCH v1 4/4] hw/arm/cubieboard: report error when using unsupported -bios argument Niek Linnenbank
2020-03-02 15:44   ` Peter Maydell
2020-03-02 18:04     ` Philippe Mathieu-Daudé
2020-03-02 22:30       ` Niek Linnenbank
2020-03-02 16:06 ` [PATCH v1 0/4] hw/arm/cubieboard: correct CPU type and add machine argument checks Peter Maydell
2020-03-02 22:21   ` Niek Linnenbank
2020-03-02 18:05 ` Philippe Mathieu-Daudé

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=CAFEAcA9cbCNYo_RP7VnHxuR7LNjdwViE6NCVCuoea1Q2SsrvEg@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=b.galvani@gmail.com \
    --cc=nieklinnenbank@gmail.com \
    --cc=philmd@redhat.com \
    --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).