From patchwork Fri Mar 11 19:49:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randy Dunlap X-Patchwork-Id: 12778544 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 782E2C433EF for ; Fri, 11 Mar 2022 19:50:30 +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=7txaV7BNqG5+GHb8q5m+87WTfm/5x5sPD37mL0HApxI=; b=cza/hIl2aDX4fK 6Z8evBucvwwcPkmVVvcX+VmPowOQ0voAbdBG7oxFFP05KdXPlOEsSBCZOWjJr5JzyiqviiSgK5NJ6 5ug9u0VKOeDre6749afo4nK7As6YfsXmYYaJuUaqtO6mSUr57T3sjC1GAHmpCOb2d2URp5xogRffx 4T+iztj/8AzWuLtPeXOxcSAdc+Tzc/F7rsZLPIf2w+w1IjfX+teivCc6YFbpNC/tBM3IrA7GQdZ/P OnFNZ7W5Ek8NM8lFw+3lb1PDJrif/GhH/bMsBNGmUV0Z9SENF/h33s1wDxnXjMRu+bQcgqfEndsQY UOnIcjYDcmNvREAQnWBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSlGG-0007ZM-EM; Fri, 11 Mar 2022 19:49:16 +0000 Received: from [2601:1c0:6280:3f0::aa0b] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSlGD-0007Z5-S7; Fri, 11 Mar 2022 19:49:14 +0000 From: Randy Dunlap To: linux-kernel@vger.kernel.org, Linus Torvalds Cc: Randy Dunlap , kernel test robot , Russell King , Catalin Marinas , linux-arm-kernel@lists.infradead.org, patches@armlinux.org.uk Subject: [PATCH v2] ARM: Spectre-BHB: provide empty stub for non-config Date: Fri, 11 Mar 2022 11:49:12 -0800 Message-Id: <20220311194912.26249-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 When CONFIG_GENERIC_CPU_VULNERABILITIES is not set, references to spectre_v2_update_state() cause a build error, so provide an empty stub for that function when the Kconfig option is not set. Fixes this build error: arm-linux-gnueabi-ld: arch/arm/mm/proc-v7-bugs.o: in function `cpu_v7_bugs_init': proc-v7-bugs.c:(.text+0x52): undefined reference to `spectre_v2_update_state' arm-linux-gnueabi-ld: proc-v7-bugs.c:(.text+0x82): undefined reference to `spectre_v2_update_state' Fixes: b9baf5c8c5c3 ("ARM: Spectre-BHB workaround") Signed-off-by: Randy Dunlap Reported-by: kernel test robot Cc: Russell King Cc: Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org Cc: patches@armlinux.org.uk Acked-by: Russell King (Oracle) --- v2: add Russell's Ack and suggestion to send directly to Linus. Linus- Russel King says: I'd suggest sending this direct to Linus as I've been doing with the other fixes for Spectre BHB. Trying to fit it now into a pull request is just going to be very messy. KernelVersion: v5.17-rc7-205-g79b00034e9dc arch/arm/include/asm/spectre.h | 6 ++++++ 1 file changed, 6 insertions(+) --- linux-next-20220310.orig/arch/arm/include/asm/spectre.h +++ linux-next-20220310/arch/arm/include/asm/spectre.h @@ -25,7 +25,13 @@ enum { SPECTRE_V2_METHOD_LOOP8 = BIT(__SPECTRE_V2_METHOD_LOOP8), }; +#ifdef CONFIG_GENERIC_CPU_VULNERABILITIES void spectre_v2_update_state(unsigned int state, unsigned int methods); +#else +static inline void spectre_v2_update_state(unsigned int state, + unsigned int methods) +{} +#endif int spectre_bhb_update_vectors(unsigned int method);