Wei Huang
2011-Apr-14 20:39 UTC
[Xen-devel] [PATCH][RFC] FPU LWP 4/5: enable LWP for SVM guest
This patch enables LWP support for SVM guests. It saves and restores LWP_CFG MSRs on each VCPU context switch. Additionally it handles LWP CPUIDs and MSRs. Signed-off-by: Wei Huang <wei.huang2@amd.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jan Beulich
2011-Apr-15 09:17 UTC
Re: [Xen-devel] [PATCH][RFC] FPU LWP 4/5: enable LWP for SVM guest
>>> On 14.04.11 at 22:39, Wei Huang <wei.huang2@amd.com> wrote: >+static void svm_lwp_save(struct vcpu *v) >+{ >+ if ( cpu_has_lwp ) >+ { >+ rdmsrl(MSR_AMD64_LWP_CFG, v->arch.hvm_svm.guest_lwp_cfg); >+ wrmsrl(MSR_AMD64_LWP_CFG, 0x0); >+ /* Disable LWP for next VCPU */ >+ wrmsrl(MSR_AMD64_LWP_CBADDR, 0x0); >+ } >+} >+ >+static void svm_lwp_load(struct vcpu *v) >+{ >+ if ( cpu_has_lwp ) >+ { >+ /* Only LWP_CFG is reloaded. LWP_CBADDR will be reloaded via xrstor */ >+ wrmsrl(MSR_AMD64_LWP_CFG, v->arch.hvm_svm.guest_lwp_cfg); >+ } >+}I think I had pointed this out before - to avoid these MSR accesses for guests not using LWP, you should track whether the vCPU has LWP support enabled (e.g. non-zero written into LWP_CFG) and key off of that instead of cpu_has_lwp. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel