Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1211372pxb; Wed, 6 Apr 2022 11:25:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEfhlwIR+m/e6juho/2fE/rqjcn9oiHaAi0tybLfEWU1UxTlP972WqFs+ucOtTLxBo7W9S X-Received: by 2002:a05:6a00:10c7:b0:4fd:9ee6:4130 with SMTP id d7-20020a056a0010c700b004fd9ee64130mr10470100pfu.84.1649269557993; Wed, 06 Apr 2022 11:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649269557; cv=none; d=google.com; s=arc-20160816; b=t++rxsk3WeMZc7FMIxwszaMhMPuog9fLSFrYQ9spbNxJrFyB0WdU2HC4wx9cdzZ1G2 02twWQVr4MNvWhsFdXXu/l4bPTPtFCF8e9gSH8Tm0Gxt/FEPUgPahjZlmjxDVMUhOJbN sMxhrGVr9Y8lEB3L9kCb1EH96pDZvGnd9fS4ecYVDDp8Kwsam2KWSNKL1qTxKlkJqq6J 23PmOoiJvh/plxPbPm4HvwUlbdssC73UHcRPKrkvbY5BH9abAd3XXKdpQ4rnfzUhC0tV JMW4vgFdX0lHeaV1uAzDPMO7cVIMwHyMDdPvF9kSbPfHpMcRGgkvoMrnj0lMJWB+3lYo U/Bg== 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; bh=2v1mbbDicwZoT8hSbr94Zd3x99ZqKmx0z2LVw2yoR9Q=; b=ooliJaaS5nu91XGfnT8QkpJ3Mg9cgjsPhyIviDGfwsUmML+2vW+7s4lJF4WwHoXFh8 dKdRjrrTvMCAqeU/Qiu0PwrDY/KSKicIhkSby7RViTXEnBU9tnfeQW9Mhwrs9TJdcw6r CHSsE/9gTrvJduTbOStn3HkD4+EB4kf5TtzYcyDfCcnACxtdWR0L7tIyEzWRVutQCdrx bQUulXWSn3fJGzRcwZsv+Xxn7vMetGdnrPO5hWMkfvp2sIaJjad1mlKJTGP0QaDJTY57 UJJteXO7OXyQXXi0MypU2hLb9kAhRuPSXPqQUmHbXZu5A6xzNwkNR4V26Q1yU6UckRrc v8gA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d16-20020a170902ced000b00153b2d165a0si18429324plg.424.2022.04.06.11.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 11:25:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 79A01254584; Wed, 6 Apr 2022 11:09:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240084AbiDFSKz (ORCPT + 99 others); Wed, 6 Apr 2022 14:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240002AbiDFSIO (ORCPT ); Wed, 6 Apr 2022 14:08:14 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6C48713316D; Wed, 6 Apr 2022 09:46:33 -0700 (PDT) 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 5369F1516; Wed, 6 Apr 2022 09:46:33 -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 A66783F73B; Wed, 6 Apr 2022 09:46:32 -0700 (PDT) From: James Morse To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: James Morse , Catalin Marinas Subject: [stable:PATCH v4.9.309 35/43] arm64: Move arm64_update_smccc_conduit() out of SSBD ifdef Date: Wed, 6 Apr 2022 17:45:38 +0100 Message-Id: <20220406164546.1888528-35-james.morse@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220406164546.1888528-1-james.morse@arm.com> References: <0220406164217.1888053-1-james.morse@arm.com> <20220406164546.1888528-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 arm64_update_smccc_conduit() is an alternative callback that patches HVC/SMC. Currently the only user is SSBD. To use this for Spectre-BHB, it needs to be moved out of the SSBD #ifdef region. Signed-off-by: James Morse --- arch/arm64/kernel/cpu_errata.c | 44 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 37cb8c23ccc6..0d08249cbdab 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -204,6 +204,28 @@ enable_smccc_arch_workaround_1(const struct arm64_cpu_capabilities *entry) } #endif /* CONFIG_HARDEN_BRANCH_PREDICTOR */ +void __init arm64_update_smccc_conduit(struct alt_instr *alt, + __le32 *origptr, __le32 *updptr, + int nr_inst) +{ + u32 insn; + + BUG_ON(nr_inst != 1); + + switch (psci_ops.conduit) { + case PSCI_CONDUIT_HVC: + insn = aarch64_insn_get_hvc_value(); + break; + case PSCI_CONDUIT_SMC: + insn = aarch64_insn_get_smc_value(); + break; + default: + return; + } + + *updptr = cpu_to_le32(insn); +} + #ifdef CONFIG_ARM64_SSBD DEFINE_PER_CPU_READ_MOSTLY(u64, arm64_ssbd_callback_required); @@ -239,28 +261,6 @@ static int __init ssbd_cfg(char *buf) } early_param("ssbd", ssbd_cfg); -void __init arm64_update_smccc_conduit(struct alt_instr *alt, - __le32 *origptr, __le32 *updptr, - int nr_inst) -{ - u32 insn; - - BUG_ON(nr_inst != 1); - - switch (psci_ops.conduit) { - case PSCI_CONDUIT_HVC: - insn = aarch64_insn_get_hvc_value(); - break; - case PSCI_CONDUIT_SMC: - insn = aarch64_insn_get_smc_value(); - break; - default: - return; - } - - *updptr = cpu_to_le32(insn); -} - void __init arm64_enable_wa2_handling(struct alt_instr *alt, __le32 *origptr, __le32 *updptr, int nr_inst) -- 2.30.2