ANDROID: arm64: Register earlycon fixmap with the MMIO guard

On initialising the MMIO guard infrastructure, register the
earlycon mapping if present.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Bug: 233587962
Change-Id: I379387253d08e2414fa386a3360a45391da7d90d
Signed-off-by: Will Deacon <willdeacon@google.com>
Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
Marc Zyngier
2021-07-01 09:34:12 +01:00
committed by Quentin Perret
parent c5eb79ce1a
commit ef4a035f8a

View File

@@ -68,6 +68,17 @@ static int __init ioremap_guard_setup(char *str)
}
early_param("ioremap_guard", ioremap_guard_setup);
static void fixup_fixmap(void)
{
pte_t *ptep = __get_fixmap_pte(FIX_EARLYCON_MEM_BASE);
if (!ptep)
return;
ioremap_phys_range_hook(__pte_to_phys(*ptep), PAGE_SIZE,
__pgprot(pte_val(*ptep) & PTE_ATTRINDX_MASK));
}
void kvm_init_ioremap_services(void)
{
struct arm_smccc_res res;
@@ -91,6 +102,7 @@ void kvm_init_ioremap_services(void)
&res);
if (res.a0 == SMCCC_RET_SUCCESS) {
static_branch_enable(&ioremap_guard_key);
fixup_fixmap();
pr_info("Using KVM MMIO guard for ioremap\n");
} else {
pr_warn("KVM MMIO guard registration failed (%ld)\n", res.a0);