From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=unavailable 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 9AD55C04AAB for ; Mon, 6 May 2019 15:37:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7288E205C9 for ; Mon, 6 May 2019 15:37:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbfEFPhp (ORCPT ); Mon, 6 May 2019 11:37:45 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54566 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbfEFPho (ORCPT ); Mon, 6 May 2019 11:37:44 -0400 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 E7C34374; Mon, 6 May 2019 08:37:43 -0700 (PDT) Received: from [10.37.12.89] (unknown [10.37.12.89]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0DE983F575; Mon, 6 May 2019 08:37:41 -0700 (PDT) Subject: Re: [PATCH V2] ARM: mach-shmobile: Don't init CNTVOFF if PSCI is available To: Oleksandr Tyshchenko , linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: horms@verge.net.au, magnus.damm@gmail.com, linux@armlinux.org.uk, biju.das@bp.renesas.com, Oleksandr Tyshchenko References: <1556882268-27451-1-git-send-email-olekstysh@gmail.com> From: Julien Grall Message-ID: Date: Mon, 6 May 2019 16:37:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1556882268-27451-1-git-send-email-olekstysh@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed 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 Hi Oleksandr, On 5/3/19 12:17 PM, Oleksandr Tyshchenko wrote: > From: Oleksandr Tyshchenko > > If PSCI is available then most likely we are running on PSCI-enabled > U-Boot which, we assume, has already taken care of resetting CNTVOFF > before switching to non-secure mode and we don't need to. > > Also, don't init CNTVOFF if we are running on top of Xen hypervisor, > as CNTVOFF is controlled by hypervisor itself and shouldn't be touched > by Dom0 in such case. > > Signed-off-by: Oleksandr Tyshchenko > CC: Julien Grall > > --- > You can find previous discussion here: > https://lkml.org/lkml/2019/4/17/810 > > Changes in v2: > - Clarify patch subject/description > - Don't use CONFIG_ARM_PSCI option, check whether the PSCI is available, > by using psci_smp_available() > - Check whether we are running on top of Xen, by using xen_domain() > --- > arch/arm/mach-shmobile/setup-rcar-gen2.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c > index eea60b2..bc8537b 100644 > --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c > +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c > @@ -17,7 +17,9 @@ > #include > #include > #include > +#include > #include > +#include > #include > #include "common.h" > #include "rcar-gen2.h" > @@ -63,7 +65,16 @@ void __init rcar_gen2_timer_init(void) > void __iomem *base; > u32 freq; > > - secure_cntvoff_init(); > + /* > + * If PSCI is available then most likely we are running on PSCI-enabled > + * U-Boot which, we assume, has already taken care of resetting CNTVOFF > + * before switching to non-secure mode and we don't need to. > + * Another check is to be sure that we are not running on top of Xen > + * hypervisor, as CNTVOFF is controlled by hypervisor itself and > + * shouldn't be touched by Dom0 in such case. If you are running on top of Xen, then PSCI will be available. So is there any real value to check the presence of Xen as well? Cheers, -- Julien Grall