From nobody Wed Sep 02 02:08:00 2026 X-Original-To: dev-commits-src-main@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 4hZR2n3GMmz6qQSd for ; Wed, 02 Sep 2026 02:08:01 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hZR2m3GWyz3lQ1 for ; Wed, 02 Sep 2026 02:08:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788314880; 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=GBiCoHlD+Xlh42jRIEcHKaCM7ZnM0SG3rDvHwtzFah8=; b=UytPvEPBwZgKvY3Qe2KboWJrFoqtPk6CRCE2k4HbN0aoeNc1MgxatuRf7swMSXEX9/qA8j FkuVXxXBXZXP+H/i/kGcB3SIbD1iG7j8KA/hkxZvLVBjQnfqoLkXu/828KCGgR6bpKfqzT FPxgEPkn/s4icx4VRtprYkpe+xX+JRDBtLpHskv/nUfno6x3rx2+JbvPNRhbH+WQiY6YOo E+xbQR5dKYo5DTxod1RbVl1L/tAepCchQ7uTrE6V9LyuU8BHS5PQbjkj6Q1H5ff7efuspe EVkwUY2Z1BhQo6PVF9h4Z5xf84xO/IgFDq8ZH62u2BT4Wmjq5t6ociRGET270g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788314880; a=rsa-sha256; cv=none; b=n35JnoYPYvp26s1p8s3jM5LDDO6Z5Cmy3gZ9xlUDcAHiL9kEcj1ZgyJwqB+CmHMw6NrqCD JxtxG1StelcYpAmCp3lObl9jE5uqu6nUPWtU0uyXSym9sFL0xBLTn+VwRrBwoem7B3/Iof Lw6udKBKS1VIEIFEAOxLunwFBtbSQGTbe7gHcoRHUMp2qysfLfapX2DqpUJdSwMk22sEw7 9bAxAsxqzKUZDhMihRvBoIq/4TCn4JK4u2FJ0Ec6ZR6mTnKrXX5DJFJyuN1d8ibbAD+ors IsMg3MpEaQRJn9kWxV+GvkPt4t8GsEIaNnmeF4EIOUa5B9PyDjR4oLSodqgCKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788314880; 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=GBiCoHlD+Xlh42jRIEcHKaCM7ZnM0SG3rDvHwtzFah8=; b=qKauRVaQFrkimpfzGdSJqcJUl4Z9wxo/m+QFd+WDp+mAH646G5KeS3+PyV9c6lZcEDC6Gq B/yyXNXXN+9iAK7RiLBkc6G8duvPW2qyWlAnVMWw4nhL5Mwu3lh29zG5TPPo6orJ/Bwlt9 xbjzrGtWaouJGSVUml/76NYR42E3DgkoUNDwsOo3IgbBUHpC0pTmqpwUdp6cj/7WEp8IbK nbyzuuopFHehqGHFfWvEiw2UKZOOlu08NM7X1ntXNb85ZZ5C2Wztuiv6ZDsZypYRzMQawk 6E5iSZ+dA8Igj0NWHsi+L8QFCT6NS3CgqP4iV/wVvVC0M+MZfrxknk7WPjp3vw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hZR2m22xrz7yc for ; Wed, 02 Sep 2026 02:08:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22997 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 02 Sep 2026 02:08:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jaeyoon Choi Subject: git: 9930150214d1 - main - ufshci: skip the reinit when the new link works List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jaeyoon X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9930150214d1ca4ad21561d2e0afce9ebf2cdf6c Auto-Submitted: auto-generated Date: Wed, 02 Sep 2026 02:08:00 +0000 Message-Id: <6a978500.22997.31ab30a3@gitrepo.freebsd.org> The branch main has been updated by jaeyoon: URL: https://cgit.FreeBSD.org/src/commit/?id=9930150214d1ca4ad21561d2e0afce9ebf2cdf6c commit 9930150214d1ca4ad21561d2e0afce9ebf2cdf6c Author: Jaeyoon Choi AuthorDate: 2026-09-02 01:52:48 +0000 Commit: Jaeyoon Choi CommitDate: 2026-09-02 02:05:10 +0000 ufshci: skip the reinit when the new link works UFSHCI_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH always rebuilt the link after the gear switch. It threw away a working HS link and ended up in PWM. The reinit is only needed for a dead link. There the local side reports HS and the peer never answers. A local readback cannot tell the two apart. Peer traffic can. Probe the peer with DME_PEER_GET after the switch. Skip the reinit when the probe succeeds. Log it when the probe fails. Reviewed by: imp (mentor) Sponsored by: Samsung Electronics Differential Revision: https://reviews.freebsd.org/D59299 --- sys/dev/ufshci/ufshci_ctrlr.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/sys/dev/ufshci/ufshci_ctrlr.c b/sys/dev/ufshci/ufshci_ctrlr.c index b3b9abbe867c..480bbfd43d81 100644 --- a/sys/dev/ufshci/ufshci_ctrlr.c +++ b/sys/dev/ufshci/ufshci_ctrlr.c @@ -127,10 +127,25 @@ ufshci_ctrlr_start(struct ufshci_controller *ctrlr, bool resetting) ufshci_dev_init_uic_link_state(ctrlr); - if ((ctrlr->quirks & UFSHCI_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH) && - ufshci_ctrlr_reinit_after_max_gear_switch(ctrlr) != 0) { - ufshci_ctrlr_fail(ctrlr); - return; + if (ctrlr->quirks & UFSHCI_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH) { + uint32_t probe; + + /* + * The reinit is only needed when the link did not survive + * the gear switch. A local readback still shows HS when the + * peer is dead. Only peer traffic proves the link works. + */ + if (ufshci_uic_send_dme_peer_get(ctrlr, PA_Granularity, + &probe) != 0) { + ufshci_printf(ctrlr, + "link probe failed after the gear switch, " + "reinitializing\n"); + if (ufshci_ctrlr_reinit_after_max_gear_switch( + ctrlr) != 0) { + ufshci_ctrlr_fail(ctrlr); + return; + } + } } /* Read Controller Descriptor (Device, Geometry) */