From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 576623F6C3C for ; Wed, 10 Jun 2026 11:59:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781092790; cv=none; b=LWmW7sZg8Uz+o+boAnDfHK+kgBcZ8qAKDJHNzp574BGZvwnLFD7ktoG2gBbiG9xiabVoQcFQGvWtX3dAfQQjR/fIB8O1W9kGosKzNZhCCZwewUeBkiGlcPoV2A9SVKjJ30gV96GqVpRPkpxtruTsfAenZ08Lz95YHBHlRo5wV54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781092790; c=relaxed/simple; bh=u9EDB4T0+1GDi2LjsjVOwso18YXI7T4zBts/lmLz42o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CC4rUCRGEYw2sIqzWg0+HwDVsTAS2wxovcEr/VzkLfNL5io8zFejaWj36oJg3AHT347fWHmravtfmPzwecTXs2cyMEFR7eGYqlqdYj2Wh6OhiKpREL27p7h4QVTZaAveHXrvkLGLA84opTzym26A9RVnOzQCJATqFeO9PnsvBoU= 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=Gbub9KSb; arc=none smtp.client-ip=209.85.128.46 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="Gbub9KSb" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-490cf322ed0so27680035e9.1 for ; Wed, 10 Jun 2026 04:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781092788; x=1781697588; 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=c28G8tbnZUyXO5kH0COrZ2xlMJ2YX0+1C3t/9VCQTd8=; b=Gbub9KSb3T9qYxxnl+DyV0nDd1JtHc85M5NrBIQYzEiz6DAdRqaQ2vhv9sFa8wr7o3 B/EcVD1rFv3Waz5sdK4Wwa/cNpHRIANq7/Tfz6XV6vE+QTsHXgxJml1MPaRbl49jzJdq JcQz/oSJKSH+kJnqm1+zWr/vkW8fUeRXV9czVQ808j9ta3Cs4q0ino/NGc4whAbBQG29 RHKTlhrKvIOWpY8nuJQJ1r6eeRFp1SL/FaYVgTnsEYvjvPJVI4y5gmxrA5RkQgd/vIJZ AvI6BqM5b8/VJsczlu7naB1Xmy1WskfWp/hVE3Ngv9m7dVPloV4wjZij3XtaPNdeJMBg MUNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781092788; x=1781697588; 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=c28G8tbnZUyXO5kH0COrZ2xlMJ2YX0+1C3t/9VCQTd8=; b=sLAKX1LR0wzXeTo1y+Gcg+92sYmnPVk6corhxfqBdvQ22Q2slBRDXfTG0SIrd2+Jft j2BjNR8z/pzOnRH9Mg8zcZsTwvnqa7BT4c83AV9Kci8mUCJgEUD0XPwb1BZJKesZId7z tTl5Byh9VW6mxiSs0QodtkmCt95bkM3qso23iST+WBvWyJp4svqcCy8UOuzMwj48la+y NdNCo9NHV6Mrh0AFYxfhoCFdsBrB3QosC8ZLF2YNMP/bKtOG+0RFyOdQGgC9+g5gmdfM Vmu6DCRyncbajdzGf1wcJL6GPbes+KSBfHR1JWVU6yJjirtVpzAOcxuyw53oDlqjZMX8 beYw== X-Forwarded-Encrypted: i=1; AFNElJ+POhNlrK6EBOZbEyDO9qEstfPHaZpWGb8vuBBs3mB/21PYPic4cauGbRbV7qQY2SO7zhe6Hs0WS+OJuoc=@vger.kernel.org X-Gm-Message-State: AOJu0YzieBsxxb3qD7TBUulmW1l2TE2WoaUT3D80m/XV9ffFgh62JpGi KTVVqFFAwNLPj6Mqi0uUGTZUNil269Qcc7Z+6NvIeyVwwvhnddWZahzrH3uIFm/ETg== X-Gm-Gg: Acq92OG6fN2R0KkmoIDUGhnP0cfEFVzVCBrrvQ1erUTqFfpSweIsC5+1YDW2o2uBn4y 77nSM11mzOR5D47enp+wYhFcZIoHxc9WOJxMNJLrylidCiOua28FmNBeyQrZOq3MPk75EiNWdSL gK77e8u7o2My+yWBZCztdmCnSkVStFKmot5TaIHWnrn+dmwrXQhT13Q0jOuJSw0mWRhytPsWdrX YqB6sDmpZgXbwBa4JnJdv93QiBtwqRWIpzNU+H1UAeviWFmrBIzX7VF/5ZZxZllxYAiCneRpCut h2RJnGsoh0gt8p/Rubg8v2nf5eYRGI4n6fpdbmwNOkbOATWUti/tPvvv50gjvczbGs+Cw0e0NtL Km/Q/U2uXhWpwplKmXhvjVoqrDOUGvelXPLKE7Px9hywMfpKJZRYCJcn+v1uscFk5+cOT2cEjjf 6GRc5nxj1MUqPkWIMgdUAqnFaHG2WOx9Nqoy3BzwTODkbKS7VZVwHdpjMXhWggzPmEVpi/fjFQX v2GDw== X-Received: by 2002:a05:600c:6091:b0:490:601f:d766 with SMTP id 5b1f17b1804b1-490c259a103mr424487945e9.1.1781092787304; Wed, 10 Jun 2026 04:59:47 -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-4601f3446aesm78457172f8f.24.2026.06.10.04.59.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2026 04:59:46 -0700 (PDT) Date: Wed, 10 Jun 2026 12:59: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 1/7] KVM: arm64: Support FFA_NOTIFICATION_BITMAP_CREATE in host handler Message-ID: References: <20260608165549.1479409-1-sebastianene@google.com> <20260608165549.1479409-2-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: On Wed, Jun 10, 2026 at 09:51:55AM +0100, Vincent Donnefort wrote: > Hi Seb, > > On Mon, Jun 08, 2026 at 04:55:43PM +0000, Sebastian Ene wrote: > > 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; > > > > +static bool ffa_check_unused_args_sbz(struct kvm_cpu_context *ctxt, int first_reg) > > +{ > > + int reg; > > + > > + for (reg = first_reg; reg < 17; reg++) { > > The upper limit should probably be something like ARRAY_SIZE(ctx->regs.regs) - first_reg? I wasn't really inspired this morning on the cruiser... But nonetheless, that 17 should probably be a #define somewhere? > > > + if (cpu_reg(ctxt, reg)) > > + return true; > > + } > > + > > + return false; > > +} > > + > > static void ffa_to_smccc_error(struct arm_smccc_1_2_regs *res, u64 ffa_errno) > > { > > *res = (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); > > } > > > > +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)) { > > Is that expected we start at 3 but only read 0 and 1? Ha, we do not read 2 but nonetheless it is useful! > > > + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); > > + return; > > + } > > + > > + if (vmid != HOST_FFA_ID) { > > + ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS); > > + return; > > + } > > + > > + args = (void *)&ctxt->regs.regs[0]; > > + arm_smccc_1_2_smc(args, res); > > Should be hyp_smccc_1_2_smc() > > > +} > > + > > 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; > > } > > > > if (ffa_call_supported(func_id)) > > -- > > 2.54.0.1064.gd145956f57-goog > >