kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v3] KVM: PPC: Book3E HV: call RECONCILE_IRQ_STATE to sync the software state
@ 2013-10-21  9:49 Tiejun Chen
  2013-10-21  9:56 ` "“tiejun.chen”"
  0 siblings, 1 reply; 2+ messages in thread
From: Tiejun Chen @ 2013-10-21  9:49 UTC (permalink / raw)
  To: agraf; +Cc: scottwood, kvm, kvm-ppc

We enter with interrupts disabled in hardware, but we need to
call SOFT_DISABLE_INTS anyway to ensure that the software state
is kept in sync instead of calling hard_irq_disable() directly.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
v3:

Base on the latest tree, now we can use RECONCILE_IRQ_STATE instead of SOFT_DISABLE_INTS.

v2:

Move SOFT_DISABLE_INTS[1] earlier to avoid clobbering the arguments we want to pass to kvmppc_handle_exit.  

 arch/powerpc/kvm/booke.c              |   11 -----------
 arch/powerpc/kvm/bookehv_interrupts.S |   11 +++++++++++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 15d0149..0d211ff 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -899,17 +899,6 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
 	int s;
 	int idx;
 
-#ifdef CONFIG_PPC64
-	WARN_ON(local_paca->irq_happened != 0);
-#endif
-
-	/*
-	 * We enter with interrupts disabled in hardware, but
-	 * we need to call hard_irq_disable anyway to ensure that
-	 * the software state is kept in sync.
-	 */
-	hard_irq_disable();
-
 	/* update before a new last_exit_type is rewritten */
 	kvmppc_update_timing_stats(vcpu);
 
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index e8ed7d6..4e867b1 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -33,6 +33,8 @@
 
 #ifdef CONFIG_64BIT
 #include <asm/exception-64e.h>
+#include <asm/hw_irq.h>
+#include <asm/irqflags.h>
 #else
 #include "../kernel/head_booke.h" /* for THREAD_NORMSAVE() */
 #endif
@@ -465,6 +467,15 @@ _GLOBAL(kvmppc_resume_host)
 	mtspr	SPRN_EPCR, r3
 	isync
 
+#ifdef CONFIG_64BIT
+	/*
+	 * We enter with interrupts disabled in hardware, but
+	 * we need to call SOFT_DISABLE_INTS anyway to ensure
+	 * that the software state is kept in sync.
+	 */
+	RECONCILE_IRQ_STATE(r3,r5)
+#endif
+
 	/* Switch to kernel stack and jump to handler. */
 	PPC_LL	r3, HOST_RUN(r1)
 	mr	r5, r14 /* intno */
-- 
1.7.9.5

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

* Re: [v3] KVM: PPC: Book3E HV: call RECONCILE_IRQ_STATE to sync the software state
  2013-10-21  9:49 [v3] KVM: PPC: Book3E HV: call RECONCILE_IRQ_STATE to sync the software state Tiejun Chen
@ 2013-10-21  9:56 ` "“tiejun.chen”"
  0 siblings, 0 replies; 2+ messages in thread
From: "“tiejun.chen”" @ 2013-10-21  9:56 UTC (permalink / raw)
  To: agraf; +Cc: scottwood, kvm, kvm-ppc

On 10/21/2013 05:49 PM, Tiejun Chen wrote:
> We enter with interrupts disabled in hardware, but we need to
> call SOFT_DISABLE_INTS anyway to ensure that the software state

OOPS! Here I should change this with RECONCILE_IRQ_STATE :( Please ignore this 
to see next version directly.

Tiejun

> is kept in sync instead of calling hard_irq_disable() directly.
>
> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
> ---
> v3:
>
> Base on the latest tree, now we can use RECONCILE_IRQ_STATE instead of SOFT_DISABLE_INTS.
>
> v2:
>
> Move SOFT_DISABLE_INTS[1] earlier to avoid clobbering the arguments we want to pass to kvmppc_handle_exit.
>
>   arch/powerpc/kvm/booke.c              |   11 -----------
>   arch/powerpc/kvm/bookehv_interrupts.S |   11 +++++++++++
>   2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 15d0149..0d211ff 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -899,17 +899,6 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
>   	int s;
>   	int idx;
>
> -#ifdef CONFIG_PPC64
> -	WARN_ON(local_paca->irq_happened != 0);
> -#endif
> -
> -	/*
> -	 * We enter with interrupts disabled in hardware, but
> -	 * we need to call hard_irq_disable anyway to ensure that
> -	 * the software state is kept in sync.
> -	 */
> -	hard_irq_disable();
> -
>   	/* update before a new last_exit_type is rewritten */
>   	kvmppc_update_timing_stats(vcpu);
>
> diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
> index e8ed7d6..4e867b1 100644
> --- a/arch/powerpc/kvm/bookehv_interrupts.S
> +++ b/arch/powerpc/kvm/bookehv_interrupts.S
> @@ -33,6 +33,8 @@
>
>   #ifdef CONFIG_64BIT
>   #include <asm/exception-64e.h>
> +#include <asm/hw_irq.h>
> +#include <asm/irqflags.h>
>   #else
>   #include "../kernel/head_booke.h" /* for THREAD_NORMSAVE() */
>   #endif
> @@ -465,6 +467,15 @@ _GLOBAL(kvmppc_resume_host)
>   	mtspr	SPRN_EPCR, r3
>   	isync
>
> +#ifdef CONFIG_64BIT
> +	/*
> +	 * We enter with interrupts disabled in hardware, but
> +	 * we need to call SOFT_DISABLE_INTS anyway to ensure
> +	 * that the software state is kept in sync.
> +	 */
> +	RECONCILE_IRQ_STATE(r3,r5)
> +#endif
> +
>   	/* Switch to kernel stack and jump to handler. */
>   	PPC_LL	r3, HOST_RUN(r1)
>   	mr	r5, r14 /* intno */
>

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

end of thread, other threads:[~2013-10-21  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-21  9:49 [v3] KVM: PPC: Book3E HV: call RECONCILE_IRQ_STATE to sync the software state Tiejun Chen
2013-10-21  9:56 ` "“tiejun.chen”"

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).