[PATCH RFC v2 02/54] riscv: test for Svnapot in pte_napot()
Rik van Riel
riel at surriel.com
Wed Dec 2 21:29:46 PST 2026
On Thu, 2026-11-26 at 13:14 +0200, Mike Rapoport (Microsoft) wrote:
> pte_napot() tests only bit 63 and relies on its callers to check that
> the
> CPU supports Svnapot.
>
> On T-Head CPUs bit 63 is not the NAPOT bit: it is set in the non-
> cached I/O
> mappings (_PAGE_IO_THEAD).
>
> pte_pfn() checks has_svnapot() before pte_napot(), but
> pte_leaf_size() does
> not. With CONFIG_RISCV_ISA_SVNAPOT=y on T-Head, a page of an I/O
> mapping
> looks like a NAPOT block and pte_leaf_size() derives its size from
> the
> alignment of its PFN. perf then reports a bogus page size for
> addresses in
> I/O mappings.
>
> Check has_svnapot() in pte_napot() so that its callers don't have to,
> and
> drop the check that became redundant in pte_pfn().
>
> Fixes: e0fe5ab4192c ("riscv: Fix pte_leaf_size() for NAPOT")
> Signed-off-by: Mike Rapoport (Microsoft) <rppt at kernel.org>
Acked-by: Rik van Riel <riel at surriel.com>
--
All Rights Reversed.
More information about the linux-arm-kernel
mailing list