Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2605848yba; Mon, 6 May 2019 08:40:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuyrNDCvl0WrT8zKNK6OmckvWbn99esAeTsWpTCz6jIYf5eC31BJmF2FfFT70yFVcwkQRU X-Received: by 2002:a62:e00e:: with SMTP id f14mr33916803pfh.257.1557157225957; Mon, 06 May 2019 08:40:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557157225; cv=none; d=google.com; s=arc-20160816; b=buKqHrWjeCO3QI/4rlyZ61B9zT//kuOOU4NdoLpTgIB7VpF5kKREwT1FCAFVBKqWu0 7tp5757Yghj/VFI9MOcEzdx5ZnkPEWVv3iSJaehdsOrPsq/ko5OGkNOW13UCTSgNVhIi bUfXMU3dLzMOHBnyTaQElZovx6xcmIOE/lx39ZRKXqy8amrSgcet+yS63Fjj7Barm0HM CA2Kebcs2AgQDEulEzQXjLBRp1i/kSjJsY3ZTCTs5IJ3iP6aGGUsc8LeVhf+5kpK6Wtw X3XddLCwpQ6q3Tra2yMgIwprRKynZ8TjItJIB3PiHPeesYcVJ7xN/OQnEei1oyG3g5vO oqxg== 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; bh=3kMCItr3tkfkKHVMkfvdAzhXccaYtcMLH92+T6ck6Tk=; b=UEvuaSbLkZtoOpamt3tnGjncR6wakRL6Gx5IHqcYuGG7CJ6Si3x+jorki8j4qCZq7e L0EraB0pAWgq3NQfOhhoh3FqcZ91A5oAg5MZjMLOVJBiW+DDO6CB5outUk5oc0rh7XFu NpGwbZuw5xrwE7sNcRPTdMkx83nt3kldT1HKz3axev2F2+aUNPHj2lHVX09B3Qw88WGp Lh5MS5z7t2Tyrueewu7WjPN4BHsIBXX5pE8fFvod2Z6hKBUV0FQ0cddvDIsNEC55AZWT zP6YXSgHFGEYz1j3gzKPlTuGIuKBs0+ew5nAJxN2pTbSmKbkDF9ZAku7KB5PeqJf/NE7 B9Pw== 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 b15si4071912plz.338.2019.05.06.08.40.09; Mon, 06 May 2019 08:40:25 -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; 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 S1726672AbfEFPhp (ORCPT + 99 others); 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