From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 47F3631CA50 for ; Fri, 9 Jan 2026 11:18:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767957520; cv=none; b=LIBtBziTzjjrZUimgaf29DGRDecLt7Nf4RFrBpvTOo4COHnWaiOzfJYatOY9Xa67LaH/fxTmL4Vv9G6EzgTMZYXxEr1xAC1kPH9H7TVMvy+B4a1yh2mciV9bqqppovB8jSeQ84MZEmpECnEB6bS5Eu3alfaFE1SRxwlz3J3AJ7Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767957520; c=relaxed/simple; bh=l7AkI4fdFk0CQnpocg/oG/SiDKajWkqbJOnxr7H9+mw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Av3ThS3p0Z5mjJZlVzY1br6rigzqTFDi1CbRAwd88I5ptaFdj9gy9fuwqSm2peA+5MLxRgzk6K7FUCwXEkwQkuEmoStEgUf6q2Vt7qnzTAFyDvLoxQA0pl+Z2q+YkbK3z269UhAc99S//xysAGhDJcm5JeJcq+dhQXxO7mWr6Hc= 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=l95Ro3Rh; arc=none smtp.client-ip=209.85.128.42 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="l95Ro3Rh" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4779a4fb9bfso48965e9.0 for ; Fri, 09 Jan 2026 03:18:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767957518; x=1768562318; 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=LcRKW9XG66IWSuObrKpBcxYjxRwc8D6DgwgNC2eRp3A=; b=l95Ro3RhPMvnPTWZCLrHgdZ8zc+UwJNE+tq8L1iN5fPXjjS13T72cGbsOFsVBf3CoO 90+yFUbcYs5ClpuHeT/rRXeRxHalHwUUG7QBPdDU1keDRmjxUZhWu1CGJGW8aX8L9TuR oC+1QXPtf1vr04gWhJ2wDGrqucYYM4QZWWr+F+AXUW9oLlfnOO4BXKuvwqe+NrexfTwO pN0iEE7xvigVbJUVRRA4Tve9P2rq7tYxHV2z5TOX+8SUP67ylvZhQONx+ExNY8X5tuvD u7TEJhLU6lCSASYiktoHP1mdUWA5by9p9c5y1VWtIaNA1FbwwVicIG4A3133YeXCHKzx kipw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767957518; x=1768562318; 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=LcRKW9XG66IWSuObrKpBcxYjxRwc8D6DgwgNC2eRp3A=; b=f9tuvJT3ekP0Jig0iLqLlnMECaJeCaogb3pV8UWUvyz0QV2i1qBm9a9Mmyh40+hEOA PF9tutea4g+1JHmS8Vi5fIKGN4M85YYFKTKYxA7IBdYO+0SAjWXPJ5geR5Ce54jeLITY uIJz5w2ZNh/nN0O6A6ie1h3OFrDbNr3+1ZO47y+4VkW+hhWH8ZylYOYVzqHh5jsQa2Wy P+Hu372F7s7mwhAURY9BN7IffuRbCs+s8MQLZf+EPEbF9rWxdazVe8koDVJ5gWazoyOB gNSNsNYrGKegyByaay7WDUd+f1hDTwgR5S4J6dz12ZXqAVwEpj+7P9nlWle1gZ42jERN DTog== X-Forwarded-Encrypted: i=1; AJvYcCXei7RecFy7MwcdWpmtrQKIIU2X5buQEv2BbsyaK1YLo1/Bb0Nz5pbQDpfKlAyaNPw875Pma4EiUWWTfzk=@vger.kernel.org X-Gm-Message-State: AOJu0Ywbsefdp6RyOEteh/iIsj4rj/Nj8S9ZZlZv9BBqAot8rtHE/Cot DxDR2TvdokuHwZmvgrXXrxH8nt035hGKEcfmaUdINQ9vR0RhuJmTJZhLvn5LrzS7gg== X-Gm-Gg: AY/fxX7V1MFrgSe7Br8s33nvF5Q1aiYAun8SpfeJgRcPJQgGH41imgSGL7Ducr1PnxH xtyuB/Dsas2o5YPGPsF5IfY9dIeu6UGhQbV85qaDF8c7JyV1YjLAC7K9MEeUaO8xjbTv1Ug4kUI nSJHgqt/8YYoEDevjoptfAdcX0Dj9M6zUAlr7ZIRReXxeBwXBqZ36xaw8gzfH/gI2P7KcctCsn7 r4L/5OtRdZAUcsW7yeMIHG+yqXws0bJoVB1w3BLM7gpYlytIGy3oSlZZMLh+TL+U8rVzpKYmNFS m2QrrPYGsGp+mMvJ758lTpajBZ2S+QPJFfuARqXLUq6aqrPnEecA4KS1bs8Dp7oUh18GCTYz/jT U/qI57LNyxcPMO1aDo1KZAIKyUoo4P0BH0cBgZBzFrnIwAjQ7VGpeVmlmeWyJFgOjXIH1SvBUi+ FcNu9+9DVxxCL4ax1/WA/F8tEE/7yu7dC1yg53aVBxu2a8lvn8CKdI X-Received: by 2002:a05:600c:755:b0:477:b358:c0cd with SMTP id 5b1f17b1804b1-47d904419ebmr504375e9.18.1767957517587; Fri, 09 Jan 2026 03:18:37 -0800 (PST) Received: from google.com (238.18.78.34.bc.googleusercontent.com. [34.78.18.238]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7f703a8csm200896695e9.13.2026.01.09.03.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jan 2026 03:18:37 -0800 (PST) Date: Fri, 9 Jan 2026 11:18:33 +0000 From: Sebastian Ene To: Will Deacon Cc: perlarsen@google.com, Marc Zyngier , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Yeoreum Yun , Ben Horgan , Oliver Upton , Armelle Laine , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/2] KVM: arm64: Support FFA_MSG_SEND_DIRECT_REQ in host handler Message-ID: References: <20251119-host-direct-messages-v3-0-c74d04944b26@google.com> <20251119-host-direct-messages-v3-1-c74d04944b26@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 Thu, Jan 08, 2026 at 03:26:21PM +0000, Will Deacon wrote: Hi Will, > On Wed, Nov 19, 2025 at 02:07:53AM +0000, Per Larsen via B4 Relay wrote: > > From: Sebastian Ene > > > > Allow direct messages to be forwarded from the host. The host should > > not be sending framework messages so they are filtered out. > > > > Signed-off-by: Sebastian Ene > > Reviewed-by: Yeoreum Yun > > Signed-off-by: Per Larsen > > --- > > arch/arm64/kvm/hyp/nvhe/ffa.c | 22 ++++++++++++++++++++++ > > include/linux/arm_ffa.h | 3 +++ > > 2 files changed, 25 insertions(+) > > > > diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c > > index 58b7d0c477d7fce235fc70d089d175c7879861b5..a38a3ab497e5eac11777109684a33f02d88d09a1 100644 > > --- a/arch/arm64/kvm/hyp/nvhe/ffa.c > > +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c > > @@ -862,6 +862,23 @@ static void do_ffa_part_get(struct arm_smccc_1_2_regs *res, > > hyp_spin_unlock(&host_buffers.lock); > > } > > > > +static void do_ffa_direct_msg(struct arm_smccc_1_2_regs *res, > > + struct kvm_cpu_context *ctxt, > > + u64 vm_handle) > > +{ > > + DECLARE_REG(u32, flags, ctxt, 2); > > + > > + struct arm_smccc_1_2_regs *args = (void *)&ctxt->regs.regs[0]; > > + > > + /* filter out framework messages */ > > + if (FIELD_GET(FFA_MSG_FLAGS_MSG_TYPE, flags)) { > > Wouldn't we be better off just checking that flags is 0? The rest of it > is SBZ or MBZ in the current spec. Yes, we can simplify it in this way. > > > + ffa_to_smccc_error(res, FFA_RET_INVALID_PARAMETERS); > > + return; > > + } > > + > > + 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 +937,11 @@ 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_MSG_SEND_DIRECT_REQ: > > + case FFA_FN64_MSG_SEND_DIRECT_REQ: > > + > > Weird whitespace addition ^^ > Let me clear this space out. > > + do_ffa_direct_msg(&res, host_ctxt, HOST_FFA_ID); > > What's the point of passing HOST_FFA_ID here? Is that supposed to end up > in the Sender ID bits of W1? I can remove it, this doesn't bring too much for upstream but on the android kernel with guest-ffa it makes sense because we need to validate the sender to prevent impersonation. > > Will Thanks, Sebastian