From nobody Thu Sep 14 15:30:20 2023 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 4Rmh8r68gsz4sjZQ; Thu, 14 Sep 2023 15:30:20 +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 4Rmh8r5X9Hz3CwF; Thu, 14 Sep 2023 15:30:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694705420; 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=iRxnUI2HCnXj66JCCJ7vle4Bfm6a1n/z2l9PISEVIXs=; b=ZHGMIwOYYJWKnbVi1xaeyYNebW/TUV5BOJyxPNf8+KdctoCIz0cVdYQtlONfzBbxCPW4Fy d6yCS//Y4YrXE6fC/+3EdUq1lMGHY46AvwPQLkS/icj9zcRITjyFk/QdymNCvHbG0znrCl 4h3BbCJdxzblOIOROXHa/yn09Pbj4b8uTdqs91TjxB5+sRbcGJgTLYuG3vOs52XsXt7Rrj R+OLB63NYUInBZbqTq/yO9mqagmhC4f7S04XZIHeIrtMbdB4W5u80+K2zU+Fbv0p0gN34S bECr1ZsIuQ1A2TTUelQ2tvyKY9711XqdqjUSRA1Fj1mhDPEn6xokKdbOKCV3dA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694705420; a=rsa-sha256; cv=none; b=QGtFByA4giPl8eMRNPDRgSPoPTQcm2bdtMO5vWJkmBnQAqR9K3Nmr3IzjQrMhU5ADyselK PcBmGFCQ+0Ifbp5h0amKpy9xPM0t7WHtQf156pfMatBzVHRPYdMN6SqvyN+uVqZVklnfev d9DL2J/7DXvLlwLMv1RhlqUDzH5ZE81FCTQiWPkdpVReG/+ERV66Q0e4gIDAtc2NGkj2Vi 4A4UgNk+XJ5afSXtJxOrI/w9wbsIeUtw5oMOUJIs9y6wIpUYFzcfSDR7wuBwN7m8rtAI8a sL6Ds8BupP1H+XXizT1XVnLPZeXjoGgLNkcuv8XgHs7vWol5MJK6zPtTMiSUrw== 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=1694705420; 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=iRxnUI2HCnXj66JCCJ7vle4Bfm6a1n/z2l9PISEVIXs=; b=ozSyDTS6zlkdabejbGhJR698ofLkyPIf+F22qtzLhF9tdiOkN/UMwKKH59Mwvh8iXroAd0 dkYLQwsIk+aBhpysw7LAoIvGbbEwF5UB/zhmjfkPOqTUICvSkU54YaHoTZIfkg9UGw1pRg TFFUuSJ1Rg2OxzhOZDWzb00V7OJNhwH22L1d8yoJwExuoJsKy/Ef39YaBbcHxQhlcFkcDZ vB++BD77UgTzIzSCoYFSc4R/Y+QK0v4u0uGhQjQuIYEFMYEYUYMD9LxtkERLk/5bMJB4ew +mi5SkLpEoxvfI/0EhB/vaHjqjqPNybK495/vg2ehy8r6G5n95XL6RpfYnKmkg== 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 4Rmh8r4cPGz12ZS; Thu, 14 Sep 2023 15:30:20 +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 38EFUKOs038937; Thu, 14 Sep 2023 15:30:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38EFUKOr038934; Thu, 14 Sep 2023 15:30:20 GMT (envelope-from git) Date: Thu, 14 Sep 2023 15:30:20 GMT Message-Id: <202309141530.38EFUKOr038934@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 125bbadf6084 - main - x86: Add defines for workaround bits in AMD's MSR "Decode Configuration" 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 125bbadf6084ac341673c9eb1979a740d3d5899a Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=125bbadf6084ac341673c9eb1979a740d3d5899a commit 125bbadf6084ac341673c9eb1979a740d3d5899a Author: Olivier Certner AuthorDate: 2023-09-11 13:10:35 +0000 Commit: Ed Maste CommitDate: 2023-09-14 15:24:48 +0000 x86: Add defines for workaround bits in AMD's MSR "Decode Configuration" They are a bit more informative than raw hexadecimal values. While here, sort existing defines of bits for AMD MSRs to match the address order. Reviewed by: kib, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41816 --- sys/amd64/amd64/initcpu.c | 5 +++-- sys/x86/include/specialreg.h | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c index 4debe89426df..a048c08fc9ae 100644 --- a/sys/amd64/amd64/initcpu.c +++ b/sys/amd64/amd64/initcpu.c @@ -101,7 +101,8 @@ init_amd(void) case 0x10: case 0x12: if ((cpu_feature2 & CPUID2_HV) == 0) - wrmsr(MSR_DE_CFG, rdmsr(MSR_DE_CFG) | 1); + wrmsr(MSR_DE_CFG, rdmsr(MSR_DE_CFG) | + DE_CFG_10H_12H_STACK_POINTER_JUMP_FIX_BIT); break; } @@ -151,7 +152,7 @@ init_amd(void) (cpu_feature2 & CPUID2_HV) == 0) { /* 1021 */ msr = rdmsr(MSR_DE_CFG); - msr |= 0x2000; + msr |= DE_CFG_ZEN_LOAD_STALE_DATA_FIX_BIT; wrmsr(MSR_DE_CFG, msr); /* 1033 */ diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h index 548d6010e7b8..f45990a056c8 100644 --- a/sys/x86/include/specialreg.h +++ b/sys/x86/include/specialreg.h @@ -1162,11 +1162,16 @@ #define MSR_IC_CFG 0xc0011021 /* Instruction Cache Configuration */ #define MSR_DE_CFG 0xc0011029 /* Decode Configuration */ +/* MSR_AMDK8_IPM */ +#define AMDK8_SMIONCMPHALT (1ULL << 27) +#define AMDK8_C1EONCMPHALT (1ULL << 28) + /* MSR_VM_CR related */ #define VM_CR_SVMDIS 0x10 /* SVM: disabled by BIOS */ -#define AMDK8_SMIONCMPHALT (1ULL << 27) -#define AMDK8_C1EONCMPHALT (1ULL << 28) +/* MSR_DE_CFG */ +#define DE_CFG_10H_12H_STACK_POINTER_JUMP_FIX_BIT 0x1 +#define DE_CFG_ZEN_LOAD_STALE_DATA_FIX_BIT 0x2000 /* VIA ACE crypto featureset: for via_feature_rng */ #define VIA_HAS_RNG 1 /* cpu has RNG */