From nobody Sat May 03 15:20:08 2025 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 4ZqWgY0LJrz5vT7r; Sat, 03 May 2025 15:20:09 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZqWgX4Jsnz3L39; Sat, 03 May 2025 15:20:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746285608; 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=GG4w3CIiLqFnlkA1f+hAFsHg/q0j7ibAWYuSPsyAiZg=; b=eN4GAZb6SlMTtNE5CEb7hJm0bFYEt+jca/Od5YC8JZYtCjsmOvgwHzFrcg2/9GyY9qP2c5 efxBHQKpdOe/qy1cOuo7o7zXa+5XwPLUmurjhiPxiHG5Oy46oCbR5zh6eA054gODjZq3Uc B/0M0fokKHbNPvMWLKc5DGfupSCPVjY7DoEXzNioFxcN04b/aTZb75u49pIdzZ0TTnbRIL bDgIZZmPfCKpInPitlFQQGCqlRICZBc9HwMrxhrZlmVSProI9g3Y347clyNypU5FoIAQKF szlFdp8JYtBBIjPCJOC/R3gvs0xZ3YnQ26zz6KpWPIZGELqlF+6URxFHpS2voQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746285608; 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=GG4w3CIiLqFnlkA1f+hAFsHg/q0j7ibAWYuSPsyAiZg=; b=ubmoPeL+4wpLFeDqBs/iFu5VrRY+BNii+k7T6hxo170oZCcIM0+a0g+TcIC4fXef2nJP6H 0bKglHTGXn0yZaerpUNei5z1oz+ZSp56j+n2TK6bBk+oclMMr4WFiwUoKidY2xRmD/gG6B SagRI5YDnHdo6hjXk6NSKb4uFmrx68AWem5Jvz3yiaK65RmAAdhU4icvpgmTOMRkdXtfcF QXGGBp2afbSUc9RiWIfEHTs4ceKpN1QR+HMSZPe3rcb88hirLTNwwVmwmzKLtKWso8D7O9 4qe75pfDh3q/iA0kjCe7lUY4PYIz5BfVqyXpI+mruN00nTW/dUqt80xInyodKA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1746285608; a=rsa-sha256; cv=none; b=yad2YyqfCi2gVrQMOLT5qkYucHu/hLvSi1DDDDvLeNw2m+OJAfIJsFFDRTbI3tSTYj9Ygs ZQvKKNwGaxImhC5i0Frs21e3l9EnJuH9F9ITxKqVLprt41xXeJgpZYpEnfy0/jZSTXp9Cp tFIoRSGAPrI9NHdbY1auWYZErcS2/e55Hu+tYUZrGrGskvcAnlZ0GCTXvf0p0xyiLSTDxe baO90V+FOQWmsYSAYXPgrfF0Uy0/Bn6Jeg+lmVR4U3YalGZYd5G8N0wMwwN72gLjYBTBvr cnTLEgypkOlAtKIROxhgaMDKmCQ13qZv2a8ZZyv6qgVuAIOXn+UEYKxwtd2Bkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4ZqWgX3dyjznfT; Sat, 03 May 2025 15:20:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 543FK80a049570; Sat, 3 May 2025 15:20:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 543FK89h049567; Sat, 3 May 2025 15:20:08 GMT (envelope-from git) Date: Sat, 3 May 2025 15:20:08 GMT Message-Id: <202505031520.543FK89h049567@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: 3637d81e8f68 - stable/14 - x86: add cpu_stdext_feature4 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3637d81e8f6875c7f777ca3cf14a2fc3e601db60 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3637d81e8f6875c7f777ca3cf14a2fc3e601db60 commit 3637d81e8f6875c7f777ca3cf14a2fc3e601db60 Author: Konstantin Belousov AuthorDate: 2024-10-24 02:28:05 +0000 Commit: Konstantin Belousov CommitDate: 2025-05-03 15:19:41 +0000 x86: add cpu_stdext_feature4 (cherry picked from commit 011a3493610cc69e9337c857d4947b0bbc462c0a) --- sys/x86/include/x86_var.h | 1 + sys/x86/x86/identcpu.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index 6609871bf89e..0ff336c9c1f0 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -50,6 +50,7 @@ extern u_int cpu_clflush_line_size; extern u_int cpu_stdext_feature; extern u_int cpu_stdext_feature2; extern u_int cpu_stdext_feature3; +extern u_int cpu_stdext_feature4; extern uint64_t cpu_ia32_arch_caps; extern u_int cpu_high; extern u_int cpu_id; diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c index 000f99c683e7..3ae3d17f8028 100644 --- a/sys/x86/x86/identcpu.c +++ b/sys/x86/x86/identcpu.c @@ -107,9 +107,12 @@ char cpu_vendor[20]; /* CPU Origin code */ u_int cpu_vendor_id; /* CPU vendor ID */ u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */ u_int cpu_clflush_line_size = 32; +/* leaf 7 %ecx = 0 */ u_int cpu_stdext_feature; /* %ebx */ u_int cpu_stdext_feature2; /* %ecx */ u_int cpu_stdext_feature3; /* %edx */ +/* leaf 7 %ecx = 1 */ +u_int cpu_stdext_feature4; /* %eax */ uint64_t cpu_ia32_arch_caps; u_int cpu_max_ext_state_size; u_int cpu_mon_mwait_flags; /* MONITOR/MWAIT flags (CPUID.05H.ECX) */ @@ -1039,6 +1042,16 @@ printcpuinfo(void) "\040SSBD" ); } +#define STDEXT4_MASK (CPUID_STDEXT4_LASS | CPUID_STDEXT4_LAM) + if ((cpu_stdext_feature4 & STDEXT4_MASK) != 0) { + printf("\n Structured Extended Features4=0x%b", + cpu_stdext_feature4 & STDEXT4_MASK, + "\020" + "\007LASS" + "\033LAM" + ); + } +#undef STDEXT4_MASK if ((cpu_feature2 & CPUID2_XSAVE) != 0) { cpuid_count(0xd, 0x1, regs); @@ -1534,7 +1547,7 @@ identify_cpu1(void) void identify_cpu2(void) { - u_int regs[4], cpu_stdext_disable; + u_int regs[4], cpu_stdext_disable, max_eax_l7; if (cpu_high >= 6) { cpuid_count(6, 0, regs); @@ -1547,6 +1560,7 @@ identify_cpu2(void) if (cpu_high >= 7) { cpuid_count(7, 0, regs); cpu_stdext_feature = regs[1]; + max_eax_l7 = regs[0]; /* * Some hypervisors failed to filter out unsupported @@ -1563,6 +1577,11 @@ identify_cpu2(void) if ((cpu_stdext_feature3 & CPUID_STDEXT3_ARCH_CAP) != 0) cpu_ia32_arch_caps = rdmsr(MSR_IA32_ARCH_CAP); + + if (max_eax_l7 >= 1) { + cpuid_count(7, 1, regs); + cpu_stdext_feature4 = regs[0]; + } } }