From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.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 AFCE93FD15E for ; Mon, 29 Jun 2026 09:36:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782725781; cv=none; b=tsA3psH7qofTjk9YISn69J4tczwAn385oOVSppRno3N5yVCSRboi9rg1nU0KrTyN5E40BzbCn3xf9KL/dE3yerqOJEBXMiIZoTJ2WcUAblC0e6yX9qRVz1H9NYIFs1fvDB+SHAgaFOCaDgdV2NLmOSSoYMl9sVIbzXGt9wDfBOY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782725781; c=relaxed/simple; bh=A9iEB7RoLYR7o3b9JIWmxzrK9nW9JHyaFAr0Gs34LmA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JvnF+KH5cP8tRkpOY+v4lLA7MW4Iux2qTrSU4dyoyx69wE2gUFqJGtGOt9b4q0lKa34lyK7cvPgdc5+R0ssWuvH6tyl6eD8FJbL9SRlz6hCd2N11aAR+uPFgEWRK4bZhOt3oZjqrnas2HnTeByt2aUu7G3y07sRHcJeNOXLcuSk= 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=Q8Vg/cbg; arc=none smtp.client-ip=209.85.208.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="Q8Vg/cbg" Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-69840b68343so1892062a12.3 for ; Mon, 29 Jun 2026 02:36:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782725776; x=1783330576; 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=mgEdqVZzkg8EdfvsvaTXXYI6aDMdt2t7UIchiBP7OMQ=; b=Q8Vg/cbgsrfVeaJQateDkDQUHtnjS4e9vXSurszacgQgIyujZqA3Ywu6AzL2/7WIn0 KdqIHnlEU0J/fsw7r5SpfDvtea+o1KPlRccNN9xDN9mB+NkP07c/vBR1d0RFVjYTAXxI K7ty31saf/9ivrUNxUxfNCWLVeIZRMpfknK0v3VOSH/6lLn2lI3E1pyZFBJvXkmYuPal B7o7czvuZLd5VjERwiS2Uqt0TNfTtI2K9zzO1qAsH0nQ50sPb46LBViSYCuBPHGkhK7t z/r88xoChhNz+2icEAcXATf/wjOnc3913Km9rng+0qhloHu3EVW8zioCvSRSZvkJprgU dSng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782725776; x=1783330576; 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=mgEdqVZzkg8EdfvsvaTXXYI6aDMdt2t7UIchiBP7OMQ=; b=D33dbnPuTEnih0rey4JA95wCSy9Iwu0GnLdFg4J7K0aNOQMdj7i6xEgcW2QVhLDC96 Gb3j1r3+hZAEHjWEaQZecuHj7bqHbI16BrfYEB0Jy64udZPtLDM4OBzEWUdx65qJJwbx RoJ3b1GEg3yTf9JKyChppExks0S3B0Se1oEHCXfrEe9PnRV2JlUQGS4GM7LcKBC5St3o 4FbtttLKAy8A4XbgzC2dNn93UIaqiseV9PB9TmrLdD6HhENREp7jpYWEiwPBjfoq+Y8i HAMXkoljhVtlc8a7wBopq7zLsNXCfgbnvbRvlHmPkTRQZ2Jt4FZKbN6wvngDdy51O59n U41A== X-Forwarded-Encrypted: i=1; AHgh+RqSrT0NAdbK7BGS2Y/zTjHSC8ZAkQC/8vHLOPkZ6YCuxZ95Ifhqhsyi4miwDHQWCaFxjvYG1ylRxgBc/u0=@vger.kernel.org X-Gm-Message-State: AOJu0YxPfh+5togk+D/WkjBdCwFN01YynB3kn+f0NWgTdYXrlBJGmhi2 eyIjRERzV5VKUMKH+YobM8ODWGnhesUzAt99FQ68b1HoDtngWOK29Yq+cwBRPoEEOqJp5kl3WSm Ex7ujnHlMVuC/a/o6D5qNjfvSSNIPHw== X-Received: from edyb2.prod.google.com ([2002:aa7:df82:0:b0:697:8356:d9d4]) (user=sebastianene job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:5249:b0:698:62b7:a4cc with SMTP id 4fb4d7f45d1cf-69862b7a909mr1588559a12.5.1782725775494; Mon, 29 Jun 2026 02:36:15 -0700 (PDT) Date: Mon, 29 Jun 2026 09:35:55 +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-5-sebastianene@google.com> Subject: [PATCH v7 4/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-Type: text/plain; charset="UTF-8" Allow FF-A notification SET messages to be proxied from the pKVM hypervisor to Trustzone and verify the arguments. Signed-off-by: Sebastian Ene Reviewed-by: Vincent Donnefort --- arch/arm64/kvm/hyp/nvhe/ffa.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index d52d7c4d5e7f..2bb16aa414f9 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -43,6 +43,7 @@ #define HOST_FFA_ID 0 #define FFA_NOTIF_RECEIVER_ENDP_MASK GENMASK(15, 0) +#define FFA_NOTIF_SENDER_ENDP_MASK GENMASK(31, 16) /* * A buffer to hold the maximum descriptor size we can see from the host, @@ -678,7 +679,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 */ @@ -917,6 +917,27 @@ static void do_ffa_notif_unbind(struct arm_smccc_1_2_regs *res, hyp_smccc_1_2_smc(args, res); } +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) != HOST_FFA_ID) { + 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 = (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; @@ -985,6 +1006,9 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *host_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; } if (ffa_call_supported(func_id)) -- 2.55.0.rc0.799.gd6f94ed593-goog