Received: from [140.186.70.92] (port=38528 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pkwe4-0005D2-8O for qemu-devel@nongnu.org; Thu, 03 Feb 2011 05:42:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PkwaL-0006aZ-Ji for qemu-devel@nongnu.org; Thu, 03 Feb 2011 05:38:46 -0500 Received: from cantor.suse.de ([195.135.220.2]:35702 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PkwaL-0006aM-Ap for qemu-devel@nongnu.org; Thu, 03 Feb 2011 05:38:45 -0500 Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <4D4A83B6.3030007@siemens.com> Date: Thu, 3 Feb 2011 11:38:41 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <4286FBFA-E222-4F74-80F3-DAFAAB0AABAC@suse.de> References: <1296571892-12702-1-git-send-email-agraf@suse.de> <1296657567-31100-1-git-send-email-agraf@suse.de> <4D4A83B6.3030007@siemens.com> Subject: [Qemu-devel] Re: [PATCH 7/7] ahci: work around bug with level interrupts List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Kevin Wolf , Joerg Roedel , qemu-devel Developers , Sebastian Herbszt On 03.02.2011, at 11:30, Jan Kiszka wrote: > On 2011-02-02 15:39, Alexander Graf wrote: >> When using level based interrupts, the interrupt is treated the same = as an >> edge triggered one: leaving the line up does not retrigger the = interrupt. >>=20 >> In fact, when not lowering the line, we won't ever get a new = interrupt inside >> the guest. So let's always retrigger an interrupt as soon as the OS = ack'ed >> something on the device. This way we're sure the guest doesn't starve = on >> interrupts until someone fixes the actual interrupt path. >>=20 >> Signed-off-by: Alexander Graf >>=20 >> --- >>=20 >> v2 -> v3: >>=20 >> - add comment about the interrupt hack >>=20 >> v3 -> v4: >>=20 >> - embed non-workaround version in the code >> --- >> hw/ide/ahci.c | 13 +++++++++++++ >> 1 files changed, 13 insertions(+), 0 deletions(-) >>=20 >> diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c >> index 98bdf70..10377ca 100644 >> --- a/hw/ide/ahci.c >> +++ b/hw/ide/ahci.c >> @@ -152,12 +152,25 @@ static void ahci_check_irq(AHCIState *s) >> } >> } >>=20 >> + /* XXX We always lower the interrupt line here because of a bug = with >> + interrupt handling in Qemu. When leaving a line up, the = interrupt >> + does not get retriggered automatically currently. Once = that bug is >> + fixed, this workaround is not necessary anymore and we = only need to >> + lower in the else branch. */ >> +#if 0 >> if (s->control_regs.irqstatus && >> (s->control_regs.ghc & HOST_CTL_IRQ_EN)) { >> ahci_irq_raise(s, NULL); >> } else { >> ahci_irq_lower(s, NULL); >> } >> +#else >> + ahci_irq_lower(s, NULL); >> + if (s->control_regs.irqstatus && >> + (s->control_regs.ghc & HOST_CTL_IRQ_EN)) { >> + ahci_irq_raise(s, NULL); >> + } >> +#endif >> } >>=20 >> static void ahci_trigger_irq(AHCIState *s, AHCIDevice *d, >=20 > Could you check if this quick-hack obsoletes the above hack? >=20 > I was hoping it has some influence on our 64-bit Windows issue, but it > hasn't, or it's still buggy, or both. However, its intention is to > reassert still pending level-triggered IRQs on APIC EOI. This logic is > missing in the user space model but exists in KVM's kernel model (I = was > asking for a test against the latter but unfortunately did not receive > an answer - I bet you already don't need your patch over qemu-kvm). Oh, sorry for not replying there. I work on qemu.git, so the in-kernel = apic is out of question for testing. I tried merging qemu-kvm.git and = qemu.git several times and every time just wasted a few hours of my = life, so I gave up on testing things on qemu-kvm.git. The patch works though. If everybody agrees to take it, we can drop = patch 7/7 of my ahci set. Alex