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) <[email protected]>

Acked-by: Rik van Riel <[email protected]>

-- 
All Rights Reversed.

Reply via email to