From nobody Tue Feb 14 23:17:57 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PGcZG1xTQz3qNyr; Tue, 14 Feb 2023 23:17:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PGcZG1R1nz4P7X; Tue, 14 Feb 2023 23:17:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676416678; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vfQPRGIXbEtqqtX8XCRw3iUx73gVndtNfx9EctQSnBw=; b=PIgHDPy4KOXh0z7Px8tGI3fCmzum8Rm3gWoQwgdpdJ1rSRvGPJahW9/1jQKtZwuGNWFAZS 7jYu+BWv3u4wuZPeGUplBGorMjWgNOLJ00Af/CNaCpGUhklsmgyYExMnhLBC90a1/Aqe88 DTb3IrdwznHyGpPTR4tElBFjfJobpqqsPHh+JXOlQjQTWAbYEkinbXNqTh5F/NR6sAWuk4 Uz4t9GcX98RXOHMJN7wj5UymE3f1VVpNuOsnwx9wg6Cund2wJiQE1xd/2/ZuysffLdrSuO b4F7FaXJ67lJpTHhu4kmcvK7jRwJn1tXneMwQjjMWOSAwnVv10eCptmAdNUw7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676416678; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vfQPRGIXbEtqqtX8XCRw3iUx73gVndtNfx9EctQSnBw=; b=OkmpVFcP0Jw4paRfoEYy9hbtBvCo19kAj5TJQT3UJLExorMy1pjOARRKex39Fj/bHtQpVC PTQRBLb5V60mFbG9Vh4XltN2DPCGe+R6CtFLUlnZS4+w3HeCbRW9nsEE7+3d8QOxnhw2uH B5o9b8j73G0fXV/olREi4djC/dkxaPn6LFzNA3HXAhbeyIffGNZlyu6LWQnPI/Ut+jQI6A GlvPjpN4pDZwYyFvg+cw5cLzs81mxKzNlhSXruoe1gBmivjWsjfjKrY/bIQYmmHldxjkzp NluVWZa32+OEeim0yCrVyTcjav7NHMsDNDnw3JQCsgY7ZdqvLBvrUBMKo1h2yw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676416678; a=rsa-sha256; cv=none; b=nAZbvWkA4bW9ZB/TROvIgiWwrJ7Lq3/Y8TLhcGv1GRlQ1YWFRiMJGjjdZT8sxoV6phx/YS Xx89m65a0bshVsU6/tvPwB55oa9yDAx9HfaYb1Q+SujKEJGAOx2qfWghWBSZPFqcEJb1pj /0RMeXkz0scI+qEShIHsexrvqfGDEvkmvOXa0x5h+j2goDbDeDP9qevq4O6udv0z2NYAr8 jl7sP0PMjpZ/G7l8P0cXiW1dOzwHQxKxf4SXQuDbwbEJMUwu9xeG9ViUZUzlytuoqLSNfZ HX5JYMz0fduXUIq0E+TYQY+UesKdEcn2l7EinvHibGtlaWT6SqKcGQdwmK5nDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PGcZG0My1z1H95; Tue, 14 Feb 2023 23:17:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31ENHv1R005542; Tue, 14 Feb 2023 23:17:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31ENHvFL005541; Tue, 14 Feb 2023 23:17:57 GMT (envelope-from git) Date: Tue, 14 Feb 2023 23:17:57 GMT Message-Id: <202302142317.31ENHvFL005541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: f09f828a41d8 - releng/13.2 - ahci: increase timout List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: f09f828a41d8eaf6456d2894a97a2a10f8979ea1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=f09f828a41d8eaf6456d2894a97a2a10f8979ea1 commit f09f828a41d8eaf6456d2894a97a2a10f8979ea1 Author: Mariusz Zaborski AuthorDate: 2023-02-10 15:56:04 +0000 Commit: Mariusz Zaborski CommitDate: 2023-02-14 23:17:57 +0000 ahci: increase timout For some devices, like Marvell 88SE9230, it takes more time to connect to the device. This patch introduces a special flag that extends the timeout from around 100ms to around 500ms. This change is based on the work of: Peter Eriksson Approved by: re (cperciva) PR: 243401 Reviewed by: imp Tested by: dch MFC after: 3 days Sponsored by: Equinix Sponsored by: SkunkWerks, GmbH Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D38413 (cherry picked from commit f08ac4cb14c1c0740346a4363f82e1e1367c2bad) (cherry picked from commit 65bab39e140f97cace92a2923e50c6b654b02e22) --- sys/dev/ahci/ahci.c | 12 ++++++++---- sys/dev/ahci/ahci.h | 4 +++- sys/dev/ahci/ahci_pci.c | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c index f5227f5e7147..45171a34cfbf 100644 --- a/sys/dev/ahci/ahci.c +++ b/sys/dev/ahci/ahci.c @@ -2605,10 +2605,14 @@ static int ahci_sata_connect(struct ahci_channel *ch) { u_int32_t status; - int timeout, found = 0; + int timeout, timeoutslot, found = 0; - /* Wait up to 100ms for "connect well" */ - for (timeout = 0; timeout < 1000 ; timeout++) { + /* + * Wait for "connect well", up to 100ms by default and + * up to 500ms for devices with the SLOWDEV quirk. + */ + timeoutslot = ((ch->quirks & AHCI_Q_SLOWDEV) ? 5000 : 1000); + for (timeout = 0; timeout < timeoutslot; timeout++) { status = ATA_INL(ch->r_mem, AHCI_P_SSTS); if ((status & ATA_SS_DET_MASK) != ATA_SS_DET_NO_DEVICE) found = 1; @@ -2627,7 +2631,7 @@ ahci_sata_connect(struct ahci_channel *ch) break; DELAY(100); } - if (timeout >= 1000 || !found) { + if (timeout >= timeoutslot || !found) { if (bootverbose) { device_printf(ch->dev, "SATA connect timeout time=%dus status=%08x\n", diff --git a/sys/dev/ahci/ahci.h b/sys/dev/ahci/ahci.h index 472f9845117d..e28c02d6678e 100644 --- a/sys/dev/ahci/ahci.h +++ b/sys/dev/ahci/ahci.h @@ -621,6 +621,7 @@ enum ahci_err_type { #define AHCI_Q_NOCCS 0x00400000 #define AHCI_Q_NOAUX 0x00800000 #define AHCI_Q_IOMMU_BUSWIDE 0x01000000 +#define AHCI_Q_SLOWDEV 0x02000000 #define AHCI_Q_BIT_STRING \ "\020" \ @@ -648,7 +649,8 @@ enum ahci_err_type { "\026MRVL_SR_DEL" \ "\027NOCCS" \ "\030NOAUX" \ - "\031IOMMU_BUSWIDE" + "\031IOMMU_BUSWIDE" \ + "\032SLOWDEV" int ahci_attach(device_t dev); int ahci_detach(device_t dev); diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c index 3671efcb8e22..b5cbc044d9f0 100644 --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -292,7 +292,7 @@ static const struct { {0x92201b4b, 0x00, "Marvell 88SE9220", AHCI_Q_ALTSIG | AHCI_Q_IOMMU_BUSWIDE}, {0x92301b4b, 0x00, "Marvell 88SE9230", AHCI_Q_ALTSIG | - AHCI_Q_IOMMU_BUSWIDE}, + AHCI_Q_IOMMU_BUSWIDE | AHCI_Q_SLOWDEV}, {0x92351b4b, 0x00, "Marvell 88SE9235", 0}, {0x06201103, 0x00, "HighPoint RocketRAID 620", 0}, {0x06201b4b, 0x00, "HighPoint RocketRAID 620", 0},