From mboxrd@z Thu Jan 1 00:00:00 1970 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 F1631C433F5 for ; Wed, 13 Apr 2022 17:07:24 +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:References:In-Reply-To: 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: List-Owner; bh=0faU3vmserN3cCXmwjflvld0YJfanWYDWqPYUUDWnaA=; b=XSUIkrw3HibXrT zfgjqIcNBEwFawohemnXVhDBu2yGvPs5xm2C4D+bO2onMl53V67vpXAVjsDoEDSXyoUi17iPcT4KA ENsw73f0+e9gFPDOiFy2W5F6xK6hvqkZJ0CbtWL3as5glBOr6tYzY83iYk80/XXmeoZBOLuUFhi4D +DhnyRs0+kUzvh6Qzpbg04tvpiMch7hb7+KmPFqBk/hQL33UJSc4ANW29NHctck16wRG1XuZAC5PJ 3NTRhYQ28iPTptAkKkHFDZ861DGMXXaq48fJ9kpQLrrZuI8hNgzAHA7Ly0eJed33qbUZwQ4MLNwLn QBfQTH3QpmuGXe8lJA5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1negRj-001skH-Az; Wed, 13 Apr 2022 17:06:23 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1negRO-001sfg-Qh for linux-arm-kernel@lists.infradead.org; Wed, 13 Apr 2022 17:06:04 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CEA231576; Wed, 13 Apr 2022 10:06:01 -0700 (PDT) Received: from eglon.cambridge.arm.com (eglon.cambridge.arm.com [10.1.196.218]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 129313F73B; Wed, 13 Apr 2022 10:06:00 -0700 (PDT) From: James Morse To: linux-arm-kernel@lists.infradead.org Cc: Russell King , Ard Biesheuvel , Catalin Marinas , Will Deacon Subject: [PATCH v2 2/2] ARM: Remove AES hwcap for parts affected by errata Date: Wed, 13 Apr 2022 18:05:45 +0100 Message-Id: <20220413170545.3042558-3-james.morse@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220413170545.3042558-1-james.morse@arm.com> References: <20220413170545.3042558-1-james.morse@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_100602_962477_D7959CA8 X-CRM114-Status: GOOD ( 12.32 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Cortex-A57 and Cortex-A72 have an erratum where an interrupt that occurs between a pair of AES instructions in aarch32 mode may corrupt the ELR. The task will subsequently produce the wrong AES result. The AES instructions are part of the cryptographic extensions, which are optional. User-space software will detect the support for these instructions from the hwcaps. If the platform doesn't support these instructions a software implementation should be used. Remove the hwcap bits on affected parts to indicate user-space should not use the AES instructions. Signed-off-by: James Morse --- arch/arm/kernel/setup.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 1e8a50a97edf..8a409bfd33f2 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -501,6 +501,15 @@ static void __init elf_hwcap_fixup(void) return; } + /* + * HWCAP2_AES can get the wrong result due to A57's erratum #1742098 or + * A72's #1655431. + */ + if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A57 || + read_cpuid_part() == ARM_CPU_PART_CORTEX_A72) { + elf_hwcap2 &= ~HWCAP2_AES; + } + /* Verify if CPUID scheme is implemented */ if ((id & 0x000f0000) != 0x000f0000) return; -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel