Re: [PATCH v4] x86/bhyve: Detect FreeBSD Bhyve hypervisor

From: Borislav Petkov
Date: Mon Aug 18 2025 - 06:39:26 EST


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

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);
}

--
Regards/Gruss,
Boris.

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