qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Greg Bellows <greg.bellows@linaro.org>
Cc: Sergey Fedorov <serge.fdrv@gmail.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Fabian Aggeler <aggelerf@ethz.ch>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v2 09/15] target-arm: Add ARMCPU secure property
Date: Mon, 15 Dec 2014 17:01:59 +0000	[thread overview]
Message-ID: <CAFEAcA_O7XEWRZG9Q24acM8h6dNOHUDVYHk-uO9Y3DCRzCsu8Q@mail.gmail.com> (raw)
In-Reply-To: <1418340569-30519-10-git-send-email-greg.bellows@linaro.org>

On 11 December 2014 at 23:29, Greg Bellows <greg.bellows@linaro.org> wrote:
> Added a "has_el3" state property to the ARMCPU descriptor.  This property
> indicates whether the ARMCPU has security extensions enabled (EL3) or not.
> By default it is disabled at this time.
>
> Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
>
> ---
>
> v1 -> v2
> - Added set of has_el3 to true when EL3 is enabled
> ---
>  target-arm/cpu-qom.h |  2 ++
>  target-arm/cpu.c     | 24 ++++++++++++++++++++++++
>  2 files changed, 26 insertions(+)
>
> diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h
> index dcfda7d..ed5a644 100644
> --- a/target-arm/cpu-qom.h
> +++ b/target-arm/cpu-qom.h
> @@ -100,6 +100,8 @@ typedef struct ARMCPU {
>      bool start_powered_off;
>      /* CPU currently in PSCI powered-off state */
>      bool powered_off;
> +    /* CPU has security extension */
> +    bool has_el3;
>
>      /* PSCI conduit used to invoke PSCI methods
>       * 0 - disabled, 1 - smc, 2 - hvc
> diff --git a/target-arm/cpu.c b/target-arm/cpu.c
> index 01afed2..758e8f8 100644
> --- a/target-arm/cpu.c
> +++ b/target-arm/cpu.c
> @@ -388,6 +388,9 @@ static Property arm_cpu_reset_hivecs_property =
>  static Property arm_cpu_rvbar_property =
>              DEFINE_PROP_UINT64("rvbar", ARMCPU, rvbar, 0);
>
> +static Property arm_cpu_has_el3_property =
> +            DEFINE_PROP_BOOL("has_el3", ARMCPU, has_el3, false);

I think the default value here should be "true": we want
CPUs to default to having all their features turned on
unless the board specifically disables it.

(This won't affect behaviour til we get to patch 15 because
before then ARM_FEATURE_EL3 isn't set and we never add
the property here.)

> +
>  static void arm_cpu_post_init(Object *obj)
>  {
>      ARMCPU *cpu = ARM_CPU(obj);
> @@ -407,6 +410,15 @@ static void arm_cpu_post_init(Object *obj)
>          qdev_property_add_static(DEVICE(obj), &arm_cpu_rvbar_property,
>                                   &error_abort);
>      }
> +
> +    if (arm_feature(&cpu->env, ARM_FEATURE_EL3)) {
> +        /* Add the has_el3 state CPU property only if EL3 is allowed.  This will
> +         * prevent "has_el3" from existing on CPUs which cannot support EL3.
> +         */
> +        qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el3_property,
> +                                 &error_abort);
> +        cpu->has_el3 = true;
> +    }
>  }
>
>  static void arm_cpu_finalizefn(Object *obj)
> @@ -476,6 +488,18 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
>              cpu->reset_sctlr |= (1 << 13);
>      }
>
> +    if (!cpu->has_el3) {
> +        /* If the hsa_el3 CPU property is disabled then we need to disable the
> +         * feature.

Typo: "has_el3".

> +         */
> +        unset_feature(env, ARM_FEATURE_EL3);
> +
> +        /* Disable the security extension feature bits in the processor feature
> +         * register as well.  This is id_pfr1[7:4].
> +         */
> +        cpu->id_pfr1 &= ~0xf0;
> +    }
> +
>      register_cp_regs_for_features(cpu);
>      arm_cpu_register_gdb_regs_for_features(cpu);

thanks
-- PMM

  reply	other threads:[~2014-12-15 17:02 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11 23:29 [Qemu-devel] [PATCH v2 00/15] target-arm: Add CPU security extension enablement Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 01/15] target-arm: Add vexpress class and machine types Greg Bellows
2014-12-15 16:54   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 02/15] target-arm: Add vexpress a9 & a15 machine objects Greg Bellows
2014-12-15 16:54   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 03/15] target-arm: Switch to common vexpress machine init Greg Bellows
2014-12-15 16:55   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 04/15] target-arm: Add vexpress machine secure property Greg Bellows
2014-12-15 17:11   ` Peter Maydell
2014-12-15 17:46     ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 05/15] target-arm: Change vexpress daughterboard init arg Greg Bellows
2014-12-15 16:55   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 06/15] target-arm: Add virt class and machine types Greg Bellows
2014-12-15 16:56   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 07/15] target-arm: Add virt machine secure property Greg Bellows
2014-12-15 17:12   ` Peter Maydell
2014-12-15 17:51     ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 08/15] target-arm: Add feature unset function Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 09/15] target-arm: Add ARMCPU secure property Greg Bellows
2014-12-15 17:01   ` Peter Maydell [this message]
2014-12-15 17:18     ` Greg Bellows
2014-12-15 17:21       ` Peter Maydell
2014-12-15 17:34         ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 10/15] target-arm: Add arm_boot_info secure_boot control Greg Bellows
2014-12-15 17:04   ` Peter Maydell
2014-12-15 17:23     ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 11/15] target-arm: Enable CPU has_el3 prop during VE init Greg Bellows
2014-12-15 17:06   ` Peter Maydell
2014-12-15 17:44     ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 12/15] target-arm: Set CPU has_el3 prop during virt init Greg Bellows
2014-12-15 17:07   ` Peter Maydell
2014-12-15 17:44     ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 13/15] target-arm: Breakout integratorcp and versatilepb cpu init Greg Bellows
2014-12-15 17:08   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 14/15] target-arm: Disable EL3 on unsupported machines Greg Bellows
2014-12-15 17:09   ` Peter Maydell
2014-12-15 21:45     ` Greg Bellows
2014-12-15 22:39       ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 15/15] target-arm: add cpu feature EL3 to CPUs with Security Extensions Greg Bellows
2014-12-15 17:10   ` 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=CAFEAcA_O7XEWRZG9Q24acM8h6dNOHUDVYHk-uO9Y3DCRzCsu8Q@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=aggelerf@ethz.ch \
    --cc=edgar.iglesias@gmail.com \
    --cc=greg.bellows@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=serge.fdrv@gmail.com \
    /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).