Re: [PATCH v3] perf/x86/amd: Don't touch the Host-only bit inside the guest hypervisor

From: Borislav Petkov
Date: Wed Mar 16 2022 - 14:30:13 EST


On Mon, Mar 14, 2022 at 12:22:54PM +0800, Dongli Si wrote:
> diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h
> index e41cbf2ec41d..fcc66c23cc72 100644
> --- a/arch/x86/include/asm/hypervisor.h
> +++ b/arch/x86/include/asm/hypervisor.h
> @@ -73,11 +73,21 @@ static inline bool hypervisor_is_type(enum x86_hypervisor_type type)
> {
> return x86_hyper_type == type;
> }
> +
> +static inline bool run_as_host(void)
> +{
> + return hypervisor_is_type(X86_HYPER_NATIVE);
> +}

What's the point of this "wrapper"?

--
Regards/Gruss,
Boris.

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