mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Sebastian Ene <sebastianene@google.com>
Cc: Marc Zyngier <maz@kernel.org>,
	catalin.marinas@arm.com, oupton@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, vdonnefort@google.com,
	yuzenghui@huawei.com, Sudeep Holla <sudeep.holla@kernel.org>
Subject: Re: [PATCH] KVM: arm64: Forward FFA_NOTIFICATION* calls to TrustZone
Date: Mon, 8 Jun 2026 15:40:30 +0100	[thread overview]
Message-ID: <aibUXmzfDsVWcZjY@willie-the-truck> (raw)
In-Reply-To: <aibQHiYimPP1ylk3@google.com>

Hey Seb,

On Mon, Jun 08, 2026 at 02:22:22PM +0000, Sebastian Ene wrote:
> On Fri, May 29, 2026 at 04:32:24PM +0100, Will Deacon wrote:
> > I'd probably structure it as a separate patch per call, tbh. That way,
> > the commit message can talk about the specific fields that are reserved
> > for a given call. See below.
> > 
> > > Refactor the handling logic in pKVM FF-A proxy to support checking for
> > > SBZ/MBZ values. While at it, drop the do_ffa_mem_xfer macro and replace
> > > it with two functions that make it clear that we re-write the
> > > function-id with a 64-bit variant, to keep the same behavior as before.
> > > Keep each handler in an array of structures together with a mask that
> > > corresponds to the SBZ registers the spec expects.
> > 
> > Although I agree that we should be enforcing SBZ/MBZ paramaters (because
> > we have no idea what they might do in future versions of the spec), I
> > also think that doing this at the register level is too coarse.
> > 
> > For example, the VM ID parameter to FFA_NOTIFICATION_BITMAP_CREATE has bits
> > 31:16 as MBZ. So I think we probably need to do the checking on a
> > per-function basis, like Per is doing in his series:
> > 
> > https://lore.kernel.org/r/20260501-host-direct-messages-v6-0-3f4af727ed85@google.com
> > 
> 
> For the newly added calls like FFA_NOTIFICATION_* we can do that in a
> separate functions, but what about the other existing calls that have
> MBZ registers ? that was the reason for the inline proposal in :
> https://lore.kernel.org/all/af3fW468-f1KXCrC@google.com/
> (to avoid duplicate checks).

For unused parameter registers that are SBZ, I think you could just add
a helper, e.g.:

	ffa_check_unused_args_sbz(struct kvm_cpu_context *ctxt, int reg);

which takes the index of the first unused register and then checks that
all the registers from there to the last unused parameter register are
zero. You can then just call that directly before you start parsing the
SBZ/MBZ fields on the used parameter registers and there's no need for
the table-based indirection in [1].

Will

[1] https://lore.kernel.org/all/af3fW468-f1KXCrC@google.com/

  reply	other threads:[~2026-06-08 14:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01 11:44 Sebastian Ene
2026-05-06 16:29 ` Marc Zyngier
2026-05-07 10:48   ` Sebastian Ene
2026-05-07 13:36     ` Marc Zyngier
2026-05-07 14:13       ` Sebastian Ene
2026-05-07 14:21         ` Marc Zyngier
2026-05-08 13:04           ` Sebastian Ene
2026-05-08 16:57             ` Sudeep Holla
2026-05-29 15:32             ` Will Deacon
2026-06-08 14:22               ` Sebastian Ene
2026-06-08 14:40                 ` Will Deacon [this message]
2026-06-08 14:51                   ` Sebastian Ene

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aibUXmzfDsVWcZjY@willie-the-truck \
    --to=will@kernel.org \
    --cc=android-kvm@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=korneld@google.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=mrigendra.chaubey@gmail.com \
    --cc=oupton@kernel.org \
    --cc=perlarsen@google.com \
    --cc=sebastianene@google.com \
    --cc=sudeep.holla@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=vdonnefort@google.com \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®