mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Snehal Koukuntla <snehalreddy@google.com>
To: Vincent Donnefort <vdonnefort@google.com>
Cc: Marc Zyngier <maz@kernel.org>,
	Oliver Upton <oliver.upton@linux.dev>,
	 Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	 Sudeep Holla <sudeep.holla@arm.com>,
	Fuad Tabba <tabba@google.com>, Joey Gouly <joey.gouly@arm.com>,
	 Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	 Sebastian Ene <sebastianene@google.com>,
	Mostafa Saleh <smostafa@google.com>,
	 Snehal Koukuntla <snehalreddy@google.com>,
	linux-arm-kernel@lists.infradead.org,  kvmarm@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: arm64: Support FFA_FN64_MEM_RECLAIM2 in host handler
Date: Tue, 22 Sep 2026 11:16:54 +0000	[thread overview]
Message-ID: <20260922111654.1024808-1-snehalreddy@google.com> (raw)
In-Reply-To: <arJTf9C-dr3eMnsW@google.com>

Hi Vincent,

On Tue, Sep 22, 2026 at 10:07:27AM +0000, Vincent Donnefort wrote:
> > +	if (ffa_check_unused_args_sbz(ctxt, 6) || (flags & ~1ULL) || (x4 >> 32)) {
> 
> nit: (flags > 1) ?

Ack, will update in v2.

> > +	if (offset % desc_size != 0) {
> 
> nit: 
> 
> if (offset % desc_size) is enough

Ack.

> > +	if (offset >= (u64)req_desc_cnt * desc_size) {
> > +		ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS);
> > +		return;
> > +	}
> 
> Not sure I understand what Sashiko means here offset can not be bigger than the
> number of constituents we have...
> 
> > +
> > +	hyp_spin_lock(&host_buffers.lock);
> > +	if (!host_buffers.tx) {
> > +		ret = FFA_RET_INVALID_PARAMETERS;
> > +		goto out_unlock;
> > +	}
> > +
> > +	memcpy(hyp_buffers.tx, host_buffers.tx, (u64)req_desc_cnt * desc_size);
> 
> Either I or Sashiko is confused here. The invocation will not do more than
> req_desc_cnt will it?

Agreed. Per [S0039] and [S0047] in the spec, req_desc_cnt is the total
count of constituent descriptors in the TX buffer array starting at
offset 0, and offset indexes into that array so callers can advance
offset on subsequent invocations without repopulating the array.

> > +
> > +	range = (void *)hyp_buffers.tx + offset;
> > +	if (page_index >= range->pg_cnt) {
> > +		ret = FFA_RET_INVALID_PARAMETERS;
> > +		goto out_unlock;
> > +	}
> 
> Should we also verify total_pages here?

Good catch. I will add a check in v2 to verify that the sum of pg_cnt
across the constituent descriptors matches total_pages (without
overflowing) before forwarding the call.

Thanks,
Snehal

      reply	other threads:[~2026-09-22 11:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 16:47 [PATCH 0/2] " Snehal Koukuntla
2026-09-21 16:47 ` [PATCH 1/2] firmware: arm_ffa: Add FFA_FN64_MEM_RECLAIM2 function ID Snehal Koukuntla
2026-09-22 12:15   ` Sudeep Holla
2026-09-21 16:47 ` [PATCH 2/2] KVM: arm64: Support FFA_FN64_MEM_RECLAIM2 in host handler Snehal Koukuntla
2026-09-22 10:07   ` Vincent Donnefort
2026-09-22 11:16     ` Snehal Koukuntla [this message]

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=20260922111654.1024808-1-snehalreddy@google.com \
    --to=snehalreddy@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=oliver.upton@linux.dev \
    --cc=sebastianene@google.com \
    --cc=smostafa@google.com \
    --cc=sudeep.holla@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=vdonnefort@google.com \
    --cc=will@kernel.org \
    /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®