> Date: Mon, 15 Dec 2014 23:21:35 +0100 (CET)
> From: Stefan Fritsch <[email protected]>
>
> On Thu, 11 Dec 2014, Mark Kettenis wrote:
>
> > > From: Alexey Suslikov <[email protected]>
> > > Date: Thu, 11 Dec 2014 20:51:14 +0000 (UTC)
> > >
> > > Stefan Fritsch <sf <at> sfritsch.de> writes:
> > >
> > > > --- a/sys/arch/amd64/include/specialreg.h
> > > > +++ b/sys/arch/amd64/include/specialreg.h
> > > > <at> <at> -158,6 +158,7 <at> <at>
> > > > #define CPUIDECX_AVX 0x10000000 /* Advanced Vector
> > > > Extensions
> > > */
> > > > #define CPUIDECX_F16C 0x20000000 /* 16bit fp conversion
> > > > */
> > > > #define CPUIDECX_RDRAND 0x40000000 /* RDRAND instruction
> > > > */
> > > > +#define CPUIDECX_HYPERV 0x80000000 /* Hypervisor present */
> > >
> > > Is this flag standardized? Last time I have tried to push this, there
> > > was an objection based on "reserved for future use" status of this flag.
> > >
> > > See http://marc.info/?l=openbsd-bugs&m=136907278229145&w=2
> >
> > Well, that thread started out with a questionable workaround for a
> > hypervisor bug. That may have have influenced the debate about the
> > flag a bit.
> >
> > You can be almost certain that Intel and AMD will not use that
> > reserved bit for anything else. The Linux KVM virtualization business
> > is too important for them. And if Microsoft Hyper-V or VMWare ESX
> > sets that bit as well, this becomes an absolute certainty.
>
> The intel manual says "Not Used, Always returns 0" which is different from
> "reserved", which is stated for other bits.
>
> FTR, jasper@ checked that vmware sets the bit while virtual box does not.
> So, many but not all hypervisors set it.
>
> > I prefer the CPUIDECX_HV name used in the diff you posted in:
>
> OK?
ok kettenis@
> diff --git a/sys/arch/amd64/amd64/identcpu.c b/sys/arch/amd64/amd64/identcpu.c
> --- a/sys/arch/amd64/amd64/identcpu.c
> +++ b/sys/arch/amd64/amd64/identcpu.c
> @@ -129,6 +129,7 @@ const struct {
> { CPUIDECX_AVX, "AVX" },
> { CPUIDECX_F16C, "F16C" },
> { CPUIDECX_RDRAND, "RDRAND" },
> + { CPUIDECX_HV, "HV" },
> }, cpu_ecpuid_ecxfeatures[] = {
> { CPUIDECX_LAHF, "LAHF" },
> { CPUIDECX_CMPLEG, "CMPLEG" },
> diff --git a/sys/arch/amd64/include/specialreg.h
> b/sys/arch/amd64/include/specialreg.h
> --- a/sys/arch/amd64/include/specialreg.h
> +++ b/sys/arch/amd64/include/specialreg.h
> @@ -158,6 +158,7 @@
> #define CPUIDECX_AVX 0x10000000 /* Advanced Vector Extensions */
> #define CPUIDECX_F16C 0x20000000 /* 16bit fp conversion */
> #define CPUIDECX_RDRAND 0x40000000 /* RDRAND instruction */
> +#define CPUIDECX_HV 0x80000000 /* Running on hypervisor */
>
> /*
> * "Structured Extended Feature Flags Parameters" (CPUID function 0x7, leaf
> 0)
>