Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754332AbcKQE11 (ORCPT ); Wed, 16 Nov 2016 23:27:27 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:46637 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752375AbcKQE1X (ORCPT ); Wed, 16 Nov 2016 23:27:23 -0500 X-AuditID: b6c32a26-f79ed6d000001917-06-582d2f5257f5 Subject: Re: [PATCH 01/16] ARM: scu: Provide support for parsing SCU device node to enable SCU To: Russell King - ARM Linux , Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org, Andrew Lunn , Heiko Stuebner , geert+renesas@glider.be, Linus Walleij , Liviu Dudau , Patrice Chotard , Wei Xu , Jisheng Zhang , magnus.damm@gmail.com, Michal Simek , krzk@kernel.org, thomas.ab@samsung.com, "cpgs ." , Stephen Warren , Ray Jui , horms@verge.net.au, Jun Nie , shiraz.linux.kernel@gmail.com, linux-kernel@vger.kernel.org, vireshk@kernel.org, Dinh Nguyen , Shawn Guo , "cpgs ." From: "pankaj.dubey" Message-id: Date: Thu, 17 Nov 2016 09:50:27 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-version: 1.0 In-reply-to: <20161114145143.GM1041@n2100.armlinux.org.uk> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Tf0xbVRTHd/va10Kseytl3DWyNc+pGVlL25VyWWBORH0ZiyGaxbrFwEt5 0mb9QfooGRojhjkYSxQKi64riKSIFrK1BUbLBKFjP9iCqLiGJU6YdOoYIwrBbA7Ftq8m/Pc9 935Ozvl+kyPCJCeFMpHJWsXYrbSZxFP5Fy7tkitey1boVa3LW9DU7TCG/nFeEaJ74V3Iu9yL obazToDWf7kvQHUDqwAtXb3IR57oHSGamvIJUetaNw8F5iMCND3kxlH49DBAo131fDTX8wBH S/f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96muE3d 1SgrMiwrP1TO96VmYSlL1DbTWZo16UVJzKyFlGa5SouiNysyqzkJpPPpdw6/P4cDRwQlNkGA KNWYxZqMjJ4ifPlpevUh+dZwuVbRZI7A/cNOiKfNd4R4whmCrZ8bIK46awb4z8t3Apx3dRLg D3ev83Gt+4UQ9/c3C3Hxrzoeto25BHjwWiWBnSWdAN+8eJyPRy+/J/CHCS2uvPcY4FcVdgKP tyzG5771CPDbW/l8fOISwPbROwR23y6G62R0Q3UDoAddA5Ce+mkGtOV5H0EX9snpdsuwkB6r uiKkbdaTBP3M1UHQ9trDdLvjC48uOu/xT7vMQvpUixXQba5qSL/60QnjpDti1qawTDJrCmKN SenJqUZdFBWviZFjKsjIGNgoSiuP1WyjgvYy+mxPt0rxX63bELdRTYVHJ8ak2Ia6BRmPA/cd 7f0hzAW1sgLgI0KkCr0erCNm2R89GGnysoS0A+T6op7hhWQiarZOwhmWkvGoceKnYNZx8FDj 14AC4CuCZAGBuj5WecMEGY7Kxlq9LCaj0eWhY94wnwxGnV29vBleRGqRbbKSP+v4oZ4Kt5d9 yEjkaHZ7HUiGIceT2WWQDERt7yvhGbDAMidimaNZ5mg1AFqBP5vBGXQGLkOhCuMYA5dt1IUl pRtswPMvrd2UzAGs9ZucgBQBap64XC7XSgTMXm6/wQmQCFJSceoKz0iczOzPYU3pCaZsPcs5 QYTnjEIYsCgp3fN9xqyElaoIjLFqtVKpxCpqsXhX2evtElLHZLFpLJvBmv7leCKfgFzQMe6e 76w/MhSye83zTFNY1ahicz6r1jgSSm4nNEqzj615NyXJu/G0ZqkmJjjne2yNz4H1fkWh8MRv 2RL1Salm8Mqe6BVTKfOVaYb65G/TIDdwaUvUmwulBav3bWmilrXmR7Yv/1SaOawbaAu1cveV p8tlB/WpxM7I6sYzI9KcRw8pPpfCrAyFJo75Cytp4IlFAwAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161117041721epcas4p1a06dc0de206942cedd474ca3d60418f8 X-Msg-Generator: CA X-Sender-IP: 182.195.34.25 X-Local-Sender: =?UTF-8?B?7YyQ7Lm07KaIG1NTSVItVHVybiBLZXkgU29sdXRpb25zGw==?= =?UTF-8?B?7IK87ISx7KCE7J6QGy4vQ2hpZWYgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?UEFOS0FKIEtVTUFSIERVQkVZG1NTSVItVHVybiBLZXkgU29s?= =?UTF-8?B?dXRpb25zG1NhbXN1bmcgRWxlY3Ryb25pY3MbLi9DaGllZiBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG1NXQUhRG0MxMElEMDdJRDAxMDk5Nw==?= CMS-TYPE: 104P DLP-Filter: Pass X-CFilter-Loop: Reflected X-HopCount: 7 X-CMS-RootMailID: 20161114145228epcas3p136b117d2b99a31efc59a973262173295 X-RootMTR: 20161114145228epcas3p136b117d2b99a31efc59a973262173295 References: <1479099731-28108-1-git-send-email-pankaj.dubey@samsung.com> <2479429.Js1FDSdQzs@wuerfel> <20161114135018.GL1041@n2100.armlinux.org.uk> <6787744.7DRFf7p3US@wuerfel> <20161114145143.GM1041@n2100.armlinux.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3961 Lines: 92 Hi Russell, On Monday 14 November 2016 08:21 PM, Russell King - ARM Linux wrote: > On Mon, Nov 14, 2016 at 03:37:44PM +0100, Arnd Bergmann wrote: >> On Monday, November 14, 2016 1:50:18 PM CET Russell King - ARM Linux wrote: >>> On Mon, Nov 14, 2016 at 01:03:09PM +0100, Arnd Bergmann wrote: >>>> On Monday, November 14, 2016 2:10:16 PM CET pankaj.dubey wrote: >>>>>>> + scu_base = of_iomap(np, 0); >>>>>>> + of_node_put(np); >>>>>>> + if (!scu_base) { >>>>>>> + pr_err("%s failed to map scu_base via DT\n", __func__); >>>>>> >>>>>> For non-ca5, non-ca9 based SoCs, we'll see this error msg. We understand >>>>>> what does it mean, but it may confuse normal users. In current version, >>>>>> berlin doesn't complain like this for non-ca9 SoCs >>>>>> >>>>> >>>>> OK, let me see other reviewer's comment on this. Then we will decide if >>>>> this error message is required or can be omitted. >>>> >>>> We need to look at all callers here, to see if the function ever gets >>>> called for a CPU that doesn't have an SCU. I'd say we should warn if >>>> we know there is an SCU but we cannot map it, but never warn on >>>> any of the CPU cores that don't support an SCU. >>> >>> Maybe there should be two helpers: >>> >>> of_scu_enable() which _only_ looks up the SCU address in DT and enables >>> it if it finds it, otherwise returning failure. >>> >>> a9_scu_enable() which tries to use the A9 provided SCU address and >>> enables it if it finds it, otherwise returning failure. >>> OK, In that case I can see need for following four helpers as: 1: of_scu_enable() which will __only__ lookup the SCU address in DT and enables it if it finds, otherwise return -ENOMEM failure. This helper APIs is required and sufficient for most of platforms such as exynos, berlin, realview, socfpga, STi, ux500, vexpress, rockchip and mvebu 2: a9_scu_enable(), which will __only__ use A9 provided SCU address and enables it, if address mapped successfully, otherwise returning failure. This helper APIs is required and sufficient for two ARM platforms as of now tegra and hisi. 3: of_scu_get_base() which will lookup the SCU address in DT and if node found maps address and returns ioremapped address to caller. This helper APIs is required for three ARM plaforms rockchip, mvebu and ux500, along with scu_enable() API to enable and find number_of_cores. 4: s9_scu_iomap_base() which will internally use s9_scu_get_base() and do ioremap of scu address and returns ioremapped address to the caller along with ownership (caller has responsibility to unmap it). This helper APIs is required to simplify SCU enable and related code in two ARM plaforms BCM ans ZX. For remaining two ARM platforms (IMX and ZYNQ), none of these helpers are useful for the time-being, as they need SCU mapping very early of boot, where we can't use iomap APIs. So I will drop patches related to these platforms in v2 version. Please let me know if any concern in this approach. >>> Then callers can decide which of these to call, and what error messages >>> to print on their failures. >> >> Splitting the function in two is probably simpler overall, but >> we may still have to look at all the callers: Any platform that >> currently tries to map it on any CPU and doesn't warn about the >> absence of the device node (or about scu_a9_has_base() == false) >> should really continue not to warn about that. > > Did you miss the bit where none of of_scu_enable() or a9_scu_enable() > should produce any warnings or errors to be printed. It's up to the > caller to report the failure, otherwise doing this doesn't make sense: > > if (of_scu_enable() < 0 && a9_scu_enable() < 0) > pr_err("Failed to map and enable the SCU\n"); > > because if of_scu_enable() prints a warning/error, then it's patently > misleading. > I will move out error message out of these helpers and let caller (platform specific code) handle and print error if required. Thanks, Pankaj Dubey