From owner-freebsd-current@FreeBSD.ORG Sun Sep 11 15:07:57 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B083106564A; Sun, 11 Sep 2011 15:07:57 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8B58D8FC13; Sun, 11 Sep 2011 15:07:55 +0000 (UTC) Received: by fxg9 with SMTP id 9so375659fxg.13 for ; Sun, 11 Sep 2011 08:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=SyTRUo66dSLcWeB9wqYZYokW2+fcqWuPckVgkDHaseg=; b=fiqX8M5smvKPm5EbrlRnJAMCLFrxTLOh1oQNofItULdK7ay9z6dZRQTIzw+jirgdNO RlAQq+HOmlgw8vvgJorQfuArFRjvN7opFtjHmRSZswnYPCZyWrC01hvxKtn+B36N9KKw vR17y63S9gAlUOPNuoG/tsH8qs/xtaZP0hu+s= Received: by 10.223.88.83 with SMTP id z19mr121114fal.11.1315751904398; Sun, 11 Sep 2011 07:38:24 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id d23sm6553816fam.4.2011.09.11.07.38.22 (version=SSLv3 cipher=OTHER); Sun, 11 Sep 2011 07:38:22 -0700 (PDT) Sender: Alexander Motin Message-ID: <4E6CC7C1.9050102@FreeBSD.org> Date: Sun, 11 Sep 2011 17:37:53 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:6.0.2) Gecko/20110910 Thunderbird/6.0.2 MIME-Version: 1.0 To: Andriy Gapon References: <4E632972.7080409@FreeBSD.org> In-Reply-To: <4E632972.7080409@FreeBSD.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=x-viet-vps Content-Transfer-Encoding: 7bit Cc: FreeBSD-Current Subject: Re: ahci doesn't work with qemu emulation X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2011 15:07:57 -0000 Hi. On 04.09.2011 10:32, Andriy Gapon wrote: > ahcich0: Timeout on slot 0 port 0 > ahcich0: is 00000005 cs 00000000 ss 00000000 rs 00000001 tfd 50 serr 00000000 > cmd 1000c017 > ahcich0: AHCI reset... > ahcich0: SATA connect time=0us status=00000113 > ahcich0: AHCI reset: device found > ahcich0: AHCI reset: device ready after 0ms > (aprobe0:ahcich0:0:0:0): ATA_IDENTIFY. ACB: ec 00 00 00 00 40 00 00 00 00 00 00 > (aprobe0:ahcich0:0:0:0): CAM status: Command timeout > (aprobe0:ahcich0:0:0:0): SIGNATURE: 0000 > > I guess that this is a problem with the emulation - some unsupported command or > reliance on some specific behavior of a driver (e.g. a Linux driver), but still > would be nice to have it working for testing / experimentation purposes. > > Example of how a disk behind an AHCI controller can be specified to qemu-devel: > qemu-system-x86_64 ... -drive id=disk,file=disk.img,if=none -device ahci,id=ahci > -device ide-drive,drive=disk,bus=ahci.0 I've reproduced the problem. I believe the problem is in QEMU's AHCI emulation. 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 our 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 to QEMU fixes the problem for me: http://people.freebsd.org/~mav/qemu.ahci.patch This patch workarounds the problem from the FreeBSD side: http://people.freebsd.org/~mav/qemu.ahci.freebsd.patch , but I would prefer to see problem solved from the QEMU side. -- Alexander Motin