Received: by 10.223.176.5 with SMTP id f5csp732863wra; Fri, 2 Feb 2018 05:18:48 -0800 (PST) X-Google-Smtp-Source: AH8x224mA3cYzUnhYm1arNJNgtbBf1bJFfNzEmTQlTyo/NvlcjJpiEebLt2Ge0peKcH+eMY5Rj03 X-Received: by 2002:a17:902:aa85:: with SMTP id d5-v6mr36683821plr.239.1517577528305; Fri, 02 Feb 2018 05:18:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517577528; cv=none; d=google.com; s=arc-20160816; b=Y6uESOB3OMW7t6vhU+yLH8gETI6Z3ECjxh9JaZsI1CYRfxM9hCEimUQTD5Mjrqt24k /+D0C9zY4NI15UIfIyeYE5MNxLWDjvyXJze0CPoclz+FjuM2ZQaH8ss5eu6R2eiZiQD5 jIfK38me/ManC1VBcMQ+wccpp2T+1CKr4Yxxo6PE/wwk1wSctpI1XqnRIp7ctdxLPF1D cmkzm+WZUH0A02Y51E9DEbHeL/abyEPBQ+YRWs9Ut+cY7yfPruys1ABf0ER1I6sJ9uNJ PM8QBi1Y7KEgRFo/6LnH+knLiBkBFxFVrYCjj9oWCfFLMdVGmvivyJlDLuQYtW+7+BPt 9adA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :arc-authentication-results; bh=3X2/IaNdR9tEjKDAGJsBq5x/8ZrIGmHwCaXA7oeFWts=; b=CSKFv4CKqcVsQ81gfQiMiK/eeCpgsa6pgWnWzN0oK01JqqxzCIDRbxB8/hWe45sVhM 7UKs9mwYEOnq7G6SVcCRxDA/rdGEDxdukB2q+xSwxi5kydbN+uiAq3uxZL+0TLip/sEK Tqcc+JoRXiTFxnwgk9pih3j486/S306N9k5mr2CMs4esGSFOLHtqv6RcrEtnCsPz/Tfr fLIHM+bfwh5Ag6K44qwkJiL759+Vcmj8eMWlwgx+8JGoJoLEWCncuX8gzApJqXg9hKNy Lxh4JCqU1ujTkJzJAJqVgSIk5bOaag5uKTfFfQqDpxtVk4eQk53K3h3kIrru1dEIp6HL 5GpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x30si1427516pgc.607.2018.02.02.05.18.32; Fri, 02 Feb 2018 05:18:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751643AbeBBNSG (ORCPT + 99 others); Fri, 2 Feb 2018 08:18:06 -0500 Received: from foss.arm.com ([217.140.101.70]:59136 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416AbeBBNSA (ORCPT ); Fri, 2 Feb 2018 08:18:00 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BDDE71529; Fri, 2 Feb 2018 05:17:59 -0800 (PST) Received: from [10.1.207.62] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 322723F25C; Fri, 2 Feb 2018 05:17:57 -0800 (PST) Subject: Re: [PATCH v3 18/18] arm64: Kill PSCI_GET_VERSION as a variant-2 workaround To: Hanjun Guo , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: Catalin Marinas , Will Deacon , Peter Maydell , Christoffer Dall , Lorenzo Pieralisi , Mark Rutland , Robin Murphy , Ard Biesheuvel , Andrew Jones , Jayachandran C , Jon Masters , Russell King - ARM Linux References: <20180201114657.7323-1-marc.zyngier@arm.com> <20180201114657.7323-19-marc.zyngier@arm.com> From: Marc Zyngier Organization: ARM Ltd Message-ID: Date: Fri, 2 Feb 2018 13:17:55 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/02/18 04:05, Hanjun Guo wrote: > Hi Marc, > > Thank you for keeping me in the loop, just minor comments below. > > On 2018/2/1 19:46, Marc Zyngier wrote: >> Now that we've standardised on SMCCC v1.1 to perform the branch >> prediction invalidation, let's drop the previous band-aid. >> If vendors haven't updated their firmware to do SMCCC 1.1, they >> haven't updated PSCI either, so we don't loose anything. >> >> Signed-off-by: Marc Zyngier >> --- >> arch/arm64/kernel/bpi.S | 24 ----------------------- >> arch/arm64/kernel/cpu_errata.c | 43 ++++++++++++------------------------------ >> arch/arm64/kvm/hyp/switch.c | 14 -------------- >> 3 files changed, 12 insertions(+), 69 deletions(-) >> >> diff --git a/arch/arm64/kernel/bpi.S b/arch/arm64/kernel/bpi.S >> index fdeed629f2c6..e5de33513b5d 100644 >> --- a/arch/arm64/kernel/bpi.S >> +++ b/arch/arm64/kernel/bpi.S >> @@ -54,30 +54,6 @@ ENTRY(__bp_harden_hyp_vecs_start) >> vectors __kvm_hyp_vector >> .endr >> ENTRY(__bp_harden_hyp_vecs_end) >> -ENTRY(__psci_hyp_bp_inval_start) >> - sub sp, sp, #(8 * 18) >> - stp x16, x17, [sp, #(16 * 0)] >> - stp x14, x15, [sp, #(16 * 1)] >> - stp x12, x13, [sp, #(16 * 2)] >> - stp x10, x11, [sp, #(16 * 3)] >> - stp x8, x9, [sp, #(16 * 4)] >> - stp x6, x7, [sp, #(16 * 5)] >> - stp x4, x5, [sp, #(16 * 6)] >> - stp x2, x3, [sp, #(16 * 7)] >> - stp x0, x1, [sp, #(16 * 8)] >> - mov x0, #0x84000000 >> - smc #0 >> - ldp x16, x17, [sp, #(16 * 0)] >> - ldp x14, x15, [sp, #(16 * 1)] >> - ldp x12, x13, [sp, #(16 * 2)] >> - ldp x10, x11, [sp, #(16 * 3)] >> - ldp x8, x9, [sp, #(16 * 4)] >> - ldp x6, x7, [sp, #(16 * 5)] >> - ldp x4, x5, [sp, #(16 * 6)] >> - ldp x2, x3, [sp, #(16 * 7)] >> - ldp x0, x1, [sp, #(16 * 8)] >> - add sp, sp, #(8 * 18) >> -ENTRY(__psci_hyp_bp_inval_end) >> >> ENTRY(__qcom_hyp_sanitize_link_stack_start) >> stp x29, x30, [sp, #-16]! >> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c >> index 9e77809a3b23..b8279a11f57b 100644 >> --- a/arch/arm64/kernel/cpu_errata.c >> +++ b/arch/arm64/kernel/cpu_errata.c >> @@ -67,7 +67,6 @@ static int cpu_enable_trap_ctr_access(void *__unused) >> DEFINE_PER_CPU_READ_MOSTLY(struct bp_hardening_data, bp_hardening_data); >> >> #ifdef CONFIG_KVM >> -extern char __psci_hyp_bp_inval_start[], __psci_hyp_bp_inval_end[]; >> extern char __qcom_hyp_sanitize_link_stack_start[]; >> extern char __qcom_hyp_sanitize_link_stack_end[]; >> extern char __smccc_workaround_1_smc_start[]; >> @@ -116,8 +115,6 @@ static void __install_bp_hardening_cb(bp_hardening_cb_t fn, >> spin_unlock(&bp_lock); >> } >> #else >> -#define __psci_hyp_bp_inval_start NULL >> -#define __psci_hyp_bp_inval_end NULL >> #define __qcom_hyp_sanitize_link_stack_start NULL >> #define __qcom_hyp_sanitize_link_stack_end NULL >> #define __smccc_workaround_1_smc_start NULL >> @@ -164,14 +161,15 @@ static void call_hvc_arch_workaround_1(void) >> arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL); >> } >> >> -static bool check_smccc_arch_workaround_1(const struct arm64_cpu_capabilities *entry) >> +static int smccc_arch_workaround_1(void *data) >> { >> + const struct arm64_cpu_capabilities *entry = data; >> bp_hardening_cb_t cb; >> void *smccc_start, *smccc_end; >> struct arm_smccc_res res; >> >> if (!entry->matches(entry, SCOPE_LOCAL_CPU)) > > entry->matches() will be called twice in this function, another > one is in install_bp_hardening_cb() below, but install_bp_hardening_cb() > will be called in qcom_enable_link_stack_sanitization(), and > this is in the init path, so I think it's fine to keep as it is now. That's on purpose. Otherwise we spam the firmware/hypervisor with probe calls for each entry that has the same capability. Not a big deal, but still. This should be addressed when we get Suzuki's rework. > >> - return false; >> + return 0; >> >> if (psci_ops.smccc_version == SMCCC_VERSION_1_0) >> return false; > > return 0; Ah, indeed. Thanks. M. -- Jazz is not dead. It just smells funny...