All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Xiantao" <xiantao.zhang@intel.com>
To: "Zhang, Yang" <yang.zhang@intel.com>,
	"kvm-ia64@vger.kernel.org" <kvm-ia64@vger.kernel.org>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>, Avi Kivity <avi@redhat.com>
Subject: RE: [PATCH] KVM: IA64: fix fp fault/trap handler
Date: Thu, 15 Jan 2009 15:39:24 +0800	[thread overview]
Message-ID: <706158FABBBA044BAD4FE898A02E4BC21F50E9F0@pdsmsx503.ccr.corp.intel.com> (raw)
In-Reply-To: <10C63FAD690C13458F0B32BCED571F1403D7491A@pdsmsx502.ccr.corp.intel.com>

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



WARNING: multiple messages have this Message-ID (diff)
From: "Zhang, Xiantao" <xiantao.zhang@intel.com>
To: kvm-ia64@vger.kernel.org
Subject: RE: [PATCH] KVM: IA64: fix fp fault/trap handler
Date: Thu, 15 Jan 2009 07:39:24 +0000	[thread overview]
Message-ID: <706158FABBBA044BAD4FE898A02E4BC21F50E9F0@pdsmsx503.ccr.corp.intel.com> (raw)
In-Reply-To: <10C63FAD690C13458F0B32BCED571F1403D7491A@pdsmsx502.ccr.corp.intel.com>

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



  reply	other threads:[~2009-01-15  7:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14  9:08 [PATCH] KVM: IA64: fix fp fault/trap handler Zhang, Yang
2009-01-14  9:08 ` Zhang, Yang
2009-01-15  7:39 ` Zhang, Xiantao [this message]
2009-01-15  7:39   ` Zhang, Xiantao
2009-01-15 15:20 ` Avi Kivity
2009-01-15 15:20   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=706158FABBBA044BAD4FE898A02E4BC21F50E9F0@pdsmsx503.ccr.corp.intel.com \
    --to=xiantao.zhang@intel.com \
    --cc=avi@redhat.com \
    --cc=kvm-ia64@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=yang.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.