[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YPhdehJ2m/EEGkdT@myrica>
Date: Wed, 21 Jul 2021 19:46:34 +0200
From: Jean-Philippe Brucker <jean-philippe@...aro.org>
To: Oliver Upton <oupton@...gle.com>
Cc: Alexandru Elisei <Alexandru.Elisei@....com>,
salil.mehta@...wei.com, lorenzo.pieralisi@....com,
kvm@...r.kernel.org, corbet@....net, maz@...nel.org,
linux-kernel@...r.kernel.org, jonathan.cameron@...wei.com,
catalin.marinas@....com, pbonzini@...hat.com, will@...nel.org,
kvmarm@...ts.cs.columbia.edu, linux-arm-kernel@...ts.infradead.org
Subject: Re: [RFC PATCH 0/5] KVM: arm64: Pass PSCI to userspace
On Mon, Jul 19, 2021 at 12:37:52PM -0700, Oliver Upton wrote:
> On Mon, Jul 19, 2021 at 11:02 AM Jean-Philippe Brucker
> <jean-philippe@...aro.org> wrote:
> > We forward the whole PSCI function range, so it's either KVM or userspace.
> > If KVM manages PSCI and the guest calls an unimplemented function, that
> > returns directly to the guest without going to userspace.
> >
> > The concern is valid for any other range, though. If userspace enables the
> > HVC cap it receives function calls that at some point KVM might need to
> > handle itself. So we need some negotiation between user and KVM about the
> > specific HVC ranges that userspace can and will handle.
>
> Are we going to use KVM_CAPs for every interesting HVC range that
> userspace may want to trap? I wonder if a more generic interface for
> hypercall filtering would have merit to handle the aforementioned
> cases, and whatever else a VMM will want to intercept down the line.
>
> For example, x86 has the concept of 'MSR filtering', wherein userspace
> can specify a set of registers that it wants to intercept. Doing
> something similar for HVCs would avoid the need for a kernel change
> each time a VMM wishes to intercept a new hypercall.
Yes we could introduce a VM device group for this:
* User reads attribute KVM_ARM_VM_HVC_NR_SLOTS, which defines the number
of available HVC ranges.
* User writes attribute KVM_ARM_VM_HVC_SET_RANGE with one range
struct kvm_arm_hvc_range {
__u32 slot;
#define KVM_ARM_HVC_USER (1 << 0) /* Enable range. 0 disables it */
__u16 flags;
__u16 imm;
__u32 fn_start;
__u32 fn_end;
};
* KVM forwards any HVC within this range to userspace.
* If one of the ranges is PSCI functions, disable KVM PSCI.
Since it's more work for KVM to keep track of ranges, I didn't include it
in the RFC, and I'm going to leave it to the next person dealing with this
stuff :)
Thanks,
Jean
Powered by blists - more mailing lists