Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp413176yba; Fri, 3 May 2019 04:22:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDZTvtgwr828jatYZBBOxSRJHHFEIOeUSLhq4JJZsAXH6NNOCdoPS00l1WfDzMnyU+kT/Y X-Received: by 2002:a65:6554:: with SMTP id a20mr9743862pgw.284.1556882565100; Fri, 03 May 2019 04:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556882565; cv=none; d=google.com; s=arc-20160816; b=NtyneEzVhv8ad9vKfotMrQ8dFz/TJyh/39wXeivb97+/wZu8dvNZuD1MqLkya0yqbe qpidXW02GvTYV95EwRgxUc7eEPO4LiRrtO0ewZUikh82W4l6KoevJUG4BzlPBSpCR/d9 1nbYhm6EtdLiySIeKPdODTPnomMo+TKE7mAEFDK/ZD3pwQramyUOx461ko37hAOtAeOD gcGTcHTDmoVPVs/Bxx2TcR7QacmHnnY1M8qWHnlf+jqYHPwaQkaOL/MTTAdOIQAW01cV lSK4Hvrw15P/bqgTxVe8IgRJFOdVweKp6bUk9BTNbRz8mJBHGHjtbKjUqbfMjDlIbC8j xOtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=eJXURNNvLCpeFBpRtJCIRPKpBboCkLnQxDdwM/tNb1U=; b=ycUPTdMLUyxWWAGff4tVufZcwoCJfUgiNFD/sZICBy8vYWqCianGokt2S8RTRgNWpR ECcQoJ5RWgpxAcIq5xeXmNimuHRnLTRMmBr6obKXXUX0NHLtNZT79ZwujjBdC8I52zOS 6k6GNJ2o8Ad0l2hrEDz9XRMTgYmOKewTYzH/sModVk0TAtVgKlbwuU4m4lNhKapSAD7U cuBec+d9fWdmQPxvylU1bkwjgEeDYrobVDj4tuPBJfHvP4hcA1vZhB5OcJlK4zDw1vyd 5b1bd3lBhSeoGC82DOEkYKVXjXLFl46NtSJbrmmC8NhuzVVBgrMLZcqO3cZw/XsQTI/q 3LOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KVpLdx+c; 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 v16si1753481pgk.131.2019.05.03.04.22.29; Fri, 03 May 2019 04:22:45 -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=KVpLdx+c; 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 S1727608AbfECLSQ (ORCPT + 99 others); Fri, 3 May 2019 07:18:16 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35942 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726396AbfECLSP (ORCPT ); Fri, 3 May 2019 07:18:15 -0400 Received: by mail-lj1-f196.google.com with SMTP id y8so4681359ljd.3; Fri, 03 May 2019 04:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=eJXURNNvLCpeFBpRtJCIRPKpBboCkLnQxDdwM/tNb1U=; b=KVpLdx+c0FazhIk9DysPEnyHpZz7UKLQjnFBYMUL3hpnH3EPaWzEAKirN/hvLCClVn e4UaHC76lOeTmW7N+q5XgtjXchPKIU/zBJSpdzrDYHI7YfMFWs5kbTjoz1Wjl0+jamjk Qga8yOqa3G/nIkLSAXu4t02rUsoyQHigekUIQfaCCy5sMhDOfAtP2h5/HNbiToW3aafw QUGFht57y/Il9IW3807teHhXNZtD1l2oQUphIiGs1jVeJQ9JqylHFg6X4tBiQO5xKT7X v4Zzue0kZfges4yO7xyzWYwJOk95Acv/CRvE++YZorIa4ociSuktQrODA0hR2YsrXt50 S6dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=eJXURNNvLCpeFBpRtJCIRPKpBboCkLnQxDdwM/tNb1U=; b=ZWsrZ89yBM86UseIoHiYB3JtZrRio7l6VUvByStmMOVYhp26GsphCPkankQ4RL1fJn BuHHKpRBsvLS80zo98QixV3mnvumMI52tUUGDRvDp0l5/jXaVdrutxRPZ2HfRAgD27OM HUbe401+wTI88HIis+MTLRo14upOMXla8lSlYRNoiKe4fj0v8/8LHaRnSueWDadP+wFY RwlGBEcvn0C9hTBfhk1FhftjboeEcDT7ruRUtxIyqNzc+Kab/a6Zv1Kv01Mdv1+C1Fcn zAaqk7wAR6XV0ZMvHcFeZIms2hLPe7IywdJjDNFL2W/Z/Iqwxr1CPkDWPdlSkLzcUXPR /UBg== X-Gm-Message-State: APjAAAXLhB1BPTGMMDz2Iwfc3aM42SMzuWx0N2uwzT3y/BcEFghfxdQt p1VXoISLvVGkzIE77HLZXhFw1qBRb+A= X-Received: by 2002:a2e:8794:: with SMTP id n20mr5097631lji.76.1556882293173; Fri, 03 May 2019 04:18:13 -0700 (PDT) Received: from otyshchenko.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id p19sm370795lfc.48.2019.05.03.04.18.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 May 2019 04:18:12 -0700 (PDT) From: Oleksandr Tyshchenko To: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: julien.grall@arm.com, horms@verge.net.au, magnus.damm@gmail.com, linux@armlinux.org.uk, biju.das@bp.renesas.com, Oleksandr Tyshchenko Subject: [PATCH V2] ARM: mach-shmobile: Don't init CNTVOFF if PSCI is available Date: Fri, 3 May 2019 14:17:48 +0300 Message-Id: <1556882268-27451-1-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 (!psci_smp_available() && !xen_domain()) + secure_cntvoff_init(); if (of_machine_is_compatible("renesas,r8a7745") || of_machine_is_compatible("renesas,r8a77470") || -- 2.7.4