From patchwork Wed Nov 29 11:22:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 171267 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp267568vqn; Wed, 29 Nov 2023 03:22:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IEX3vr+mbHfDqNNS9M1Zq4XTht+I5x7qFsAWGebPtLVsflNSdH7HVG1FAnngROuR4fRt3tA X-Received: by 2002:a05:6a00:2e95:b0:6cb:634a:c838 with SMTP id fd21-20020a056a002e9500b006cb634ac838mr19609330pfb.3.1701256956987; Wed, 29 Nov 2023 03:22:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701256956; cv=none; d=google.com; s=arc-20160816; b=ElaX65CspkOSgret4uC9tsnJGHrjiqm7qzpzrHF1x+DlpN2fNEuvAQDmmE03HfjiIG UCxn31K/i7R1fW5Fw4nvDj/UBdzxatE1RQkt8gVJQ2YIzXIhyuN7mRQYaaYfGBw8jrHq Wk9lHi5/fdewEkKhWiCWtilTbIal6Stgsps3y2Wu2XI+u3ngnyNYT7mqSKaFf/ChwvYY +hLdx2keOr0i1GIdvfXLXGfOwk4I02BkgwE0culZYnLONYBHeJUtvaXdSYDu/OMGhhHy 8Z8IVpF1Q7U5Mr/B+JS1VMxHpKBhmGtl7BwYLDqbSnjYtFbiTd8S4ePyEmRHU+yiupar Tt5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=gZgRhBmUlUnwhB36HfXgplvzDOMNeYjiRUD2/zH/lSI=; fh=UD1ZRCSS/l4PYbuMk1gSsIJwAKOC33PKfkYvw4GUlo4=; b=zH4Ar61/f7uBIdpodpdjR9wzTAehh6Z5zEdc7nAwd453lt8G6n9NOs7EUzkWpjGDSm AaAjGLgZRLV+lBSZ+jptI15cs5UTnLcN1uUmyYghfkc2d79ZcSP5Cm5HshIGZmnwJkwg NX+eGYAmPLj8eZWP4XBwlIqAJxnrr5lExAmgF8VyO4p1R2XlVKaIzGS3bVFFLsp02RgS 394lqXpWxyAIHTLAOyvRlK/QvkXXsQt9Yka+bckAKR7gypeavixCnIYKVdO5InAejNU5 g4OiWCSgkK2lY+L7uA0Z/+apA/XskWRn2/kwyerLVmY/q5UW0zu/2IHgKbjpGpEIZ6an ao6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=CG5AvWON; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=LFT7HSq+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a6-20020a63d206000000b00578fe1bdfcasi14574717pgg.860.2023.11.29.03.22.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 03:22:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=CG5AvWON; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=LFT7HSq+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 464FA80408D7; Wed, 29 Nov 2023 03:22:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232038AbjK2LWY (ORCPT + 99 others); Wed, 29 Nov 2023 06:22:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231483AbjK2LWW (ORCPT ); Wed, 29 Nov 2023 06:22:22 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8693519BC; Wed, 29 Nov 2023 03:22:28 -0800 (PST) Date: Wed, 29 Nov 2023 11:22:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701256947; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gZgRhBmUlUnwhB36HfXgplvzDOMNeYjiRUD2/zH/lSI=; b=CG5AvWONmjQIsto2kag/zI+lQT7u7nhF2oCEPdZHmAjjeVOjP+SCk2nyh5nqndKsmAnlcu +8MMfBSSnLs8WA9+ceCfRIWh306L7uY8sZVT7MDLHQzHfZp9V3yKvWOF5RNLaTwT854eqa upNdy5BeOfDaTmujhH/gPWZmGhyxLgbthSr5DMouP5chaa0Ya2Mfyadf0MMCaC9e1lwAoI LZ/T17hO7PqKQGkyuApm/9TVSe9AK0IaMoZGFD6djlzyXx5OEKXUOmLUwiTZ7uzZMwbcZm u3e/Oemkn6d+jU4cc2icMtxuClmMbpZ/nPrFBTVia4BzkfcM855qKuyIvvUXxA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701256947; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gZgRhBmUlUnwhB36HfXgplvzDOMNeYjiRUD2/zH/lSI=; b=LFT7HSq+61U4GVd31XtA3sHeGTiEQt+RF5GHe1p/6n5Ltb3ZwVXybbK4UOw8nLKnp1R5qX 6AeU+kqmW/tRf8Dg== From: "tip-bot2 for Borislav Petkov (AMD)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cpu] x86/CPU/AMD: Get rid of amd_erratum_400[] Cc: "Borislav Petkov (AMD)" , Nikolay Borisov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231120104152.13740-12-bp@alien8.de> References: <20231120104152.13740-12-bp@alien8.de> MIME-Version: 1.0 Message-ID: <170125694654.398.5196102162020154893.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 03:22:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783079447279780212 X-GMAIL-MSGID: 1783897215323332740 The following commit has been merged into the x86/cpu branch of tip: Commit-ID: b3ffbbd282d4eb79f489853a171242c2a06bd8b8 Gitweb: https://git.kernel.org/tip/b3ffbbd282d4eb79f489853a171242c2a06bd8b8 Author: Borislav Petkov (AMD) AuthorDate: Fri, 03 Nov 2023 23:20:11 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 29 Nov 2023 12:13:23 +01:00 x86/CPU/AMD: Get rid of amd_erratum_400[] Setting X86_BUG_AMD_E400 in init_amd() is early enough. No functional changes. Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Nikolay Borisov Link: http://lore.kernel.org/r/20231120104152.13740-12-bp@alien8.de --- arch/x86/kernel/cpu/amd.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 7ab7f98..550ac25 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -59,10 +59,6 @@ static u32 nodes_per_socket = 1; #define AMD_MODEL_RANGE_START(range) (((range) >> 12) & 0xfff) #define AMD_MODEL_RANGE_END(range) ((range) & 0xfff) -static const int amd_erratum_400[] = - AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf), - AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf)); - static const int amd_erratum_1485[] = AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x19, 0x10, 0x0, 0x1f, 0xf), AMD_MODEL_RANGE(0x19, 0x60, 0x0, 0xaf, 0xf)); @@ -765,15 +761,6 @@ static void early_init_amd(struct cpuinfo_x86 *c) if (c->x86 == 0x16 && c->x86_model <= 0xf) msr_set_bit(MSR_AMD64_LS_CFG, 15); - /* - * Check whether the machine is affected by erratum 400. This is - * used to select the proper idle routine and to enable the check - * whether the machine is affected in arch_post_acpi_init(), which - * sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check. - */ - if (cpu_has_amd_erratum(c, amd_erratum_400)) - set_cpu_bug(c, X86_BUG_AMD_E400); - early_detect_mem_encrypt(c); /* Re-enable TopologyExtensions if switched off by BIOS */ @@ -840,6 +827,16 @@ static void init_amd_k8(struct cpuinfo_x86 *c) msr_set_bit(MSR_K7_HWCR, 6); #endif set_cpu_bug(c, X86_BUG_SWAPGS_FENCE); + + /* + * Check models and steppings affected by erratum 400. This is + * used to select the proper idle routine and to enable the + * check whether the machine is affected in arch_post_acpi_subsys_init() + * which sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check. + */ + if (c->x86_model > 0x41 || + (c->x86_model == 0x41 && c->x86_stepping >= 0x2)) + setup_force_cpu_bug(X86_BUG_AMD_E400); } static void init_amd_gh(struct cpuinfo_x86 *c) @@ -874,6 +871,16 @@ static void init_amd_gh(struct cpuinfo_x86 *c) msr_clear_bit(MSR_AMD64_BU_CFG2, 24); set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH); + + /* + * Check models and steppings affected by erratum 400. This is + * used to select the proper idle routine and to enable the + * check whether the machine is affected in arch_post_acpi_subsys_init() + * which sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check. + */ + if (c->x86_model > 0x2 || + (c->x86_model == 0x2 && c->x86_stepping >= 0x1)) + setup_force_cpu_bug(X86_BUG_AMD_E400); } static void init_amd_ln(struct cpuinfo_x86 *c)