Re: [PATCH v4 17/26] KVM: Introduce a arch wrapper to check all processor compatibility

From: Chao Gao
Date: Fri Sep 09 2022 - 03:32:58 EST


On Thu, Sep 08, 2022 at 04:25:33PM -0700, isaku.yamahata@xxxxxxxxx wrote:
>From: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>
>
>Introduce a arch wrapper to check all processor compatibility and define
>default implementation as weak symbol to keep the current logic.
>
>The hardware feature compatibility check is arch dependent, only x86 KVM
>does cpu feature check on all processors. It doesn't make much sense to
>enforce the current implementation to invoke check function on each
>processors. Introduce a arch callback,
>kvm_arch_check_processor_compat_all(), so that arch code can override it.
>
>Eventually feature check should be pushed down into arch callback,
>(kvm_arch_hardware_setup(), kvm_arch_online_cpu(), and kvm_arch_resume()),
>the two compatibility check, kvm_arch_check_processor_compat{,_all}(), will
>be eliminated. This is a transitional step for it.
>
>Signed-off-by: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>

Reviewed-by: Chao Gao <chao.gao@xxxxxxxxx>

>+__weak int kvm_arch_check_processor_compat_all(void)

nit: int __weak