[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SA1PR11MB6734E58758C5611087B5E688A8B2A@SA1PR11MB6734.namprd11.prod.outlook.com>
Date: Tue, 14 Nov 2023 06:02:01 +0000
From: "Li, Xin3" <xin3.li@...el.com>
To: "Gao, Chao" <chao.gao@...el.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"seanjc@...gle.com" <seanjc@...gle.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"corbet@....net" <corbet@....net>,
"kys@...rosoft.com" <kys@...rosoft.com>,
"haiyangz@...rosoft.com" <haiyangz@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>,
"Cui, Dexuan" <decui@...rosoft.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"x86@...nel.org" <x86@...nel.org>, "hpa@...or.com" <hpa@...or.com>,
"vkuznets@...hat.com" <vkuznets@...hat.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>
Subject: RE: [PATCH v1 08/23] KVM: VMX: Initialize VMCS FRED fields
> >@@ -1477,6 +1477,18 @@ void vmx_vcpu_load_vmcs(struct kvm_vcpu *vcpu, int
> cpu,
> > (unsigned long)(cpu_entry_stack(cpu) + 1));
> > }
> >
> >+#ifdef CONFIG_X86_64
> >+ /* Per-CPU FRED MSRs */
> >+ if (cpu_feature_enabled(X86_FEATURE_FRED)) {
>
> how about kvm_cpu_cap_has()? to decouple KVM's capability to virtualize a feature
> and host's enabling a feature.
Very likely I guess.
> >+ vmcs_write64(HOST_IA32_FRED_RSP1,
> read_msr(MSR_IA32_FRED_RSP1));
> >+ vmcs_write64(HOST_IA32_FRED_RSP2,
> read_msr(MSR_IA32_FRED_RSP2));
> >+ vmcs_write64(HOST_IA32_FRED_RSP3,
> read_msr(MSR_IA32_FRED_RSP3));
> >+ vmcs_write64(HOST_IA32_FRED_SSP1,
> read_msr(MSR_IA32_FRED_SSP1));
> >+ vmcs_write64(HOST_IA32_FRED_SSP2,
> read_msr(MSR_IA32_FRED_SSP2));
> >+ vmcs_write64(HOST_IA32_FRED_SSP3,
> read_msr(MSR_IA32_FRED_SSP3));
> >+ }
> >+#endif
>
> why is this hunk enclosed in #ifdef CONFIG_X86_64 while the one below isn't?
As if the compiler doesn't complain, I should NOT add it.
>
> >+ if (cpu_feature_enabled(X86_FEATURE_FRED)) {
> >+ vmcs_write64(GUEST_IA32_FRED_CONFIG, 0);
> >+ vmcs_write64(GUEST_IA32_FRED_RSP1, 0);
> >+ vmcs_write64(GUEST_IA32_FRED_RSP2, 0);
> >+ vmcs_write64(GUEST_IA32_FRED_RSP3, 0);
> >+ vmcs_write64(GUEST_IA32_FRED_STKLVLS, 0);
> >+ vmcs_write64(GUEST_IA32_FRED_SSP1, 0);
> >+ vmcs_write64(GUEST_IA32_FRED_SSP2, 0);
> >+ vmcs_write64(GUEST_IA32_FRED_SSP3, 0);
> >+ }
> >+
>
> move this hunk to __vmx_vcpu_reset() because FRED spec says
>
> "INIT does not change the value of the new MSRs."
>
Yeah, will do.
Powered by blists - more mailing lists