Re: [PATCH 2/4] x86/vmware: Add a header file for hypercall definitions

From: Borislav Petkov
Date: Sun Aug 18 2019 - 16:19:01 EST


On Sun, Aug 18, 2019 at 04:33:14PM +0200, Thomas HellstrÃm (VMware) wrote:
> From: Thomas Hellstrom <thellstrom@xxxxxxxxxx>
>
> This is intended to be used by drivers using the backdoor, and
> we follow the kvm example using alternatives self-patching to
> choose between vmcall, vmmcall and inl instructions.
>
> This patch defines two new x86 cpu feature flags.

Avoid having "This patch" or "This commit" in the commit message. It is
tautologically useless.

Also, do

$ git grep 'This patch' Documentation/process

for more details.

Also, s/cpu/CPU/g in the text.

> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> Cc: <x86@xxxxxxxxxx>
> Signed-off-by: Thomas Hellstrom <thellstrom@xxxxxxxxxx>
> Reviewed-by: Doug Covelli <dcovelli@xxxxxxxxxx>
> ---
> MAINTAINERS | 1 +
> arch/x86/include/asm/cpufeatures.h | 2 ++
> arch/x86/include/asm/vmware.h | 13 +++++++++++++
> 3 files changed, 16 insertions(+)
> create mode 100644 arch/x86/include/asm/vmware.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1bd7b9c2d146..412206747270 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -17203,6 +17203,7 @@ M: "VMware, Inc." <pv-drivers@xxxxxxxxxx>
> L: virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
> S: Supported
> F: arch/x86/kernel/cpu/vmware.c
> +F: arch/x86/include/asm/vmware.h
>
> VMWARE PVRDMA DRIVER
> M: Adit Ranadive <aditr@xxxxxxxxxx>
> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> index 998c2cc08363..69cecc3bc9cb 100644
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@ -232,6 +232,8 @@
> #define X86_FEATURE_VMMCALL ( 8*32+15) /* Prefer VMMCALL to VMCALL */
> #define X86_FEATURE_XENPV ( 8*32+16) /* "" Xen paravirtual guest */
> #define X86_FEATURE_EPT_AD ( 8*32+17) /* Intel Extended Page Table access-dirty bit */
> +#define X86_FEATURE_VMW_VMCALL ( 8*32+18) /* VMware prefers VMCALL hypercall instruction */
> +#define X86_FEATURE_VMW_VMMCALL ( 8*32+19) /* VMware prefers VMMCALL hypercall instruction */

Those are not set anywhere in the patchset. Please send them with their
user.

Then, there already is X86_FEATURE_VMMCALL which you can use too, I'd
guess.

Which would turn the macro into

ALTERNATIVE_2(".byte 0xed", \
".byte 0x0f, 0x01, 0xc1", X86_FEATURE_VMW_VMCALL, \
".byte 0x0f, 0x01, 0xd9", X86_FEATURE_VMMCALL)

and then you end up adding a single new feature bit X86_FEATURE_VMW_VMCALL.

Also, I don't see a reason to show the synthetic bit in /proc/cpuinfo
so when you define it, add "":

#define X86_FEATURE_VMW_VMCALL ( 8*32+18) /* "" VMware prefers VMCALL hypercall instruction */
^
|
|
this here.

Thx.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.