From 0767794e9cf7cc62e46a014140980628d15d719a Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Wed, 22 Aug 2007 13:32:14 +0800
Subject: [PATCH] Fix the updating of PPR after TPR shadow introduced

After TPR Shadow feature introduced, many TPR access won't cause vmexit, so
the ordinary point of catching TPR and updating PPR is insufficient.

This patch updates PPR everytime when possible reading PPR action occurs.

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
 drivers/kvm/lapic.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index 98a3719..b0665fa 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c
@@ -496,6 +496,7 @@ static u32 __apic_read(struct kvm_lapic *apic, unsigned int offset)
 		break;
 
 	default:
+		apic_update_ppr(apic);
 		val = apic_get_reg(apic, offset);
 		break;
 	}
@@ -963,6 +964,7 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu)
 	if (!apic || !apic_enabled(apic))
 		return -1;
 
+	apic_update_ppr(apic);
 	highest_irr = apic_find_highest_irr(apic);
 	if ((highest_irr == -1) ||
 	    ((highest_irr & 0xF0) <= apic_get_reg(apic, APIC_PROCPRI)))
-- 
1.5.2

