[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fd16797c-b80f-c414-a731-0b9b73a3732e@redhat.com>
Date: Fri, 10 Dec 2021 17:02:49 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Yang Zhong <yang.zhong@...el.com>, x86@...nel.org,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com
Cc: seanjc@...gle.com, jun.nakajima@...el.com, kevin.tian@...el.com,
jing2.liu@...ux.intel.com, jing2.liu@...el.com
Subject: Re: [PATCH 10/19] kvm: x86: Emulate WRMSR of guest IA32_XFD
First, the MSR should be added to msrs_to_save_all and
kvm_cpu_cap_has(X86_FEATURE_XFD) should be checked in kvm_init_msr_list.
It seems that RDMSR support is missing, too.
More important, please include:
- documentation for the new KVM_EXIT_* value
- a selftest that explains how userspace should react to it.
This is a strong requirement for any new API (the first has been for
years; but the latter is also almost always respected these days). This
series should not have been submitted without documentation.
Also:
On 12/8/21 01:03, Yang Zhong wrote:
>
> + if (!guest_cpuid_has(vcpu, X86_FEATURE_XFD))
> + return 1;
This should allow msr->host_initiated always (even if XFD is not part of
CPUID). However, if XFD is nonzero and kvm_check_guest_realloc_fpstate
returns true, then it should return 1.
The selftest should also cover using KVM_GET_MSR/KVM_SET_MSR.
> + /* Setting unsupported bits causes #GP */
> + if (~XFEATURE_MASK_USER_DYNAMIC & data) {
> + kvm_inject_gp(vcpu, 0);
> + break;
> + }
This should check
if (data & ~(XFEATURE_MASK_USER_DYNAMIC &
vcpu->arch.guest_supported_xcr0))
instead.
Paolo
Powered by blists - more mailing lists