From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 102B23FC5C1 for ; Mon, 29 Jun 2026 09:36:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782725776; cv=none; b=EiehWdQIGegVAtXxlYRxy7o6HTHxwZd5XmmQhtir5AVnwQx964ukQ8A2BcSucSIlukeEuRUDlYcb3RaYq7cIpMDiJmdWMoCMsZ8PJ09Neum5GDR+gxK7cpDNaO6mmHKUhqCd+aHd1kAgNW5vW6+rSvc6oHxRjn9R8nwELrsY8mE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782725776; c=relaxed/simple; bh=mw61qrEShLN4em+7Zp/Kc0hPkSUzR3I//jfz8mh5fjo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WlqFKA0yh3KWt0Y0WVb6Hy1OmqmXj9rg42zA2Uilpjx238kg+QqOMj50Kw3Kr44htBBET0E1sTFBilxn+MNAfEmfYw3f5W3fOzJT1RVEAGb2wQEg0buKWQjuoi4sZzc5sGruVzrVWhAyr0TRhKZNbTFLCMezVoABOPUYYAetslQ= 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=Y58ZsR/i; arc=none smtp.client-ip=209.85.128.74 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="Y58ZsR/i" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-490a767b782so24343855e9.2 for ; Mon, 29 Jun 2026 02:36:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782725771; x=1783330571; 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=x/ufGm0/gR8nHfEhXcbUb8L6QO2HXRkkGS5TfPgnqx4=; b=Y58ZsR/i4DTM8KKkRkqhgJsC/5FvQ5sRE5Bw4ufZdoPRasIsNuSgj+G25R8kvuYBFQ Zgnff++kiNkgMU9OUBRTv9OejO/I6lgQ8PCmqoGq0OJUMuiOf2yF/wp4MmCttIEQzBAe hI4EPRiPzhfiHFrr5jxjL4uuD3fRGoFD79Qo9C83DNt6q6+uqj6XmIfFi48FDEX7CD90 MbqZ0YQNPhWbTHvQpvMXzRXWCS7NJz5k957KkYT9v88ygLcDAF+DjPyxjtAmWmG9Fi6b uFz3PAqFiFfJAqM7j4SiBlUmSgqTpsGYYAioWy65KzE7ptxygcQ3x4GglDz8HOnvsEpj /6BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782725771; x=1783330571; 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=x/ufGm0/gR8nHfEhXcbUb8L6QO2HXRkkGS5TfPgnqx4=; b=oZ66U2+5vKsjfWWjt+5JV2k3dEsOEsJox0wvY+AapF4OoEjsNLQre48kvNOvJ6Wzcc xQf3J2k80276SlLXnNtfMRhnJl03SlE+Bz+/osyCLJbkg9nYL7n6HmkOk/0boNT8ac+5 pufHzlkwbH1CFpG9ilz3Jc+bSeTYjuZrrAZlt67Yr16i7pNHu5BAR6+cnYlROTs2oL+V sSBfLlqdRzT6SzhwVlrPBS56KjFONTi+geH4d2eZYz/iBM3amhquXq60UPPAGQvva7ji UcnJ8ppQ1ooRLNom0r9p/MPq4gx6Pccb3QEsEAmuDOKu4v5W9Qx4OqBoqxkuJd5hnk9a 34xQ== X-Forwarded-Encrypted: i=1; AFNElJ+V5ZVABFDRKRGyakqDZhLovrADUEgZoizCHPbT4pTLh1cIkTh4dl3rML3LMHS2vxf38KG40ih5quQbfu0=@vger.kernel.org X-Gm-Message-State: AOJu0YyadIpU00q5NtZklQfpVOze0+nRBTi6zutHvs//fsn654HGZVfs dD0bNItvn5nbXZwLRqkd8Pl76efBsmsuuh9lgYXt77Nj1t5SAYaHzWhpnF5FYCxesyEnLjwW0yw MDGxlKZZf7yvLf2RJVlFTcVlYfGcnaA== X-Received: from wmro8.prod.google.com ([2002:a05:600c:3788:b0:492:49e7:fff3]) (user=sebastianene job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4e4b:b0:492:7078:4ead with SMTP id 5b1f17b1804b1-49270784ee4mr134371805e9.25.1782725770867; Mon, 29 Jun 2026 02:36:10 -0700 (PDT) Date: Mon, 29 Jun 2026 09:35:53 +0000 In-Reply-To: <20260629093558.2425257-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: <20260629093558.2425257-1-sebastianene@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260629093558.2425257-3-sebastianene@google.com> Subject: [PATCH v7 2/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 Reviewed-by: Vincent Donnefort --- arch/arm64/kvm/hyp/nvhe/ffa.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index ecc13b795f2c..331d9d0d8287 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_RECEIVER_ENDP_MASK GENMASK(15, 0) + /* * 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 @@ -676,7 +678,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: @@ -875,6 +876,27 @@ 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 (FIELD_GET(FFA_NOTIF_RECEIVER_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; @@ -937,6 +959,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.55.0.rc0.799.gd6f94ed593-goog