From nobody Tue Apr 16 02:34:51 2024 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 4VJSmr0nVWz5HbC8; Tue, 16 Apr 2024 02:34:52 +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 4VJSmq69jVz4HcD; Tue, 16 Apr 2024 02:34:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713234891; 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=ln/v3kCC9zKapMySvHKlhMoB2jEt5UpExxSPsuAl3x4=; b=ArG+DrDqayq1u+SYOxeINlr8cGs7ACn+2/UF5AJjIR/coknG7LAMd5tOaYbXm1Cv0bTbyl y0jqeEZzd9IyrkeVHa5yI6tFO8bjuNgBMXvYRqrpZRKBNyl4c/Q8A7QQ8dyo93ANXqWaN6 WNV//xNqNlSBIC8p3N4mGHADp0HWONgq1N+R6AVjatVbsg+MWrtJsUwC1WclAOwy0kSlDu PvfefkR8Nuw+CYcUNEjY//QNsRy8/yVcDmU1TInGeZVkLbR+wHz9lutTLMwI4Z5dGIOnzN qpehiTXjYL4F4Eh2B5+aXektTtWxAuFO6yn12SVD/OEhwNHc89mMbADVUUckbQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713234891; a=rsa-sha256; cv=none; b=KYyEzy89Ghx7czHFxxz3z/r7N8/T7yjgJVUcHqlINb5a3JbrEjAwVTGShweMBx9GKyaeTE gktpadsoewBNhU6VlpyuSqydkEcmI1mAbHtBecSnWOERw2xEOHAkYXHbE1V2yRzCMKTKjS Dspmg5YCf85ViH/NDcJ3fzqic9WNUt0htoY4VZ0Dk4rUF6SSNf7G0zoU7c5VtxUypHv/ja H3xdIkBlN4O2csCL592JKafoBKaZhY5Y165Gyb0boyqNv+QNj4kDWZmKiWNRoRteFAhcGE 5EXfQYQRYf7RPNJNJmmPrzqoh8fkDD7buzB9CQJu5Pe9iTHMmAyOv1PCtuGpkA== 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=1713234891; 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=ln/v3kCC9zKapMySvHKlhMoB2jEt5UpExxSPsuAl3x4=; b=bI5vceXwxxxB1ZRe8PsSXBKsyrwUkGtuhCaj/cibSNqGydZQBVS8v+rBxUKuQVRJpdPGqA 7XapSp89KsG4Z/y2PACkXlkMUjH0p/NcE2GBAuCmxDHeFLH3u/e7xDy8SNfrl5HCrz5XQV Y2SHy7w+SQBvIqzMMKGs/PBuvXGEgwzrsdOktWdexEO+SSBSxmryPQB5qtEizlVrfGG+Q8 3ZmLHaB+IxizjUCOy2qkaxhRDLwgI+Zfnvk03D4mFYgd+DVPl1OIrxWBw+rFFJZaSCVfAE pa5M7rc8gmS1ePxP3ufo+RbkOxiFAZXpfafYIV8n7CHFZKLjxT3zwhD7B/xUBQ== 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 4VJSmq5p5WzPZc; Tue, 16 Apr 2024 02:34:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43G2YpuD037934; Tue, 16 Apr 2024 02:34:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43G2YpgG037931; Tue, 16 Apr 2024 02:34:51 GMT (envelope-from git) Date: Tue, 16 Apr 2024 02:34:51 GMT Message-Id: <202404160234.43G2YpgG037931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 77d298ea3fb1 - stable/14 - loader: lua: assume late ACPI detection if the feature isn't enabled 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 77d298ea3fb1ba6789afe6cd0c4946a4c392a66c Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=77d298ea3fb1ba6789afe6cd0c4946a4c392a66c commit 77d298ea3fb1ba6789afe6cd0c4946a4c392a66c Author: Kyle Evans AuthorDate: 2023-12-08 21:36:06 +0000 Commit: Warner Losh CommitDate: 2024-04-16 02:32:05 +0000 loader: lua: assume late ACPI detection if the feature isn't enabled While we're here, enable the feature in the places we detect ACPI. This lets us side-step the existing issues and provide a path forward for folks upgrading from previous releases that haven't updated their ESP yet. Let's also fix core.setACPI: the hint already indicates that the user's disabled it more consistently than loader.acpi_disabled_by_user. Even more, the latter is wrong because we set it by default if we did not detect ACPI. The ACPI hint remains even when we're setting defaults because ACPI loaded into the kernel will make some noise if it's not hinted off, even when we didn't detect it. imp notes that this will result in some relatively harmless noise on platforms that don't support ACPI but aren't using the UEFI loader, as we would enable the ACPI module for loading on them and then loader would not be able to find it. These are non-fatal, but should probably be fixed by just declaring support for EARLY_ACPI in those loaders since we know they won't have ACPI early on -- punting on this for the time being, though, in favor of providing a safer upgrade path sooner. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D42727 (cherry picked from commit e183039f0882009c455c3b59fe1ab58a4fd25a5e) --- stand/efi/loader/main.c | 1 + stand/i386/libi386/biosacpi.c | 2 ++ stand/lua/core.lua | 21 +++++++++++---------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 4100c0680b7f..d7cffe5f6df9 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -914,6 +914,7 @@ acpi_detect(void) char buf[24]; int revision; + feature_enable(FEATURE_EARLY_ACPI); if ((rsdp = efi_get_table(&acpi20)) == NULL) if ((rsdp = efi_get_table(&acpi)) == NULL) return; diff --git a/stand/i386/libi386/biosacpi.c b/stand/i386/libi386/biosacpi.c index f94e8684c970..fcad64d81549 100644 --- a/stand/i386/libi386/biosacpi.c +++ b/stand/i386/libi386/biosacpi.c @@ -54,6 +54,8 @@ biosacpi_detect(void) char buf[24]; int revision; + feature_enable(FEATURE_EARLY_ACPI); + /* locate and validate the RSDP */ if ((rsdp = biosacpi_find_rsdp()) == NULL) return; diff --git a/stand/lua/core.lua b/stand/lua/core.lua index 65b91cd8f63e..9226de564348 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -133,17 +133,20 @@ function core.setSingleUser(single_user) end function core.hasACPI() - return loader.getenv("acpi.rsdp") ~= nil -end + -- We can't trust acpi.rsdp to be set if the loader binary doesn't do + -- ACPI detection early enough. UEFI loader historically didn't, so + -- we'll fallback to assuming ACPI is enabled if this binary does not + -- declare that it probes for ACPI early enough + if loader.getenv("acpi.rsdp") ~= nil then + return true + end -function core.isX86() - return loader.machine_arch == "i386" or loader.machine_arch == "amd64" + return not core.hasFeature("EARLY_ACPI") end function core.getACPI() if not core.hasACPI() then - -- x86 requires ACPI pretty much - return false or core.isX86() + return false end -- Otherwise, respect disabled if it's set @@ -157,13 +160,11 @@ function core.setACPI(acpi) end if acpi then - loader.setenv("acpi_load", "YES") + config.enableModule("acpi") loader.setenv("hint.acpi.0.disabled", "0") - loader.unsetenv("loader.acpi_disabled_by_user") else - loader.unsetenv("acpi_load") + config.disableModule("acpi") loader.setenv("hint.acpi.0.disabled", "1") - loader.setenv("loader.acpi_disabled_by_user", "1") end core.acpi = acpi end