All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kristina Martšenko" <kristina.martsenko@arm.com>,
	kvmarm@lists.linux.dev, linux-efi@vger.kernel.org
Cc: "Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Ryan Roberts" <ryan.roberts@arm.com>,
	"David Hildenbrand" <david@kernel.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Linu Cherian" <linu.cherian@arm.com>,
	"Anshuman Khandual" <anshuman.khandual@arm.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Hanjun Guo" <guohanjun@huawei.com>,
	"Sudeep Holla" <sudeep.holla@kernel.org>,
	"Marc Zyngier" <maz@kernel.org>,
	"Oliver Upton" <oupton@kernel.org>,
	"Fuad Tabba" <fuad.tabba@linux.dev>,
	"Joey Gouly" <joey.gouly@arm.com>,
	"Steffen Eiden" <seiden@linux.ibm.com>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	"Zenghui Yu" <yuzenghui@huawei.com>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Jinqian Yang" <yangjinqian1@huawei.com>,
	"Zi Yan" <ziy@nvidia.com>
Subject: Re: [RFC v2 07/13] ACPI: TLBI: Parse domains from table
Date: Thu, 26 Nov 2026 12:04:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-235472@kernel.org> (raw)
In-Reply-To: <20261126114936.864256-8-kristina.martsenko@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ACPI: TLBI: validate_tlbi_domains() allows zero NIS bits and
  duplicate ID 0
--

commit 16b5ea117539549acd04f827b44be9eb240e442f
Author: Kristina Martšenko <kristina.martsenko@arm.com>

ACPI: TLBI: Parse domains from table

This commit adds parsing for the Arm TLBI ACPI table to build and validate
the list of TLBI domains and their CPU masks.

> diff --git a/drivers/acpi/arm64/tlbi.c b/drivers/acpi/arm64/tlbi.c
> new file mode 100644
> index 0000000000000..1a4b591f8f706
> --- /dev/null
> +++ b/drivers/acpi/arm64/tlbi.c
> @@ -0,0 +1,211 @@
[ ... ]
> +static int __init validate_tlbi_domains(void)
> +{
> +	u64 tlbididr = read_sanitised_ftr_reg(SYS_TLBIDIDR_EL1);
> +	int domain_bits = FIELD_GET(TLBIDIDR_EL1_NIS, tlbididr);
> +	int domain0_idx = -1;
> +	int cpu;
> +
> +	if (domain_bits > 16)
> +		return -EINVAL;
> +
> +	for (int i = 0; i < domain_count; i++) {
> +		u16 max_domain_id = (1 << domain_bits) - 1;
> +
> +		if (domains[i].id > max_domain_id &&
> +		    !cpumask_empty(domains[i].cpus))
> +			return -EINVAL;
> +
> +		if (!domains[i].id)
> +			domain0_idx = i;
> +	}

[Severity: Low]
This rests on an architecture and specification detail that could not be
confirmed from the kernel source alone: can a system with FEAT_TLBID and
TLBIDIDR_EL1.NIS == 0 validly present an ACPI TLBI table (for example,
describing domain 0 alongside SMMU or Outer Shareable domains), and are
TLBIP instructions permitted when NIS == 0?

__init_vtlbid_regs in arch/arm64/include/asm/el2_setup.h anticipates that
TLBIDIDR_EL1.NIS can be 0 when ID_AA64MMFR4_EL1.TLBID is implemented.  If
such a system presents a TLBI table, validate_tlbi_domains() only checks
domain_bits > 16 and does not reject domain_bits == 0, nor does it reject
domains[i].id > max_domain_id when cpumask_empty(domains[i].cpus) is true.
In addition, duplicate id == 0 entries are not rejected and overwrite
domain0_idx, so an earlier id == 0 entry covering only a subset of CPUs
passes validation if the final id == 0 entry covers all possible CPUs.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126114936.864256-1-kristina.martsenko@arm.com?part=7

  reply	other threads:[~2026-11-26 12:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 11:49 [RFC v2 00/13] arm64: Add support for TLBI domains Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 01/13] arm64: sysreg: Add definitions for TLBID Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 02/13] arm64: boot: Handle TLBID boot requirements Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 03/13] arm64: Detect TLBID Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 04/13] KVM: arm64: Hide TLBID from guest sysregs Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 05/13] KVM: arm64: Hide TLBID from guest instructions Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 06/13] ACPICA: Add TLBI table definition Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 07/13] ACPI: TLBI: Parse domains from table Kristina Martšenko
2026-11-26 12:04   ` sashiko-bot [this message]
2026-11-26 11:49 ` [RFC v2 08/13] arm64: tlbid: Set up CPU domain bitmaps Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 09/13] efi/arm: Check return value of init_new_context() Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 10/13] arm64: tlbid: Track the TLBI domain of a task Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 11/13] arm64: Support TLBIP instructions Kristina Martšenko
2026-11-26 12:06   ` sashiko-bot
2026-11-26 11:49 ` [RFC v2 12/13] arm64: tlbid: Pass domain to TLBI instructions Kristina Martšenko
2026-11-26 11:49 ` [RFC v2 13/13] arm64: tlbid: Add documentation Kristina Martšenko

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=sashiko-outbox-235472@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=david@kernel.org \
    --cc=fuad.tabba@linux.dev \
    --cc=guohanjun@huawei.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=joey.gouly@arm.com \
    --cc=kristina.martsenko@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linu.cherian@arm.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=seiden@linux.ibm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --cc=yangjinqian1@huawei.com \
    --cc=yuzenghui@huawei.com \
    --cc=ziy@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.