xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Denis Obrezkov <denisobrezkov@gmail.com>,
	xen-devel@lists.xenproject.org
Cc: Hunyue Yau <hy-gsoc@hy-research.com>,
	"julien.grall@foss.arm.com" <julien.grall@foss.arm.com>,
	Andre Przywara <andre.przywara@arm.com>,
	tim@xen.org, Iain Hunter <drhunter95@gmail.com>,
	baozich@gmail.com
Subject: Re: [Xen-devel] [PATCH] xen/arm: Switch OMAP5 secondary cores into hyp mode
Date: Tue, 25 Jun 2019 10:57:58 +0100	[thread overview]
Message-ID: <e6f3e92d-6be8-f1c8-e2e3-93ef8f581dda@arm.com> (raw)
In-Reply-To: <670083cc-00d8-ccfd-7abc-e6fd98e7ff2b@citrix.com>

Hi Andrew,

On 24/06/2019 13:03, Andrew Cooper wrote:
> On 24/06/2019 12:09, Julien Grall wrote:
>> (+ GSOC mentors and Andre)
>>
>> Hi Denis,
>>
>> Thank you for the patch.
>>
>> First of all, may I ask to CC the other mentors?
>>
>> On 6/21/19 9:02 PM, Denis Obrezkov wrote:
>>> This function allows xen to bring secondary CPU cores into non-secure
>>> HYP mode. This is done by using a Secure Monitor call.
>>>
>>> Signed-off-by: Denis Obrezkov <denisobrezkov@gmail.com>
>>> ---
>>>   xen/arch/arm/arm32/head.S             | 11 ++++++++++-
>>>   xen/arch/arm/platforms/omap5.c        |  5 +++--
>>>   xen/include/asm-arm/platforms/omap5.h |  3 +++
>>>   3 files changed, 16 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
>>> index 5f817d473e..120e034934 100644
>>> --- a/xen/arch/arm/arm32/head.S
>>> +++ b/xen/arch/arm/arm32/head.S
>>> @@ -36,6 +36,10 @@
>>>   #include EARLY_PRINTK_INC
>>>   #endif
>>>   +
>>> +#define API_HYP_ENTRY 0x102
>>> +#define AUX_CORE_BOOT0_PA           0x48281800
>>> +
>>
>> I have thought a bit more about the placement of the code. I think it would be 
>> best if it lives in a separate file (maybe platforms/omap5-head.S).
> 
> For something this trivial, it is easy to put straight into omap5.c
> 
> Completely untested, but this ought to work:
> 
> diff --git a/xen/arch/arm/platforms/omap5.c b/xen/arch/arm/platforms/omap5.c
> index 6b5cc15af3..1dcc92d3a4 100644
> --- a/xen/arch/arm/platforms/omap5.c
> +++ b/xen/arch/arm/platforms/omap5.c
> @@ -23,6 +23,16 @@
>   #include <xen/vmap.h>
>   #include <asm/io.h>
>   
> +void omap5_init_secondary(void);
> +asm (
> +".text                            \n\t"
> +"omap5_init_secondary:            \n\t"
> +"        ldr   r12, =0x102        \n\t" /* API_HYP_ENTRY */
> +"        adr   r0, init_secondary \n\t"

You cannot use adr on external address for Arm32. This is because the immediate 
constant needs to have a specific format (see "Modified immediate constants in 
ARM instructions" A5.2.4 in ARM DDI 406C.c).

Instead we would need something like:

omap5_init_secondary:
      ldr r12, =0x102
      adr r0, omap5_hyp
      smc #0
omap5_hyp:
      b   init_secondary

Note similar code would be needed for the stub file.

> +"        smc   #0                 \n\t"
> +"        b     init_secondary     \n\t"
> +);
> +
>   static uint16_t num_den[8][2] = {
>       {         0,          0 },  /* not used */
>       {  26 *  64,  26 *  125 },  /* 12.0 Mhz */
> 
> 
> I personally find this favourable to introducing new stub files.
> 
> Ultimately it is Julien/Stefano's decision, but I'd like to point it out as an 
> option for anyone who is unaware.

Thank you for the suggestion :). This was suggested last week, but no-one came 
back explaining how it could be implemented.

The two are fine with me.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

      reply	other threads:[~2019-06-25  9:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21 20:02 [Xen-devel] [PATCH] xen/arm: Switch OMAP5 secondary cores into hyp mode Denis Obrezkov
2019-06-24 11:09 ` Julien Grall
2019-06-24 12:03   ` Andrew Cooper
2019-06-25  9:57     ` Julien Grall [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=e6f3e92d-6be8-f1c8-e2e3-93ef8f581dda@arm.com \
    --to=julien.grall@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=baozich@gmail.com \
    --cc=denisobrezkov@gmail.com \
    --cc=drhunter95@gmail.com \
    --cc=hy-gsoc@hy-research.com \
    --cc=julien.grall@foss.arm.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.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).