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] x86: Some cleanups for apic_write, apic_r

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: Some cleanups for apic_write, apic_read, apic_wrmsr, apic_rdmsr
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 07 Sep 2009 06:35:19 -0700
Delivery-date: Mon, 07 Sep 2009 06:35:39 -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 1252327897 -3600
# Node ID 26bdf05cb7ae23ab0bfa3f66f8406ec5d784c85f
# Parent  3cfa9a6a3168cd21681f29eb124d574f8e507cc2
x86: Some cleanups for apic_write, apic_read, apic_wrmsr, apic_rdmsr

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
---
 xen/arch/x86/apic.c        |    9 ++++-----
 xen/include/asm-x86/apic.h |    9 +++++++++
 2 files changed, 13 insertions(+), 5 deletions(-)

diff -r 3cfa9a6a3168 -r 26bdf05cb7ae xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c       Mon Sep 07 13:51:19 2009 +0100
+++ b/xen/arch/x86/apic.c       Mon Sep 07 13:51:37 2009 +0100
@@ -627,8 +627,7 @@ int lapic_suspend(void)
     apic_pm_state.apic_id = apic_read(APIC_ID);
     apic_pm_state.apic_taskpri = apic_read(APIC_TASKPRI);
     apic_pm_state.apic_ldr = apic_read(APIC_LDR);
-    if ( !x2apic_enabled )
-        apic_pm_state.apic_dfr = apic_read(APIC_DFR);
+    apic_pm_state.apic_dfr = apic_read(APIC_DFR);
     apic_pm_state.apic_spiv = apic_read(APIC_SPIV);
     apic_pm_state.apic_lvtt = apic_read(APIC_LVTT);
     apic_pm_state.apic_lvtpc = apic_read(APIC_LVTPC);
@@ -654,7 +653,7 @@ int lapic_resume(void)
 {
     unsigned int l, h;
     unsigned long flags;
-    int maxlvt = get_maxlvt();
+    int maxlvt;
 
     if (!apic_pm_state.active)
         return 0;
@@ -679,8 +678,7 @@ int lapic_resume(void)
 
     apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED);
     apic_write(APIC_ID, apic_pm_state.apic_id);
-    if ( !x2apic_enabled )
-        apic_write(APIC_DFR, apic_pm_state.apic_dfr);
+    apic_write(APIC_DFR, apic_pm_state.apic_dfr);
     apic_write(APIC_LDR, apic_pm_state.apic_ldr);
     apic_write(APIC_TASKPRI, apic_pm_state.apic_taskpri);
     apic_write(APIC_SPIV, apic_pm_state.apic_spiv);
@@ -688,6 +686,7 @@ int lapic_resume(void)
     apic_write(APIC_LVT1, apic_pm_state.apic_lvt1);
     apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
 
+    maxlvt = get_maxlvt();
     if (maxlvt >= 6) {
         apic_write(APIC_CMCI, apic_pm_state.apic_lvtcmci);
     }
diff -r 3cfa9a6a3168 -r 26bdf05cb7ae xen/include/asm-x86/apic.h
--- a/xen/include/asm-x86/apic.h        Mon Sep 07 13:51:19 2009 +0100
+++ b/xen/include/asm-x86/apic.h        Mon Sep 07 13:51:37 2009 +0100
@@ -77,6 +77,10 @@ static __inline u32 apic_mem_read(unsign
 
 static __inline void apic_wrmsr(unsigned long reg, u32 low, u32 high)
 {
+    if (reg == APIC_DFR || reg == APIC_ID || reg == APIC_LDR ||
+        reg == APIC_LVR)
+        return;
+
     __asm__ __volatile__("wrmsr"
             : /* no outputs */
             : "c" (APIC_MSR_BASE + (reg >> 4)), "a" (low), "d" (high));
@@ -84,6 +88,11 @@ static __inline void apic_wrmsr(unsigned
 
 static __inline void apic_rdmsr(unsigned long reg, u32 *low, u32 *high)
 {
+    if (reg == APIC_DFR)
+    {
+        *low = *high = -1u;
+        return;
+    }
     __asm__ __volatile__("rdmsr"
             : "=a" (*low), "=d" (*high)
             : "c" (APIC_MSR_BASE + (reg >> 4)));

_______________________________________________
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] x86: Some cleanups for apic_write, apic_read, apic_wrmsr, apic_rdmsr, Xen patchbot-unstable <=