arm64: mm: convert cpu_do_switch_mm() to C
authorMark Rutland <mark.rutland@arm.com>
Thu, 13 Feb 2020 12:14:52 +0000 (12:14 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 27 Feb 2020 14:30:50 +0000 (14:30 +0000)
commit25b92693a1b67a47b0c64a3410009d09e9658412
tree6a976dc413dc64669b6ba2a4b61ef571b21c1a88
parent4399e6cdf3e920ab99c5f935ecbae88e60682596
arm64: mm: convert cpu_do_switch_mm() to C

There's no reason that cpu_do_switch_mm() needs to be written as an
assembly function, and having it as a C function would make it easier to
maintain.

This patch converts cpu_do_switch_mm() to C, removing code that this
change makes redundant (e.g. the mmid macro). Since the header comment
was stale and the prototype now implies all the necessary information,
this comment is removed. The 'pgd_phys' argument is made a phys_addr_t
to match the return type of virt_to_phys().

At the same time, post_ttbr_update_workaround() is updated to use
IS_ENABLED(), which allows the compiler to figure out it can elide calls
for !CONFIG_CAVIUM_ERRATUM_27456 builds.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will@kernel.org>
[catalin.marinas@arm.com: change comments from asm-style to C-style]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/assembler.h
arch/arm64/include/asm/mmu_context.h
arch/arm64/include/asm/proc-fns.h
arch/arm64/mm/context.c
arch/arm64/mm/proc.S