From: Oleksandr <olekstysh@gmail.com>
To: Julien Grall <julien.grall@arm.com>,
linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: horms@verge.net.au, magnus.damm@gmail.com, linux@armlinux.org.uk,
Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Subject: Re: [PATCH] ARM: mach-shmobile: Don't configure ARCH timer if PSCI is enabled
Date: Fri, 26 Apr 2019 22:51:06 +0300 [thread overview]
Message-ID: <e8798fa4-a0dc-7c85-e294-bdf6dad6ec74@gmail.com> (raw)
In-Reply-To: <c08c0d02-37f9-9f53-62b9-e5012097d94a@arm.com>
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
prev parent reply other threads:[~2019-04-26 19:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-17 17:10 [PATCH] ARM: mach-shmobile: Don't configure ARCH timer if PSCI is enabled Oleksandr Tyshchenko
2019-04-18 7:14 ` Biju Das
2019-04-18 10:35 ` Oleksandr
2019-04-18 9:32 ` Julien Grall
2019-04-18 11:15 ` Oleksandr
2019-04-24 12:31 ` Julien Grall
2019-04-26 19:51 ` Oleksandr [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=e8798fa4-a0dc-7c85-e294-bdf6dad6ec74@gmail.com \
--to=olekstysh@gmail.com \
--cc=horms@verge.net.au \
--cc=julien.grall@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=magnus.damm@gmail.com \
--cc=oleksandr_tyshchenko@epam.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