From: Jean-Christophe DUBOIS <jcd@tribudubois.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm <qemu-arm@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: Qemu and ARM secure state.
Date: Mon, 8 Nov 2021 23:09:49 +0100 [thread overview]
Message-ID: <ec74f093-9508-c0fc-3e06-2e8abf8655c6@tribudubois.net> (raw)
In-Reply-To: <CAFEAcA-DnbocsRHC3cUM_uX=kGn-KJa3q42TCyaB=isxKTS-Sg@mail.gmail.com>
Le 08/11/2021 à 15:50, Peter Maydell a écrit :
> On Sat, 6 Nov 2021 at 18:11, Jean-Christophe DUBOIS <jcd@tribudubois.net> wrote:
>> One small question/remark:
>>
>> According to the the "Arm Power State Coordinate Interface" (DEN0022D.b) document (chapter 5) PSCI calls can only be issued by "normal world" (EL1 or EL2). Therefore, should we be adding a test for the current secure state in the arm_is_psci_call() function? This would prevent calling the built-in Qemu PSCI function if SMC is issued from secure state.
> This shouldn't matter, because if the machine model is configured
> to execute guest code in EL3 at all then it should not be enabling
> QEMU's internal PSCI support. The internal PSCI stuff is only
> there as a kind of "emulated firmware" for when we're running
> guest code that starts at EL2 (notably, when directly booting
> a Linux kernel).
>
> The problem seems to be that fsl_imx6ul_realize() and
> fsl_imx7_realize() unconditionally enable PSCI-via-SMC.
> The imx7 code also puts all the secondaries into
> PSCI-powered-off mode -- this should be checked to
> work out what the right thing is if we're not doing
> emulated PSCI and instead starting the guest at EL3.
OK, so one problem seems to be that PSCI-via-SMC is enabled on i.MX6UL
when there is no built in PSCI related function on this processor.
According the Linux DTS, i.MX7 (solo and dual) processors have a
somewhat PSCI related "entry-method"
(https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/imx7s.dtsi).
But it is not clear to me how this is used and this seems a bit strange
as "entry-method" seems to be mostly used on arm64 and there is no other
PSCI related information in the i.MX7 DTS files. As a matter of fact
previous quad or dual i.MX6 were not supporting PSCI. Instead they were
using a proprietary method through the internal SRC device (and i.MX7
also has a similar internal SRC device). But let's assume Linux on i.mx7
is actually using PSCI to handle processors.
Thinking about it, I guess this might be u-boot that sets an EL3 monitor
software that is able to handle PSCI requests for the Linux kernel. If
this is the case, it make sense that Qemu emulates the PSCI services
normally provided by u-boot to be able to boot linux directly (without
booting a real u-boot prior to linux). All is well and nice.
But then if I want to boot and test the u-boot binary (or any trusted OS
for the matter) on a Qemu emulated i.MX7 (to later boot an hypervisor or
an OS), it would be rather strange that any PSCI related service
requested by the hypervisor/OS would be handled by Qemu directly and
not by the u-boot code (or any other EL3 code) running on the processor.
How is it supposed to work? How can I tell Qemu (dynamically?) if I want
it to provide (or not) the PSCI services (and more generally SMC/HVC
services). How can I tell it that I want to handle all SMC/EL3 services
by myself even if the "psci-conduit" is already set to SMC in Qemu?
Am I missing something?
thanks.
JC
>
> -- PMM
>
next prev parent reply other threads:[~2021-11-08 22:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <07e63acb-b756-2586-2ba2-b54b837f7fc8@tribudubois.net>
2021-11-04 11:11 ` Qemu and ARM secure state Peter Maydell
2021-11-04 21:11 ` Jean-Christophe DUBOIS
2021-11-06 10:04 ` Jean-Christophe DUBOIS
2021-11-06 13:04 ` Jean-Christophe DUBOIS
2021-11-06 18:11 ` Jean-Christophe DUBOIS
2021-11-08 14:14 ` Alex Bennée
2021-11-08 22:06 ` Jean-Christophe DUBOIS
2021-11-08 14:50 ` Peter Maydell
2021-11-08 22:09 ` Jean-Christophe DUBOIS [this message]
2021-11-09 10:55 ` Peter Maydell
2021-11-09 19:06 ` Jean-Christophe DUBOIS
2021-11-09 19:20 ` 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=ec74f093-9508-c0fc-3e06-2e8abf8655c6@tribudubois.net \
--to=jcd@tribudubois.net \
--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 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).