target/arm/kvm: Add helper to detect EL2 when using KVM

Introduce query support for KVM_CAP_ARM_EL2.

Signed-off-by: Haibo Xu <haibo.xu@linaro.org>
Signed-off-by: Miguel Luis <miguel.luis@oracle.com>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20250707164129.1167837-3-eric.auger@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Haibo Xu 2025-07-07 18:40:28 +02:00 committed by Peter Maydell
parent 66ba6d1367
commit 776aac5653
3 changed files with 17 additions and 0 deletions

View file

@ -47,6 +47,11 @@ bool kvm_arm_mte_supported(void)
return false;
}
bool kvm_arm_el2_supported(void)
{
return false;
}
/*
* These functions should never actually be called without KVM support.
*/

View file

@ -1763,6 +1763,11 @@ bool kvm_arm_aarch32_supported(void)
return kvm_check_extension(kvm_state, KVM_CAP_ARM_EL1_32BIT);
}
bool kvm_arm_el2_supported(void)
{
return kvm_check_extension(kvm_state, KVM_CAP_ARM_EL2);
}
bool kvm_arm_sve_supported(void)
{
return kvm_check_extension(kvm_state, KVM_CAP_ARM_SVE);

View file

@ -191,6 +191,13 @@ bool kvm_arm_sve_supported(void);
*/
bool kvm_arm_mte_supported(void);
/**
* kvm_arm_el2_supported:
*
* Returns true if KVM can enable EL2 and false otherwise.
*/
bool kvm_arm_el2_supported(void);
/**
* kvm_arm_get_max_vm_ipa_size:
* @ms: Machine state handle