From nobody Wed May 13 12:39:53 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 4gFtMY2wDhz6dLD3 for ; Wed, 13 May 2026 12:39:53 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gFtMY0bFWz3vtP for ; Wed, 13 May 2026 12:39:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778675993; 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=6eGrSWeqCHwcizrYoJmErCjXAbWYSSsHAONUK3Gvv0M=; b=pyhdj0+BF4yg5hdPAyiZ4W1ifcq7Pf2Z1gVIEz9NLopfhPUW0cwd9CPcYkkx+SziHyGJ6C YbJKabWiRLo469+kQQ5W1aVsylSCAi1vW6pDCkp2TAM9RD271cs6pbu3rslR0nf52qb9O9 FPL7avbEyE65Q7cmQ7o3uz+YBcGfSAdHvRdONviYSo3c9YgL6mSFulJvroJr/Yv4YfLxox xtd9ihsXtdz0C7omcW0CDYLUY3pXCu4OAwB7DYSX7hCW1CSnXYkQGi7g9jOPTTOAq5wPja BWdHfydv8wG4wub18DOapqgpSKYfzjfewCgHLA4yPccgNcFcmd9iCV3cugxIpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1778675993; a=rsa-sha256; cv=none; b=lY8jx8yooVQyngh1hnPUMGinkvJ3GESpRgQP3+GkQ4EkQ50QYAkru5UQ6ueTaPf9dyTDLS 7Ch9VllHLg/uZh8j6qUIH8y/cE+CT0rg7YF+2J+IQl+hHjXiK9P2EDXXaazMRaMpb9NgyK Ahnu3a3Ws19Tdp4CCILxusD9bGcky/NXo7AW75Ey/FZDOw4dSf5RQSYs3GvG2ZxfIa9k35 fqTslENy9lV6rlxx5TWuFwmd/zSLuL84u5udY7pa3u5iWOPWC2s0xthqm4V/bxfpEvyoLd R+FEx6R7Pfi3Cbq1Tuuvzfuhp7UvupSZkqtgGkfdTYdifACRmUnBoAqniSWXhg== 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=1778675993; 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=6eGrSWeqCHwcizrYoJmErCjXAbWYSSsHAONUK3Gvv0M=; b=G/FoUV/Is3ajUxjPW7yYBPe9b8HaJitt58egSoYqDudZL93WBif/k5lY2SNgYsPLm9Juyu yWYPgDiZudjM9Rr/mYha8IW9lJQGmOyYZKyXl7GsF54h+SfesoC2ho/6H8+wNqMY72E3lJ Qw4sTDH4HSFunvDnymeDya8Y8Z11aZRZ+eLhqdKno336rHC8ljW0k83eV+GjiBbxgVsjkx ft0j3GlEarsnogZaIvaVrpxliSaN1JDNBb764ezrlBlDhBxCLzXvh74NbUIhb8rSfiQGa4 uzplGIB9j/zXWuG8PwSg/bdk/CQyN15QiCAAST1K/OHB85r8KOcmhxpU9bnQ2g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gFtMY04V6zrR6 for ; Wed, 13 May 2026 12:39:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19bdf by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 13 May 2026 12:39:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 921a6d6c38f5 - main - acpi_spmc(4): Gracefully support a standalone Microsoft DSM 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 921a6d6c38f5b099b1290a614689d70df2e0f0d4 Auto-Submitted: auto-generated Date: Wed, 13 May 2026 12:39:53 +0000 Message-Id: <6a047119.19bdf.1c924158@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=921a6d6c38f5b099b1290a614689d70df2e0f0d4 commit 921a6d6c38f5b099b1290a614689d70df2e0f0d4 Author: Olivier Certner AuthorDate: 2026-05-04 19:17:21 +0000 Commit: Olivier Certner CommitDate: 2026-05-13 12:38:22 +0000 acpi_spmc(4): Gracefully support a standalone Microsoft DSM In acpi_spmc_get_constraints(), stop assuming that if there is no AMD DSM, then the Intel one is present. Although this is likely to be the overwhelming majority of cases on amd64, there is no technical reason nor constraint in our code that really needs assuming that. On (so far hypothetical) machines with only the Microsoft DSM, this assumption would cause a cryptic and irrelevant error message (and, prior to the previous commit, a panic on INVARIANTS). Warn the user if both the Intel and AMD DSMs are present, and use the constraints reported by the Intel one (see the comment for why). Reviewed by: imp (older version), obiwac Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56813 --- sys/dev/acpica/acpi_spmc.c | 52 +++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c index 9a4264d6785b..fde803bdd15d 100644 --- a/sys/dev/acpica/acpi_spmc.c +++ b/sys/dev/acpica/acpi_spmc.c @@ -333,7 +333,7 @@ static void acpi_spmc_probe_dsm(struct acpi_spmc_softc *sc, static void acpi_spmc_dsm_print_functions( const struct acpi_spmc_softc *const sc, const struct dsm_desc *const dsm); -static int acpi_spmc_get_constraints(device_t dev); +static int acpi_spmc_get_constraints(struct acpi_spmc_softc *const sc); static void acpi_spmc_free_constraints(struct acpi_spmc_softc *const sc); static void acpi_spmc_suspend(device_t dev, enum power_stype stype); @@ -399,7 +399,7 @@ acpi_spmc_attach(device_t dev) acpi_spmc_dsm_print_functions(sc, dsms[i]); /* Get device constraints. We can only call this once so do this now. */ - acpi_spmc_get_constraints(dev); + acpi_spmc_get_constraints(sc); sc->eh_suspend = EVENTHANDLER_REGISTER(acpi_post_dev_suspend, acpi_spmc_suspend, dev, 0); @@ -597,24 +597,36 @@ acpi_spmc_parse_constraints_amd(struct acpi_spmc_softc *sc, ACPI_OBJECT *object) } static int -acpi_spmc_get_constraints(device_t dev) +acpi_spmc_get_constraints(struct acpi_spmc_softc *const sc) { - struct acpi_spmc_softc *sc; - struct dsm_desc *dsm; - ACPI_STATUS status; - ACPI_BUFFER result; - ACPI_OBJECT *object; - bool is_amd; - int rv; + struct dsm_desc *dsm; + ACPI_STATUS status; + ACPI_BUFFER result; + ACPI_OBJECT *object; + int rv; struct acpi_spmc_constraint *constraint; - sc = device_get_softc(dev); MPASS(!sc->get_constraints_succeeded); - - /* The Microsoft DSM doesn't have this function. */ - is_amd = has_dsm(sc, DSM_AMD); - dsm = is_amd ? &dsm_amd : &dsm_intel; + /* + * Constraints are not supported by the Microsoft DSM. Since we do not + * expect both Intel and AMD DSMs to be present at once, we only have + * a single storage for common information ('min_d_state'). In case + * some day both happen to be present, warn the user so that he can + * report that condition to us, and somewhat arbitrarily favor the Intel + * one because it at least has a written specification. + */ + if (has_dsm(sc, DSM_INTEL)) { + dsm = &dsm_intel; + + if (has_dsm(sc, DSM_AMD)) + device_printf(sc->dev, "Constraints: Both Intel and " + "AMD DSMs are present!\n" + "Using constraints from Intel.\nPlease report.\n"); + } else if (has_dsm(sc, DSM_AMD)) + dsm = &dsm_amd; + else + return (0); /* It seems like this DSM can fail if called more than once. */ status = acpi_EvaluateDSMTyped(sc->handle, (uint8_t *)&dsm->uuid, @@ -626,10 +638,12 @@ acpi_spmc_get_constraints(device_t dev) } object = (ACPI_OBJECT *)result.Pointer; - if (is_amd) - rv = acpi_spmc_parse_constraints_amd(sc, object); - else + if (dsm == &dsm_intel) rv = acpi_spmc_parse_constraints_intel(sc, object); + else { + MPASS(dsm == &dsm_amd); + rv = acpi_spmc_parse_constraints_amd(sc, object); + } AcpiOsFree(object); if (rv != 0) return (rv); @@ -641,7 +655,7 @@ acpi_spmc_get_constraints(device_t dev) status = acpi_GetHandleInScope(sc->handle, __DECONST(char *, constraint->name), &constraint->handle); if (ACPI_FAILURE(status)) { - device_printf(dev, + device_printf(sc->dev, "Constraints: Cannot get handle for %s, ignoring\n", constraint->name); constraint->handle = NULL;