[PATCH 03/11] KVM: arm64: CCA: Check for RMI support at KVM init

Kohei Enju enju.kohei at fujitsu.com
Wed Nov 4 02:23:29 PST 2026


Hi Steven,

On 11/02 14:12, Steven Price wrote:
> Check if the RMI support is sufficient for using in KVM. Specifically, we
> will only support creating realm VMs when KVM is set to 'rmm' mode.
> 
> Signed-off-by: Steven Price <steven.price at arm.com>
> ---
>  arch/arm64/kvm/Kconfig | 1 +
>  arch/arm64/kvm/rmi.c   | 4 +++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
> index cecea0820e52..d067063a3686 100644
> --- a/arch/arm64/kvm/Kconfig
> +++ b/arch/arm64/kvm/Kconfig
> @@ -34,6 +34,7 @@ menuconfig KVM
>  	select GUEST_PERF_EVENTS if PERF_EVENTS
>  	select KVM_GUEST_MEMFD
>  	select KVM_GENERIC_PRE_FAULT_MEMORY
> +	select ARM_RMM_RMI
>  	help
>  	  Support hosting virtualized guest machines.
>  
> diff --git a/arch/arm64/kvm/rmi.c b/arch/arm64/kvm/rmi.c
> index 5ecc8b349869..9d118768550d 100644
> --- a/arch/arm64/kvm/rmi.c
> +++ b/arch/arm64/kvm/rmi.c
> @@ -3,6 +3,7 @@
>   * Copyright (C) 2023-2026 ARM Ltd.
>   */
>  
> +#include <linux/arm-rmi-cmds.h>
>  #include <linux/kvm_host.h>
>  
>  #include <asm/virt.h>
> @@ -12,7 +13,8 @@ void kvm_init_rmi(void)
>  	if (kvm_get_mode() != KVM_MODE_RMM)
>  		return;
>  
> -	/* TODO: Check if the RMI is available */
> +	if (!is_rmi_available())
> +		return;

>From an admin/operator's perspective, kvm_rmi_is_available would
silently remain FALSE in either of the following cases:
- kvm-arm.mode=rmm is set, but RMI is not available for some reason.
- RMI is available, but the admin forgot to set kvm-arm.mode=rmm.

So I think it would be useful to emit diagnostic messages for these
cases, for example:

if (!is_rmi_available()) {
    if (kvm_get_mode() == KVM_MODE_RMM)
        pr_info("Realm VM support is disabled because RMI is not available\n");
	return;
}

if (kvm_get_mode() != KVM_MODE_RMM) {
    pr_info("Realm VM support is disabled. Use kvm-arm.mode=rmm to enable it\n");
	return;
}

Thanks,
Kohei



More information about the linux-arm-kernel mailing list