Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2125380rdb; Mon, 20 Nov 2023 02:44:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGPfmjA3qD8FIlQPFQAkjS+FgKyI7RI4s94ZHGncCarcfp4NsvueKEF/zZKGxI0AI9tHKnd X-Received: by 2002:a17:902:f68d:b0:1cf:6787:6ed9 with SMTP id l13-20020a170902f68d00b001cf67876ed9mr484512plg.17.1700477092288; Mon, 20 Nov 2023 02:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700477092; cv=none; d=google.com; s=arc-20160816; b=Emm+HLpUIScV/gQa+qjbZxXWVkybvpxeYeSq/PVrp74adcb3n5Z5qVkpcxGM2PaEyn W18QLRqKGmSQDLgB+6DBRepVic2WN7Yq654hcp/cKkbLlKCPR25PNsJh8yaYUA7LLLDZ ufoGU979bVBHBvUnTUR2Czd0pP27DwAEjG6WhkZE56ME/gcIK+XoVqqL7ztUkABHjPTf 6AAkQNnOpSrSeJuVnlZ6lh60Iy9+yw1kblBxlKt8UaH51xD8OxgnN+ZCOsNXRrQtDoVa PflYwRXsgIYyNGLKdvmnVsfbtHZ/Fj+A1hgJAh8hCgdhAiu3ODF606z8/usHWGapB9d0 +nQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FKJnicpQVINuQyamLhG0SPWIUFk7dsZCSicR3K/Afz4=; fh=yRofEPOsMYSFYi/7/f3tXB782BWAy0107oR1j5aafGk=; b=sjxc+kU5BHgGQXVc4e16qUc61dvLl244sAsnyd2UaugVAtvCf1sOx0FSZ5PKOq5fGr olzXH6TtcZLX1gXF/hFAEjarAl0fyALnF9Bj3X69c9wo2Y5tAqo2dJac7/vTeEfHRMCB nccCbhyWDyQ7gbAZEXYKhmtpxyqfsixz7Ch6IUj7fV3TxVhT2rm247uoHeOsUSdwxptk HVK890fpq/zDp+r5hbZGSfNnNpkq2UFzHa87Cy7jrJPkaYE1jGWFxcI4iGYwi3Bvttv0 evaodDtoc8U+tDkng6EPI4TS+xJqg7xHPUAiTM/EtTeapDyjmv9Yr7XIygxwN1sv0plJ kdaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@alien8.de header.s=alien8 header.b=eLjyU6l5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id jc5-20020a17090325c500b001c62ca6d540si7464162plb.77.2023.11.20.02.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 02:44:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@alien8.de header.s=alien8 header.b=eLjyU6l5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2F399805D590; Mon, 20 Nov 2023 02:44:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232952AbjKTKoX (ORCPT + 99 others); Mon, 20 Nov 2023 05:44:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233195AbjKTKoH (ORCPT ); Mon, 20 Nov 2023 05:44:07 -0500 Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D1221BE1 for ; Mon, 20 Nov 2023 02:43:15 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 7F94F40E0191; Mon, 20 Nov 2023 10:43:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=fail (4096-bit key) reason="fail (body has been altered)" header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zrEdcRAkvAu4; Mon, 20 Nov 2023 10:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1700476962; bh=CeuqZVKZSFZbymJVdmtPdEsvanTHXzAKwND3+dNFkVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eLjyU6l56F/aLBvzxQzl+i2e/rrASbVV/iVxLK/+b/NK3GMYtSAvaCFbbhx1zfhFL JB2ABi8mgPCxC/zckKwLZoR0GE+rbxmNWYjufLOLRG4g1CN/L81kgt/lH/hCRaT+dH B5g6q4pt2kW4x6OV649xUxKPmHSSXDh9qabjOiRG//KMYoHxTbMUF9lIzl/I2LWZK8 i08OKH8QtFsdiG9raXWBWRjxP35/qx07diUE4iNf+MfCyf40vAJfxSy6R7HeBtJJUv +a/9t2D89eniLEWy0tMqQQM94E/aAVH+Fv0gVc6+oD5rOIif4JEzL3ajlhKVgyhN95 HJFd1ZChvi8RF0p5QJz/Fao4zELxcXrXYeeGWck7cW/uJYh+ztWVmQrWDeLgDXav/s VgcO/27oyQmBBvP2liL5Cdjq7WTwkhxQkkJx6LTE3I7GjehBhaBIYvIizjN/i+NPXq dQUMO19xX/xr+oPzjUyxi+AnC7wvneucndbqHwVF6SAJTOoJdP8GIzEGozPxq0Xo1D 6n4yHHAikpCc+8fkZKwT/Fl8IgJj71SGOWncEW5gM5pxCeZT3zyLJzU4EetQmF4WsB xip2lZr3c2xW0u2HDzFicRRW/66W9hYx0o/97MQAwWx3D6KozIJFQDktrCw3am1ZwD j4wIhaPBzz0T7UZWhoQ+OZ+g= Received: from zn.tnic (pd95304da.dip0.t-ipconnect.de [217.83.4.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 42D5C40E0031; Mon, 20 Nov 2023 10:42:40 +0000 (UTC) From: Borislav Petkov To: X86 ML Cc: LKML Subject: [PATCH 11/13] x86/CPU/AMD: Get rid of amd_erratum_400[] Date: Mon, 20 Nov 2023 11:41:50 +0100 Message-ID: <20231120104152.13740-12-bp@alien8.de> X-Mailer: git-send-email 2.42.0.rc0.25.ga82fb66fed25 In-Reply-To: <20231120104152.13740-1-bp@alien8.de> References: <20231120104152.13740-1-bp@alien8.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Mon, 20 Nov 2023 02:44:37 -0800 (PST) From: "Borislav Petkov (AMD)" Setting X86_BUG_AMD_E400 in init_amd() is early enough. No functional changes. Signed-off-by: Borislav Petkov (AMD) --- 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 3e25fa9c5275..f913ca245639 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -59,10 +59,6 @@ static u32 nodes_per_socket =3D 1; #define AMD_MODEL_RANGE_START(range) (((range) >> 12) & 0xfff) #define AMD_MODEL_RANGE_END(range) ((range) & 0xfff) =20 -static const int amd_erratum_400[] =3D - 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[] =3D 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 =3D=3D 0x16 && c->x86_model <=3D 0xf) msr_set_bit(MSR_AMD64_LS_CFG, 15); =20 - /* - * 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); =20 /* 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 =3D=3D 0x41 && c->x86_stepping >=3D 0x2)) + setup_force_cpu_bug(X86_BUG_AMD_E400); } =20 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); =20 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 =3D=3D 0x2 && c->x86_stepping >=3D 0x1)) + setup_force_cpu_bug(X86_BUG_AMD_E400); } =20 static void init_amd_ln(struct cpuinfo_x86 *c) --=20 2.42.0.rc0.25.ga82fb66fed25