* [RFC PATCH 2/2] ASID: Flush by ASID
@ 2011-01-11 17:55 Wei Wang2
2011-01-12 8:27 ` Jan Beulich
0 siblings, 1 reply; 2+ messages in thread
From: Wei Wang2 @ 2011-01-11 17:55 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
[-- Attachment #1: Type: text/plain, Size: 368 bytes --]
This patch implements flush by asid feature for AMD CPUs.
Thanks,
Wei
Signed-off-by: Wei Huang <wei.huang2@amd.com>
Signed-off-by: Wei Wang <wei.wang2@amd.com>
--
Advanced Micro Devices GmbH
Sitz: Dornach, Gemeinde Aschheim,
Landkreis München Registergericht München,
HRB Nr. 43632
WEEE-Reg-Nr: DE 12919551
Geschäftsführer:
Alberto Bozzo, Andrew Bowd
[-- Attachment #2: flush_by_asid_2.patch --]
[-- Type: text/x-diff, Size: 2180 bytes --]
diff -r 940b8760c604 xen/arch/x86/hvm/svm/asid.c
--- a/xen/arch/x86/hvm/svm/asid.c Tue Jan 11 14:32:25 2011 +0100
+++ b/xen/arch/x86/hvm/svm/asid.c Tue Jan 11 14:55:24 2011 +0100
@@ -26,12 +26,16 @@ void svm_asid_init(struct cpuinfo_x86 *c
void svm_asid_init(struct cpuinfo_x86 *c)
{
int nasids = 0;
+ int svm_features = 0;
/* Check for erratum #170, and leave ASIDs disabled if it's present. */
if ( !cpu_has_amd_erratum(c, AMD_ERRATUM_170) )
nasids = cpuid_ebx(0x8000000A);
-
- hvm_asid_init(nasids, 0);
+
+ /* We can't use cpu_has_flush_by_asid here because svm_feature_flags has
+ * been initialized yet. Use CPUID to find out instead. */
+ svm_features = cpuid_edx(0x8000000A);
+ hvm_asid_init(nasids, svm_features & (1 << SVM_FEATURE_FLUSHBYASID));
}
/*
@@ -42,7 +46,7 @@ asmlinkage void svm_asid_handle_vmrun(vo
{
struct vcpu *curr = current;
struct vmcb_struct *vmcb = curr->arch.hvm_svm.vmcb;
- bool_t need_flush = !!hvm_asid_handle_vmenter();
+ asid_action_t asid_action = hvm_asid_handle_vmenter();
/* ASID 0 indicates that ASIDs are disabled. */
if ( curr->arch.hvm_vcpu.asid == 0 )
@@ -53,7 +57,10 @@ asmlinkage void svm_asid_handle_vmrun(vo
}
vmcb_set_guest_asid(vmcb, curr->arch.hvm_vcpu.asid);
- vmcb->tlb_control = need_flush;
+
+ /* Note: make sure asid_action value returned from hvm_asid_handle_vmenter
+ * matches SVM's definition here. */
+ curr->arch.hvm_svm.vmcb->tlb_control = asid_action;
}
/*
diff -r 940b8760c604 xen/include/asm-x86/hvm/svm/svm.h
--- a/xen/include/asm-x86/hvm/svm/svm.h Tue Jan 11 14:32:25 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/svm.h Tue Jan 11 14:55:24 2011 +0100
@@ -80,6 +80,7 @@ extern u32 svm_feature_flags;
#define cpu_has_svm_svml cpu_has_svm_feature(SVM_FEATURE_SVML)
#define cpu_has_svm_nrips cpu_has_svm_feature(SVM_FEATURE_NRIPS)
#define cpu_has_svm_cleanbits cpu_has_svm_feature(SVM_FEATURE_VMCBCLEAN)
+#define cpu_has_flush_by_asid cpu_has_svm_feature(SVM_FEATURE_FLUSHBYASID)
#define cpu_has_pause_filter cpu_has_svm_feature(SVM_FEATURE_PAUSEFILTER)
#endif /* __ASM_X86_HVM_SVM_H__ */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC PATCH 2/2] ASID: Flush by ASID
2011-01-11 17:55 [RFC PATCH 2/2] ASID: Flush by ASID Wei Wang2
@ 2011-01-12 8:27 ` Jan Beulich
0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2011-01-12 8:27 UTC (permalink / raw)
To: Wei Wang2; +Cc: xen-devel@lists.xensource.com
>>> On 11.01.11 at 18:55, Wei Wang2 <wei.wang2@amd.com> wrote:
>+ /* Note: make sure asid_action value returned from hvm_asid_handle_vmenter
>+ * matches SVM's definition here. */
Probably a good use case for BUILD_BUG_ON()?
>+ curr->arch.hvm_svm.vmcb->tlb_control = asid_action;
Jan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-12 8:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-11 17:55 [RFC PATCH 2/2] ASID: Flush by ASID Wei Wang2
2011-01-12 8:27 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.