Received: by 10.223.185.116 with SMTP id b49csp2633924wrg; Mon, 5 Mar 2018 06:20:57 -0800 (PST) X-Google-Smtp-Source: AG47ELt6z22xAJcXu/npAiVmC6kTASZy9/KcS1QBRGgZfn2fHbPXCjhy2u3bzdiLdOOm9qCy9XRF X-Received: by 10.98.55.7 with SMTP id e7mr15671207pfa.112.1520259657345; Mon, 05 Mar 2018 06:20:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520259657; cv=none; d=google.com; s=arc-20160816; b=GGxV8RQJe2DUWlF+Nl0ox42WvgwFxcR3KTweHpbhm+MP1/yL6MICi6JsiWP7AIREv1 Pwkg9lQug7zXyXFECR3nh5A1lOEvmUIVTuV29sYN6aGA1DG1EpwvuWDNwtWUVzYsbNRu fb06GVr+2yIueL5jmbCbRUoaMEJsDPSeRTWx7OUH7ULmyCWz605j/dpBwXiwztaUEL4R ukLeHcgOWTm7GGh4Wf/iLcPs0nJbzOrphHyx7EfZGrBpAG/0K5Ah3LQEcJY+y6FXwOpN N/6j0ppHHccA1WVUQ8jnjrH7QYK8NXpeZ9quoeYLgBdwZLpcrwLmYZZHe+90CQNCbeWW ci4w== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=rI5kiDEsfBcrES1vAafMfsXi/0ScsfIX9yUFXkJiGXk=; b=Z1mBaxj5W77ZeXkc8pbH8gG1kDBu/v4QxPQVnQGSv+BGnLRIW72tzu7RyaV8y76n/4 SjH1HYVdmyJ78BiPPC6gFST2ducOs22phOjsRkvLWl6/PkbFZkzeoLwE/g14uykGVUBg Ej82aBviEt3Lw4F+3XalqxGqJ+3tM8vp0j46Wt+StIS9Cryl81h+KVLFzLegbBmOfApE sw37c7bj4KU1vgeat6jjiMiIxtE8YDDTexvLxtW/Y1m544vBjXQQl7n91jO5RZpYT6Ye 2AuzPMGL16qrxTW4rFMJ4lFL2LcE/SIokRbFwOPP3GoVE+hh5TMoVjEwox8/0pmClXyb Kv3A== 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 s10si10322606pfi.143.2018.03.05.06.20.42; Mon, 05 Mar 2018 06:20:57 -0800 (PST) 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 S934098AbeCENvP convert rfc822-to-8bit (ORCPT + 99 others); Mon, 5 Mar 2018 08:51:15 -0500 Received: from mail.bootlin.com ([62.4.15.54]:57707 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933502AbeCENvN (ORCPT ); Mon, 5 Mar 2018 08:51:13 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 76FB2207A3; Mon, 5 Mar 2018 14:51:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from dell-desktop.home (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id DE3C620379; Mon, 5 Mar 2018 14:51:09 +0100 (CET) Date: Mon, 5 Mar 2018 14:51:10 +0100 From: =?UTF-8?B?TXlsw6huZQ==?= Josserand To: Maxime Ripard Cc: Chen-Yu Tsai , Russell King , Rob Herring , Mark Rutland , devicetree , linux-arm-kernel , linux-kernel , LABBE Corentin , Thomas Petazzoni , quentin.schulz@bootlin.com Subject: Re: [PATCH v4 10/10] ARM: sunxi: smp: Add initialization of CNTVOFF Message-ID: <20180305145110.2f43802a@dell-desktop.home> In-Reply-To: <20180305083114.dwqfdqlziwptfnxq@flea.lan> References: <20180223133742.26044-1-mylene.josserand@bootlin.com> <20180223133742.26044-11-mylene.josserand@bootlin.com> <20180226101252.ozdsxjvawgkemz2c@flea.lan> <20180305085148.1de2a99c@dell-desktop.home> <20180305083114.dwqfdqlziwptfnxq@flea.lan> Organization: Bootlin X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Mon, 5 Mar 2018 09:31:14 +0100 Maxime Ripard wrote: > On Mon, Mar 05, 2018 at 08:51:48AM +0100, Mylène Josserand wrote: > > > >> > diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c > > > >> > index 5e9602ce1573..4bb041492b54 100644 > > > >> > --- a/arch/arm/mach-sunxi/sunxi.c > > > >> > +++ b/arch/arm/mach-sunxi/sunxi.c > > > >> > @@ -37,8 +37,12 @@ static const char * const sun6i_board_dt_compat[] = { > > > >> > }; > > > >> > > > > >> > extern void __init sun6i_reset_init(void); > > > >> > +extern void sunxi_init_cntvoff(void); > > > >> > + > > > >> > static void __init sun6i_timer_init(void) > > > >> > { > > > >> > + sunxi_init_cntvoff(); > > > >> > > > >> You should check the enable-method to see if PSCI is set or not, > > > >> as an indicator whether the kernel is booted secure or non-secure. > > > > > > > > It's an indicator, but it's not really a perfect one. You could very > > > > well have your kernel booted in non-secure, without PSCI. Or even with > > > > PSCI, but without the SMP ops. > > > > > > > > We have a quite big number of these cases already, where, depending on > > > > the configuration, we might not have access to the device we write to, > > > > the number of hacks to just enable that device for non-secure is a > > > > good example of that. > > > > > > I wouldn't consider them hacks though. The hardware gives the option > > > to have control of many devices delegated solely to secure-only, or > > > secure/non-secure. Our present model is to support everything we can > > > in Linux directly, instead of through some firmware interface to a > > > non-existent firmware. > > > > I am not sure to understand what is the conclusion about it. > > Should I use "psci"/enable-method or should I use another mechanism to > > detect we are in secure/non-secure (if it exists)? > > > > Otherwise, for the moment, I can use machine-compatible on sun8i-a83t > > and we will see later how we can handle it in a better way. > > Can't we have another approach here? > > If we use an enable-method (and we should), instead of having it tied > to the machine compatible, the SMP setup code will run only if our > enable-method is the one we set up. If PSCI is in use, the > enable-method is not going to be the one defined here, and the code > will not run. > > So why not just move that call to the SMP ops setup function, just > like renesas does? > > Maxime > Okay, I will update my series and handle the differences using enable-method instead of machine-compatible. Best regards, -- Mylène Josserand, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com