From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R31kl-0005wM-T5 for qemu-devel@nongnu.org; Mon, 12 Sep 2011 04:20:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R31kk-0002Ts-In for qemu-devel@nongnu.org; Mon, 12 Sep 2011 04:20:31 -0400 Received: from mail-bw0-f45.google.com ([209.85.214.45]:61120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R31kk-0002Tn-DL for qemu-devel@nongnu.org; Mon, 12 Sep 2011 04:20:30 -0400 Received: by bkbzv15 with SMTP id zv15so2012382bkb.4 for ; Mon, 12 Sep 2011 01:20:29 -0700 (PDT) Sender: Alexander Motin Message-ID: <4E6DC08D.3010507@FreeBSD.org> Date: Mon, 12 Sep 2011 11:19:25 +0300 From: Alexander Motin MIME-Version: 1.0 References: <4E6CC92F.30407@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] AHCI Port Interrupt Enable register cleaning on soft reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Kevin Wolf , "qemu-devel@nongnu.org" Alexander Graf wrote: > Am 11.09.2011 um 16:43 schrieb Alexander Motin : >> I've found that FreeBSD AHCI driver doesn't work with AHCI hardware >> emulation of QEMU 0.15.0. I believe the problem is on QEMU's side. As I >> see, it clears port's Interrupt Enable register each time when reset of >> any level happens. Is is reasonable for the global controller reset. It >> is probably not good, but acceptable for FreeBSD driver for the port >> hard reset. But it is IMO wrong for the device soft reset. None of real >> hardware I know behaves that way. >> >> This patch fixes the problem for me: >> http://people.freebsd.org/~mav/qemu.ahci.patch > > Ah, cool! So FreeBSD works with AHCI using this patch? Yes. I haven't done deep testing to guarantee there is no other issues, but at least disk is properly detected now. > Please send it again as an inline patch (if really really hard not 100% important) and add a signed-off-by line (very important) to the patch. OK. Here it is: Signed-off-by: Alexander Motin --- hw/ide/ahci.c.prev 2011-09-11 16:39:53.000000000 +0300 +++ hw/ide/ahci.c 2011-09-11 16:39:48.000000000 +0300 @@ -505,10 +505,7 @@ static void ahci_reset_port(AHCIState *s ide_bus_reset(&d->port); ide_state->ncq_queues = AHCI_MAX_CMDS; - pr->irq_stat = 0; - pr->irq_mask = 0; pr->scr_stat = 0; - pr->scr_ctl = 0; pr->scr_err = 0; pr->scr_act = 0; d->busy_slot = -1; @@ -1157,12 +1154,17 @@ void ahci_uninit(AHCIState *s) void ahci_reset(void *opaque) { struct AHCIPCIState *d = opaque; + AHCIPortRegs *pr; int i; d->ahci.control_regs.irqstatus = 0; d->ahci.control_regs.ghc = 0; for (i = 0; i < d->ahci.ports; i++) { + pr = &d->ahci.dev[i].port_regs; + pr->irq_stat = 0; + pr->irq_mask = 0; + pr->scr_ctl = 0; ahci_reset_port(&d->ahci, i); } } -- Alexander Motin