Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp828943imm; Wed, 22 Aug 2018 13:23:06 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxV4h/Yb/eDkJ8ZSFmlnxo6CrQhADEpxVaeQfByn635G84EuD5sAHhnFV/4MLyPCe3GpV0w X-Received: by 2002:a63:2744:: with SMTP id n65-v6mr23182059pgn.29.1534969386860; Wed, 22 Aug 2018 13:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534969386; cv=none; d=google.com; s=arc-20160816; b=szk2ogBbJF5XW7mwzLyjGASg5aFcdpg8WPN2XLVjG9hV8MfdKcguBwwlw2ZyDZPO4O Mijb2NacZP/rQ1HP52bsrilEc+LaC9Mq7k6hXqft3E1vF9aFbw5mnZlcH3F4HWHCNL0g dElpHSwYwg/cBfyzA8lSyLvLUFhU79ozOSX1M6QvZzoBUJYNc4cVjxnjHA8McUYZInyu Ri0CIxVYyI1ttgeiGMFnkj/A/mjerDh8RTwtHFvBSXhP/hPIj66t4jxx9+agk6YV7I9m oDVjy34WypUbSU1U09UjNsR/2C7u3JsF3vQaPU7dna0VhYi/+I8xSIft0l+Cb17aDLz2 EhFA== 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:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=t5uPrUDmNlK04MQOuJY0LHy/NNtg3cNiuXD4u9yAW4E=; b=JxdfwO7GIP+V0TSw8W3wwIryOUS5MN6HVi9FURo90jNCbGnnToHuWwyu9ykF4C5N58 RH8Uj/Mmvzc8br41vd1mdoWml4qff5EHXM68gpMuIYBHCM2WkVQfpSg/IH/xHedcPKOH l1Y8J8R5/9X3pGRnGHcfgyKWT7bOMtp/uap+9UVbDNIZXn4cwv+AAXI2c8atCVHdgB85 L97kAcPKXiBHrxAp9UYzq5YHBnXOshU5DRVk+YnpbxB8RF/rsLfaAi1sitkQIheVW8yE S/3AdflR44IPXtRM0XyY4UQTprf5RXwpp9MfG87vDLYad5xnkkGspkzQ2KxWYWi7o9sy xHrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nVkpNC7n; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d30-v6si2430074pla.200.2018.08.22.13.22.50; Wed, 22 Aug 2018 13:23:06 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nVkpNC7n; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728261AbeHVXsD (ORCPT + 99 others); Wed, 22 Aug 2018 19:48:03 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45129 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbeHVXsD (ORCPT ); Wed, 22 Aug 2018 19:48:03 -0400 Received: by mail-wr1-f65.google.com with SMTP id 20-v6so2631422wrb.12 for ; Wed, 22 Aug 2018 13:21:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=t5uPrUDmNlK04MQOuJY0LHy/NNtg3cNiuXD4u9yAW4E=; b=nVkpNC7n7/EC/CGbfRyOzF2N7hnPMcYSgfvHlUY2IsiY0QmHMskY5F71be4TL/AG/t ZxrIsUs7WpuMFRpuzDUYgQAgVJW8PC/QzMsGmtF1NKQcrMpRMYB8di1RW5USF8ypqtTC CYF4P86AdD42GrNMiQmLk3ekH6w8/k6H31Fkrl1nVu8Oa2B3xUzkXcvUuXQ3qGz0nUUq 3sTgtrnmBYnOWc3ignbAXJ8RQIxvOTdIP9RTEIMRG7dFtOOBubzBpv+9rNrMYrFVBbfu 5slFDLnVvX/SVmaAJsev6ziDVHwiigQvLETFgje5g9A4h1CB+rGK2vCJYo5O74zq0sEd DfYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=t5uPrUDmNlK04MQOuJY0LHy/NNtg3cNiuXD4u9yAW4E=; b=UT/K70DpUKfLKpN5lAxVVh+m72R7QCTvWHCLTXFgg9uTDwv1e4Xl5E+Os6NYnRAfOP YvpnOl9k9f5DJcN736Y5x43LzBSm5G64a9TwKSSRlZ30TXuBQqu8TK+YgpSKOEkF6yTq /qpNhmwZoChFd2mhJdxWT+f5lChnpGxpAPNUk3iqdMRfISBQ+Ob1bnM1qWqKlMr0Xtco U8mJFJUl3nZ+detuG2vc9XsfLPjObnVeOBo8yh/kEEDNz8WJ/PAI1R5v6Vih+zsW76JE gz3XqgIdYF33uqNKNi7gcJydAUCUf5/TktCi/r5Q6gitjc5m9axvxdFkG7L9KFXdblIy Gf5w== X-Gm-Message-State: AOUpUlHeSJ/sIcADIBUHtJm6naxtgRbPaNEyJkF5CsL5lhexI56v4wel +IWisMtKZQHYEermtSxTMWg= X-Received: by 2002:a5d:6a92:: with SMTP id s18-v6mr36672641wru.44.1534969301508; Wed, 22 Aug 2018 13:21:41 -0700 (PDT) Received: from [192.168.1.4] (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id n7-v6sm642138wmc.2.2018.08.22.13.21.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Aug 2018 13:21:40 -0700 (PDT) Subject: Re: [PATCH] ARM: spectre-v2: Try to set IBE bit for Cortex-A15 and Brahma-B15 To: Florian Fainelli , linux-arm-kernel@lists.infradead.org Cc: Luca Scalabrino , marc.zyngier@arm.com, Russell King , open list , Tony Lindgren , Geert Uytterhoeven References: <20180607225804.28771-1-f.fainelli@gmail.com> From: Marek Vasut Message-ID: <3698a520-00cd-f904-a031-a7d6f22c8885@gmail.com> Date: Wed, 22 Aug 2018 22:21:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/11/2018 03:58 PM, Marek Vasut wrote: > On 06/08/2018 12:58 AM, Florian Fainelli wrote: >> Per the ARM reference manual for the Cortex-A15, The ACTLR: >> >> Is a read/write register. >> >> Common to the Secure and Non-secure states. >> >> Is only accessible from PL1 or higher, with access rights that depend >> on the mode: >> >> * Read/write in Secure PL1 modes. >> >> * Read-only and write-ignored in Non-secure PL1 and PL2 modes >> if NSACR.NS_SMP is 0. >> >> * Read/write in Non-secure PL1 and PL2 modes if NSACR.NS_SMP >> is 1. In this case, all bits are write-ignored except for the SMP bit. >> >> We can attempt to set this bit from within the kernel, which helps >> avoiding firmware side modifications to set the IBE bit when that is >> impractical. We do this within __v7_ca15mp_setup and __v7_b15mp_setup >> because by then we already took those labels because the processors we >> run on do match. >> >> Signed-off-by: Florian Fainelli > > I believe this would help on selected R-Car Gen2 SoCs which have CA15 > cores. Those cores are released from reset by Linux directly and jump to > the reset vector set up by Linux in Secure mode. > > I was looking for a generic solution after discussing how to mitigate > the spectrev2 on such SoCs with Catalin on IRC and this seems to be one > option. There was also a suggestion that Russell is working on some sort > of generic solution too. Can you comment on that please ? Is there any feedback on this ? >> --- >> arch/arm/mm/proc-v7.S | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S >> index 6fe52819e014..a21cf3729efa 100644 >> --- a/arch/arm/mm/proc-v7.S >> +++ b/arch/arm/mm/proc-v7.S >> @@ -284,10 +284,16 @@ __v7_cr8mp_setup: >> b 1f >> __v7_ca7mp_setup: >> __v7_ca12mp_setup: >> + b 2f >> __v7_ca15mp_setup: >> __v7_b15mp_setup: >> +#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR >> + mrc p15, 0, r0, c1, c0, 1 >> + orr r0, r0, #1 @ Enable IBE bit >> + mcr p15, 0, r0, c1, c0, 1 >> +#endif >> __v7_ca17mp_setup: >> - mov r10, #0 >> +2: mov r10, #0 >> 1: adr r0, __v7_setup_stack_ptr >> ldr r12, [r0] >> add r12, r12, r0 @ the local stack >> > > -- Best regards, Marek Vasut