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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4B1AC4332F for ; Fri, 18 Nov 2022 14:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=O7i03up599zQYRSU6vEzAEe13P1n1bo39kbdc20dUuk=; b=pXdaSEf5k3XZQd YhXC/UQ1qWTMOBMHZflRuAJOJAMog2XP7iM1YaTr5ey6WjNZXJfhZlAbdDXah6G0J9b00KUhg15jr ffBI7/gg9Cr85LyjB/VKiN+qgJbfczUIu/RJvGTAw4M/0SttkyuKALhHTAjeF+hDymhVVWr9iDpAy fLGrg7mgJlCHc9KtkRIC5i+lTq/WHZ60ZH3jUUdSU8TtZZ/tkyTg4VT9Trn2+PXcVxgNtPAgBcyCr U8drnelUB5qmaeZZjHYe8vCCBEHghsXaNnW1sV195PhM7+sj/uI46nG4q+tswgB5jszVPfDU3FJzk 2py9UV7FZk/KL2EUs9IQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow2p1-004hHM-DK; Fri, 18 Nov 2022 14:58:28 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow2nP-004gPl-EX for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 14:56:49 +0000 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 0785AB8243B; Fri, 18 Nov 2022 14:56:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49A0CC433C1; Fri, 18 Nov 2022 14:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668783404; bh=kQqNwIRTX/hMdAUkbPpnbCbz6J1Qz8mIuBGg79EWriQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YAcGcNO717vxcqR6gw7hPCPkskQj2wFxDzeuW9mROwlkdTfHvsj313IATnooRiuH7 tggG//xkOzUdbhHJi9RH5nUHr7JyjuEL8To04GZkGxQ+NqDdJYuK0xU8yvqQm2SnY5 Gv9xoQAQQwMXscRow5tS3mEG0waNLDXKKDfLUaCfkyCYxD/MDglLWUCFLE8+3Dp8iv 0mSr5zAFkl6F8Wv3JRf0R4kjtOsD7JHBNfgBGcKygeKngjWkZ4TPuc+YarzIdVBPqn 55sMg9/gLjLP2+8k17o7zmujzTy38yupQVAQHhdgtLRalXIq0dYP63UmSdSl8lUPu9 OZ4b8PrPzo3Mg== Date: Fri, 18 Nov 2022 14:56:38 +0000 From: Will Deacon To: Oliver Upton Cc: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Paolo Bonzini , Raghavendra Rao Ananta , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [RFC PATCH 2/3] KVM: arm64: Allow userspace to trap SMCCC sub-ranges Message-ID: <20221118145637.GC4624@willie-the-truck> References: <20221110015327.3389351-1-oliver.upton@linux.dev> <20221110015327.3389351-3-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221110015327.3389351-3-oliver.upton@linux.dev> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221118_065647_685057_608E407F X-CRM114-Status: GOOD ( 21.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hey Oliver, On Thu, Nov 10, 2022 at 01:53:26AM +0000, Oliver Upton wrote: > As the SMCCC (and related specifications) march towards an > 'everything and the kitchen sink' interface for interacting with a > system, it is less likely that KVM will implement every supported > feature. > > Add a capability that allows userspace to trap hypercall ranges, > allowing the VMM to mix-and-match between calls handled in userspace vs. > KVM. > > Signed-off-by: Oliver Upton > --- > arch/arm64/include/asm/kvm_host.h | 5 ++++ > arch/arm64/include/uapi/asm/kvm.h | 15 ++++++++++ > arch/arm64/kvm/arm.c | 10 +++++++ > arch/arm64/kvm/hypercalls.c | 48 +++++++++++++++++++++++++++++++ > include/uapi/linux/kvm.h | 1 + > 5 files changed, 79 insertions(+) [...] > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index 6f0b56e7f8c7..6e8a222fc295 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -100,6 +100,13 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, > r = 0; > set_bit(KVM_ARCH_FLAG_SYSTEM_SUSPEND_ENABLED, &kvm->arch.flags); > break; > + case KVM_CAP_ARM_USER_HYPERCALLS: > + if (cap->args[0] & ~KVM_ARM_USER_HYPERCALL_FLAGS) > + return -EINVAL; Why not use KVM_CAP_EXIT_HYPERCALL for this? At some point during pKVM development, we used that to notify the VMM about memory being shared back from the guest but we eventually dropped it as the notification to userspace ended up not being needed: https://android-kvm.googlesource.com/linux/+/dbd2861832dfc4c8a3103214b3c212ee7ace1c44%5E%21/ https://android-kvm.googlesource.com/linux/+/2a3afc6da99c0e0cb62be1687153ee572903aa80%5E%21/ I'm not saying that what we did was necessarily better, but it seems a bit simpler and I figured it might be useful to point you to it. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel