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/apic: check maxlvt before accessing c

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86/apic: check maxlvt before accessing certain LVT fields
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 17 Jun 2011 23:11:10 +0100
Delivery-date: Fri, 17 Jun 2011 15:13:02 -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 Jan Beulich <jbeulich@xxxxxxxxxx>
# Date 1308165881 -3600
# Node ID 644838dc1322163a49701ddc79e251260d3b39e8
# Parent  a8edfacd4b5e2cecb78d2ff93e57e7efa1bf2db2
x86/apic: check maxlvt before accessing certain LVT fields

This follows Linux, including in not checking maxlvt for certain
accesses to APIC_LVTERR.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---


diff -r a8edfacd4b5e -r 644838dc1322 xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c       Wed Jun 15 20:24:09 2011 +0100
+++ b/xen/arch/x86/apic.c       Wed Jun 15 20:24:41 2011 +0100
@@ -753,7 +753,8 @@
     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);
+    if (maxlvt >= 4)
+        apic_pm_state.apic_lvtpc = apic_read(APIC_LVTPC);
 
     if (maxlvt >= 6) {
         apic_pm_state.apic_lvtcmci = apic_read(APIC_CMCI);
@@ -764,7 +765,8 @@
     apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
     apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
     apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
-    apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
+    if (maxlvt >= 5)
+        apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
 
     local_irq_save(flags);
     disable_local_APIC();
@@ -800,6 +802,7 @@
     else
         resume_x2apic();
 
+    maxlvt = get_maxlvt();
     apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED);
     apic_write(APIC_ID, apic_pm_state.apic_id);
     apic_write(APIC_DFR, apic_pm_state.apic_dfr);
@@ -808,14 +811,15 @@
     apic_write(APIC_SPIV, apic_pm_state.apic_spiv);
     apic_write(APIC_LVT0, apic_pm_state.apic_lvt0);
     apic_write(APIC_LVT1, apic_pm_state.apic_lvt1);
-    apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
+    if (maxlvt >= 5)
+        apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
 
-    maxlvt = get_maxlvt();
     if (maxlvt >= 6) {
         apic_write(APIC_CMCI, apic_pm_state.apic_lvtcmci);
     }
 
-    apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
+    if (maxlvt >= 4)
+        apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
     apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
     apic_write(APIC_TDCR, apic_pm_state.apic_tdcr);
     apic_write(APIC_TMICT, apic_pm_state.apic_tmict);

_______________________________________________
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/apic: check maxlvt before accessing certain LVT fields, Xen patchbot-unstable <=