# 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
|