Skip to content

quiesce MMU updates and add early EL2 KVM support#61

Open
aswinm94 wants to merge 2 commits intoqualcomm-linux:qcom-nextfrom
aswinm94:kvm2
Open

quiesce MMU updates and add early EL2 KVM support#61
aswinm94 wants to merge 2 commits intoqualcomm-linux:qcom-nextfrom
aswinm94:kvm2

Conversation

@aswinm94
Copy link
Copy Markdown

@aswinm94 aswinm94 commented May 8, 2026

Flush D-cache and invalidate TLBs around emergency MMU map updates
to ensure page table consistency on ARMv8 systems.

Introduce Kconfig options for DragonBoard 410c and Qualcomm KVM guest
support. Extend early boot code to:
- Apply the PSCI workaround for DragonBoard 410c conditionally
- Switch hypervisor mode from Gunyah to KVM via TrustZone SMC before
  EL register setup, allowing U-Boot to run correctly at EL2 in KVM
  guest environments.

aswinm94 added 2 commits May 8, 2026 11:39
Flush D-cache and invalidate TLBs around emergency MMU map updates
to ensure page table consistency on ARMv8 systems.

Introduce Kconfig options for DragonBoard 410c and Qualcomm KVM guest
support. Extend early boot code to:
- Apply the PSCI workaround for DragonBoard 410c conditionally
- Switch hypervisor mode from Gunyah to KVM via TrustZone SMC before
  EL register setup, allowing U-Boot to run correctly at EL2 in KVM
  guest environments.

Signed-off-by: Aswin Murugan <aswin.murugan@oss.qualcomm.com>
Enable CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK for Qualcomm platforms and
explicitly select TARGET_DRAGONBOARD410C in the DragonBoard 410c
defconfig.

This ensures that the early boot hooks required for PSCI workaround
and hypervisor/KVM-related early initialization are enabled and
becomes generic for all platforms.

Signed-off-by: Aswin Murugan <aswin.murugan@oss.qualcomm.com>

flush_dcache_range(gd->arch.tlb_addr,
gd->arch.tlb_addr + gd->arch.tlb_size);
__asm_invalidate_tlb_all();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if with other MMU fixes if we really need these changes, since CMD-DB and SMEM are now mapped as un-cached regions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For boot0 hook updates, please rather pick this patch from upstream related to DB410c hook update here: https://lore.kernel.org/all/20260508-qcom_spl-v6-4-aaac1ab17b50@seznam.cz/, then add the EL2 switch config on top of that.

mov x9, x0

/*
* Switch to EL2 (exit Gunyah)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you first need to check if we already entered in EL2 or EL3 then skip this EL2 SMC call switch. IOW, just do the switch when entered in EL1.

Comment thread configs/qcom_defconfig
CONFIG_NR_DRAM_BANKS=24
CONFIG_DEFAULT_DEVICE_TREE="qcom/sdm845-db845c"
CONFIG_SYS_LOAD_ADDR=0xA0000000
CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK=y
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to enable this hook support by default? It should be selected by the special config option.

Support for Qualcomm DragonBoard 410c (APQ8016).
Enables PSCI workaround for 64-bit mode switching.

config QCOM_KVM_GUEST_SUPPORT
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather rename this option to: QCOM_EL2_GUNYAH_EXIT_SUPPORT

/*
* KVM Guest Support - Hypervisor Switch
*
* Configure hypervisor for KVM mode during early boot by switching
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't mention just KVM but other hypervisors can be supported when U-Boot is run in EL2 mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants