[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <471e1f6b-56eb-281e-155d-3149f6915f81@shipmail.org>
Date: Wed, 28 Aug 2019 09:45:19 +0200
From: Thomas Hellström (VMware)
<thomas_os@...pmail.org>
To: Borislav Petkov <bp@...en8.de>
Cc: linux-kernel@...r.kernel.org, pv-drivers@...are.com,
linux-graphics-maintainer@...are.com,
Thomas Hellstrom <thellstrom@...are.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
dri-devel@...ts.freedekstop.org, Doug Covelli <dcovelli@...are.com>
Subject: Re: [PATCH v2 1/4] x86/vmware: Update platform detection code for
VMCALL/VMMCALL hypercalls
On 8/27/19 2:56 PM, Borislav Petkov wrote:
>
> Also, you could restructure that function something like this to save yourself
> an indentation level or two and make it more easily readable:
>
> static uint32_t __init vmware_platform(void)
> {
> unsigned int hyper_vendor_id[3];
> unsigned int eax;
>
> if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
> if (dmi_available && dmi_name_in_serial("VMware") && __vmware_platform())
> return 1;
Hmm, we're missing a return 0; here. The number of return points and the
moved up variable declarations worries me a little. I'll see if I can
clean this up a bit, but would prefer to make a follow-up patch in that
case.
/Thomas
> }
>
> cpuid(CPUID_VMWARE_INFO_LEAF, &eax, &hyper_vendor_id[0],
> &hyper_vendor_id[1], &hyper_vendor_id[2]);
>
> if (!memcmp(hyper_vendor_id, "VMwareVMware", 12)) {
> if (eax >= CPUID_VMWARE_FEATURES_LEAF)
> vmware_hypercall_mode = vmware_select_hypercall();
>
> pr_info("hypercall mode: 0x%02x\n", (unsigned int) vmware_hypercall_mode);
>
> return CPUID_VMWARE_INFO_LEAF;
> }
> return 0;
> }
>
Powered by blists - more mailing lists