From patchwork Tue Feb 21 22:33:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 60274 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp257825wrd; Tue, 21 Feb 2023 14:37:44 -0800 (PST) X-Google-Smtp-Source: AK7set+lU7sAUuKy33dm50L4g+YQJ9yOuca/SDE0nF/RA5vMNLyw9JUPZcGvc0cyqwz2Ejo7bZrL X-Received: by 2002:aa7:cb57:0:b0:4aa:a51a:7380 with SMTP id w23-20020aa7cb57000000b004aaa51a7380mr5757524edt.0.1677019064768; Tue, 21 Feb 2023 14:37:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677019064; cv=none; d=google.com; s=arc-20160816; b=fTMpvwDUjx6l7dD2ShGVwYMfxVL9jRYJpjbSH+s2CkR46hFiM8G99KkAExKEvu4sOq FoA8SNb5ueagx+zL9o6aeS0WxBWADgMgC5zI9hP7BjksTL1QWMSykC435k6ZAM66A/Ab rMUfJkCrkEM1uogSzM7P6jG7hq8iZRw2iTAw88qvqbMV7/N3LVxv8n6nFJ/2McGR+3kB qlTR6lX40f/5DnoF0kyBboRzEqHR+qAXBLbb7eGbEUPpK7iqa8KCs0FVyPwWWBTkscIt 9MhIjFJ9wDy9/+6vB8RfRcxgtvWLaGlLPieBZ3LIOjgacMzCmliuNcVKWeiWVYghnjrL XUSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=qx90CRTesKnJw2CUnP4R1CUUB5qDm2cUmGugspK2V6I=; b=0rEe4RbZIqws/AyxaF840iNqclifTbvQgLVyEYgNDaZlBSLD9t3euEzZsTuU+DYjbv AebZdszKSzOpcbEfe8hdIULohDIl5NT8Tg4jRzP8LQ8kp+RLRyZGNW9xAhKoCfdTnbeE RHhzVqa6ORi3TAsZWPSQhkX6v/VWROae0Enn2rGjQvQ8dnf/cfA6sBAbo4tzoFpXbrsd ZVgQerO2MCyHj2rZonK2FwG+vSMJbPZbrgesWtXkMgyYQefhLq94HZMX7St6BkwmtbY9 f2mjWpZ82Z8vDXs5OJYMlRGnRLWjleZ20z7pAtIJFJ0cfh4FfU56sFslV2G8/XhIwRk4 8GtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ZMrvKVgW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020aa7ca4e000000b004acbebc9408si1809915edt.383.2023.02.21.14.37.21; Tue, 21 Feb 2023 14:37:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ZMrvKVgW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230115AbjBUWdP (ORCPT + 99 others); Tue, 21 Feb 2023 17:33:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbjBUWdN (ORCPT ); Tue, 21 Feb 2023 17:33:13 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71AB225949 for ; Tue, 21 Feb 2023 14:33:12 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 8E82B1EC059E; Tue, 21 Feb 2023 23:33:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1677018790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:references; bh=qx90CRTesKnJw2CUnP4R1CUUB5qDm2cUmGugspK2V6I=; b=ZMrvKVgW40UpUL1r7wA4UtCpay/588UHAs/zi6iVLef+fyd51om0mFPR7wPg9skCo6GoLt zaCSzassXGp0WgXQBBltb5N30Vadr2TI0MzpLI753EdS61CfzENUXiZcZ6VYMMWsseE4g2 ogwDCaksiCFXGT5dWmBhrfUG1Zy/hWY= Date: Tue, 21 Feb 2023 23:33:06 +0100 From: Borislav Petkov To: Linus Torvalds Cc: x86-ml , lkml Subject: [GIT PULL] x86/cpu for v6.3-rc1 Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758481942627324293?= X-GMAIL-MSGID: =?utf-8?q?1758481942627324293?= Hi Linus, please pull the currently accumulated x86/cpu pile for 6.3. There are a bunch of easy peasy merge conflicts, an exemplary resolve of which I'm adding at the end of this message. Thx. --- The following changes since commit b7bfaa761d760e72a969d116517eaa12e404c262: Linux 6.2-rc3 (2023-01-08 11:49:43 -0600) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tags/x86_cpu_for_v6.3_rc1 for you to fetch changes up to 7914695743d598b189d549f2f57af24aa5633705: x86/amd: Cache debug register values in percpu variables (2023-01-31 20:09:26 +0100) ---------------------------------------------------------------- - Cache the AMD debug registers in per-CPU variables to avoid MSR writes where possible, when supporting a debug registers swap feature for SEV-ES guests - Add support for AMD's version of eIBRS called Automatic IBRS which is a set-and-forget control of indirect branch restriction speculation resources on privilege change - Add support for a new x86 instruction - LKGS - Load kernel GS which is part of the FRED infrastructure - Reset SPEC_CTRL upon init to accomodate use cases like kexec which rediscover - Other smaller fixes and cleanups ---------------------------------------------------------------- Alexey Kardashevskiy (1): x86/amd: Cache debug register values in percpu variables Ashok Raj (1): x86/cpu: Remove redundant extern x86_read_arch_cap_msr() Breno Leitao (1): x86/bugs: Reset speculation control settings on init H. Peter Anvin (Intel) (5): x86/cpufeature: Add the CPU feature bit for LKGS x86/opcode: Add the LKGS instruction to x86-opcode-map x86/gsseg: Make asm_load_gs_index() take an u16 x86/gsseg: Move load_gs_index() to its own new header file x86/gsseg: Use the LKGS instruction if available for load_gs_index() Ingo Molnar (1): x86/gsseg: Add the new header to Kim Phillips (8): x86/cpu, kvm: Add support for CPUID_80000021_EAX KVM: x86: Move open-coded CPUID leaf 0x80000021 EAX bit propagation code x86/cpu, kvm: Add the NO_NESTED_DATA_BP feature x86/cpu, kvm: Move X86_FEATURE_LFENCE_RDTSC to its native leaf x86/cpu, kvm: Add the Null Selector Clears Base feature x86/cpu, kvm: Add the SMM_CTL MSR not present feature x86/cpu: Support AMD Automatic IBRS KVM: x86: Propagate the AMD Automatic IBRS feature to the guest Documentation/admin-guide/hw-vuln/spectre.rst | 6 +-- Documentation/admin-guide/kernel-parameters.txt | 6 +-- arch/x86/entry/entry_64.S | 2 +- arch/x86/include/asm/asm-prototypes.h | 1 + arch/x86/include/asm/cpufeature.h | 7 ++- arch/x86/include/asm/cpufeatures.h | 12 ++++- arch/x86/include/asm/debugreg.h | 9 +++- arch/x86/include/asm/disabled-features.h | 3 +- arch/x86/include/asm/gsseg.h | 66 +++++++++++++++++++++++++ arch/x86/include/asm/mmu_context.h | 1 + arch/x86/include/asm/msr-index.h | 6 +++ arch/x86/include/asm/required-features.h | 3 +- arch/x86/include/asm/special_insns.h | 21 -------- arch/x86/kernel/cpu/amd.c | 49 ++++++++++++------ arch/x86/kernel/cpu/bugs.c | 31 ++++++++---- arch/x86/kernel/cpu/common.c | 27 +++++----- arch/x86/kernel/cpu/cpu.h | 2 - arch/x86/kernel/cpu/tsx.c | 1 + arch/x86/kernel/hw_breakpoint.c | 4 +- arch/x86/kernel/paravirt.c | 1 + arch/x86/kernel/signal_32.c | 1 + arch/x86/kernel/tls.c | 1 + arch/x86/kvm/cpuid.c | 41 ++++++++------- arch/x86/kvm/reverse_cpuid.h | 1 + arch/x86/kvm/svm/svm.c | 3 ++ arch/x86/kvm/x86.c | 3 ++ arch/x86/lib/x86-opcode-map.txt | 1 + arch/x86/xen/enlighten_pv.c | 1 + tools/arch/x86/include/asm/cpufeatures.h | 1 + tools/arch/x86/lib/x86-opcode-map.txt | 1 + 30 files changed, 218 insertions(+), 94 deletions(-) create mode 100644 arch/x86/include/asm/gsseg.h --- merge conflicts resolve: --- +++ b/arch/x86/include/asm/cpufeatures.h @@@ -314,7 -312,7 +314,8 @@@ #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */ #define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */ #define X86_FEATURE_CMPCCXADD (12*32+ 7) /* "" CMPccXADD instructions */ +#define X86_FEATURE_ARCH_PERFMON_EXT (12*32+ 8) /* "" Intel Architectural PerfMon Extension */ + #define X86_FEATURE_LKGS (12*32+18) /* "" Load "kernel" (userspace) GS */ #define X86_FEATURE_AMX_FP16 (12*32+21) /* "" AMX fp16 Support */ #define X86_FEATURE_AVX_IFMA (12*32+23) /* "" Support for VPMADD52[H,L]UQ */ +++ b/arch/x86/include/asm/special_insns.h @@@ -184,19 -173,9 +173,9 @@@ static __always_inline void wbinvd(void native_wbinvd(); } - - static inline void load_gs_index(unsigned int selector) - { - #ifdef CONFIG_X86_64 - native_load_gs_index(selector); - #else - loadsegment(gs, selector); - #endif - } - #endif /* CONFIG_PARAVIRT_XXL */ -static inline void clflush(volatile void *__p) +static __always_inline void clflush(volatile void *__p) { asm volatile("clflush %0" : "+m" (*(volatile char __force *)__p)); } +++ b/arch/x86/kernel/cpu/common.c @@@ -1403,14 -1412,6 +1414,9 @@@ static void __init cpu_set_bug_bits(str setup_force_cpu_bug(X86_BUG_RETBLEED); } - if (cpu_has(c, X86_FEATURE_IBRS_ENHANCED) && - !cpu_matches(cpu_vuln_whitelist, NO_EIBRS_PBRSB) && - !(ia32_cap & ARCH_CAP_PBRSB_NO)) - setup_force_cpu_bug(X86_BUG_EIBRS_PBRSB); - + if (cpu_matches(cpu_vuln_blacklist, SMT_RSB)) + setup_force_cpu_bug(X86_BUG_SMT_RSB); + if (cpu_matches(cpu_vuln_whitelist, NO_MELTDOWN)) return; diff --cc arch/x86/include/asm/cpufeatures.h index 49973061b5bd,06909dc7fa63..389ea336258f --- a/arch/x86/include/asm/cpufeatures.h diff --cc arch/x86/include/asm/special_insns.h index f358a23f228d,cfd9499b617c..de48d1389936 --- a/arch/x86/include/asm/special_insns.h diff --cc arch/x86/kernel/cpu/common.c index 65ceabb2e114,62c73c57f16d..a394bbba7a4b --- a/arch/x86/kernel/cpu/common.c