Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Drake" <dan@reactivated.net>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 3/5] iommu/generic_pt: Add Broadcom BCM2712 page table format
Date: Tue, 25 Aug 2026 21:10:32 +0000	[thread overview]
Message-ID: <20260825211033.1936F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260825-bcm2712-iommu-submit-v3-3-7f143e7289b6@reactivated.net>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Silent truncation of the page table physical address if allocated above the 37-bit limit.
--

commit d58086891d7da9b612c9b0e4a88de9a9dc4f255e
Author: Daniel Drake <dan@reactivated.net>

iommu/generic_pt: Add Broadcom BCM2712 page table format

Implement generic_pt support for the 2-level page table format used by
the BCM2712 IOMMUs.

> diff --git a/drivers/iommu/generic_pt/fmt/bcm2712.h b/drivers/iommu/generic_pt/fmt/bcm2712.h
> new file mode 100644
> index 0000000000000..2c5b034441c14
> --- /dev/null
> +++ b/drivers/iommu/generic_pt/fmt/bcm2712.h
> @@ -0,0 +1,288 @@

[ ... ]

> +static inline bool bcm2712pt_install_table(struct pt_state *pts,
> +					   pt_oaddr_t table_pa,
> +					   const struct pt_write_attrs *attrs)
> +{
> +	pt_bcm2712_entry_t entry =
> +		BCM2712PT_VALID |
> +		FIELD_PREP(BCM2712PT_PFN,
> +			   oalog2_div(table_pa, PT_GRANULE_LG2SZ));
> +
> +	return pt_table_install32(pts, entry);
> +}

[Severity: High]
Can table_pa exceed the 37-bit physical address limit here?

Because GFP_KERNEL is used when allocating child tables, the memory
allocations are not restricted to 32-bit or 37-bit physical addresses.

While the BCM2712 hardware might currently not exceed 16GB of RAM, the
generic_pt KUnit test for this format can run on any architecture. On systems
with >128GB of RAM, couldn't the child table memory be allocated above the
37-bit boundary?

If so, wouldn't FIELD_PREP() silently truncate the upper bits of table_pa
since BCM2712PT_PFN is only 25 bits?

Could this cause the IOMMU hardware to access truncated physical addresses,
reading random memory and leading to spurious test failures, faults, or DMA
memory corruption?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260825-bcm2712-iommu-submit-v3-0-7f143e7289b6@reactivated.net?part=3

  reply	other threads:[~2026-08-25 21:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 20:56 [PATCH v3 0/5] Add support for Broadcom BCM2712 IOMMU driver (Raspberry Pi 5) Daniel Drake
2026-08-25 20:56 ` [PATCH v3 1/5] iommu_pt: Fix test_pgsize_boundary() failure on narrow-OA formats Daniel Drake
2026-08-26 18:18   ` Jason Gunthorpe
2026-08-25 20:56 ` [PATCH v3 2/5] dt-bindings: iommu: Add Broadcom BCM2712 IOMMU Daniel Drake
2026-08-26 20:19   ` Florian Fainelli
2026-08-25 20:56 ` [PATCH v3 3/5] iommu/generic_pt: Add Broadcom BCM2712 page table format Daniel Drake
2026-08-25 21:10   ` sashiko-bot [this message]
2026-08-26 18:18   ` Jason Gunthorpe
2026-08-25 20:56 ` [PATCH v3 4/5] iommu: Add Broadcom BCM2712 IOMMU driver Daniel Drake
2026-08-25 21:12   ` sashiko-bot
2026-08-26 18:18   ` Jason Gunthorpe
2026-08-26 18:33   ` Florian Fainelli
2026-08-25 20:56 ` [PATCH v3 5/5] arm64: dts: broadcom: bcm2712: Add GPU IOMMU and IOMMU cache nodes Daniel Drake

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=20260825211033.1936F1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=dan@reactivated.net \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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