Re: [PATCH v2] MIPS: Fixed __debug_virt_addr_valid()

From: Thomas Bogendoerfer
Date: Fri Jul 15 2022 - 08:26:00 EST


On Thu, Jul 14, 2022 at 03:25:12PM -0700, Florian Fainelli wrote:
> It is permissible for kernel code to call virt_to_phys() against virtual
> addresses that are in KSEG0 or KSEG1 and we need to be dealing with both
> types. Rewrite the test condition to ensure that the kernel virtual
> addresses are above PAGE_OFFSET which they must be, and below KSEG2
> where the non-linear mapping starts.
>
> For EVA, there is not much that we can do given the linear address range
> that is offered, so just return any virtual address as being valid.
>
> Finally, when HIGHMEM is not enabled, all virtual addresses are assumed
> to be valid as well.
>
> Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL")
> Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
> ---
> Changes in v2:
>
> - handle lack of HIGHMEM and EVA
>
> arch/mips/mm/physaddr.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)

applied to mips-next.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]