From patchwork Tue Oct 11 02:21:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: D Scott Phillips X-Patchwork-Id: 13003564 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12D2DC433F5 for ; Tue, 11 Oct 2022 02:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=rsfp5UEQPvdtrtuomikM8hLdpRYEDCs821mAFRGYtnQ=; b=P24b+91a0TCVIQ Qy6rtZyRSK9rB+KNBKe5hVRlTJi3b2lp+lVWgY1PcWk0glM2bZUav7D7BYHVfLRW6CAJ3acDwVQKb VLMJ5lqM8vAhEuoS//Kr/m586NFoiI+LJlWE+A8NiXeanhYWeWPC8Ld5iu04m9IM73U2ZPqp3H7yT 0vU1+CwlHMmRZa8TnouFul74V+bCnWbC4uWKzhhxzV+yp/T8+byGl7UcoRqSNvh49+hsTOjPQuw3a +ubum737dzv0U7R6SIt0lqgr7XFEfBoco5YypRsELX3+VmgOt36RZu1unGBntNKn0t/KFSOeLTF+H kwcQByarzT0y59LNGtVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oi4u5-0030Ro-9t; Tue, 11 Oct 2022 02:21:57 +0000 Received: from mail-dm6nam11on2092.outbound.protection.outlook.com ([40.107.223.92] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oi4u3-0030RA-3k for linux-arm-kernel@lists.infradead.org; Tue, 11 Oct 2022 02:21:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EF4Hp4paLMll1TbVC69QP+EVFOGMnVd/JXanD3Idzm3Hfj0ELgz8cnG4hmRJ8PyJi1BHfPmkrf+BR4MeqtQoffXkReOLt4QKTbmd5A7ivuuIrBdzD0LGf3+qfDwAg4WR0uSBo+uJ5vPT4BXis5azrx7GYJD8wnb41ZjDh+8B+wxZlaZ8GHks1fSlKJ/cQA0B1xUmvrFNZ85szfCTc3OSOLQzByK2Txi5FH/WvpT2P9OOlKHCnAeIBHg32sj+QmnPRzfo1Wv2p1ytPeZFfVZEXpIj3DCHJ2UUnHeH1y+D5w/7BJSl8t/WacFKqd5akYosslAl3c4pQKiodk7APr+1TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WOytqn+Cuc/WdUkbFn7U8Rgpfnsfwv06r9s0ypxzWO4=; b=MJGQhVebM/XqXSY/1dLhyo+ESLdWBG4ZN7CiIQ3mwX5ZflDtdgX7BMmc2XUdRRUaSPcembBPVvkJEfA+BoMqnsSmbcp2aT54gbAhh6qEE6STx0rzN3qXPJlth/lsYsmAIoQ2TYRj19R4d/vAG3Gknw3X6tue2ChFfZA1IaIt9yAs5TBrHgEctxxxxXbaZOh/BQz3unmK5ri1A1uvTz0P+4hMy5YJ9yvQWZmielLMCdaYh9FgGQMtmEmQM0DneqMcS+6SI6psXDIYNuO/CQfYRersHI9tKzrZvQBB2bDbWRl4o8GzvVA3OGPWfNewiIlY29SVGhKaZcSlKHjUCkt+lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WOytqn+Cuc/WdUkbFn7U8Rgpfnsfwv06r9s0ypxzWO4=; b=T+BfftjTSVpBOqUwY0Mqx5agnVuVEQPZzdgNeIzTd+M5Im+QK2sYBBXxeJwZ/sUmivoKso9zDEjYgTxtxgYKfP9Ea3Av6H67AyFHacTPIpnE/z2Jf4/qMFsy8hWraugaCIlwuRl+ZgMXfiIbS3bUAmYr4IDzqCWO/s/VRvB88Qo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from MWHPR0101MB2893.prod.exchangelabs.com (2603:10b6:301:33::25) by BN7PR01MB3635.prod.exchangelabs.com (2603:10b6:406:8d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.32; Tue, 11 Oct 2022 02:21:45 +0000 Received: from MWHPR0101MB2893.prod.exchangelabs.com ([fe80::e591:47a2:a605:5f81]) by MWHPR0101MB2893.prod.exchangelabs.com ([fe80::e591:47a2:a605:5f81%6]) with mapi id 15.20.5676.028; Tue, 11 Oct 2022 02:21:44 +0000 From: D Scott Phillips To: linux-arm-kernel@lists.infradead.org Cc: James Morse , Catalin Marinas , Will Deacon , Darren Hart , patches@amperecomputing.com Subject: [PATCH] arm64: Add AMPERE1 to the Spectre-BHB affected list Date: Mon, 10 Oct 2022 19:21:40 -0700 Message-Id: <20221011022140.432370-1-scott@os.amperecomputing.com> X-Mailer: git-send-email 2.37.3 X-ClientProxiedBy: CH0PR03CA0344.namprd03.prod.outlook.com (2603:10b6:610:11a::35) To MWHPR0101MB2893.prod.exchangelabs.com (2603:10b6:301:33::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR0101MB2893:EE_|BN7PR01MB3635:EE_ X-MS-Office365-Filtering-Correlation-Id: 67837263-7b1f-4132-148c-08daab2f5751 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qn3WCotmmMWG6tFsjBQ6Iip1PpoGYwxf6+HFaWSvex0VuNwm8jPpAxKXoQdq3kUoIoMP0A8rmknxwQGQZFOCa3AzWl8Wrmb1OE6KgVECuXawQ5AU9qcbCNymmIJTmyIs627VWgZWUEVImSxxdIpFpuQkHDe/zFOms2gKbZxt0LekCAMa9xdLbAWJvzFVLKpVTuMwYimivaahoaUveQxhr6Wh5A/tNv/LN3Brzl7E4cCvP2IyRSme+YhRsV8GPAvnyrwZYG2kH0XcSySs22TKT5VACktbitexl7eyuo2F29MJEKUsozPfbtAsURH3g1K1lWcjTjLkDauebqOislsqXan71IPhGk2zOyL8xvBOD6BzDz02au3djZvgo3JCM/Q3hhTlLwp7IShKd5OkL65wSIYUbvKLtVLA32oHHVnLbxw2wkj6OzTNnK/pImgf8JKY642JWH4YPrwxH19cSZZo+vF56ucb5RVVnxhlievcPbHRN4WnwI0ANlSYYEcdh2V07PB0IWyFJSdVrl0nTv8tdWQiri3/9TDeyqJL7gbYIzsQpBN/obDzhy2Bi1bJ63Pu08ucn/uM8Jd07Anx9B6U+bAzXS61Ux/QavzCpTbHw3UX7fqCi0+h/tyLj70GpFdAYL+B6GuTZ21ajOhsmnTKi1FoBF7b+31pH7E+sQZHkobH6N2JBwZ5N0yhZUbplhFj/aNztr9zMx05RDAFwSnLxFJ2i/KsCaNRPCbXoFwKoi1arJAlbQ7nFt4Tr/+J4bG4SutlxSXZVb7OzB2UpMlplA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR0101MB2893.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(376002)(39850400004)(136003)(346002)(451199015)(66476007)(186003)(41300700001)(2616005)(316002)(5660300002)(54906003)(6916009)(4326008)(66556008)(66946007)(8936002)(8676002)(2906002)(107886003)(478600001)(86362001)(52116002)(6486002)(6666004)(6512007)(6506007)(26005)(38100700002)(38350700002)(1076003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NXlTP28H97Esal5wf/fQzgGwIxkJU8A/SxwDK6qH4HcT8wS47lKemGbed0+yGQcOgf0k28xWPjBxNXDrPsUr0aL9sJ+4P9GGo5QAzEiMXZGnI3GtdaVMXte9y0k1WP4S0SLLpa523vwD/Hp3jYPm2GUjllHw7MFYK03J79cGU71KwootmdLHkZ7iLXMvDym0+Opv0O3qgfu0gHaUIfEwkvE4bzJ+AaLgahaLze96yTJvN/2na3BFPKDvJUbJOa9ZaKMjJMg3mpnpDE6QUdz/dqj/2B4mU4iI7GJE/dfKbvGFAIB2SXi3b+EmRAt5beoaqWODZkJHYon+wbiMD/+vnimu6B9N16DLCrikKAk/iXCqzxKeuB1azwKf+/yKLZ6HDbsU0NjTFCp5tVuZVCqPt09RlK7XzlgBOHQKZHz2eNw9a0+GVZIrQGk1OSor8uVpTRRw9aET8QUxruKMYSYp1AWLw+Umm77zVF32vaiRbIumY+jOh4n3DCcSZeET3uXTe1Xvpu26QsQoRTKzlNGlZKSw6AaNniy/Lt61vg8N0sQPh/zNp6CBWfVOm3dh23KNkQi/CbHA28Zvw/61zTnFFqSUKptjus2aDdhdL2nn3aGvBbibP13l/wbn6jC4b5d9d8foHyYC3em8EJUfoY1fqIpZJWfEteDPHTldLu6YZAZxmmk0+aDP3EOf49HpbLiX68gVZsnW5Z8fQyo/nz2jVCPlBiiULvE1o7vTrpR6lVxgImRNIljmwGIxmLuf3NAoqkm3q0dDCAR+N/P7PT5ph3+cCodA6mWF2Yvbue21UvIys7ks1AEE2D2HKiIlpaidLznCXH2Z4B/9z3Yg58I02WQudL08frDkK6qbHae3gEktj7z8GRu7GL5IoeW3kV1npHR/MA/KSZDRFAkSvFGm2BP/b+tGK9rFltLl7afSVt/tCFDL6964z2gxqANjZNOMYSufkmOFjIVZQLqaJU89y6nXAdiAOyef+fZjhp9s9MKwzwtYkxFvjvPhPeTIvo6TltSbPmRPJLaON8cq8h12BRKj8bk8/3aBIwQuGU989UMJyjaB2+uJ+CkdZ3yxfDrENJPqEyEj8pgEBTO6hp82UIEmM8i7Fo1EHx6EcbseC/0sswn/L+xlqEFgvcpzm//mnOFCBS4pYdaZeg1pUtbswdIzXfpAxUk6Qa6uMLKlv0oYz7ci5hoKG2691r4G4zrxtCn3yHTfkvjVBPbNGBnu3iEnqlR7aG8nMFLszu1RblLEVagdjdUtKpm8Nfr8UiaDmeeaxVZYZZc5G9/5D/ob2artv8lYDZ7pW2ZVMozb9SOB3EStyBpIw3jzjS1wPr9XIYY7VA1XyGxngOQtmQEfkn2A+YvhiwC23pTakL/hcXwA/f4aOxp55KQHDT50/VnFAb/Qn5EG2KFjtBDJWtMWGDUla1f6eHWICtcT+aiQxHK19Z4eBeawP355sWukISj8FN9LwgA0Flzys70ofIikaLrcWyAH1j/iM3l8utb+jnsJA6l9Pb4y5s/avJsZP1yBVnJCI+aJzsZuNFkO2oeym7OWKhltjzplVMrrjok4AV2KLMxwnVIorbzYUJrhlbkrie2357Ubi/Uh2TOxd3feeA== X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67837263-7b1f-4132-148c-08daab2f5751 X-MS-Exchange-CrossTenant-AuthSource: MWHPR0101MB2893.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 02:21:44.6840 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7C3Xyd26PnV5G5A+4CaMyNHGQMBC3aVS2YzJLO8r0U+n+lnvL6CkQmohLUnRYwdAnJiaqYhbhDfNv0GEZkHYwP9T7juTghfE1ZJCS9umBDLF/huPgNExo+b+apwWYtH4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR01MB3635 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221010_192155_380975_02CB2A9C X-CRM114-Status: UNSURE ( 9.82 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Per AmpereOne erratum AC03_CPU_12, "Branch history may allow control of speculative execution across software contexts," the AMPERE1 core needs the bhb clearing loop to mitigate Spectre-BHB, with a loop iteration count of 11. Signed-off-by: D Scott Phillips Reviewed-by: James Morse --- arch/arm64/include/asm/cputype.h | 4 ++++ arch/arm64/kernel/proton-pack.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h index 8aa0d276a636..abc418650fec 100644 --- a/arch/arm64/include/asm/cputype.h +++ b/arch/arm64/include/asm/cputype.h @@ -60,6 +60,7 @@ #define ARM_CPU_IMP_FUJITSU 0x46 #define ARM_CPU_IMP_HISI 0x48 #define ARM_CPU_IMP_APPLE 0x61 +#define ARM_CPU_IMP_AMPERE 0xC0 #define ARM_CPU_PART_AEM_V8 0xD0F #define ARM_CPU_PART_FOUNDATION 0xD00 @@ -123,6 +124,8 @@ #define APPLE_CPU_PART_M1_ICESTORM_MAX 0x028 #define APPLE_CPU_PART_M1_FIRESTORM_MAX 0x029 +#define AMPERE_CPU_PART_AMPERE1 0xAC3 + #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53) #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57) #define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72) @@ -172,6 +175,7 @@ #define MIDR_APPLE_M1_FIRESTORM_PRO MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM_PRO) #define MIDR_APPLE_M1_ICESTORM_MAX MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM_MAX) #define MIDR_APPLE_M1_FIRESTORM_MAX MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM_MAX) +#define MIDR_AMPERE1 MIDR_CPU_MODEL(ARM_CPU_IMP_AMPERE, AMPERE_CPU_PART_AMPERE1) /* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */ #define MIDR_FUJITSU_ERRATUM_010001 MIDR_FUJITSU_A64FX diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c index a8ea1637b137..bfce41c2a53b 100644 --- a/arch/arm64/kernel/proton-pack.c +++ b/arch/arm64/kernel/proton-pack.c @@ -868,6 +868,10 @@ u8 spectre_bhb_loop_affected(int scope) MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1), {}, }; + static const struct midr_range spectre_bhb_k11_list[] = { + MIDR_ALL_VERSIONS(MIDR_AMPERE1), + {}, + }; static const struct midr_range spectre_bhb_k8_list[] = { MIDR_ALL_VERSIONS(MIDR_CORTEX_A72), MIDR_ALL_VERSIONS(MIDR_CORTEX_A57), @@ -878,6 +882,8 @@ u8 spectre_bhb_loop_affected(int scope) k = 32; else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k24_list)) k = 24; + else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k11_list)) + k = 11; else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k8_list)) k = 8;