All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Michel <luc@lmichel.fr>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-trivial@nongnu.org, Michael Tokarev <mjt@tls.msk.ru>,
	qemu-devel@nongnu.org,
	Andrew Baumann <Andrew.Baumann@microsoft.com>,
	Laurent Vivier <laurent@vivier.eu>,
	qemu-arm@nongnu.org
Subject: Re: [RFC PATCH 2/2] hw/arm/raspi: Restrict BCM2835 / BCM2836 SoC to TCG
Date: Mon, 1 Feb 2021 09:18:26 +0100	[thread overview]
Message-ID: <20210201081826.yx34xjzbgsiwzcpd@sekoia-pc.home.lmichel.fr> (raw)
In-Reply-To: <20210131151410.318649-3-f4bug@amsat.org>

Hi Philippe,

On 16:14 Sun 31 Jan     , Philippe Mathieu-Daudé wrote:
> KVM requires the target cpu to be at least ARMv8 architecture
> (support on ARMv7 has been dropped in commit 82bf7ae84ce:
> "target/arm: Remove KVM support for 32-bit Arm hosts").
Wow, is there absolutely no way to do that then? What about using an
ARMv8 and starting in AArch32 mode? Is that possible with KVM? I guess
it might not be strictly identical as spawning the "real" CPU...

> 
> From the various SoC used by the Raspberry Pi machines, only
> the BCM2837 is an ARMv8 (Cortex-A53).
> 
> Restrict the BCM2835 (ARM1176) and BCM2836 (Cortex-A7) to TCG.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/arm/bcm2836.c | 6 ++++++
>  hw/arm/raspi.c   | 4 ++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
> index fd16ed87c40..3051764f2dc 100644
> --- a/hw/arm/bcm2836.c
> +++ b/hw/arm/bcm2836.c
> @@ -89,6 +89,7 @@ static bool bcm283x_common_realize(DeviceState *dev, Error **errp)
>      return true;
>  }
>  
> +#ifdef CONFIG_TCG
I'm not sure it's enough. TCG and KVM can be enabled in the same
binary. You'll have to perform a runtime check here I think.

>  static void bcm2835_realize(DeviceState *dev, Error **errp)
>  {
>      BCM283XState *s = BCM283X(dev);
> @@ -107,6 +108,7 @@ static void bcm2835_realize(DeviceState *dev, Error **errp)
>      sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1,
>              qdev_get_gpio_in(DEVICE(&s->cpu[0].core), ARM_CPU_FIQ));
>  }
> +#endif /* CONFIG_TCG */
>  
>  static void bcm2836_realize(DeviceState *dev, Error **errp)
>  {
> @@ -178,6 +180,7 @@ static void bcm283x_class_init(ObjectClass *oc, void *data)
>      dc->user_creatable = false;
>  }
>  
> +#ifdef CONFIG_TCG
>  static void bcm2835_class_init(ObjectClass *oc, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(oc);
> @@ -201,6 +204,7 @@ static void bcm2836_class_init(ObjectClass *oc, void *data)
>      bc->clusterid = 0xf;
>      dc->realize = bcm2836_realize;
>  };
> +#endif /* CONFIG_TCG */
>  
>  #ifdef TARGET_AARCH64
>  static void bcm2837_class_init(ObjectClass *oc, void *data)
> @@ -227,6 +231,7 @@ static const TypeInfo bcm283x_types[] = {
>          .class_init     = bcm283x_class_init,
>          .abstract       = true,
>      },
> +#ifdef CONFIG_TCG
>      {
>          .name           = TYPE_BCM2835,
>          .parent         = TYPE_BCM283X,
> @@ -236,6 +241,7 @@ static const TypeInfo bcm283x_types[] = {
>          .parent         = TYPE_BCM283X,
>          .class_init     = bcm2836_class_init,
>      },
> +#endif /* CONFIG_TCG */
>  #ifdef TARGET_AARCH64
>      {
>          .name           = TYPE_BCM2837,
> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> index dce966a4dd8..cfa15504d9c 100644
> --- a/hw/arm/raspi.c
> +++ b/hw/arm/raspi.c
> @@ -319,6 +319,7 @@ static void raspi_machine_class_common_init(MachineClass *mc,
>      mc->default_ram_id = "ram";
>  };
>  
> +#ifdef CONFIG_TCG
>  static void raspi0_machine_class_init(ObjectClass *oc, void *data)
>  {
>      MachineClass *mc = MACHINE_CLASS(oc);
> @@ -346,6 +347,7 @@ static void raspi2b_machine_class_init(ObjectClass *oc, void *data)
>      rmc->board_rev = 0xa21041;
>      raspi_machine_class_common_init(mc, rmc->board_rev);
>  };
> +#endif /* CONFIG_TCG */
>  
>  #ifdef TARGET_AARCH64
>  static void raspi3ap_machine_class_init(ObjectClass *oc, void *data)
> @@ -376,6 +378,7 @@ static const TypeInfo raspi_machine_types[] = {
>          .class_size     = sizeof(RaspiMachineClass),
>          .abstract       = true,
>      },
> +#ifdef CONFIG_TCG
>      {
>          .name           = MACHINE_TYPE_NAME("raspi0"),
>          .parent         = TYPE_RASPI_MACHINE,
> @@ -389,6 +392,7 @@ static const TypeInfo raspi_machine_types[] = {
>          .parent         = TYPE_RASPI_MACHINE,
>          .class_init     = raspi2b_machine_class_init,
>      },
> +#endif /* CONFIG_TCG */
>  #ifdef TARGET_AARCH64
>      {
>          .name           = MACHINE_TYPE_NAME("raspi3ap"),
> -- 
> 2.26.2
> 

-- 


  reply	other threads:[~2021-02-01  8:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-31 15:14 [RFC PATCH 0/2] hw/arm/raspi: Restrict BCM2835 / BCM2836 SoC to TCG Philippe Mathieu-Daudé
2021-01-31 15:14 ` [RFC PATCH 1/2] hw/arm/raspi: Trivial code movement Philippe Mathieu-Daudé
2021-02-01  8:09   ` Luc Michel
2021-01-31 15:14 ` [RFC PATCH 2/2] hw/arm/raspi: Restrict BCM2835 / BCM2836 SoC to TCG Philippe Mathieu-Daudé
2021-02-01  8:18   ` Luc Michel [this message]
2021-02-01  8:46     ` Philippe Mathieu-Daudé
2021-02-01  9:04       ` Paolo Bonzini
2021-02-02 12:28     ` Peter Maydell
2021-02-02 13:29       ` Philippe Mathieu-Daudé
2021-02-02 13:47         ` Peter Maydell
2021-02-02 14:26           ` Philippe Mathieu-Daudé
2021-02-02 12:25 ` [RFC PATCH 0/2] " Peter Maydell

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=20210201081826.yx34xjzbgsiwzcpd@sekoia-pc.home.lmichel.fr \
    --to=luc@lmichel.fr \
    --cc=Andrew.Baumann@microsoft.com \
    --cc=f4bug@amsat.org \
    --cc=laurent@vivier.eu \
    --cc=mjt@tls.msk.ru \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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 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.