All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: IA64: fix fp fault/trap handler
@ 2009-01-14  9:08 ` Zhang, Yang
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Yang @ 2009-01-14  9:08 UTC (permalink / raw)
  To: kvm-ia64

[-- Attachment #1: Type: text/plain, Size: 2050 bytes --]

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



[-- Attachment #2: 0001-KVM-IA64-fix-fp-fault-trap-handler.patch --]
[-- Type: application/octet-stream, Size: 1928 bytes --]

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] KVM: IA64: fix fp fault/trap handler
@ 2009-01-14  9:08 ` Zhang, Yang
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Yang @ 2009-01-14  9:08 UTC (permalink / raw)
  To: kvm-ia64@vger.kernel.org; +Cc: kvm@vger.kernel.org, Avi Kivity, Zhang, Xiantao

[-- Attachment #1: Type: text/plain, Size: 2051 bytes --]

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



[-- Attachment #2: 0001-KVM-IA64-fix-fp-fault-trap-handler.patch --]
[-- Type: application/octet-stream, Size: 1928 bytes --]

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH] KVM: IA64: fix fp fault/trap handler
  2009-01-14  9:08 ` Zhang, Yang
@ 2009-01-15  7:39   ` Zhang, Xiantao
  -1 siblings, 0 replies; 6+ messages in thread
From: Zhang, Xiantao @ 2009-01-15  7:39 UTC (permalink / raw)
  To: kvm-ia64

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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH] KVM: IA64: fix fp fault/trap handler
@ 2009-01-15  7:39   ` Zhang, Xiantao
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Xiantao @ 2009-01-15  7:39 UTC (permalink / raw)
  To: Zhang, Yang, kvm-ia64@vger.kernel.org; +Cc: kvm@vger.kernel.org, Avi Kivity

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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: IA64: fix fp fault/trap handler
  2009-01-14  9:08 ` Zhang, Yang
@ 2009-01-15 15:20   ` Avi Kivity
  -1 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2009-01-15 15:20 UTC (permalink / raw)
  To: kvm-ia64

Zhang, Yang wrote:
> 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.
>
>   

Applied and queued, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: IA64: fix fp fault/trap handler
@ 2009-01-15 15:20   ` Avi Kivity
  0 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2009-01-15 15:20 UTC (permalink / raw)
  To: Zhang, Yang; +Cc: kvm-ia64@vger.kernel.org, kvm@vger.kernel.org, Zhang, Xiantao

Zhang, Yang wrote:
> 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.
>
>   

Applied and queued, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-01-15 15:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-01-15  7:39   ` Zhang, Xiantao
2009-01-15 15:20 ` Avi Kivity
2009-01-15 15:20   ` Avi Kivity

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.