From nobody Sun Jun 14 07:36:19 2026 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 1EE3B3D47C0 for ; Mon, 8 Jun 2026 16:55:58 +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=1780937759; cv=none; b=H6eaW3Zs7Elb13B/NaPRqSBAZ5S55wM/po+S8uuQeEhkkWh21iDXUaJbEiFbZ97UpBzAfftsX5Zu3gPu8k37vDRD89pjbXx1FBzxQTB0XF+0iy6Z1f7niSRHXuh59/jtAotXZoz7PXLHxtY47RDrVok0HcE5wGptKDNzqr6Xb7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780937759; c=relaxed/simple; bh=ZSf1agfoztRze1vMk/U42ZW5zDEwC5EzHMFs8OfgvCA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=tVyhT2hYJtmy8Ip3d45p39ihUxBo9DMxSXnx1vpj2ShOg+cFCIePNBkNF1x9JMNjFr4bjug3R6/RBkx+sMQJ4ltKd08Q5y5NyosEZ5sPr1kYUJ6kVhbQxdd+uRyRx/NSsQMDIdAYurQj7OBn3h/zL8oluMjDUoERxX2xBEJ3p7Y= 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=d8qatfPU; 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="d8qatfPU" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-490b37e1f47so40638445e9.0 for ; Mon, 08 Jun 2026 09:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780937756; x=1781542556; 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=SgnNHCiglWyE1dRfo9bMlmn2W0ut6mUT68P6HrXKuCQ=; b=d8qatfPUVbJem/v1JpTQZsuxuBd7fdvGnhVXG+KiFX8kE4EWcdauBpM/Vgs3QXNLNH Dhleu8Ze80WkB/RWFQgtw6FKQLNdQnkQdX/SkR4M41fqbbgT8D6F3VSdVfBEiOnpIJ6t vny0IBtsreKiT8Og/jB7IRJrywgS/jzNsAYdgt4+90sx31wEtNv1DRDY9Aq1BBOVoRJG TbxFFjzqzQYMAfgYpmymsaa8CJXBjuu3iiOjusdx5xD2BpI2DEUxSaHhsi4UewdoTPft tEMi44exBIF0/3/fMRDQfmFHlnJwiboXxvItAx3yomRM/F6VTxgY1J5hmmzHWhQIFRod hHqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780937756; x=1781542556; 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=SgnNHCiglWyE1dRfo9bMlmn2W0ut6mUT68P6HrXKuCQ=; b=OQK7uVtOnGoNvvPri2t2j4u/aQnA0Voqtqc5/lnFKosQ6C4dYpkilkDeA/m93Wc4cs 2sj8A4smYE/NgTBDShzRQGqqQIAzO3y88bpPY3Z5Z/8/zM19pykkv7AJrWznRm/IbvDV /tTtmcb8iIuSYq84butrUcEYMmkN85s/ALLl0WdCcvB0+/3c0HdjP49hSK5nAL5biZNq nyQM6AmUU5GxgDk4xiIT2pX+uyR1D34T5iBnK3bzA0vrI0xCHL/Y55oQpfIBsgOOBBYQ rTEvRDKsWIdEK4wVPikfasRrwkHddMyuUwsbaPZOjs/fl6Bak1enPolvhJ7QocUkLn7Q a8Bw== X-Forwarded-Encrypted: i=1; AFNElJ+aTsFcnO+6wsAVdNjmuvCw65BNaOZjDSAS0J9vG9XlErpU9kNPvFba/K4eUwJ/DV5FU+Opfi0cCUjpqps=@vger.kernel.org X-Gm-Message-State: AOJu0YyLz34SoljTyKj5zwDpnmYGasuF9jadwsFt4ZJ2amZn1OQdtdMW ZCodp8YIu8ejaJRD+pu2i2uE+Fvf5UjjI0lrF9TQr0m/wGz6f/oZrgoxMVX+1QXj4AUgtMFt6y4 P/uwAFwfB/w5Rj7Z1o+SFnoJJJ7LNZQ== X-Received: from wmxb10-n1.prod.google.com ([2002:a05:600d:844a:10b0:490:bb60:cdf4]) (user=sebastianene job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:620f:b0:490:b2c9:e284 with SMTP id 5b1f17b1804b1-490c2612c43mr262310685e9.30.1780937756547; Mon, 08 Jun 2026 09:55:56 -0700 (PDT) Date: Mon, 8 Jun 2026 16:55:43 +0000 In-Reply-To: <20260608165549.1479409-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: <20260608165549.1479409-1-sebastianene@google.com> X-Mailer: git-send-email 2.54.0.1064.gd145956f57-goog Message-ID: <20260608165549.1479409-2-sebastianene@google.com> Subject: [PATCH v2 1/7] KVM: arm64: Support FFA_NOTIFICATION_BITMAP_CREATE 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Allow FF-A notification bitmap creation messages to be forwarded to Trustzone from the host and introduce a helper to check for SBZ register fields. Signed-off-by: Sebastian Ene --- arch/arm64/kvm/hyp/nvhe/ffa.c | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index 1af722771178..c20d45191085 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -71,6 +71,18 @@ static u32 hyp_ffa_version; static bool has_version_negotiated; static hyp_spinlock_t version_lock; =20 +static bool ffa_check_unused_args_sbz(struct kvm_cpu_context *ctxt, int fi= rst_reg) +{ + int reg; + + for (reg =3D first_reg; reg < 17; reg++) { + if (cpu_reg(ctxt, reg)) + return true; + } + + return false; +} + static void ffa_to_smccc_error(struct arm_smccc_1_2_regs *res, u64 ffa_err= no) { *res =3D (struct arm_smccc_1_2_regs) { @@ -676,7 +688,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_BITMAP_CREATE: case FFA_NOTIFICATION_BITMAP_DESTROY: case FFA_NOTIFICATION_BIND: case FFA_NOTIFICATION_UNBIND: @@ -862,6 +873,26 @@ static void do_ffa_part_get(struct arm_smccc_1_2_regs = *res, hyp_spin_unlock(&host_buffers.lock); } =20 +static void do_ffa_notif_bitmap_create(struct arm_smccc_1_2_regs *res, + struct kvm_cpu_context *ctxt) +{ + DECLARE_REG(u32, vmid, ctxt, 1); + struct arm_smccc_1_2_regs *args; + + if (ffa_check_unused_args_sbz(ctxt, 3)) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + if (vmid !=3D HOST_FFA_ID) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + args =3D (void *)&ctxt->regs.regs[0]; + arm_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; @@ -920,6 +951,9 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *host_= ctxt, u32 func_id) case FFA_PARTITION_INFO_GET: do_ffa_part_get(&res, host_ctxt); goto out_handled; + case FFA_NOTIFICATION_BITMAP_CREATE: + do_ffa_notif_bitmap_create(&res, host_ctxt); + goto out_handled; } =20 if (ffa_call_supported(func_id)) --=20 2.54.0.1064.gd145956f57-goog From nobody Sun Jun 14 07:36:19 2026 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 451423D647F for ; Mon, 8 Jun 2026 16:55:59 +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=1780937760; cv=none; b=kph+u9rNAsyYXQCYdzaLujwHe2+M7NE3SgrsPe9H7QCvzGLd480L2Vr9ZEmYGuqIr9s7zlFT8Fyn1/xdH2e3y/claLtpEJJvMFB57gk+/btpYw7V59sKLrS2TVco560Ma7Lcbsw1bEl4517b1Ez4nUW/Mpo+KDst7waS0WzaHvg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780937760; c=relaxed/simple; bh=oAOA5EybKndmgBCuwAjcbu1eSQBnYactyGCVcpLbImI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=DDOMkX0+cq+EL8x8j0Xyv19F1ZK9WycC1xT/13aB66q4dkoBSPQ1gUKvPt2q7ookYu3/9Clcsrzv6WvuInr1MmhZmBGn13bIw3xjRPDxDyiy3VFL7fvL0bX+g3X+71mR7UtE/oobd7aWUAQAswoLkpk6mxExG2/BBuTU9E4uroA= 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=heCXljA0; 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="heCXljA0" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-490bde3d239so35373755e9.1 for ; Mon, 08 Jun 2026 09:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780937758; x=1781542558; 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=fiJTpHe0EoFyzEzrXyY6n13kVh9yVUaMFhDd94X4zOQ=; b=heCXljA0ocGOH5YJOB1alFvUJ8qZpxs7dHRflYpwnR4ODnIoJ7qXzbjC7r5Yq08WEv fFHgwOo5XN77y3tixhvX+LDg9X1dI22fkF9gB2iDZnIOJ56GksqUCFmcoyKWcawtciBm ImejK9A/H4He3NEG+86YDxlFPgDOb0t/Gsw2+zCNdvRgZEcuYZjyCTTYKGf02rXidETU i2hFS/sj6Y79H6BqH7yJPuTSh//LCs1Rn1FevZdBE4s3S54es/lzBUJ4VFu9Dca0G3bX cXfIC5eNqXtH3qkI3DfXqxzn0VeUYuWNod4yy/OYnOovHdYJBi3IugnmMd3NnDi94QMv iapg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780937758; x=1781542558; 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=fiJTpHe0EoFyzEzrXyY6n13kVh9yVUaMFhDd94X4zOQ=; b=T5RSQ38Wrf86HttKKrEjwyz9T6gM6PPCiWDl9BTBKzTB01nblNXsxGlt7s6/6Aue1e g65vH6pg/ByuthabjXnJcukrxoL2lkBag4wKINBn8GC/EWenA2nW9WUM0IAT/AFChWht rOjKbxhMJgKp1rKh47x0+LVmwfEx+IakCOwM16m6TJh3m+Y5ZFD+Hk5xGXoQNUfCwjcY Qvu85U3OG4sTSfNEkgeoG4IJfuQr9U2zUOoWY9DlpmLwKsBcjEmoKA25vzPu913XTXrQ /jmz5721FGwEGMDVp1/zKkCEgbvSbQ/Bz43cClPNP/y4l+e2XABfvN4ywMklHMPgHOi0 cV8w== X-Forwarded-Encrypted: i=1; AFNElJ+pw7Bpe4IC55nASQoLFMzfY8nt5rU+6pd33QFfn8pMKsQvWO2REEjXUSnhBU3j5t7Hwp3uykUEVHbaU+8=@vger.kernel.org X-Gm-Message-State: AOJu0Yyf7Rip3emkUXeZv4zHFrB+HfcmnSoZeLA1kvQ/rNqI3BuSOEPp mKqUtlJaWijPqRCn9HtfhMJeXXq34fM6SFefAo2ft/KNABNYIKSwzXW1MhiBLAVLafIvO+7o3Ao qeWfesN+TGXPwJ3OW+WL3HeRFm2uPPw== X-Received: from wmot17.prod.google.com ([2002:a05:600c:4511:b0:490:b9f9:d4b8]) (user=sebastianene job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1f90:b0:490:c032:ae92 with SMTP id 5b1f17b1804b1-490c2610b21mr273574485e9.33.1780937757698; Mon, 08 Jun 2026 09:55:57 -0700 (PDT) Date: Mon, 8 Jun 2026 16:55:44 +0000 In-Reply-To: <20260608165549.1479409-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: <20260608165549.1479409-1-sebastianene@google.com> X-Mailer: git-send-email 2.54.0.1064.gd145956f57-goog Message-ID: <20260608165549.1479409-3-sebastianene@google.com> Subject: [PATCH v2 2/7] KVM: arm64: Support FFA_NOTIFICATION_BITMAP_DESTROY 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Allow FF-A notification bitmap destruction messages to be forwarded to Trustzone from the host. Signed-off-by: Sebastian Ene --- arch/arm64/kvm/hyp/nvhe/ffa.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index c20d45191085..91e89d889c44 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -688,7 +688,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_BITMAP_DESTROY: case FFA_NOTIFICATION_BIND: case FFA_NOTIFICATION_UNBIND: case FFA_NOTIFICATION_SET: @@ -893,6 +892,26 @@ static void do_ffa_notif_bitmap_create(struct arm_smcc= c_1_2_regs *res, arm_smccc_1_2_smc(args, res); } =20 +static void do_ffa_notif_bitmap_destroy(struct arm_smccc_1_2_regs *res, + struct kvm_cpu_context *ctxt) +{ + DECLARE_REG(u32, vmid, ctxt, 1); + struct arm_smccc_1_2_regs *args; + + if (ffa_check_unused_args_sbz(ctxt, 2)) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + if (vmid !=3D HOST_FFA_ID) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + args =3D (void *)&ctxt->regs.regs[0]; + arm_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; @@ -954,6 +973,9 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *host_= ctxt, u32 func_id) case FFA_NOTIFICATION_BITMAP_CREATE: do_ffa_notif_bitmap_create(&res, host_ctxt); goto out_handled; + case FFA_NOTIFICATION_BITMAP_DESTROY: + do_ffa_notif_bitmap_destroy(&res, host_ctxt); + goto out_handled; } =20 if (ffa_call_supported(func_id)) --=20 2.54.0.1064.gd145956f57-goog From nobody Sun Jun 14 07:36:19 2026 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 5E9F63D8900 for ; Mon, 8 Jun 2026 16:56:00 +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=1780937762; cv=none; b=EY8JtidNj6LZN7Bzng96n/C94l3EDyisku3uioPtDvnfORNQQ6IWNjDEvlYlNeQqXtaPcY+u9FyCaHQgHy+4fmr6/OEpcWQrOJA3hwfxsokLlUifyKXGcbcGqyFJMc/Be9D7jUtUn2zOoaaycxwKOuM3YvvCk3LWnhd+42dVYO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780937762; c=relaxed/simple; bh=JUY2tMPcrSkadAgPjQ5ofJ5fMEmTSaz7neQPA28b8YE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=lOqtocb3Ur9b2thrzlb8ICD3AvkJUcBXH//aEFD0VmZncHfirIVtKwsi5WL1Cj38zE2kdQxXf8UT/Bf0E3/8yZK8QvRSQaC3p6bdCGbg2p9fuKd23SVkBcbUHMy1EV7V552eQopjbuK/o/9jqVELSrWufXwi5JeGa+KMDR5yWFg= 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=rxswTiHW; 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="rxswTiHW" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-490bfd70b0fso47742765e9.0 for ; Mon, 08 Jun 2026 09:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780937759; x=1781542559; 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=WOOiG7cLZKBESZTZeStp41m8GGWKdLGa2fPTwW93Dnw=; b=rxswTiHWYla+4ib+yFFkALtbi09f7g4KVhgtf16ZeVqdYLNLjFfRYkOtYUhJTStJ9e 7n/fvvKrx8jzmkq2ZqUS/9qQ5wvz6F2RIf9qKiydSNyYnmc5KP0kaGzSXpsphtgGdp6c cu+je+v5PaMRkY1IpzmA8Q6SXn/E3rVI0aq3CdWr/T7Bos9Xtf2XWu/caIuQ4TMczQag DiI5SQhap/9phP92ApsTxSdTXDEKaSKtz4Fovn3ClegqOllqGRwF6Bs7qN8ry9AgPnIn OWdoqKNycFWbFnJ0sx5NmbgWpgfI5vEns9Ms9d5hCVdSO/yyCMLaYknfXU7ZbkoWGkbj qAJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780937759; x=1781542559; 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=WOOiG7cLZKBESZTZeStp41m8GGWKdLGa2fPTwW93Dnw=; b=FRoeu7pQG7b8FkVN8UQt5O2KX5vUWMuXIqVZAPLBd+IJI2uuEvTjA7arbnX+OjYbNq Ho5jbZgrOTzJm2K27N+f+ygWK++ydmOtMhylF3mR0QiBlimyueQ0Y3SjnLXjx1NrSMVc a87mEOcyVyoQ4JExN4JGY/VA5PutXXizuMdWiSEit7S4WfaOAcFy3dyx+s6cWlnF91DZ wC4/Y9hopI95AyiIvWGzN4qK7Ki8kO2O9WrqsIXsAoy0/b7bZi1MFcMYUiA7Rt0mra9H pmf2SSan5MG2F9H0ejaxIWb/dozH8w9vpMgOZ/lV+dyXYE2TLZCfl5vOZGlvdKz99Nsk E58A== X-Forwarded-Encrypted: i=1; AFNElJ+RLSf9kbtv2XGjGAxN5ndiruk87II/Rj5NHw/WO4ynXfigmbrHAmYDPXxGeFcCXpXFJ5pbLeVphMPc0l4=@vger.kernel.org X-Gm-Message-State: AOJu0Yw8E0ByKEtl8c/HaDOXpK/GNFTR9gFdrmUPXsDSh+CF8AJbYkTh DV6qqi05lftzDvlYMst8jZCFNKHR95FgYjbfS1tr1FfNdvAtsBlwmaLzUr8YHvzteJ+jVqYKvIL kbDtHjo6KKILKTqJZc6jFG7L7ggWYAg== X-Received: from wmjv24.prod.google.com ([2002:a7b:cb58:0:b0:490:aeab:32d1]) (user=sebastianene job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:8518:b0:490:a298:3859 with SMTP id 5b1f17b1804b1-490c4993bdbmr293970365e9.24.1780937758833; Mon, 08 Jun 2026 09:55:58 -0700 (PDT) Date: Mon, 8 Jun 2026 16:55:45 +0000 In-Reply-To: <20260608165549.1479409-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: <20260608165549.1479409-1-sebastianene@google.com> X-Mailer: git-send-email 2.54.0.1064.gd145956f57-goog Message-ID: <20260608165549.1479409-4-sebastianene@google.com> Subject: [PATCH v2 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-Transfer-Encoding: quoted-printable 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 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 =20 +#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_R= ESP @@ -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_smc= cc_1_2_regs *res, arm_smccc_1_2_smc(args, res); } =20 +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) !=3D 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; + } + + args =3D (void *)&ctxt->regs.regs[0]; + arm_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; @@ -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; } =20 if (ffa_call_supported(func_id)) --=20 2.54.0.1064.gd145956f57-goog From nobody Sun Jun 14 07:36:19 2026 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.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 9B34A3D8133 for ; Mon, 8 Jun 2026 16:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780937764; cv=none; b=sFkeGEb00IM2rY4U830pFBzpgB+Nu0qbbTtfAiIXmQjIk5tl9IWziS4/UsZs9+PdPx8gNXxghJ5mb/PprSVQS1aBMRG8jEOsoCyztW/5tqnaAcs8i0/ce5GK/ggok8Tn17hVgbiCTF98ObV593OxTrFoooEV/rJ3Q329pl/qft8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780937764; c=relaxed/simple; bh=yyMo/IUPF6pLA2eoZ9AGkDfP9o0FQsa5VxDHxpU7Xgw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ASCqTEdiVyKCATI+cJe6U7qZ62FqXMDWyQUhgFUanJBvhW6jBbaUFr4IIyewl9xYgL9c61MDEx7flc5UVqOeWGstiKPx9rFb6cRtU1nEk+U9qmzB2LM+wEw8N3mnJlvB66LvxFRCq35hjmejjywm+HAAnMqLpxgkOGGjQCjWt0Q= 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=jSTEwo6b; arc=none smtp.client-ip=209.85.221.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="jSTEwo6b" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-45ef63d1214so2970720f8f.3 for ; Mon, 08 Jun 2026 09:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780937760; x=1781542560; 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=2857N0FYewLMeBt8Nj5klxJIE+MPtxOFSZN9bVePZ7w=; b=jSTEwo6b9niEkwDOyg62Bsy5Vteby4VPNfUTMH6FPhPmkgL5QH4h4jka3pgSCuibhj e9CxSxJPJz9yk0IuXdMO1Z7jfsa06qixHGDehQFvaPox/eCOfD+tCv101YqD3IvtWzvC Gy57RkIYz4+cjKRFH0Hq3LoVDG437yJYFPN8eh72tKOqr1nQgaWvaTA7UwY+dorVCveJ sT9q+nQFdTXQKm7wzcfDjGepaXCLFt4OcYTKBeHceXyYVd4i75dbKNDMeM+i8TPz6tg5 eMOyVDQ6P0jUKRiOJZYC5FUzJ6lAPpWno9uk+wYEEhl9/Aheau1xfmqJFcouTfyhPD+m PZ5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780937760; x=1781542560; 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=2857N0FYewLMeBt8Nj5klxJIE+MPtxOFSZN9bVePZ7w=; b=EcqFhHdDfsgMx7xJETdBwsEB8S25Xf2dTnPMiEwIxdAcdBndZjxtL3RXWVXXnLRXjb rS1nw1vsZQVHu4AVjaWX4rd78+KoXXs5T+ptjy2mJlU4qIucZjRK6SiFcz75yjMHiWci BHzIynxBUNX230yaxfv9rogao/Ku0WyO/BLKUg31JM0G95gNn8xJhSQ5kK1Zp0hvKNpT 3FiW28UFHi5Mi6/wic3n06d4U+qtEOcve59KjjsdixjdCmkgEd0tprHtXR4eQdpRbSBs RSU1Sn36Hp8n/o2qClrnsm1eWld1eaQcjGKmRiA65FkeKZFgQf5SSyEt2dg5q6PDfCXD RZEw== X-Forwarded-Encrypted: i=1; AFNElJ8eZg6BWv/YsSlICoCL64dg1i8qYQ2S2wsLaadNfxBrGdvCbqzZLPsV5aqRvvY2bRFi1rs46uOObt111v0=@vger.kernel.org X-Gm-Message-State: AOJu0YyeLEWm9MEVV5K90iZHmCTDpujdUjQ2AA+KxaxvUIGjYIS8mYY9 2TVPov5pjUsYk3Wwrqmquw8HczTJ0tRz6qehQCcvycBTXqe74SXFxe/3d8B2MK9HkW998adk4Ad N4C94BhXbSFdkDVaApp2y9MKSRjtvmg== X-Received: from wmqi7.prod.google.com ([2002:a05:600c:3547:b0:490:5e18:ff1c]) (user=sebastianene job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:34d2:b0:490:bbc4:76a6 with SMTP id 5b1f17b1804b1-490c25eea30mr291402965e9.21.1780937759935; Mon, 08 Jun 2026 09:55:59 -0700 (PDT) Date: Mon, 8 Jun 2026 16:55:46 +0000 In-Reply-To: <20260608165549.1479409-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: <20260608165549.1479409-1-sebastianene@google.com> X-Mailer: git-send-email 2.54.0.1064.gd145956f57-goog Message-ID: <20260608165549.1479409-5-sebastianene@google.com> Subject: [PATCH v2 4/7] KVM: arm64: Support FFA_NOTIFICATION_UNBIND 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Verify the arguments of the FF-A notification unbind call and forward the message to Trustzone. Signed-off-by: Sebastian Ene --- arch/arm64/kvm/hyp/nvhe/ffa.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index eedb01955a45..ca285e89516e 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -690,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_UNBIND: case FFA_NOTIFICATION_SET: case FFA_NOTIFICATION_GET: case FFA_NOTIFICATION_INFO_GET: @@ -939,6 +938,27 @@ static void do_ffa_notif_bind(struct arm_smccc_1_2_reg= s *res, arm_smccc_1_2_smc(args, res); } =20 +static void do_ffa_notif_unbind(struct arm_smccc_1_2_regs *res, + struct kvm_cpu_context *ctxt) +{ + DECLARE_REG(u32, endp_id, ctxt, 1); + DECLARE_REG(u32, reserved, ctxt, 2); + struct arm_smccc_1_2_regs *args; + + if (ffa_check_unused_args_sbz(ctxt, 5) || reserved) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + if (FIELD_GET(FFA_NOTIF_SENDER_ENDP_MASK, endp_id) !=3D HOST_FFA_ID) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + args =3D (void *)&ctxt->regs.regs[0]; + arm_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; @@ -1006,6 +1026,9 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *hos= t_ctxt, u32 func_id) case FFA_NOTIFICATION_BIND: do_ffa_notif_bind(&res, host_ctxt); goto out_handled; + case FFA_NOTIFICATION_UNBIND: + do_ffa_notif_unbind(&res, host_ctxt); + goto out_handled; } =20 if (ffa_call_supported(func_id)) --=20 2.54.0.1064.gd145956f57-goog From nobody Sun Jun 14 07:36:19 2026 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 0097E3DA7EC for ; Mon, 8 Jun 2026 16:56:02 +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=1780937765; cv=none; b=a9fl1BB8NDffyC7MYUt4MyuBi8Si8gC6cnRaPcGSjnSzgicHitjzf5O2sn0qg31edq3WGe5VqguXll383izNwka5/ji7XWn9/4bOxumWU81C7zGZHCEjsxRHvu4JobofCFJhEoU6VKyeeG67URZVLiu6w0qfqSbH/KkdjlY540w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780937765; c=relaxed/simple; bh=qq+RsWTJKd/YlKZQUHiTIrR6T6HfsiopDJCN8sVjqW8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=GlIYY3OYZ6LkE8cAMFmC0qQ7A/oNJ4+1Ua3wSW2OHQn2OOf5lgTzXhjy68D9fGNL9814P+YWdWibOfjwUJSBVfqQ4HEzX1zjYy8yB2sqRkhGR8dT2naEvv1FqsK12lixmhDihxfIchOpWavpqXgcOIYgd+hoTVhOSIal65TKPrc= 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=YU1GD7ik; 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="YU1GD7ik" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-490afe64f26so22445435e9.0 for ; Mon, 08 Jun 2026 09:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780937761; x=1781542561; 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=UNn/w8nYqQgrzocdn7kSQyhyTudAsTnVKcbXP36Ndz4=; b=YU1GD7ikOElEGvO3jzRynxRlORCo5mWFf5FKzEgYhO73540CW1FXxlS4BUJAW2ZINs qBMQcbQSnZmM1NWqBHVUcuyjPU/DaDLlXQtv1ACMBarkzxxDDoSCpm12YhOkqdFXaFk/ Yk+NP8yBdL85q7GL48j7BGAuaVDqKtZElBe1dc2KfmocWJ3G18D8GVCBknqlsLmF2SCP sbaxg+BgiLWngAsIX4/Kz1H/DmX0w6gZbKlbhqOswlOUKJhQzlydxNAmwVPliiPaIs+m L7FiOmOcjmvu2u093ctQyttNSOVi+HDTJF0dxYTk9uznlYX5aW6mQppGCE0BPqyOjiG5 YQ6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780937761; x=1781542561; 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=UNn/w8nYqQgrzocdn7kSQyhyTudAsTnVKcbXP36Ndz4=; b=JQYrKUPEVE1ZIPtUgIQPj6o94UG5b+oKw6DDMfZhPZ1uQkihhKHO/02dliJnOYSVUa tzdYJdkW+vK6uk1BKX706v3iYJpzpeQoGtBCkQ5w6gn8dV1h5M13tPmirE+PQzwFUT8e CZMnEjXNxCnbCj4aag08ejp4Ot3mJCLYeYiKc5+v3IRJ7esnGRT8UAdkpxgqEchFQl+x cCWRNpssPR6KQroOnWbhWuPNvKIp1CSr3N3AL/uXW82reGiw9R5MP0lzrWKnYM1ePXFb fASCWOsgzoRn6bT6oNv5iKApW89dZJNPPLcSITk5Eqs3GeH06ZvqqLNKvO2GTolsVWBv cKmg== X-Forwarded-Encrypted: i=1; AFNElJ+tJN8xuSPy+kRNRUx+NNP8FV6R5kZyB5PKw1Y8VGoM63pR8IhSX0CxfR29bgmEnGxZ1QQO+AeQO/GEXZ8=@vger.kernel.org X-Gm-Message-State: AOJu0YxoebFhDKu8GQj6pnTQK95mu6EaBvGnrOWjtZlKkpycouas+raP nJd5vr4l1ISg4qMYShLRjQUXkaoPxPt2Omh2XXvevfYCmcWEroMWpAuiEEBkO4jM1qnJqwdo7oJ 1In+HQxmgfOzZHRYRNdHXqPcE6seaPw== X-Received: from wmpg21.prod.google.com ([2002:a05:600c:4c95:b0:490:aefa:cdf]) (user=sebastianene job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1c29:b0:490:7df7:9190 with SMTP id 5b1f17b1804b1-490c2ceb6f6mr241823035e9.8.1780937761024; Mon, 08 Jun 2026 09:56:01 -0700 (PDT) Date: Mon, 8 Jun 2026 16:55:47 +0000 In-Reply-To: <20260608165549.1479409-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: <20260608165549.1479409-1-sebastianene@google.com> X-Mailer: git-send-email 2.54.0.1064.gd145956f57-goog Message-ID: <20260608165549.1479409-6-sebastianene@google.com> Subject: [PATCH v2 5/7] KVM: arm64: Support FFA_NOTIFICATION_SET 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Allow FF-A notification SET messages to be proxied from the pKVM hypervisor to Trustzone and enforce MBZ/SBZ fields. Signed-off-by: Sebastian Ene --- arch/arm64/kvm/hyp/nvhe/ffa.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index ca285e89516e..3270381679b4 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -690,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_SET: case FFA_NOTIFICATION_GET: case FFA_NOTIFICATION_INFO_GET: /* Optional interfaces added in FF-A 1.2 */ @@ -959,6 +958,32 @@ static void do_ffa_notif_unbind(struct arm_smccc_1_2_r= egs *res, arm_smccc_1_2_smc(args, res); } =20 +static void do_ffa_notif_set(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_SENDER_ENDP_MASK, endp_id) !=3D HOST_FFA_ID) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + if (ffa_check_unused_args_sbz(ctxt, 5)) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + if (flags & GENMASK(15, 2)) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + args =3D (void *)&ctxt->regs.regs[0]; + arm_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; @@ -1029,6 +1054,9 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *hos= t_ctxt, u32 func_id) case FFA_NOTIFICATION_UNBIND: do_ffa_notif_unbind(&res, host_ctxt); goto out_handled; + case FFA_NOTIFICATION_SET: + do_ffa_notif_set(&res, host_ctxt); + goto out_handled; } =20 if (ffa_call_supported(func_id)) --=20 2.54.0.1064.gd145956f57-goog From nobody Sun Jun 14 07:36:19 2026 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.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 403AD3D47B7 for ; Mon, 8 Jun 2026 16:56:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780937766; cv=none; b=JDPDhPckY/AiLrDMBxs4jv/Mq+w13IbZtnfBV+ncoY7gUavHf8KGeTy1OR+xZuKapQtOPvwsze9jD7ygiJAcPB5dyK1hXDtFJ0bRs7O6KNjRVIobQOAGB9+uonbJBSoeNmLCTpj8sn4kOVgAVenB3yG7BUjrcGp2XH9YIat4fk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780937766; c=relaxed/simple; bh=WvNUZlQdSlrhUEvbk/wqJOmQ5kxvYTykZDwVGfpau8w=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=q/vJNdmGltts5G1B0QjKeI6UeuDlb2KrTQHJ2D6Y91Dhl6WfAicyekFF8oI/M7EKlcLKDtjxAoAcVm338HkjhPwDY6td6C+0CTxmeHlx3dqK72gyiXRe3RrVuG5dxJxguGvMfDmYAcnYQVuqtucP1HNZ8yDtHV5OhK62u+UgAb8= 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=tlqYTUzJ; arc=none smtp.client-ip=209.85.221.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="tlqYTUzJ" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-45efb6e60e4so4257173f8f.0 for ; Mon, 08 Jun 2026 09:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780937762; x=1781542562; 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=fkWcCN/UbsW6dNVoLGt/rV/ZPDLec4SNUxgFyMxD3Hs=; b=tlqYTUzJgf9Eu6ej+YO6U7zA0Ba9S8dpqQf1bI8yTxxLXFytg4RYyBmN4vmG1DjMTm /ys1xB2wEPEW7a/UxH7/+oSqmsTJrt9dpsLHd2wzfmKO04jF7dq/HuWknWwIvsEi6pyh rCvzzq2Z57NhBsb7H4jkAPIqa5DIuY6inheNHENtd2Rb+dlVoIWtory6flXZgqrRC7o3 zdAYJZGgljAy7m96c5RiHdDsTuTp0/lN0NPYyzkoURXhXwP/oj1qxqMvFYSqiy/vO2WO Xifq544LVJqNaakzTPTlNcYacOoNRwy8t1669N2Bi6icV+whILrVTVRuZOmU6GbHUm19 vmYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780937762; x=1781542562; 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=fkWcCN/UbsW6dNVoLGt/rV/ZPDLec4SNUxgFyMxD3Hs=; b=pG6+ncvzlmILkBNEawqkW4xWnFwEpZZ7K79xHMxJ7tPgezsWnTYzV56j4Eyo4eoX5Z nBchSoc9hgAwGKxH4b85Jwd5BjX9rq3GBwmNRsVdaaEoGJ8XtICSBd8FNoqc4GiAL3+h O53IeAbq9EPt/aoYNl2cy1+ZH0J7w7kXza9/Gwj9YFZdGYtDIabvf6U32ep+37+QIOLE uR9wDvS+HjG5YNj9e7Sl5w4yIxg0+Pp6pf0Oq4wpcalzU6XSV7DjCjCBko7WBFzhQ3dR LDJa2DGZx6W/66dmnefINMBCexJh3T4ghyxSQgzjEu0gfM/zW1BKH9Qrry3UJ2tCZyoU pUrg== X-Forwarded-Encrypted: i=1; AFNElJ+bJdk43K8i06nyo8JXzQT+4nctfxT/MeAsap46y7Y5aX254uCJnsDjhrn8PXyRZKo3F7iYvwj62NY3H2s=@vger.kernel.org X-Gm-Message-State: AOJu0YzUAvudDwa9TAX0W4PSAXE5NMA/ND6MBMsXHS7uxtqVFp1IzoJF llv1TPqMf7FzbSBbpPVpFnN3UiR0I8heXJbl4ICiel6Ilo+ry/YYlPsxf65eFuJX3c7BpOVz5lF IERGURMu6YMWZ3UAasyeLUAEe3GIpzg== X-Received: from wroz2.prod.google.com ([2002:adf:f1c2:0:b0:45e:8fa3:14f7]) (user=sebastianene job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:4697:b0:45e:739b:3e43 with SMTP id ffacd0b85a97d-46030186d90mr16953340f8f.0.1780937762410; Mon, 08 Jun 2026 09:56:02 -0700 (PDT) Date: Mon, 8 Jun 2026 16:55:48 +0000 In-Reply-To: <20260608165549.1479409-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: <20260608165549.1479409-1-sebastianene@google.com> X-Mailer: git-send-email 2.54.0.1064.gd145956f57-goog Message-ID: <20260608165549.1479409-7-sebastianene@google.com> Subject: [PATCH v2 6/7] KVM: arm64: Support FFA_NOTIFICATION_GET 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Allow FF-A notification GET messages to be proxied from the pKVM hypervisor to Trustzone and enforce MBZ/SBZ fields. Signed-off-by: Sebastian Ene --- arch/arm64/kvm/hyp/nvhe/ffa.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index 3270381679b4..28b6cb0e14c4 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -690,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_GET: case FFA_NOTIFICATION_INFO_GET: /* Optional interfaces added in FF-A 1.2 */ case FFA_MSG_SEND_DIRECT_REQ2: /* Optional per 7.5.1 */ @@ -984,6 +983,26 @@ static void do_ffa_notif_set(struct arm_smccc_1_2_regs= *res, arm_smccc_1_2_smc(args, res); } =20 +static void do_ffa_notif_get(struct arm_smccc_1_2_regs *res, + struct kvm_cpu_context *ctxt) +{ + DECLARE_REG(u32, flags, ctxt, 2); + struct arm_smccc_1_2_regs *args; + + if (ffa_check_unused_args_sbz(ctxt, 3)) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + if (flags & GENMASK(31, 4)) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + args =3D (void *)&ctxt->regs.regs[0]; + arm_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; @@ -1057,6 +1076,9 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *hos= t_ctxt, u32 func_id) case FFA_NOTIFICATION_SET: do_ffa_notif_set(&res, host_ctxt); goto out_handled; + case FFA_NOTIFICATION_GET: + do_ffa_notif_get(&res, host_ctxt); + goto out_handled; } =20 if (ffa_call_supported(func_id)) --=20 2.54.0.1064.gd145956f57-goog From nobody Sun Jun 14 07:36:19 2026 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.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 52CA43DB311 for ; Mon, 8 Jun 2026 16:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780937766; cv=none; b=Uzzkbf2HPBK/hDn+o4t9as8F403QyGOxpW9/9Jc514rDe4YCAPrdSeiPjoJi//Kiw2g+IKiXS5zew6rgUJQ+fPzmGqjZE0qRAjZfHb0wWAVj4sqp7F4BJ5QzD83zu5B1SZY0duZxahx7UluONDkaUbbU+zMZBWdo7wYsLREE6dk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780937766; c=relaxed/simple; bh=a/ghZ9f8piNkArvC2k+e2cwsOUE+3fRGTGXzL9vLPps=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=P36So7HlMCEo1N7WZsYWuHN9K9sNJXo9BGqss3Ea6I0WrgzOgDq7l1TTcjC4W+PG8MiVHl+kygO6Zw783fY3dl5tQLB99prHXHNJqmJ4vXx2Q4ZQ0IFPhT4z8Rwvd9J4IZjfBO+sMNycdML4jpzeQG9qtswyxIBZ/eNzSN+WjqE= 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=dM70nfRv; arc=none smtp.client-ip=209.85.221.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="dM70nfRv" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-45eee3f9f03so4469593f8f.1 for ; Mon, 08 Jun 2026 09:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780937764; x=1781542564; 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=zvv+an6xLDGNzBLnOXXROxXfLkjVhoP4StmbjGm4UyM=; b=dM70nfRvdwzyhyBDKJxRWnTM5zXPrMCaiJkKUIhxxQr39q++mON2sEdt8JpfKsjCF0 046N8FUFvq6WMzsdyPw4CADaNiXcqUonbrgizTdfibxwmAHwBIHW5Q89Vpbs9+ziuSY3 iJVrP61J9u0f42aZzLeeyMLUHdT/DiZ1LWSfU6kHN//uYVSe1kQudYRJuucoKanWuxE1 kaT/AdhLdIHJRZND6soSQWr/vMW3BUqK28QMFGhrTEJpOj7Pgcm1oF8IAmx9Lpx/XuCW h4ZmueeiBZDhFGbz/InFmLTHbzBUbNf4myUXKceDF7PMW5RTweeH0g8k6Qu3jDEbtk+m fWmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780937764; x=1781542564; 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=zvv+an6xLDGNzBLnOXXROxXfLkjVhoP4StmbjGm4UyM=; b=eQ5R9jgWR7F70dBETE1aFxzr9G5U4Uhq17C5m+hxiSRX8bH+SzWRkEQnLVDHijrY/k xgtNDtGi+oux2lKQ3vEkOFLE0rrZzD9jf6MG4eGIkIOmVARAW2Le3Tyco4QVdUaPaKoW 728cwrEWFm1DHmkYd1A1DY1+qMJKEXQHRlqPIKuVmXbUuhNP6Bkpb9f8x0iqUECe2OOV YgX9hjJDf6VOUnYPyHYh2+3BGJklqVBmso+ocxD3Y79Z4m5h66F/M8tFD1cZ+n4lB/UB 7aaSPjfev9vI+k7dwqrUJhncwB2tPNptlMVIKiwMOzkoxk946KZW66LhyV0rGGSkKJ7+ BQGg== X-Forwarded-Encrypted: i=1; AFNElJ/PjeUa3Z1TBOuOOWW3a080hbiRfd0YA6nP2Y2KTwT6/K1xhHWpU2y+oD+bZaWEUz3iHT0XbYiTOFEfrNw=@vger.kernel.org X-Gm-Message-State: AOJu0YxS6U+6H/uepLwUy1JCeb7O8rLdKkTMh7ztdKweJrqSuMebsZa4 zywj+k4Ew1ESZdT9rQY94CzZMzrPxWVxynpNSMGiwetc9qXP4DO1kD5w25wtBtRTNmxWwbHBLy3 bcDl/cn1H8hxllqui9Whc5v+4q+xWkw== X-Received: from wrop15.prod.google.com ([2002:adf:f20f:0:b0:43b:4453:39d8]) (user=sebastianene job=prod-delivery.src-stubby-dispatcher) by 2002:adf:e906:0:b0:43d:77f4:7145 with SMTP id ffacd0b85a97d-46030506818mr19157420f8f.19.1780937763520; Mon, 08 Jun 2026 09:56:03 -0700 (PDT) Date: Mon, 8 Jun 2026 16:55:49 +0000 In-Reply-To: <20260608165549.1479409-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: <20260608165549.1479409-1-sebastianene@google.com> X-Mailer: git-send-email 2.54.0.1064.gd145956f57-goog Message-ID: <20260608165549.1479409-8-sebastianene@google.com> Subject: [PATCH v2 7/7] KVM: arm64: Support FFA_NOTIFICATION_INFO_GET 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Allow the host to query the FF-A notifiction status and proxy the info get message to Trustzone. Make sure that the SBZ fields are enforced. Signed-off-by: Sebastian Ene --- arch/arm64/kvm/hyp/nvhe/ffa.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index 28b6cb0e14c4..463a845557f9 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -689,8 +689,6 @@ static bool ffa_call_supported(u64 func_id) case FFA_RXTX_MAP: case FFA_MEM_DONATE: case FFA_MEM_RETRIEVE_REQ: - /* Optional notification interfaces added in FF-A 1.1 */ - case FFA_NOTIFICATION_INFO_GET: /* Optional interfaces added in FF-A 1.2 */ case FFA_MSG_SEND_DIRECT_REQ2: /* Optional per 7.5.1 */ case FFA_MSG_SEND_DIRECT_RESP2: /* Optional per 7.5.1 */ @@ -1003,6 +1001,20 @@ static void do_ffa_notif_get(struct arm_smccc_1_2_re= gs *res, arm_smccc_1_2_smc(args, res); } =20 +static void do_ffa_notif_info_get(struct arm_smccc_1_2_regs *res, + struct kvm_cpu_context *ctxt) +{ + struct arm_smccc_1_2_regs *args; + + if (ffa_check_unused_args_sbz(ctxt, 1)) { + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); + return; + } + + args =3D (void *)&ctxt->regs.regs[0]; + arm_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; @@ -1079,6 +1091,9 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *hos= t_ctxt, u32 func_id) case FFA_NOTIFICATION_GET: do_ffa_notif_get(&res, host_ctxt); goto out_handled; + case FFA_NOTIFICATION_INFO_GET: + do_ffa_notif_info_get(&res, host_ctxt); + goto out_handled; } =20 if (ffa_call_supported(func_id)) --=20 2.54.0.1064.gd145956f57-goog