From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (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 F2876438FE4 for ; Tue, 16 Jun 2026 10:54:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781607272; cv=none; b=olfA0QVLAHhlfSUqnuBDHUIH9VJHDpagOYwHwZunhF4L5z5O+v6If8SmASBqSfk02VxJNbS1Tc+olhH6KAlrCGUZjyjduJeDn3akLdge6a/ivhoI3uzPtYu7uAl1PJeo09qlcQFEsinkMJedaCb8shHpAS/UkTsCSnaXmTWqLdQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781607272; c=relaxed/simple; bh=l0mZkdTN2VV+fsd6+4jp+5sV/7mjSvNKmnLNFvXoifk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=EptyOwoV/sOhbo9BHHqij0gC97d8rSgUmSSlNrlza9c6sKPXd1xBwqyT2TILY/JbW4ee+Qd5TgQbG/AtTBjRB8d4reUD/BQ5tXFL5g5oSlVtfxBycZtW6xa8JGEyOWgCu+elGO7t10CrbqziRHuOezDbaoWZmsHCnSsT/rO2yMw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sebastianene.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CkW8mpXV; arc=none smtp.client-ip=209.85.128.73 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=flex--sebastianene.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CkW8mpXV" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-490b0682d2fso39123135e9.0 for ; Tue, 16 Jun 2026 03:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781607269; x=1782212069; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=IvZ7xBVFaIWlfxl/3gfs4VKaw5Sr61chB3pwbJcfuUs=; b=CkW8mpXVO8uOLd5iwwTaKYEse3Ztw2QOLRR9Y6ELe7imm7dkil2guTnJ/E1noVsxnc CHrvENkAaKEucOCP3YiSfdxL2myI82OUz1p9ZbbMGc/24tohOkZxR/a6Vg2qoMGwFYEP AZoJeylpUgLPthneTl5PvasP98UeRfWFg98PLxMRVHz2/a/L0puj+ixwP42ABClrbWLN 93ZwQQO/02aSaiqSFmQgrUcj/0e9nUd18z1n7SLxTn89qMblZHzDX4CO2a2SaxHWL6Uf lkrMlkEaljAnX0vBJ/sDrBDQ+Yqj9j52NphmcWPPvuo7fF+BHJNcY2KNcRqJp/DXvuPz 3wRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781607269; x=1782212069; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IvZ7xBVFaIWlfxl/3gfs4VKaw5Sr61chB3pwbJcfuUs=; b=LqnefmBcYrzqP/L9Smt20/KneKy8AGSytFWsTnl1UxGUtPZHMgF5ZC7tKr66+DQkYy kE+lzlNUEWOVZMbI76c28ox1/lcn4rCNgMCHUu/dmiIA/wAgWL7O6fYT634GwgDboHVD JzLrDDJz4ZGWmxHr9+2VFGiBbseMACpWpvvghvvvPuTJBgrz6HZzpAvkV7SmkTGYDvF/ 96lhdcL65X+pKt7P4lOuMLcdFPbOb7oFFLjc2itDI+x+SmZErBt58nSWt/m9a28WovBY WUeVL3OEzfNc7BCgBQtv64jDFo51jpApEFaAdBp603jVmSDjTJj8E3TvXP6Apupvbmnh MTRA== X-Forwarded-Encrypted: i=1; AFNElJ/ZDG+F6IzEXevVHVIAhqWQV26F63rC9Bn0A0Ojeccbc46rgLIPYR10k9bKmvDF4t8aICU6GhkYNVH+jGY=@vger.kernel.org X-Gm-Message-State: AOJu0YyTvgyCAz5K9/KAvdAMQ1tQDZ8Xdw6LVl07aGelM9uNTxED4OBV 3/SXPK+FUXPLT1PqR6XYuKWJbYaRmfdxIkV4PX3H7e39+KoHRJapv2zQ9hxCInuNP+hk9hJ3OkJ g44qXf28PAD8EewRbP93+zda8otEBtA== X-Received: from wmbg25.prod.google.com ([2002:a05:600c:a419:b0:48a:6051:b5af]) (user=sebastianene job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3512:b0:491:9969:739d with SMTP id 5b1f17b1804b1-4922011393fmr209070225e9.29.1781607269137; Tue, 16 Jun 2026 03:54:29 -0700 (PDT) Date: Tue, 16 Jun 2026 10:54:12 +0000 In-Reply-To: <20260616105417.2578670-1-sebastianene@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260616105417.2578670-1-sebastianene@google.com> X-Mailer: git-send-email 2.54.0.1136.gdb2ca164c4-goog Message-ID: <20260616105417.2578670-6-sebastianene@google.com> Subject: [PATCH v3 3/7] KVM: arm64: Support FFA_NOTIFICATION_BIND in host handler From: Sebastian Ene To: catalin.marinas@arm.com, maz@kernel.org, oupton@kernel.org, will@kernel.org Cc: 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, sebastianene@google.com, suzuki.poulose@arm.com, vdonnefort@google.com, yuzenghui@huawei.com Content-Type: text/plain; charset="UTF-8" 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 dc7496ec295f..3d8ed829f558 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) + /* * 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 @@ -713,7 +715,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: @@ -929,6 +930,32 @@ static void do_ffa_notif_bitmap(struct arm_smccc_1_2_regs *res, hyp_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 > 1) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + args = (void *)&ctxt->regs.regs[0]; + hyp_smccc_1_2_smc(args, res); +} + bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id) { struct arm_smccc_1_2_regs res; @@ -991,6 +1018,9 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id) case FFA_NOTIFICATION_BITMAP_DESTROY: do_ffa_notif_bitmap(&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.1136.gdb2ca164c4-goog