WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] hvm: merge efer check

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] hvm: merge efer check
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 05 Apr 2010 23:20:22 -0700
Delivery-date: Mon, 05 Apr 2010 23:20:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1270111669 -3600
# Node ID 0bbf5454cd14cbf8631ceb55860ee2643b5c2ea3
# Parent  e5e1e1532b9738f29af947d18e6546d9f0735919
hvm: merge efer check

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff -r e5e1e1532b97 -r 0bbf5454cd14 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Wed Mar 31 10:21:19 2010 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Thu Apr 01 09:47:49 2010 +0100
@@ -583,6 +583,16 @@ static int hvm_save_cpu_ctxt(struct doma
     return 0;
 }
 
+static bool_t hvm_efer_valid(uint64_t value, uint64_t efer_validbits)
+{
+    return !((value & ~efer_validbits) ||
+             ((sizeof(long) != 8) && (value & EFER_LME)) ||
+             (!cpu_has_nx && (value & EFER_NX)) ||
+             (!cpu_has_syscall && (value & EFER_SCE)) ||
+             (!cpu_has_ffxsr && (value & EFER_FFXSE)) ||
+             ((value & (EFER_LME|EFER_LMA)) == EFER_LMA));
+}
+
 static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
 {
     int vcpuid, rc;
@@ -629,13 +639,8 @@ static int hvm_load_cpu_ctxt(struct doma
         return -EINVAL;
     }
 
-    if ( (ctxt.msr_efer & ~(EFER_FFXSE | EFER_LME | EFER_LMA |
-                            EFER_NX | EFER_SCE)) ||
-         ((sizeof(long) != 8) && (ctxt.msr_efer & EFER_LME)) ||
-         (!cpu_has_nx && (ctxt.msr_efer & EFER_NX)) ||
-         (!cpu_has_syscall && (ctxt.msr_efer & EFER_SCE)) ||
-         (!cpu_has_ffxsr && (ctxt.msr_efer & EFER_FFXSE)) ||
-         ((ctxt.msr_efer & (EFER_LME|EFER_LMA)) == EFER_LMA) )
+    if ( !hvm_efer_valid(
+        ctxt.msr_efer, EFER_FFXSE | EFER_LME | EFER_LMA | EFER_NX | EFER_SCE) )
     {
         gdprintk(XENLOG_ERR, "HVM restore: bad EFER 0x%"PRIx64"\n",
                  ctxt.msr_efer);
@@ -984,11 +989,7 @@ int hvm_set_efer(uint64_t value)
 
     value &= ~EFER_LMA;
 
-    if ( (value & ~(EFER_FFXSE | EFER_LME | EFER_NX | EFER_SCE)) ||
-         ((sizeof(long) != 8) && (value & EFER_LME)) ||
-         (!cpu_has_nx && (value & EFER_NX)) ||
-         (!cpu_has_syscall && (value & EFER_SCE)) ||
-         (!cpu_has_ffxsr && (value & EFER_FFXSE)) )
+    if ( !hvm_efer_valid(value, EFER_FFXSE | EFER_LME | EFER_NX | EFER_SCE) )
     {
         gdprintk(XENLOG_WARNING, "Trying to set reserved bit in "
                  "EFER: %"PRIx64"\n", value);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] hvm: merge efer check, Xen patchbot-unstable <=