From owner-freebsd-stable@freebsd.org Thu Dec 29 08:35:46 2016 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1727C96110 for ; Thu, 29 Dec 2016 08:35:46 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D5EB15F4; Thu, 29 Dec 2016 08:35:45 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mh0.gentlemail.de (mh0.gentlemail.de [78.138.80.135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id uBT8Zg48081223; Thu, 29 Dec 2016 09:35:42 +0100 (CET) (envelope-from freebsd@omnilan.de) Received: from titan.inop.mo1.omnilan.net (titan.inop.mo1.omnilan.net [IPv6:2001:a60:f0bb:1::3:1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id 6040D351; Thu, 29 Dec 2016 09:35:42 +0100 (CET) Message-ID: <5864CADD.6020805@omnilan.de> Date: Thu, 29 Dec 2016 09:35:41 +0100 From: Harry Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Alexander Motin CC: FreeBSD Stable Subject: ASM1062 AHCI timeouts, ppt(4) BAR aligning [Was: Re: svn commit: r309251 - head/sys/dev/ahci] References: <201611281623.uASGNWoA056995@repo.freebsd.org> In-Reply-To: <201611281623.uASGNWoA056995@repo.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: ACL 119 matched, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [78.138.80.130]); Thu, 29 Dec 2016 09:35:42 +0100 (CET) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: 78.138.80.135; Sender-helo: mh0.gentlemail.de; ) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 08:35:46 -0000 Bezüglich Alexander Motin's Nachricht vom 28.11.2016 17:23 (localtime): > Author: mav > Date: Mon Nov 28 16:23:32 2016 > New Revision: 309251 > URL: https://svnweb.freebsd.org/changeset/base/309251 > > Log: > Process port interrupt even is PxIS register is zero. > > ASMedia ASM1062 AHCI chips with some fancy firmware handling PMP inside > seems sometimes forgeting to set bits in PxIS, causing command timeouts. > Removal of this check fixes the issue by the theoretical cost of slightly > higher CPU usage in some odd cases, but this is what Linux does too. > > MFC after: 1 month > > Modified: > head/sys/dev/ahci/ahci.c > > Modified: head/sys/dev/ahci/ahci.c > ============================================================================== > --- head/sys/dev/ahci/ahci.c Mon Nov 28 15:14:31 2016 (r309250) > +++ head/sys/dev/ahci/ahci.c Mon Nov 28 16:23:32 2016 (r309251) > @@ -1169,8 +1169,6 @@ ahci_ch_intr(void *arg) > > /* Read interrupt statuses. */ > istatus = ATA_INL(ch->r_mem, AHCI_P_IS); > - if (istatus == 0) > - return; > > mtx_lock(&ch->mtx); > ahci_ch_intr_main(ch, istatus); > @@ -1187,8 +1185,6 @@ ahci_ch_intr_direct(void *arg) > > /* Read interrupt statuses. */ > istatus = ATA_INL(ch->r_mem, AHCI_P_IS); > - if (istatus == 0) > - return; > > mtx_lock(&ch->mtx); > ch->batch = 1; Hello, I'd like to report that this doesn't fix timeouts for me (applied to 11-stable). For example my REV120 works without problems on Intel-AHCI but not on ASM1062-AHCI. Even attaching gives different output. Both look fine at first: # cd0 at ahcich0 bus 0 scbus5 target 0 lun 0 # cd0: Removable CD-ROM SCSI device # cd0: Serial Number 0C1E4D046E5DFF18 # cd0: 150.000MB/s transfers (SATA 1.x, UDMA5, ATAPI 12bytes, PIO 8192bytes) When attached to the Intel-AHCI, it's followed by + cd0: Attempt to query device size failed: NOT READY, Medium not present while attaching to ASM1062 it reads (!?) - cd0: 0MB (1 0 byte sectors) Then these timeouts occur: ahcich7: Timeout on slot 11 port 0 ahcich7: is 00000000 cs 00000c00 ss 00000000 rs 00000c00 tfd 6051 serr 00000000 cmd 0004cb17 ahcich7: Timeout on slot 24 port 0 ahcich7: is 00000000 cs 01800000 ss 00000000 rs 01800000 tfd 2051 serr 00000000 cmd 0004d817 ahcich7: Timeout on slot 6 port 0 ahcich7: is 00000000 cs 00000060 ss 00000000 rs 00000060 tfd 2051 serr 00000000 cmd 0004c617 ahcich7: Timeout on slot 20 port 0 ahcich7: is 00000000 cs 00180000 ss 00000000 rs 00180000 tfd 2051 serr 00000000 cmd 0004d417 Also IDENT (via camcontrol) "hangs" for 20 seconds, but finally succeeds. Btw: I already found out that extending ppt(4) to support unaligned base address register wouldn't be too easy. Initially I added that ASM1062 card to use it for byhve(8) passthrough. Unfortunately that doesn't work: bhyve: passthru device 6/0/0 BAR 5: base 0xc3e10000 or size 0x200 not page aligned That's the ASM1062: ppt0@pci0:6:0:0: class=0x010601 card=0x10601b21 chip=0x06121b21 rev=0x01 hdr=0x00 bar [10] = type I/O Port, range 32, base 0x5050, size 8, enabled bar [14] = type I/O Port, range 32, base 0x5040, size 4, enabled bar [18] = type I/O Port, range 32, base 0x5030, size 8, enabled bar [1c] = type I/O Port, range 32, base 0x5020, size 4, enabled bar [20] = type I/O Port, range 32, base 0x5000, size 32, enabled bar [24] = type Memory, range 32, base 0xc3e10000, size 512, enabled Are there any recommendations for AHCI (SATA-PCIe) controller cards/chips that do work (both, for byhve passthrough and also as plain AHCI provider)? Thanks, -harry