[PATCH] KVM: IA64: fix fp fault/trap handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi
Please help me to review it.

Best Regards
--yang

>From 9035b13377119cd7019f7e27624491dcb5e1c2d0 Mon Sep 17 00:00:00 2001
From: Yang Zhang <yang.zhang@xxxxxxxxx>
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@xxxxxxxxx>
---
 arch/ia64/kvm/process.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

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;
 	}
 
-- 
1.6.0.rc1


Attachment: 0001-KVM-IA64-fix-fp-fault-trap-handler.patch
Description: 0001-KVM-IA64-fix-fp-fault-trap-handler.patch


[Index of Archives]     [Linux KVM Devel]     [Linux Virtualization]     [Big List of Linux Books]     [Linux SCSI]     [Yosemite Forum]

  Powered by Linux