From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 23BB93B5318 for ; Wed, 10 Jun 2026 09:03:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781082231; cv=none; b=qM62/32SdTcx0IbVwlRdqVJqyZZdeYB0t03vO0Fu05l8FySOnfs9v83twvcMPcbSm8PP/ucM/XYdxrFm09qyFdo57TYQ/PzvTjPXqpJZCV64/HyOo7T6SYgrNIO/0jzyEAfJ5Vf4KIFOHpPO/w8lApZTjVqG7C4eId/5ZwMNBIk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781082231; c=relaxed/simple; bh=ayMvJgQMsXguQp3a0NEL3PtdJpMC+4QnOu019qlEDkE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hHI7q9A5xXJqGFF9y1wjGX8kCg5Ytd35+nMPOZGxzypRXgvN3vftj0R192U4w/o5fJSbEVtc9LoHXUZL643+i7HfkUH/Z5WrROwR/A2YHJLPskLuzE+XYMpw1dDWfvpHDMbEn/hyqTvpAotgvMY6a+l0mcuHsQdRkstouD6SmhY= 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=Ln+S19Cr; arc=none smtp.client-ip=209.85.128.47 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="Ln+S19Cr" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4908b92904fso74814455e9.0 for ; Wed, 10 Jun 2026 02:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781082228; x=1781687028; 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=fzwKzXJwppFYu28O2GOVJSLTLDQbIld8hQ+mf0ErcfI=; b=Ln+S19Cr9L8qSVjJBGY84sbwyLY1xZAzCMkMLB6C+eAHWWMMFsLMxZ/qUsagUo0Vbd pwOnL1ijUFrVNOtynFeaneaHKKTS5LmoRHaY8W1vJWiQHwDjJI7l0mgng/4fpo6Dyott LpTkQ+BrEyqFKE1ajrqVph2r1WfBVX0qKlUetiO/i2AnfAkS8OvSe3JEWcdp3jqAIyBP fm5zU13MCenaW16BES4rhVdL7HYupNCOGuIPjiEl5Id3zmjXXGd+ObacVpG+M6LA47ep wJKprDSAWHF9L3CvxXF0R+Msh5n8GKW78n/CoLltnmJP2EwVMtLukdv0NtSztUZY9X3l EV/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781082228; x=1781687028; 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=fzwKzXJwppFYu28O2GOVJSLTLDQbIld8hQ+mf0ErcfI=; b=GdQWCnRNHQQEvB2MdCC4iyz/ziFnnp52K+G5kdkgqml9Y8IXorImGQvITjBEmWQ4jn GKbwAq3HocTpbHpUqtgJodAN4O5xzvvgGXQsizXiaqaJimh+6Bxcz163NJCGcPy3kwk0 xbAHwK28MjKeWQnp5mHJpgXdohEOVUAvIDKcAPg96GGVJo0FWmSO7Tn7/0qWMLXTZIU8 Ci7lDNOsfJhtes+O+xgfejdqk4YeTOfWYvoqQr6+sKF2YtzIce2GBz5Fj2GK5vZjXWZp LlIQbygTnhZT9LWsrPyr0ZpHqEHi3BAuHD1HHXf98DLa/4qAYI5cMkwBsTrurjoKEAHP Dplw== X-Forwarded-Encrypted: i=1; AFNElJ/k0Qp0CL2cTRxb5ubonndsU9LlZGSKlvW2Kr0UH+teWFp20JUeL50QQ9mqy0tDs6uFwzIU++D183JRceQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxzFeDYi+umTBMhhke/mkTZ35iW3/5hBpDSPOSUStNcGpCiR9oz IpzLMFvIkOh4//HXgBQUm2lLlb73E9LXB3aioBCvJy9hO7s5k0avfQc9NiMaudaBFg== X-Gm-Gg: Acq92OFiF4JBp6C4EsFUzSo49mTMyNSPoLW7kj/ZEvypvKVeUrwo9F7I02yNrNszoiu gjxq3GLnmiFo+TzpmHnI9PinTijpnlR5smwzqN0w7/N4KM37yNxIr1i/r+vVNpNfPYjAhhIIbcD iV9i7PsVNdn6CxvroIukdlPe8JRBHFN6+M6pZ8dyugqWnBiN1H+u2iCDo6oelAS1NxbA6yaOeft +jMbYacp4w5J9ZhdDFdLHWoD19ci+DtdgENU73jpt22cLtwEv2Kwkf8Sy/+r5KOGXqN/BwmRBER rBm7P7hkeY6rrduLP18zNrhYOqynw2eH7yJK0kMPRMnLcSnP+KUl2LXSdl4xmxMgL9rBEg7ltPX 2ncTfI/Qa0FqBQV2KKtODyTwrbr5jey2zkwggH/6X5SW3W04oHTGrJF7vxYYMV4q5iJJkq45ZPY JLPcQfnjZoFSrEVMwV4nYHCklJasv0azIuxc5azKlTqu+OCp+va6t7k2sap3oE3KW3o+SBuxFSG zdLow== X-Received: by 2002:a05:600c:3107:b0:490:9588:bdb6 with SMTP id 5b1f17b1804b1-490c264cc2emr399213575e9.33.1781082228081; Wed, 10 Jun 2026 02:03:48 -0700 (PDT) Received: from google.com (135.91.155.104.bc.googleusercontent.com. [104.155.91.135]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f2eadefsm72447165f8f.11.2026.06.10.02.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2026 02:03:47 -0700 (PDT) Date: Wed, 10 Jun 2026 10:03:43 +0100 From: Vincent Donnefort To: Sebastian Ene 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: <20260608165549.1479409-4-sebastianene@google.com> 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? > + > /* > * 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) ? > + > + 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. > +} > + > 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 >