public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Marc Zyngier <maz@kernel.org>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Sean Christopherson <seanjc@google.com>,
	Salil Mehta <salil.mehta@huawei.com>
Subject: Re: [PATCH v2 06/13] KVM: arm64: Refactor hvc filtering to support different actions
Date: Fri, 31 Mar 2023 17:58:25 +0000	[thread overview]
Message-ID: <ZCcfQXj+Hs6ccla2@linux.dev> (raw)
In-Reply-To: <867cuwx38h.wl-maz@kernel.org>

On Fri, Mar 31, 2023 at 06:03:26PM +0100, Marc Zyngier wrote:
> On Thu, 30 Mar 2023 16:49:11 +0100,
> Oliver Upton <oliver.upton@linux.dev> wrote:
> > 
> > KVM presently allows userspace to filter guest hypercalls with bitmaps
> > expressed via pseudo-firmware registers. These bitmaps have a narrow
> > scope and, of course, can only allow/deny a particular call. A
> > subsequent change to KVM will introduce a generalized UAPI for filtering
> > hypercalls, allowing functions to be forwarded to userspace.
> > 
> > Refactor the existing hypercall filtering logic to make room for more
> > than two actions. While at it, generalize the function names around
> > SMCCC as it is the basis for the upcoming UAPI.
> > 
> > No functional change intended.
> > 
> > Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> > Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> > ---
> >  arch/arm64/include/uapi/asm/kvm.h |  9 +++++++++
> >  arch/arm64/kvm/hypercalls.c       | 19 +++++++++++++++----
> >  2 files changed, 24 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
> > index f8129c624b07..bbab92402510 100644
> > --- a/arch/arm64/include/uapi/asm/kvm.h
> > +++ b/arch/arm64/include/uapi/asm/kvm.h
> > @@ -469,6 +469,15 @@ enum {
> >  /* run->fail_entry.hardware_entry_failure_reason codes. */
> >  #define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED	(1ULL << 0)
> >  
> > +enum kvm_smccc_filter_action {
> > +	KVM_SMCCC_FILTER_ALLOW = 0,
> > +	KVM_SMCCC_FILTER_DENY,
> > +
> > +#ifdef __KERNEL__
> > +	NR_SMCCC_FILTER_ACTIONS
> > +#endif
> > +};
> > +
> 
> One thing I find myself wondering is what "ALLOW" mean here: Allow the
> handling of the hypercall? Or allow its forwarding? My guess is that
> this is the former, but I'd love a comment to clarify it, or even a
> clearer name ("HANDLE" instead of "ALLOW", for example, but YMMV...).

Yeah, I prefer calling it HANDLE as you suggest.

-- 
Thanks,
Oliver

  reply	other threads:[~2023-03-31 17:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 15:49 [PATCH v2 00/13] KVM: arm64: Userspace SMCCC call filtering Oliver Upton
2023-03-30 15:49 ` [PATCH v2 01/13] KVM: x86: Redefine 'longmode' as a flag for KVM_EXIT_HYPERCALL Oliver Upton
2023-03-30 17:32   ` Sean Christopherson
2023-03-30 15:49 ` [PATCH v2 02/13] KVM: arm64: Add a helper to check if a VM has ran once Oliver Upton
2023-03-30 15:49 ` [PATCH v2 03/13] KVM: arm64: Add vm fd device attribute accessors Oliver Upton
2023-03-30 15:49 ` [PATCH v2 04/13] KVM: arm64: Rename SMC/HVC call handler to reflect reality Oliver Upton
2023-03-30 15:49 ` [PATCH v2 05/13] KVM: arm64: Start handling SMCs from EL1 Oliver Upton
2023-03-30 15:49 ` [PATCH v2 06/13] KVM: arm64: Refactor hvc filtering to support different actions Oliver Upton
2023-03-31 17:03   ` Marc Zyngier
2023-03-31 17:58     ` Oliver Upton [this message]
2023-03-30 15:49 ` [PATCH v2 07/13] KVM: arm64: Use a maple tree to represent the SMCCC filter Oliver Upton
2023-03-30 15:49 ` [PATCH v2 08/13] KVM: arm64: Add support for KVM_EXIT_HYPERCALL Oliver Upton
2023-03-31 17:10   ` Marc Zyngier
2023-03-31 18:00     ` Oliver Upton
2023-03-30 15:49 ` [PATCH v2 09/13] KVM: arm64: Indroduce support for userspace SMCCC filtering Oliver Upton
2023-03-31 19:13   ` Marc Zyngier
2023-04-03 16:28     ` Oliver Upton
2023-03-30 15:49 ` [PATCH v2 10/13] KVM: arm64: Return NOT_SUPPORTED to guest for unknown PSCI version Oliver Upton
2023-03-30 15:49 ` [PATCH v2 11/13] KVM: arm64: Let errors from SMCCC emulation to reach userspace Oliver Upton
2023-03-30 15:49 ` [PATCH v2 12/13] KVM: selftests: Add a helper for SMCCC calls with SMC instruction Oliver Upton
2023-03-30 15:49 ` [PATCH v2 13/13] KVM: selftests: Add test for SMCCC filter Oliver Upton

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=ZCcfQXj+Hs6ccla2@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=james.morse@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=salil.mehta@huawei.com \
    --cc=seanjc@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=yuzenghui@huawei.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