From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67FDE3BCD10 for ; Thu, 11 Jun 2026 09:30:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781170233; cv=none; b=BoDn3RH+kufpUM1QA4t5b6ZTgrUT/3m56gRSRuo4gafz07BDHxMyq90PDCIdVBneN5EnA4GIV/wBNbu4Ghl6yb/aIVpP7E1F1GtdvEJh4sQCU6Qn4Bj25h2e7ciMH+jlO1L0fNYcn9pHYFAV1HYGeyPB/vQDZQVVoc34gZ1oSN0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781170233; c=relaxed/simple; bh=s7hBwMel7oALQbJ2W7oVVV7MTzlWhMwBYW3yS6EwLvk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Tms38p521ZURc+Xauy0w7qxTOVR1fzciYscGVznoZrBMMwW0ntzGzLEGJJN1dcTywOvVdumVPveYP33W4h2kUUn70A2JyO37LE0p7rDqv3JxbQVcQY9OPkyH0rMp2Fzryq53DS4LSqXj+Ph0t6D+yaRw5UymHmO/5So9wA3OG8g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=BGZ4oBP2; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BGZ4oBP2" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-68bd7ec2371so7439a12.1 for ; Thu, 11 Jun 2026 02:30:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781170227; x=1781775027; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=n/Oe3DW38b9AqfeR+BNHeTcKWnxDeKkYt2PnJ5PXJTI=; b=BGZ4oBP2pWGdWrE6CsSVOliA00VbLaPTInHx9HbuyMluoDZoZsRSA4zBtyBW+zZG1l pbC/Y4bCo74BzcXGyiF9FGyjBrNTPO77x05+pWa3XzyK04P9YDHaeEzuzp0Ikr3MEaHr P7EBGZjNbrP5e6dMhtuceuWFdBekxcpf+o4mC+/NBpcXXzpZfybFQ+c0IQPo1m1qnCJ5 kwTyX/r177XSVMNGCtksXG45vBHA6iYMnB9Mj6DJ5hy4nKaaPnnLY/6DczELc1qrSoqw N8WfwfQRjTUDhgJEL64ABCUiP+6Oml0Y84P1yh1lyaSY3o/6mw1hqLvXCkHYkEHuoHf2 vi2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781170227; x=1781775027; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n/Oe3DW38b9AqfeR+BNHeTcKWnxDeKkYt2PnJ5PXJTI=; b=VVRdTu4qgMkfGKYacQDLAbybHwXMGH65FSxyGAQcmt1DvkE+2KE0RcezdF1PRwuVCf raK3m+guKWTGmjb7aT5YZZj7RLCCI9drWGhCvzhSrMuWizaefLVM+/tE+1klFLNK/t3p R9aM6TFWZYLMp73nsr6mcRDyFmD/5H/3sVJ6jLkDIDAH3NTf2z57pFZ8WxkfBAlw0NHs g0CMHp2wbtC0rXsr1rHU2sPjr9+jsRozxG87Jlzvu1fOve1VCalBruP947i4nKooIwyO qZo25qK0Ob4vuj8mtqQeXvWgz/YqduuFTcpWDI0DpQ3fa8Mi+p2FaEwC692GPEfaAlW5 lh5w== X-Forwarded-Encrypted: i=1; AFNElJ9A5PISv43srXg7k80svfJWtr3dYfnjguAJ/68IKLCl3HIvys62CAcqsyNLeRPHSWrn0Jn6aEJdqza7zb8=@vger.kernel.org X-Gm-Message-State: AOJu0Yzfq25P7jVI6FJ3kSF8Xc+WJyvlGRnP2aMyY6N8wScBZDUTsd5L gI8ntJxoGIB389Q+Cdj9bQoR2g332USk55f0o15MAVN/W7MInGBUMNWlZsyihH5iWg== X-Gm-Gg: Acq92OFNGkPtyANCfmfDpqSJahWokdD3fCVfnjWuJd63q0jZAv+PnLlPI60aZrE3DXe 6BzO88lOKcqoyQJpFlhaetIQCZ3xfwB2AD8rBiZNOOMdFhfw1gk7Qk5HK8EC035FjKYMZhweM5J iwDvKdrFSZNX0VzA9Kt6Vpr5hVvdI04XcyBEvmw4axB/g+yw26oeojVYQ0/cvdX2MKAEvn59R+n KJ5WTjVNaUakyKn5Z1kLUgW1oV/PdTZMWtG1YHfJlOfGixBMI/DD/vUJIrra7ykURoz8ZQO0U0D ounQANvRzMryN91BFQpDPc7cWVCktlMEYSvM1Y+h3IXeK9d69TkmhGfjQyJbTrKLPWHh25G4n/I gPWIVTzKykoW00GFMVxdkJgO2Tjf5KdVG5+snlxLejNmeMIEE8ll3+prnYFsA+OlfAIJ+xZ/UQn F9sGole4aUXcNiR2kQQRv956dWrHSZLLmN9oboc93Ht7DEsPYHRoCkQ1+1s+2zgnotJNUo5SbCN e7R9OYT X-Received: by 2002:aa7:ca54:0:b0:693:17e4:c6b0 with SMTP id 4fb4d7f45d1cf-69317e4c895mr18477a12.9.1781170227170; Thu, 11 Jun 2026 02:30:27 -0700 (PDT) Received: from google.com (143.11.148.146.bc.googleusercontent.com. [146.148.11.143]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-68e64c2f34asm11046002a12.4.2026.06.11.02.30.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 02:30:25 -0700 (PDT) Date: Thu, 11 Jun 2026 09:30:21 +0000 From: Sebastian Ene To: Vincent Donnefort Cc: catalin.marinas@arm.com, maz@kernel.org, oupton@kernel.org, will@kernel.org, joey.gouly@arm.com, korneld@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, android-kvm@google.com, mrigendra.chaubey@gmail.com, perlarsen@google.com, suzuki.poulose@arm.com, yuzenghui@huawei.com Subject: Re: [PATCH v2 3/7] KVM: arm64: Support FFA_NOTIFICATION_BIND in host handler Message-ID: References: <20260608165549.1479409-1-sebastianene@google.com> <20260608165549.1479409-4-sebastianene@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Jun 10, 2026 at 10:03:43AM +0100, Vincent Donnefort wrote: > On Mon, Jun 08, 2026 at 04:55:45PM +0000, Sebastian Ene wrote: > > Verify the arguments of the FF-A notification bind call and forward the > > message to Trustzone. > > > > Signed-off-by: Sebastian Ene > > --- > > arch/arm64/kvm/hyp/nvhe/ffa.c | 32 +++++++++++++++++++++++++++++++- > > 1 file changed, 31 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c > > index 91e89d889c44..eedb01955a45 100644 > > --- a/arch/arm64/kvm/hyp/nvhe/ffa.c > > +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c > > @@ -42,6 +42,8 @@ > > */ > > #define HOST_FFA_ID 0 > > > > +#define FFA_NOTIF_SENDER_ENDP_MASK GENMASK(31, 16) > > Could we move the MASK definitions form arm_ffa to include/linux/arm_ffa.h? > I wanted to keep it here since it is not used anywhere else other than this file. > > + > > /* > > * A buffer to hold the maximum descriptor size we can see from the host, > > * which is required when the SPMD returns a fragmented FFA_MEM_RETRIEVE_RESP > > @@ -688,7 +690,6 @@ static bool ffa_call_supported(u64 func_id) > > case FFA_MEM_DONATE: > > case FFA_MEM_RETRIEVE_REQ: > > /* Optional notification interfaces added in FF-A 1.1 */ > > - case FFA_NOTIFICATION_BIND: > > case FFA_NOTIFICATION_UNBIND: > > case FFA_NOTIFICATION_SET: > > case FFA_NOTIFICATION_GET: > > @@ -912,6 +913,32 @@ static void do_ffa_notif_bitmap_destroy(struct arm_smccc_1_2_regs *res, > > arm_smccc_1_2_smc(args, res); > > } > > > > +static void do_ffa_notif_bind(struct arm_smccc_1_2_regs *res, > > + struct kvm_cpu_context *ctxt) > > +{ > > + DECLARE_REG(u32, endp_id, ctxt, 1); > > + DECLARE_REG(u32, flags, ctxt, 2); > > + struct arm_smccc_1_2_regs *args; > > + > > + if (ffa_check_unused_args_sbz(ctxt, 5)) { > > + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); > > + return; > > + } > > + > > + if (FIELD_GET(FFA_NOTIF_SENDER_ENDP_MASK, endp_id) != HOST_FFA_ID) { > > + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); > > + return; > > + } > > + > > + if (flags & GENMASK(31, 1)) { > > + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); > > + return; > > + } > > if (flags > 1) ? > sure, I can replace it with this. > > + > > + args = (void *)&ctxt->regs.regs[0]; > > + arm_smccc_1_2_smc(args, res); > > And of course just like all the other functions, it should use > the hyp_ prefix. > Added this. > > +} > > + > > bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id) > > { > > struct arm_smccc_1_2_regs res; > > @@ -976,6 +1003,9 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id) > > case FFA_NOTIFICATION_BITMAP_DESTROY: > > do_ffa_notif_bitmap_destroy(&res, host_ctxt); > > goto out_handled; > > + case FFA_NOTIFICATION_BIND: > > + do_ffa_notif_bind(&res, host_ctxt); > > + goto out_handled; > > } > > > > if (ffa_call_supported(func_id)) > > -- > > 2.54.0.1064.gd145956f57-goog > > Thanks, Sebastian