From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=35853 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pkds1-00028t-Ty for qemu-devel@nongnu.org; Wed, 02 Feb 2011 09:39:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pkdrl-0007AP-GB for qemu-devel@nongnu.org; Wed, 02 Feb 2011 09:39:42 -0500 Received: from cantor2.suse.de ([195.135.220.15]:38600 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pkdrl-00079q-BA for qemu-devel@nongnu.org; Wed, 02 Feb 2011 09:39:29 -0500 From: Alexander Graf Date: Wed, 2 Feb 2011 15:39:27 +0100 Message-Id: <1296657567-31100-1-git-send-email-agraf@suse.de> In-Reply-To: <1296571892-12702-1-git-send-email-agraf@suse.de> References: <1296571892-12702-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [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: qemu-devel Developers Cc: Kevin Wolf , Joerg Roedel , Sebastian Herbszt 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. 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. Signed-off-by: Alexander Graf --- v2 -> v3: - add comment about the interrupt hack v3 -> v4: - embed non-workaround version in the code --- hw/ide/ahci.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) 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) } } + /* 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 } static void ahci_trigger_irq(AHCIState *s, AHCIDevice *d, -- 1.6.0.2