From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 1/5] ARM/ARM64: KVM: Update user space API header for PSCI emulation
Date: Thu, 17 Oct 2013 09:47:27 +0100 [thread overview]
Message-ID: <525FA41F.1050204@arm.com> (raw)
In-Reply-To: <CAAhSdy2jgz24HEH1_CGCEYSGoBuy-4bA-ACYxLEWwCD33a9_XQ@mail.gmail.com>
On 17/10/13 07:45, Anup Patel wrote:
> On Thu, Oct 17, 2013 at 3:41 AM, Christoffer Dall
> <christoffer.dall@linaro.org> wrote:
>> On Wed, Oct 16, 2013 at 10:32:30PM +0530, Anup Patel wrote:
>>> Update user space API interface headers for providing information to
>>> user space needed to emulate PSCI function calls in user space (i.e.
>>> QEMU or KVMTOOL).
>>>
>>> Signed-off-by: Anup Patel <anup.patel@linaro.org>
>>> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
>>> ---
>>> include/uapi/linux/kvm.h | 7 +++++++
>>> 1 file changed, 7 insertions(+)
>>>
>>> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
>>> index e32e776..dae2664 100644
>>> --- a/include/uapi/linux/kvm.h
>>> +++ b/include/uapi/linux/kvm.h
>>> @@ -171,6 +171,7 @@ struct kvm_pit_config {
>>> #define KVM_EXIT_WATCHDOG 21
>>> #define KVM_EXIT_S390_TSCH 22
>>> #define KVM_EXIT_EPR 23
>>> +#define KVM_EXIT_PSCI 24
>>>
>>> /* For KVM_EXIT_INTERNAL_ERROR */
>>> /* Emulate instruction failed. */
>>> @@ -301,6 +302,12 @@ struct kvm_run {
>>> struct {
>>> __u32 epr;
>>> } epr;
>>> + /* KVM_EXIT_PSCI */
>>> + struct {
>>> + __u32 fn;
>>> + __u64 args[7];
>>> + __u64 ret[4];
>>> + } psci;
>>> /* Fix the size of the union. */
>>> char padding[256];
>>> };
>>> --
>>> 1.7.9.5
>>>
>> I am also wondering if this is not solving a very specific need without
>> thinking a little more carefully about this problem.
>
> No, its not solving a specific problem.
>
> In fact, its more general because we pass complete info required to
> emulate a PSCI call in user space.
> (Please refer PSCI calling convention)
>
>>
>> We have previously discussed the need for some secure side emulation
>> in QEMU, and I think perhaps we need something more generic which allows
>> user space to handle SMC calls and/or allows user space to "inject" some
>> secure world runtime that the kernel can run in a partially or fully
>> isolated container to handle SMC calls.
>>
>> Peter raised this issue previously and pointed to a proposal he had as
>> well.
>
> If required we can have an additional field in kvm_run->psci which tells
> whether the PSCI call is an SMC call or HVC call.
>
>>
>> Is there a technical reason why we need something specifically directed
>> to PSCI?
>
> Its quite natural to add this to PSCI emulation in KVM ARM/ARM64 instead
> of adding a separate VirtIO device for System reboot and System poweroff.
>
> Also in the process of implementing SYSTEM_OFF and SYSTEM_RESET
> emulation in user space we would also have an infrastructure for adding
> emulation of new PSCI calls in user space.
And I strongly oppose to that. It creates consistency issues (what if
userspace implements one version of PSCI, and the kernel another?), and
also some really horrible situations: Imagine you implement the SUSPEND
operation in userspace, and want to wake the vcpu up with an interrupt.
You'd end-up having to keep track of the state in the kernel, having to
forward the interrupt event to userspace...
So really, no.
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2013-10-17 8:47 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 17:02 [RFC PATCH 0/5] PSCI system off and reset for KVM ARM/ARM64 Anup Patel
2013-10-16 17:02 ` [RFC PATCH 1/5] ARM/ARM64: KVM: Update user space API header for PSCI emulation Anup Patel
2013-10-16 20:30 ` Christoffer Dall
2013-10-17 6:25 ` Anup Patel
2013-10-16 22:11 ` Christoffer Dall
2013-10-17 6:45 ` Anup Patel
2013-10-17 8:47 ` Marc Zyngier [this message]
2013-10-17 11:10 ` Anup Patel
2013-10-17 11:21 ` Marc Zyngier
2013-10-17 11:30 ` Anup Patel
2013-10-17 11:49 ` Alexander Graf
2013-10-17 11:55 ` Marc Zyngier
2013-10-17 12:01 ` Alexander Graf
2013-10-17 19:04 ` Christoffer Dall
2013-10-17 22:06 ` Alexander Graf
2013-10-17 22:24 ` Christoffer Dall
2013-10-17 22:26 ` Alexander Graf
2013-10-18 3:34 ` Christoffer Dall
2013-10-17 15:32 ` Anup Patel
2013-10-17 11:52 ` Marc Zyngier
2013-10-16 17:02 ` [RFC PATCH 2/5] ARM/ARM64: KVM: Forward PSCI SYSTEM_OFF and SYSTEM_RESET to user space Anup Patel
2013-10-16 22:22 ` Christoffer Dall
2013-10-17 5:52 ` Anup Patel
2013-10-17 8:37 ` Marc Zyngier
2013-10-17 9:10 ` Peter Maydell
2013-10-17 9:21 ` Marc Zyngier
2013-10-17 9:31 ` Peter Maydell
2013-10-17 18:34 ` Christoffer Dall
2013-10-18 4:18 ` Anup Patel
2013-10-17 11:07 ` Anup Patel
2013-10-17 11:13 ` Marc Zyngier
2013-10-17 11:13 ` Anup Patel
2013-10-17 18:29 ` Christoffer Dall
2013-10-16 17:02 ` [RFC PATCH 3/5] KVM: Add documentation for KVM_EXIT_PSCI exit reason Anup Patel
2013-10-16 17:02 ` [RFC PATCH 4/5] ARM: psci: Add support for system reboot and poweroff Anup Patel
2013-10-16 22:17 ` Rob Herring
2013-10-17 5:08 ` Anup Patel
2013-10-17 9:50 ` Marc Zyngier
2013-10-16 17:02 ` [RFC PATCH 5/5] ARM64: " Anup Patel
2013-10-16 17:08 ` [RFC PATCH 0/5] PSCI system off and reset for KVM ARM/ARM64 Anup Patel
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=525FA41F.1050204@arm.com \
--to=marc.zyngier@arm.com \
--cc=linux-arm-kernel@lists.infradead.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).