[v3,06/21] KVM:x86: Report XSS as to-be-saved if there are supported features

Message ID 20230511040857.6094-7-weijiang.yang@intel.com
State New
Headers
Series Enable CET Virtualization |

Commit Message

Yang, Weijiang May 11, 2023, 4:08 a.m. UTC
  From: Sean Christopherson <sean.j.christopherson@intel.com>

Add MSR_IA32_XSS to the list of MSRs reported to userspace if
supported_xss is non-zero, i.e. KVM supports at least one XSS based
feature.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Weijiang <weijiang.yang@intel.com>
---
 arch/x86/kvm/x86.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Chao Gao May 24, 2023, 7:06 a.m. UTC | #1
On Thu, May 11, 2023 at 12:08:42AM -0400, Yang Weijiang wrote:
>From: Sean Christopherson <sean.j.christopherson@intel.com>
>
>Add MSR_IA32_XSS to the list of MSRs reported to userspace if
>supported_xss is non-zero, i.e. KVM supports at least one XSS based
>feature.

The changelog doesn't match what the patch does.

Do you need to check if supported_xss is non-zero in kvm_probe_msr_to_save(),
e.g.,
        case MSR_IA32_XSS:
                if (!kvm_caps.supported_xss)
                        return;
                break;

>
>Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
>Signed-off-by: Yang Weijiang <weijiang.yang@intel.com>
>---
> arch/x86/kvm/x86.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>index e7f78fe79b32..33a780fe820b 100644
>--- a/arch/x86/kvm/x86.c
>+++ b/arch/x86/kvm/x86.c
>@@ -1454,6 +1454,7 @@ static const u32 msrs_to_save_base[] = {
> 	MSR_IA32_UMWAIT_CONTROL,
> 
> 	MSR_IA32_XFD, MSR_IA32_XFD_ERR,
>+	MSR_IA32_XSS,
> };
> 
> static const u32 msrs_to_save_pmu[] = {
>-- 
>2.27.0
>
  
Yang, Weijiang May 24, 2023, 8:19 a.m. UTC | #2
On 5/24/2023 3:06 PM, Chao Gao wrote:
> On Thu, May 11, 2023 at 12:08:42AM -0400, Yang Weijiang wrote:
>> From: Sean Christopherson <sean.j.christopherson@intel.com>
>>
>> Add MSR_IA32_XSS to the list of MSRs reported to userspace if
>> supported_xss is non-zero, i.e. KVM supports at least one XSS based
>> feature.
> The changelog doesn't match what the patch does.
>
> Do you need to check if supported_xss is non-zero in kvm_probe_msr_to_save(),
> e.g.,
>          case MSR_IA32_XSS:
>                  if (!kvm_caps.supported_xss)
>                          return;
>                  break;

I looked back the history of this patch, there's similar check 
originally, however it's lost

during following rebases. I'll add it back. Thanks for pointing it out!

>> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
>> Signed-off-by: Yang Weijiang <weijiang.yang@intel.com>
>> ---
>> arch/x86/kvm/x86.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index e7f78fe79b32..33a780fe820b 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -1454,6 +1454,7 @@ static const u32 msrs_to_save_base[] = {
>> 	MSR_IA32_UMWAIT_CONTROL,
>>
>> 	MSR_IA32_XFD, MSR_IA32_XFD_ERR,
>> +	MSR_IA32_XSS,
>> };
>>
>> static const u32 msrs_to_save_pmu[] = {
>> -- 
>> 2.27.0
>>
  

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e7f78fe79b32..33a780fe820b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1454,6 +1454,7 @@  static const u32 msrs_to_save_base[] = {
 	MSR_IA32_UMWAIT_CONTROL,
 
 	MSR_IA32_XFD, MSR_IA32_XFD_ERR,
+	MSR_IA32_XSS,
 };
 
 static const u32 msrs_to_save_pmu[] = {