Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2235529yba; Fri, 10 May 2019 08:18:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWKL4737BHQww1Zqgsw+iPhvg9oJmIL/UYFTueSLJgQU2YABSPEA7X2ryEKpQAKBNfWJYc X-Received: by 2002:a62:1690:: with SMTP id 138mr14628820pfw.28.1557501498768; Fri, 10 May 2019 08:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557501498; cv=none; d=google.com; s=arc-20160816; b=vDt3m/LWiQJIdohrBUvco8P4DwKkNHJbp7sxMpazjHB0wnfuxeNPSjqzO4QzPBaW4b y9LB13lrS8Xn+Tmcdf9W0eTB5TY34LIwxJxoPot214AfEh5vkJHuKo3Zid1co6xKzH6S Xsu+8vHfviE1tjGeJZGAx0WGTYC3EPrD8FNvfy7/cmOGsdhn+c5TB2Gm0ZDoVeaWmSXp cCLwqRBiZuiru9XtX7xkvTuNQ4DtkLFijnqKE96AB1TX+YDtm1PuCzIawmvIj16ebHb7 21K6tmK0J7Qrq0OrEh38evR6LpFMtkFbddw5Tfe4dJNVnTRr/Xan8EXDK6nBNODjWxl6 GIew== 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=UovbodiAPH01A7Tcpc/52cdJYhzSVeuvrSUyXwSIGMY=; b=CkhHvlLSNTec5s6y5F4R8E7D47DqCgxv8wA2wsl2uLg+etktbFvqGH8jw4rsTXFOGn iaVVkk7CeARU/RTFBpsgqF0bJVsEg++biGRreReL8iGUPH1Ze2AHoL9fd47IsAM6QIvo bLMMqdXUtHMpNjmGEq0Au1A+AhawLsB+iLxCyk2thIZmjiisOycY6YCl4sgfClh3lQ/2 PFXBNEM1YAMgHUZpHkczNQaR80ermWYCT7SS7ACddho4MxwZmkZzvFY3odUVyDDlRQt2 JPB4z2yOTVgwTjN08mUwpdpWHicOGiEC5tsnnQFwxO9BukMJxvZCMBShGT4wIMIyiTlh frqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VO6jPCKV; 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 f1si2379838pln.23.2019.05.10.08.18.01; Fri, 10 May 2019 08:18:18 -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=VO6jPCKV; 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 S1727613AbfEJPQc (ORCPT + 99 others); Fri, 10 May 2019 11:16:32 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:40999 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727353AbfEJPQc (ORCPT ); Fri, 10 May 2019 11:16:32 -0400 Received: by mail-lj1-f195.google.com with SMTP id k8so5394672lja.8; Fri, 10 May 2019 08:16:30 -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=UovbodiAPH01A7Tcpc/52cdJYhzSVeuvrSUyXwSIGMY=; b=VO6jPCKVOzfVew1boUYMZmskgf/NPM6AOJJgSWYT8GFFTi8BhTiuQNARiiL6Eox+ou N+ZgQAn4i6pxl4IDUFQXnHwrsQGHRIAevMbQe4Cw+TilhZS8R83yYKmGZKNnkbPA79g4 II8RqwVOaX7tOFIUe5uu3S6CJifz7cnJTSZzd3pYC8eBISgoe6f3ovH/3FC9SbupqBYO 6GRy4u3z6jY6eX7gcfgY8UbzRsMaJXQK6YgpugtgWgDT/peEoG6/yxCTUHCdm2QShCiC Gv3THVJUIOw/IprvmZk9fi8E0++qHqYfvlyeLCqksZC4VaNafDWtxVvUUDrTRTQumS0S wWOQ== 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=UovbodiAPH01A7Tcpc/52cdJYhzSVeuvrSUyXwSIGMY=; b=iZBui+f/6cpLPse/AA4ORd1AkuvPagKRuENFSMUK0nnSNJ0Q6ywgMvkuL4z+6nAyg6 Xj9jKt543/i+43exDdn/XYP6lRC+8CHer7e3eD8EvukZwN7MhgOKpK/Cnvc2Uz/OtOdN 0XmIw0KqYKHCNuvWk/sEB0owI7+zlYHSVhxy6DTQIXibEezJe43loipN+KnQePx7WA3A aBfhggwWKxi5H9u329k3gQdwq35f3QvEVRX+LYdPXG+6rVjTKpn9sfDmxk0CXlJpzIid 3RZEjDRBStbpOhfpohGPg4I+EfajTBi8SmGlcf45QCbDcB44+r4LA/OUCsbI5Xo8/WnM Q7jw== X-Gm-Message-State: APjAAAV44eBvdUCqLfl0qys7mRSVqQ/juRXPytLXfYODyYiIzigRrNUa ltnENjt5sJyir+Nr2AVLrKTDMG4QNl0= X-Received: by 2002:a2e:8141:: with SMTP id t1mr6369926ljg.122.1557501389839; Fri, 10 May 2019 08:16:29 -0700 (PDT) Received: from otyshchenko.kyiv.epam.com (ll-22.209.223.85.sovam.net.ua. [85.223.209.22]) by smtp.gmail.com with ESMTPSA id k3sm1291830ljj.73.2019.05.10.08.16.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 May 2019 08:16:29 -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, geert@linux-m68k.org, Oleksandr Tyshchenko Subject: [PATCH V3] ARM: mach-shmobile: Don't init CNTVOFF if PSCI is available Date: Fri, 10 May 2019 18:16:13 +0300 Message-Id: <1557501373-24436-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. Please note, an extra check to prevent secure_cntvoff_init() from being called for secondary CPUs in headsmp-apmu.S is not needed, as SMP code for APMU based system is not executed if PSCI is in use. Signed-off-by: Oleksandr Tyshchenko CC: Julien Grall --- You can find previous discussions here: [v1] https://lkml.org/lkml/2019/4/17/810 [v2] https://lkml.org/lkml/2019/5/3/338 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() Changes in v3: - Don't check for the presence of Xen --- arch/arm/mach-shmobile/setup-rcar-gen2.c | 9 ++++++++- 1 file changed, 8 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..35dda21 100644 --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "common.h" #include "rcar-gen2.h" @@ -63,7 +64,13 @@ 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. + */ + if (!psci_smp_available()) + secure_cntvoff_init(); if (of_machine_is_compatible("renesas,r8a7745") || of_machine_is_compatible("renesas,r8a77470") || -- 2.7.4