From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59357C76196 for ; Fri, 31 Mar 2023 17:03:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231944AbjCaRDe (ORCPT ); Fri, 31 Mar 2023 13:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbjCaRDd (ORCPT ); Fri, 31 Mar 2023 13:03:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F40FEEB54 for ; Fri, 31 Mar 2023 10:03:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ACBA0B82EB0 for ; Fri, 31 Mar 2023 17:03:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DF1BC433EF; Fri, 31 Mar 2023 17:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680282209; bh=lUSdi6Mkn5Fjo7SaUXasgSepXMbWv83Qgd5TpuVsw04=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=c/BUzODlJN6ZT3GyaaQatryxltLJkoLtgfKuBFOMxdw9fB3ovI8R1gpseeG0c1tap L/tvCAz+l33sGdpSBO2axd4B+FRaWTL5XRpm5JvEhLXaI7Zaw9JAkaW+M4l3oPkwBw jtDXCcJaNIq3qRM8gnBJ9SAS0PksSuFPfGBGRLuXAkkI+loMFTpYm5kObSWwKjqgox uJVjaeHc3GJxpUMSXKQyjkrctrnwelX+eG+4Si1+SJnPAqEzmSX0TjoSqUpbWgr2XN C3F5ENmeqoSVIB6gCA7ISMduNO/etIuaR+JmoHp/d/DFtIxqrzx6EaYG7InGgTzBq0 EC5oA5L5tog+Q== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1piI9v-004mCD-1P; Fri, 31 Mar 2023 18:03:27 +0100 Date: Fri, 31 Mar 2023 18:03:26 +0100 Message-ID: <867cuwx38h.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, Paolo Bonzini , James Morse , Suzuki K Poulose , Zenghui Yu , Sean Christopherson , Salil Mehta Subject: Re: [PATCH v2 06/13] KVM: arm64: Refactor hvc filtering to support different actions In-Reply-To: <20230330154918.4014761-7-oliver.upton@linux.dev> References: <20230330154918.4014761-1-oliver.upton@linux.dev> <20230330154918.4014761-7-oliver.upton@linux.dev> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, kvmarm@lists.linux.dev, kvm@vger.kernel.org, pbonzini@redhat.com, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, seanjc@google.com, salil.mehta@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, 30 Mar 2023 16:49:11 +0100, Oliver Upton 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 > Signed-off-by: Oliver Upton > --- > 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...). Thanks, M. -- Without deviation from the norm, progress is not possible.