From owner-dev-commits-src-all@freebsd.org Wed Jun 30 05:08:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D1EB65A2F8; Wed, 30 Jun 2021 05:08:14 +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 4GF8W22xgvz3vD4; Wed, 30 Jun 2021 05:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 23BEF26929; Wed, 30 Jun 2021 05:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15U58EMb097114; Wed, 30 Jun 2021 05:08:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15U58EdK097113; Wed, 30 Jun 2021 05:08:14 GMT (envelope-from git) Date: Wed, 30 Jun 2021 05:08:14 GMT Message-Id: <202106300508.15U58EdK097113@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 99c12760d07d - stable/13 - amd64: do not touch BIOS reset flag halfword, unless we boot through BIOS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 99c12760d07df9dba7bc69f1ae0d915badc7ee17 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2021 05:08:14 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=99c12760d07df9dba7bc69f1ae0d915badc7ee17 commit 99c12760d07df9dba7bc69f1ae0d915badc7ee17 Author: Konstantin Belousov AuthorDate: 2021-06-20 14:58:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-30 04:42:13 +0000 amd64: do not touch BIOS reset flag halfword, unless we boot through BIOS (cherry picked from commit 33e1287b6a54672860d6646111ef0e544a00c569) --- sys/amd64/amd64/locore.S | 3 --- sys/amd64/amd64/machdep.c | 12 ++++++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 3addc3fb10cd..ce37288f4400 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -56,9 +56,6 @@ */ NON_GPROF_ENTRY(btext) - /* Tell the bios to warmboot next time */ - movw $0x1234,0x472 - /* Don't trust what the loader gives for rflags. */ pushq $PSL_KERNEL popfq diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 2901ef15e69a..0098e926d0f0 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1613,11 +1613,20 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct region_descriptor r_gdt; size_t kstack0_sz; int late_console; + bool efi_boot; TSRAW(&thread0, TS_ENTER, __func__, NULL); kmdp = init_ops.parse_preload_data(modulep); + efi_boot = preload_search_info(kmdp, MODINFO_METADATA | + MODINFOMD_EFI_MAP) != NULL; + + if (!efi_boot) { + /* Tell the bios to warmboot next time */ + atomic_store_short((u_short *)0x472, 0x1234); + } + physfree += ucode_load_bsp(physfree + KERNBASE); physfree = roundup2(physfree, PAGE_SIZE); @@ -1769,8 +1778,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) * Once bootblocks have updated, we can test directly for * efi_systbl != NULL here... */ - if (preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP) - != NULL) + if (efi_boot) vty_set_preferred(VTY_VT); TUNABLE_INT_FETCH("hw.ibrs_disable", &hw_ibrs_disable);