[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <203725e3355d04b0ae6df383481e67636d116b65.camel@infradead.org>
Date: Fri, 15 Aug 2025 10:31:43 +0100
From: David Woodhouse <dwmw2@...radead.org>
To: "Ahmed S. Darwish" <darwi@...utronix.de>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
linux-kernel@...r.kernel.org, Konstantin Belousov <kib@....kiev.ua>, John
Baldwin <jhb@...ebsd.org>, "<cperciva@...snap.com>" <cperciva@...snap.com>
Subject: Re: [PATCH v2] x86/bhyve: Detect FreeBSD Bhyve hypervisor
On Thu, 2025-08-14 at 19:10 +0200, Ahmed S. Darwish wrote:
> On Thu, 14 Aug 2025, David Woodhouse wrote:
> >
> > +static uint32_t __init bhyve_detect(void)
> > +{
> > + if (boot_cpu_data.cpuid_level < 0 ||
> > ...
>
> The CPUID API at <asm/cpuid/api.h> provides a cpuid_feature() macro for
> this. Let's please use that instead.
> I understand that arch/x86/kernel/kvm.c and arch/x86/kernel/jailhouse.c
> does a similar "cpuid_level < 0" check, but they should also be using
> cpuid_feature() instead.
Or just not, in the case of jailhouse and bhyve? Since cpuid_feature()
is hard-coded to true for x86_64 anyway, and they both depend on that
(like acrn, which already only checks for X86_FEATURE_HYPERVISOR).
And anyway, how is X86_FEATURE_HYPERVISOR even going to get set if
there's no CPUID? Can that happen?
Speaking of which, I note detect_hypervisor_vendor does a bunch of
calling into various hypervisor detection routines which are only going
to return immediately because !X86_FEATURE_HYPERVISOR. Should that be
lifted out to a flag like the ignore_nopv flag, so it doesn't need to
bother, and the detection routines don't all need to reimplement the
check differently for themselves?
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5069 bytes)
Powered by blists - more mailing lists