Re: [PATCH v4] x86/bhyve: Detect FreeBSD Bhyve hypervisor
From: David Woodhouse
Date: Mon Aug 18 2025 - 07:03:41 EST
On Mon, 2025-08-18 at 12:38 +0200, Borislav Petkov wrote:
> On Sat, Aug 16, 2025 at 11:06:32AM +0100, David Woodhouse wrote:
> > +static uint32_t bhyve_features(void)
> > +{
> > + if (bhyve_cpuid_max < bhyve_cpuid_base | CPUID_BHYVE_FEATURES)
>
> Forgot those parentheses again:
>
> arch/x86/kernel/cpu/bhyve.c: In function ‘bhyve_features’:
> arch/x86/kernel/cpu/bhyve.c:42:29: warning: suggest parentheses around comparison in operand of ‘|’ [-Wparentheses]
> 42 | if (bhyve_cpuid_max < bhyve_cpuid_base | CPUID_BHYVE_FEATURES)
> |
>
> Tztztz.
>
> :-P
Doh! I actually just sent v3 again by accident. In v4 I had also
dropped the comment in bhyve_x2apic_available() since I'm not sure it's
true and it doesn't actually matter. But that's only cosmetic.
> I did the below. Ok?
>
> static uint32_t bhyve_features(void)
> {
> unsigned int cpuid_leaf = bhyve_cpuid_base | CPUID_BHYVE_FEATURES;
>
> if (bhyve_cpuid_max < cpuid_leaf)
> return 0;
>
> return cpuid_eax(cpuid_leaf);
> }
>
Looks good, thanks.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature