arch: arm64: mmu: keep page table diagnostics printable before the MMU

The page table helpers run before the MMU is enabled, while the tables
are being built, and again at run time from arch_mem_map(). In the first
phase neither the logging subsystem nor printk()'s spinlock is usable,
because the atomics under them need the shareable memory attributes the
MMU provides, so a diagnostic there faults instead of printing. That is
where this started: a page table failure during early bring-up produced
silence.

Test the MMU and pick the path accordingly. mmu_is_enabled() reads
SCTLR_EL1 and tests M, which compiles to an mrs and a tbz. With the MMU
on the messages take the ordinary LOG_*() path, keeping level filtering,
timestamps, the backends and serialized output. With it off they degrade
to an unlocked printk() to the character hook.

Gating on the log core's own Z_LOG_CONST_LEVEL_CHECK() keeps the
build-time level filtering: a filtered-out level drops both branches and
its arguments. Verified on qemu_cortex_a53, where the INF format string
is in the binary with CONFIG_KERNEL_LOG_LEVEL_INF and gone with
CONFIG_KERNEL_LOG_LEVEL_ERR.

Errors here precede a k_panic() and must appear with logging compiled out
too, so they keep this file's existing printk() fallback.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2 files changed