Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 081CAC433FE for ; Wed, 9 Dec 2020 07:32:37 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ABAAC23B79 for ; Wed, 9 Dec 2020 07:32:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABAAC23B79 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.48001.84918 (Exim 4.92) (envelope-from ) id 1kmtxc-0005zY-Pz; Wed, 09 Dec 2020 07:32:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 48001.84918; Wed, 09 Dec 2020 07:32:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kmtxc-0005zR-Mq; Wed, 09 Dec 2020 07:32:28 +0000 Received: by outflank-mailman (input) for mailman id 48001; Wed, 09 Dec 2020 07:32:27 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kmtxb-0005zM-5s for xen-devel@lists.xenproject.org; Wed, 09 Dec 2020 07:32:27 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id c613b343-a7cb-4a85-af53-992c3d92ab12; Wed, 09 Dec 2020 07:32:25 +0000 (UTC) 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 E94BA30E; Tue, 8 Dec 2020 23:32:24 -0800 (PST) Received: from [10.57.1.227] (unknown [10.57.1.227]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CF3313F66B; Tue, 8 Dec 2020 23:32:23 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c613b343-a7cb-4a85-af53-992c3d92ab12 Subject: Re: [PATCH] xen/arm: Add workaround for Cortex-A53 erratum #845719 To: Stefano Stabellini , Julien Grall Cc: Bertrand Marquis , "xen-devel@lists.xenproject.org" , Volodymyr Babchuk , Wei Chen References: <20201208072327.11890-1-michal.orzel@arm.com> <5D1B5771-A6B3-4F5E-81A1-864DBC8787B4@arm.com> From: Michal Orzel Message-ID: Date: Wed, 9 Dec 2020 08:32:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 09.12.2020 02:34, Stefano Stabellini wrote: > On Tue, 8 Dec 2020, Julien Grall wrote: >> On 08/12/2020 14:38, Bertrand Marquis wrote: >>> Hi Julien, >>> >>>> On 8 Dec 2020, at 09:47, Julien Grall wrote: >>>> >>>> Hi, >>>> >>>> On 08/12/2020 07:23, Michal Orzel wrote: >>>>> When executing in aarch32 state at EL0, a load at EL0 from a >>>>> virtual address that matches the bottom 32 bits of the virtual address >>>>> used by a recent load at (aarch64) EL1 might return incorrect data. >>>>> The workaround is to insert a write of the contextidr_el1 register >>>>> on exception return to an aarch32 guest. >>>> >>>> I am a bit confused with this comment. In the previous paragraph, you are >>>> suggesting that the problem is an interaction between EL1 AArch64 and EL0 >>>> AArch32. But here you seem to imply the issue only happen when running a >>>> AArch32 guest. >>>> >>>> Can you clarify it? >>> >>> This can happen when switching from an aarch64 guest to an aarch32 guest so >>> not only when there is interaction. > > Just to confirm: it cannot happen when switching from aarch64 *EL2* to > aarch32 EL0/1, right? Because that happens all the time in Xen. > > No it cannot. It can only happen when switching from aarch64 EL1 to aarch32 EL0. >> Right, but the context switch will write to CONTEXTIDR_EL1. So this case >> should already be handled. >> >> Xen will never switch from AArch64 EL1 to AArch32 EL0 without a context switch >> (the inverse can happen if we inject an exception to the guest). >> >> Reading the Cortex-A53 SDEN, it sounds like this is an OS and not Hypervisor >> problem. In fact, Linux only seems to workaround it when switching in the OS >> side rather than the hypervisor. >> >> Therefore, I am not sure to understand why we need to workaroud it in Xen. > > It looks like Julien is right in regards to the "aarch64 EL1 to aarch32 > EL0" issue. > Yes I agree. I missed the fact that there is a write to CONTEXTIDR_EL1 in 'ctxt_switch_to'. Let's abandon this. Thanks, Michal