MIPS: Fixed __debug_virt_addr_valid()
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 14 Jul 2022 22:25:12 +0000 (15:25 -0700)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Fri, 15 Jul 2022 12:22:51 +0000 (14:22 +0200)
commit8a2b456665d1e797123669581524cbb095fb003b
treeac183835ab1077a64cd1fa2a1a0a9dd4606f28a0
parentc022e87162219d67d687df22c977d1c2fc95fb42
MIPS: Fixed __debug_virt_addr_valid()

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@gmail.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/mm/physaddr.c