All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Fedorov <serge.fdrv@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-arm] [PATCH] target-arm: Don't report presence of EL2 if it doesn't exist
Date: Wed, 3 Feb 2016 15:30:38 +0300	[thread overview]
Message-ID: <56B1F2EE.9020008@gmail.com> (raw)
In-Reply-To: <1454437242-10262-1-git-send-email-peter.maydell@linaro.org>

On 02.02.2016 21:20, Peter Maydell wrote:
> We already modify the processor feature bits to not report EL3
> support to the guest if EL3 isn't enabled for the CPU we're emulating.
> Add similar support for not reporting EL2 unless it is enabled.
> This is necessary because real world guest code running at EL3
> (trusted firmware or bootloaders) will query the ID registers to
> determine whether it should start a guest Linux kernel in EL2 or EL3.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Sergey Fedorov <serge.fdrv@gmail.com>

> ---
> When full EL2 arrives and we have the CPU property for it then
> this will expand a bit to look like the 'if (!cpu->has_el3)'
> condition just above it.
>
>  target-arm/cpu.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/target-arm/cpu.c b/target-arm/cpu.c
> index 6c34476..0cc075d 100644
> --- a/target-arm/cpu.c
> +++ b/target-arm/cpu.c
> @@ -650,6 +650,15 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
>          cpu->id_aa64pfr0 &= ~0xf000;
>      }
>  
> +    if (!arm_feature(env, ARM_FEATURE_EL2)) {
> +        /* Disable the hypervisor feature bits in the processor feature
> +         * registers if we don't have EL2. These are id_pfr1[15:12] and
> +         * id_aa64pfr0_el1[11:8].
> +         */
> +        cpu->id_aa64pfr0 &= ~0xf00;
> +        cpu->id_pfr1 &= ~0xf000;
> +    }
> +
>      if (!cpu->has_mpu) {
>          unset_feature(env, ARM_FEATURE_MPU);
>      }


WARNING: multiple messages have this Message-ID (diff)
From: Sergey Fedorov <serge.fdrv@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH] target-arm: Don't report presence of EL2 if it doesn't exist
Date: Wed, 3 Feb 2016 15:30:38 +0300	[thread overview]
Message-ID: <56B1F2EE.9020008@gmail.com> (raw)
In-Reply-To: <1454437242-10262-1-git-send-email-peter.maydell@linaro.org>

On 02.02.2016 21:20, Peter Maydell wrote:
> We already modify the processor feature bits to not report EL3
> support to the guest if EL3 isn't enabled for the CPU we're emulating.
> Add similar support for not reporting EL2 unless it is enabled.
> This is necessary because real world guest code running at EL3
> (trusted firmware or bootloaders) will query the ID registers to
> determine whether it should start a guest Linux kernel in EL2 or EL3.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Sergey Fedorov <serge.fdrv@gmail.com>

> ---
> When full EL2 arrives and we have the CPU property for it then
> this will expand a bit to look like the 'if (!cpu->has_el3)'
> condition just above it.
>
>  target-arm/cpu.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/target-arm/cpu.c b/target-arm/cpu.c
> index 6c34476..0cc075d 100644
> --- a/target-arm/cpu.c
> +++ b/target-arm/cpu.c
> @@ -650,6 +650,15 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
>          cpu->id_aa64pfr0 &= ~0xf000;
>      }
>  
> +    if (!arm_feature(env, ARM_FEATURE_EL2)) {
> +        /* Disable the hypervisor feature bits in the processor feature
> +         * registers if we don't have EL2. These are id_pfr1[15:12] and
> +         * id_aa64pfr0_el1[11:8].
> +         */
> +        cpu->id_aa64pfr0 &= ~0xf00;
> +        cpu->id_pfr1 &= ~0xf000;
> +    }
> +
>      if (!cpu->has_mpu) {
>          unset_feature(env, ARM_FEATURE_MPU);
>      }

  reply	other threads:[~2016-02-03 12:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 18:20 [Qemu-arm] [PATCH] target-arm: Don't report presence of EL2 if it doesn't exist Peter Maydell
2016-02-02 18:20 ` [Qemu-devel] " Peter Maydell
2016-02-03 12:30 ` Sergey Fedorov [this message]
2016-02-03 12:30   ` [Qemu-devel] [Qemu-arm] " Sergey Fedorov

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=56B1F2EE.9020008@gmail.com \
    --to=serge.fdrv@gmail.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --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 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.