lkml.org 
[lkml]   [2019]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] ARM: mach-shmobile: Don't configure ARCH timer if PSCI is enabled
From
Date

On 24.04.19 15:31, Julien Grall wrote:
> Hi,

Hi Julien


>
>>
>> As I answered in a previous email:
>>
>>  > But "#if !defined(CONFIG_ARM_PSCI)" wraps secure_cntvoff_init()
>> call as
>>  > well, which resets CNTVOFF,
>>
>>  > and this is something I tried to avoid the first from being
>> executed on
>>  > a CPU, which is in SVC mode (when running on top of Xen).
>>
>> What would be a proper way to avoid calling secure_cntvoff_init() at
>> runtime?
>>
>> Check that we are already in non-secure mode and/or cntvoff is
>> already 0?
>
> CNTVOFF is controlled by the hypervisor, so you cannot access it from
> Dom0.
>
> If none of this code should be necessary when PSCI is enabled, then
> you can check the presence of PSCI (see psci_smp_available()).


If I am not mistaken, U-Boot resets CNTVOFF before leaving monitor mode
(switching to non-secure state). This happens if "support for booting in
non-secure mode" is enabled.

This is a mandatory option for PSCI support as well as for support for
hardware virtualization.

So the presence of PSCI would be an indicator, if CNTVOFF was configured
in U-Boot and we don't need to.

From other hand, Gen2 Linux may be booted in non-secure mode, without
PSCI support...


I was thinking about checking the presence of "enable-method = psci" in
CPU node, but probably psci_smp_available() is better option.

Also, there is a specific device-tree property
"arm,cpu-registers-not-fw-configured" [1], but I am not sure whether it
is appropriate to use here.


>
> Another solution is to check whether we are running on xen (see
> xen_domain()).
>
> In any case, I would still surround the two checks because the
> "armgcnt" should really not be touched by Dom0.

Agree.

I will add two checks in V2.


Thank you!


[1]

https://elixir.bootlin.com/linux/v5.1-rc6/source/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml#L68


>
> Cheers,
>
--
Regards,

Oleksandr Tyshchenko

\
 
 \ /
  Last update: 2019-04-26 21:52    [W:0.131 / U:3.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site