From nobody Sun Sep 27 16:45:01 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 4ht9KB0kD6z6tkbS for ; Sun, 27 Sep 2026 16:45:02 +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 4ht9KB06NHz4tXB for ; Sun, 27 Sep 2026 16:45:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790527502; 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=rIUyqSIvdbWtXs/VCwwXW0gzUNCoF8eizsxhWqCwtyc=; b=EzS6sGe35IRQsGICnZLYs6ty3hzkpym8ZXLjka686h4PafebwfqoDVmi0ah9ss4n4QVCHf Hk8OSVBRDjGjUG0kBpPXMJNynCpuZLXu3GYfGEfOpI7tcr68eZ4h3n+RRkQI2wayOdQ2eZ K9+5yIbrK7InqHUs3S98VLilJrQLIbla9anZOdR/gc+JHKkX9BRzpZsq43rTo0VV1htXRZ 9AhagqYmlbuhqDLNaRUiMuKMtbOz44vL1nnuZKCx1jFFBIi/C9nNnmO9qhgGMoV/GT5ZRi mbSv0T6WI4trszy5/1ZKRNz0mS7ywUjFSLyyuVh+HYVJJQCrbTnLQfXmzK1eBA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790527502; b=PNBS2CpzXNMhmLMzTFvkzpIc4MsWrGoZmHq3VM4D3HS8L9Z71B5GyJ6UzI+Y4WknJ5LSAm GI63bseNgSu+OzdpUn6GIYbwv28Jr9j3A5hlPRM2IClw3Are5pdrkibDRMb+bAIIl400yQ atLzMNpdciL4cWpDrtlPCFVNAULpmHrxzIQUJQq8sOGmvYrnnbkNCPUlIjayYFQpxUMLen FGeHU0/Et+E5OIHsMAIvx0NBp58BEYUk831J90iCV7MWBbfZO+PstJ3X2zVjEuILjFtjqf emjzilXK9gYNcswsHcvOt8+kb2ZpfF5y2CF2xVbpBOnabC2biaG6zrYS338s5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790527502; 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=rIUyqSIvdbWtXs/VCwwXW0gzUNCoF8eizsxhWqCwtyc=; b=jW/hknPUX0Rpxh6qo7uxLK7NpsZX8VbJkSU98hWajZv9jXIYITsra0Pu85It4rZMw2AiF1 P84u5pBQO+jmyZJU+JcnK1f5fzWG7+nE2LNMuaRx9SBblNrLsRyXLYWCD60XDj53/+FjAx QU7BUL7en+QZaIuoK/YuqRY75bf1zmTPFQUz+gnOuprnW61oFcA22R+TEJin5NCQX4hzZw lLOOtTjvArRP7JhcC0TVbd21G3TktGpi2YsoagVEVwDIPFBMVDrpT8aegQOvSXTxRZ75tX klmdyi2776XCZDh/s50GIv91YgGruEzjyZ6jZeAAH4dvbGD3+e9OzdlIPIp0gQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4ht9K960MTzqBX for ; Sun, 27 Sep 2026 16:45:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26f62 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 27 Sep 2026 16:45:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Joseph Mingrone Subject: git: 943686575d81 - main - tpm: Do not use timed tsleep() while polling during cold boot 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: jrm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 943686575d818c5cd3aaf2dfb912fabfb7dd7872 Auto-Submitted: auto-generated Date: Sun, 27 Sep 2026 16:45:01 +0000 Message-Id: <6ab9480d.26f62.b6c24d3@gitrepo.freebsd.org> The branch main has been updated by jrm: URL: https://cgit.FreeBSD.org/src/commit/?id=943686575d818c5cd3aaf2dfb912fabfb7dd7872 commit 943686575d818c5cd3aaf2dfb912fabfb7dd7872 Author: Joseph Mingrone AuthorDate: 2026-09-26 19:12:47 +0000 Commit: Joseph Mingrone CommitDate: 2026-09-27 16:20:34 +0000 tpm: Do not use timed tsleep() while polling during cold boot Commit 4e0f283fb97a made tpm_tis12_init() wait for TPM_STS_CMD_READY after aborting any command. The wait is implemented by the driver's existing tpm_waitfor_poll() loop, which sleeps with a one-tick tsleep() between status reads. Until now, that loop only ran from the resume and command paths after boot. From tpm_attach() it can panic with "timed sleep before timers are working" when the TPM is attached from ACPI during cold boot and the chip does not report ready on the first status read. Before 4e0f283fb97a, tpm_tis12_init() wrote TPM_STS_CMD_READY and returned without waiting, so the polling loops only ran after boot. tpm_request_locality() had the same latent hazard but its fast path returns before sleeping whenever locality is already active. Nothing calls wakeup() on the channels used by these polling loops, so the sleeps are pure delays. Use pause_sig(), which falls back to DELAY() while the kernel is cold and returns EWOULDBLOCK, a value these loops already tolerate. The c argument to tpm_waitfor_poll() is now unused. It is left in place to keep this change minimal for MFC and can be removed in a follow-up. Reviewed by: kbowling Fixes: 4e0f283fb97a ("tpm: Bound TPM 1.2 locality ownership") MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60050 --- sys/dev/tpm/tpm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/tpm/tpm.c b/sys/dev/tpm/tpm.c index ee886e6ae7f8..109d01af220e 100644 --- a/sys/dev/tpm/tpm.c +++ b/sys/dev/tpm/tpm.c @@ -561,7 +561,7 @@ tpm_request_locality(struct tpm_softc *sc, int l) while ((r = bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_ACCESS) & (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY)) != (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY) && to--) { - rv = tsleep(sc->sc_init, PRIBIO | PCATCH, "tpm_locality", 1); + rv = pause_sig("tpm_locality", 1); if (rv && rv != EWOULDBLOCK) { #ifdef TPM_DEBUG printf("tpm_request_locality: interrupted %d\n", rv); @@ -638,7 +638,7 @@ tpm_getburst(struct tpm_softc *sc) if (burst) return burst; - rv = tsleep(sc, PRIBIO | PCATCH, "tpm_getburst", 1); + rv = pause_sig("tpm_getburst", 1); if (rv && rv != EWOULDBLOCK) { return 0; } @@ -807,7 +807,7 @@ tpm_waitfor_poll(struct tpm_softc *sc, u_int8_t mask, int tmo, void *c) * met. */ while (((sc->sc_stat = tpm_status(sc)) & mask) != mask && tmo--) { - rv = tsleep(c, PRIBIO | PCATCH, "tpm_poll", 1); + rv = pause_sig("tpm_poll", 1); if (rv && rv != EWOULDBLOCK) { #ifdef TPM_DEBUG printf("tpm_waitfor_poll: interrupted %d\n", rv);