From nobody Sun Oct 11 01:17:35 2026 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 4j2N4c1M9Qz6w98R for ; Sun, 11 Oct 2026 01:17:36 +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 4j2N4b6Pskz3MB3 for ; Sun, 11 Oct 2026 01:17:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791681455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OiZ6t0KN6wzhzr9/Uh0kqx6gIVm7u+OkvkyN1/GE0Mk=; b=jAlpw3rNyLhpVg7TbrartYbLCKk/M0Zf+YejXhuVqQj7NjHi8kAHayr0NE26mp33mFFX9b HyV9lJKXvv6AWYy2MVYXbe604UmvGIWOSRcs8bY63MvOI0olwri9T/EN/Quqog5k5TwiqF PpRtTvSsRH+dW0FRTem4rTouXKyvv1/sf+3IQbUWyvernFGhirjDaXLQ958UesPG39tq5E B/day7+Khu69vtj60ULQwOZNWPGsmX1rkvdBt/y2oaWL7h2NWqErBbUTq4F5k9VNSu2vAv ywJi+J2Z+xzTPjAJgZMqmAtOJvHsSNIcfWIJMAni7rchklsco3al5V0PdxGlXA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791681455; b=HFCACcL4WObYEL0xqWKJ6m7q6BB+bIolKL128Of2itMgYVj/8lzlZkSSHgP/6o0Jr6JnAW g9LHIPGLFAWGNKyP4ixiLKNrAGlo0MXMKmcfBSxTivE7NfIxOYctL/Bux/2oyj4Gey0PtF ttZ/lecIfQYK5NK/eFw3YwP7fKdsv273SrDA5xgsZF4xs0c5ChM93Z7PGakYD41Uj5EV7k BYQcxPwU3cdlTwTe8I1bjh6r+8bcLeQRlUqiOUq/CzzNldCMueSi72B+rYJglupN/3aRxZ aMjchEaTWdxF/JC6VO09BizhOCEVnO5ombQaPxysI1gH4yrz2/X8Ij4Fo+w8GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791681455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OiZ6t0KN6wzhzr9/Uh0kqx6gIVm7u+OkvkyN1/GE0Mk=; b=KmLRobUZmZBToU6tsUDccGU4ujC7C77yXMGOcDqqbgRw715SIpAvsAHKHxFEub3keqlN8j jQU882nZEoBdyfzLeqSqTlzXovSBzeZff/1r4RuBa+i/KPeLjA3O/+7WqfcglcaNoGWRmU C6ZlZwl+aJhWOTFsLQLGOL+4c3PoGUwtVIUJ1we+fesaLUozsdxceVATe6wNts/IYW4dPm M/nLJIVnno7evf01SRmZr2dcYa5A33waF7zLZcZF5GgXsKifWTVVFbnSeltHURjiMC5xMf ZdE4Wn9+sTYC+NMeph/mV8eziWUBhwBAiWNtgYQfbgeXBvHbnug6MW2l6Dm69Q== 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 4j2N4b4vt5zJxs for ; Sun, 11 Oct 2026 01:17:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 34689 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 11 Oct 2026 01:17:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Joseph Mingrone From: Kevin Bowling Subject: git: 63276290b4e2 - stable/15 - tpm: Do not use timed tsleep() while polling during cold boot List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository 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: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 63276290b4e239b4794d52834e1a5fd5095c162d Auto-Submitted: auto-generated Date: Sun, 11 Oct 2026 01:17:35 +0000 Message-Id: <6acae3af.34689.6023ac24@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=63276290b4e239b4794d52834e1a5fd5095c162d commit 63276290b4e239b4794d52834e1a5fd5095c162d Author: Joseph Mingrone AuthorDate: 2026-09-26 19:12:47 +0000 Commit: Kevin Bowling CommitDate: 2026-10-11 01:17:21 +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") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60050 (cherry picked from commit 943686575d818c5cd3aaf2dfb912fabfb7dd7872) --- 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);