diff mbox

KVM: IA64: fix fp fault/trap handler

Message ID 706158FABBBA044BAD4FE898A02E4BC21F50E9F0@pdsmsx503.ccr.corp.intel.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Zhang, Xiantao Jan. 15, 2009, 7:39 a.m. UTC
Avi, 
	Please help to commit this patch if no other comments, and queue it for 2.6.29 fixes. Thanks!
Xiantao
 

-----Original Message-----
From: Zhang, Yang 
Sent: Wednesday, January 14, 2009 5:09 PM
To: kvm-ia64@vger.kernel.org
Cc: kvm@vger.kernel.org; Avi Kivity; Zhang, Xiantao
Subject: [PATCH] KVM: IA64: fix fp fault/trap handler

Hi
Please help me to review it.

Best Regards
--yang

From 9035b13377119cd7019f7e27624491dcb5e1c2d0 Mon Sep 17 00:00:00 2001
From: Yang Zhang <yang.zhang@intel.com>
Date: Thu, 8 Jan 2009 15:13:31 +0800
Subject: [PATCH] KVM: IA64: fix fp fault/trap handler

The floating-point registers f6-f11 is used by vmm and
saved in kvm-pt-regs, so should set the correct bit mask 
and the pointer in fp_state, otherwise, fpswa may touch 
vmm's fp registers instead of guests'. 
In addition, for fp trap handling,  since the instruction
which leads to fp trap is completely executed, so can't 
use retry machanism to re-execute it, because it may 
pollute some registers.

Signed-off-by: Yang Zhang <yang.zhang@intel.com>
---
 arch/ia64/kvm/process.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/arch/ia64/kvm/process.c b/arch/ia64/kvm/process.c
index 552d077..c84ef13 100644
--- a/arch/ia64/kvm/process.c
+++ b/arch/ia64/kvm/process.c
@@ -455,13 +455,18 @@  fpswa_ret_t vmm_fp_emulate(int fp_fault, void *bundle, unsigned long *ipsr,
 	if (!vmm_fpswa_interface)
 		return (fpswa_ret_t) {-1, 0, 0, 0};
 
-	/*
-	 * Just let fpswa driver to use hardware fp registers.
-	 * No fp register is valid in memory.
-	 */
 	memset(&fp_state, 0, sizeof(fp_state_t));
 
 	/*
+	 * compute fp_state.  only FP registers f6 - f11 are used by the
+	 * vmm, so set those bits in the mask and set the low volatile
+	 * pointer to point to these registers.
+	 */
+	fp_state.bitmask_low64 = 0xfc0;  /* bit6..bit11 */
+
+	fp_state.fp_state_low_volatile = (fp_state_low_volatile_t *) &regs->f6;
+
+   /* 
 	 * unsigned long (*EFI_FPSWA) (
 	 *      unsigned long    trap_type,
 	 *      void             *Bundle,
@@ -545,10 +550,6 @@  void reflect_interruption(u64 ifa, u64 isr, u64 iim,
 		status = vmm_handle_fpu_swa(0, regs, isr);
 		if (!status)
 			return ;
-		else if (-EAGAIN == status) {
-			vcpu_decrement_iip(vcpu);
-			return ;
-		}
 		break;
 	}