[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <75aa80eeecb66050d80c2c6a793c6c20fab22a0f.camel@gmail.com>
Date: Tue, 22 Apr 2025 18:58:10 +0200
From: Francesco Lavra <francescolavra.fl@...il.com>
To: zack.rusin@...adcom.com
Cc: bp@...en8.de, dave.hansen@...ux.intel.com, doug.covelli@...adcom.com,
hpa@...or.com, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
mingo@...hat.com, pbonzini@...hat.com, seanjc@...gle.com,
tglx@...utronix.de, x86@...nel.org
Subject: Re: [PATCH v2 1/5] KVM: x86: Centralize KVM's VMware code
On 2025-04-22 at 16:12, Zack Rusin wrote:
> Centralize KVM's VMware specific code and introduce CONFIG_KVM_VMWARE
> to
> isolate all of it.
>
> Code used to support VMware backdoor has been scattered around the
> KVM
> codebase making it difficult to reason about, maintain it and change
> it. Introduce CONFIG_KVM_VMWARE which, much like CONFIG_KVM_XEN and
> CONFIG_KVM_VMWARE for Xen and Hyper-V, abstracts away VMware specific
s/CONFIG_KVM_VMWARE/CONFIG_KVM_HYPERV/
> +static inline bool kvm_vmware_is_backdoor_opcode(u8 opcode_len, u8
> b)
> +{
> + switch (opcode_len) {
> + case 1:
> + switch (b) {
> + case 0xe4: /* IN */
> + case 0xe5:
> + case 0xec:
> + case 0xed:
> + case 0xe6: /* OUT */
> + case 0xe7:
> + case 0xee:
> + case 0xef:
> + case 0x6c: /* INS */
> + case 0x6d:
> + case 0x6e: /* OUTS */
> + case 0x6f:
> + return true;
> + }
> + break;
> + case 2:
> + switch (b) {
> + case 0x33: /* RDPMC */
> + return true;
> + }
> + break;
> + }
> +
> + return false;
> +}
> +
> +#else /* !CONFIG_KVM_VMWARE */
> +
> +static inline bool kvm_vmware_backdoor_enabled(struct kvm_vcpu
> *vcpu)
> +{
> + return false;
> +}
> +
> +static inline bool kvm_vmware_is_backdoor_pmc(u32 pmc_idx)
> +{
> + return false;
> +}
> +
> +static inline bool kvm_vmware_io_port_allowed(u16 port)
> +{
> + return false;
> +}
> +
> +static inline int kvm_vmware_pmu_rdpmc(struct kvm_vcpu *vcpu, u32
> idx, u64 *data)
> +{
> + return 0;
> +}
> +
> +static inline bool kvm_vmware_is_backdoor_opcode(u8 opcode_len, u8
> len)
Nit: even though this is just a dummy function, its second parameter
`len` appears misnamed and for consistency should be named the same as
in the CONFIG_KVM_VMWARE function, i.e. `b`.
Powered by blists - more mailing lists