Re: [PATCH v5 03/17] x86/acrn: Introduce an API to check if a VM is privileged

From: Borislav Petkov
Date: Tue Nov 03 2020 - 05:25:52 EST


On Tue, Nov 03, 2020 at 02:27:18PM +0800, Shuo A Liu wrote:
> The code just followed KVM style (see kvm_arch_para_features()).

Do you see Documentation/virt/kvm/cpuid.rst?

Now where is yours explaining what your hypervisor is doing?

> I can change to use
> cpuid_eax(acrn_cpuid_base() + 1)...
> If you prefer to.

Yes please.

> hypervisor_cpuid_base() implies the base is variable, no? We use
> this function to detect the base.

Yes, but you need to document all that and make it clear and
understandable. If Linux is supposed to run as an acrn guest, that
interface better be documented just like KVM does.

Also, if there's a bug in the KVM guest/host interface, we might be able
to fix it modulo ABI. Is that possible with acrn?

I'm guessing the answer to that is yes if I'm looking at

https://github.com/projectacrn/acrn-hypervisor

?

> OK. Then i will define acrn_cpuid_base() as a static inline function
> in asm/acrn.h for callers.

Yah, that function is simple enough.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette