All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] SVM: acknowledge interrupt only after it is taken
@ 2008-12-12 16:48 Alexander Graf
  2008-12-12 16:54 ` Alexander Graf
  2008-12-13 12:33 ` Aurelien Jarno
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Graf @ 2008-12-12 16:48 UTC (permalink / raw)
  To: qemu-devel

SVM specifies that the V_IRQ mask is only to be removed, if the
interrupt that is to be delivered actually is delivered.

As of the SVM rewrite, this mask is always unmasked when the main cpu
loop is processed, leaving a corner case where calling the interrupt
handler causes a #PF. In that case (booting Linux / starting gfxboot)
the current implementation tells the VMM the interrupt is taken, even
though it is not.

This patch modifies the VIRQ unmasking to occur after do_interrupt,
making gfxboot work again.
---
 cpu-exec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cpu-exec.c b/cpu-exec.c
index 9a35a59..981ba86 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -401,11 +401,11 @@ int cpu_exec(CPUState *env1)
                             int intno;
                             /* FIXME: this should respect TPR */
                             svm_check_intercept(SVM_EXIT_VINTR);
-                            env->interrupt_request &= ~CPU_INTERRUPT_VIRQ;
                             intno = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_vector));
                             if (loglevel & CPU_LOG_TB_IN_ASM)
                                 fprintf(logfile, "Servicing virtual hardware INT=0x%02x\n", intno);
                             do_interrupt(intno, 0, 0, 0, 1);
+                            env->interrupt_request &= ~CPU_INTERRUPT_VIRQ;
                             next_tb = 0;
 #endif
                         }
-- 
1.5.6

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

* Re: [Qemu-devel] [PATCH] SVM: acknowledge interrupt only after it is taken
  2008-12-12 16:48 [Qemu-devel] [PATCH] SVM: acknowledge interrupt only after it is taken Alexander Graf
@ 2008-12-12 16:54 ` Alexander Graf
  2008-12-13 12:33 ` Aurelien Jarno
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Graf @ 2008-12-12 16:54 UTC (permalink / raw)
  To: qemu-devel

Alexander Graf wrote:
> SVM specifies that the V_IRQ mask is only to be removed, if the
> interrupt that is to be delivered actually is delivered.
>
> As of the SVM rewrite, this mask is always unmasked when the main cpu
> loop is processed, leaving a corner case where calling the interrupt
> handler causes a #PF. In that case (booting Linux / starting gfxboot)
> the current implementation tells the VMM the interrupt is taken, even
> though it is not.
>
> This patch modifies the VIRQ unmasking to occur after do_interrupt,
> making gfxboot work again.
>   

(wow, I actually forgot that line even though working with git - phew)

Signed-off-by: Alexander Graf <agraf@suse.de>

> ---
>  cpu-exec.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/cpu-exec.c b/cpu-exec.c
> index 9a35a59..981ba86 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -401,11 +401,11 @@ int cpu_exec(CPUState *env1)
>                              int intno;
>                              /* FIXME: this should respect TPR */
>                              svm_check_intercept(SVM_EXIT_VINTR);
> -                            env->interrupt_request &= ~CPU_INTERRUPT_VIRQ;
>                              intno = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_vector));
>                              if (loglevel & CPU_LOG_TB_IN_ASM)
>                                  fprintf(logfile, "Servicing virtual hardware INT=0x%02x\n", intno);
>                              do_interrupt(intno, 0, 0, 0, 1);
> +                            env->interrupt_request &= ~CPU_INTERRUPT_VIRQ;
>                              next_tb = 0;
>  #endif
>                          }
>   

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

* Re: [Qemu-devel] [PATCH] SVM: acknowledge interrupt only after it is taken
  2008-12-12 16:48 [Qemu-devel] [PATCH] SVM: acknowledge interrupt only after it is taken Alexander Graf
  2008-12-12 16:54 ` Alexander Graf
@ 2008-12-13 12:33 ` Aurelien Jarno
  1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2008-12-13 12:33 UTC (permalink / raw)
  To: qemu-devel

On Fri, Dec 12, 2008 at 05:48:41PM +0100, Alexander Graf wrote:
> SVM specifies that the V_IRQ mask is only to be removed, if the
> interrupt that is to be delivered actually is delivered.
> 
> As of the SVM rewrite, this mask is always unmasked when the main cpu
> loop is processed, leaving a corner case where calling the interrupt
> handler causes a #PF. In that case (booting Linux / starting gfxboot)
> the current implementation tells the VMM the interrupt is taken, even
> though it is not.
> 
> This patch modifies the VIRQ unmasking to occur after do_interrupt,
> making gfxboot work again.

Thanks, applied.

> ---
>  cpu-exec.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/cpu-exec.c b/cpu-exec.c
> index 9a35a59..981ba86 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -401,11 +401,11 @@ int cpu_exec(CPUState *env1)
>                              int intno;
>                              /* FIXME: this should respect TPR */
>                              svm_check_intercept(SVM_EXIT_VINTR);
> -                            env->interrupt_request &= ~CPU_INTERRUPT_VIRQ;
>                              intno = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_vector));
>                              if (loglevel & CPU_LOG_TB_IN_ASM)
>                                  fprintf(logfile, "Servicing virtual hardware INT=0x%02x\n", intno);
>                              do_interrupt(intno, 0, 0, 0, 1);
> +                            env->interrupt_request &= ~CPU_INTERRUPT_VIRQ;
>                              next_tb = 0;
>  #endif
>                          }
> -- 
> 1.5.6
> 
> 
> 
> 

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

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

end of thread, other threads:[~2008-12-13 12:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-12 16:48 [Qemu-devel] [PATCH] SVM: acknowledge interrupt only after it is taken Alexander Graf
2008-12-12 16:54 ` Alexander Graf
2008-12-13 12:33 ` Aurelien Jarno

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.