Received: by 10.223.176.5 with SMTP id f5csp1802876wra; Wed, 31 Jan 2018 11:50:20 -0800 (PST) X-Google-Smtp-Source: AH8x224oV5r+gUQNVLIP+ILpOgKL2eFhAH2UfdOMSYMxdFn9QtoHSvWZSe8bRBUQ5aKw698hxiDR X-Received: by 10.99.56.85 with SMTP id h21mr26703590pgn.402.1517428220479; Wed, 31 Jan 2018 11:50:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517428220; cv=none; d=google.com; s=arc-20160816; b=cvGG2Rpz0A5uLGc5UuicyaGIZoqHvHRUiBbllfkNcJe5vm+kD1u/6lum+FudQwTbWD J+IfVBcuKPsd/SzebjU11U1zpHNZQPMyebPQvd6aVWZrzHfWSwTjz6a+dVSkc+16GH5j InmMQqmTwKlRSZcCHoi2O71ABiib8Y/HrjwbOAWbFrqgipGO/RRJ/A1w7OLZWnhv3277 DjYWI5ynBvmmux2tIT/XaTI/Co4hMwurwATv3RSMJFyzIzc9yI3Glkj7KeqdO/5POxjI v/mDBGx1CRIoHLCkcUiu2cgPGyFGAkCwsSjUwElkALKqB2jbe5zvl8p2ijIjBOeujbzJ zRdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=DllRa+lwIcGVP72ng3WQkRmlxi+DudulLqeDAMNqQj8=; b=Ynh8ZJMzel8evIucCdPZ4scR8IBSUCK2UqtF8qYPdiBFEsoz2YoV/1Hn4jxFOU/wdk Kq3uE/HY0ntD+rFWZ/3qhIQMD3dTNSJFtz8+L5hcEqbK0PpUilSRtp2j8QTVfw3HayAB JTMT0T2cDOrqDt+OlRAnbe9/uAMfam4KGYqfZz31913hGe401y6IRZLaQUHtUC76xZn4 YE3qWBDKJvLtsHu9qv3iKBaDM5DxlV/09jfhGMdNjpGiQCfOBHaPoPy58MGyKgoNyeWs RdPLe/m0CS0B+RhJEaPPTwKAmHYFyHRpweNtHdy/AWJ3XMaWb3KxVrSFtVFvUXwFGvwc KBvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=fuBHz9Va; 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 u142si4011476pgb.529.2018.01.31.11.50.05; Wed, 31 Jan 2018 11:50:20 -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; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=fuBHz9Va; 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 S1751391AbeAaTsO (ORCPT + 99 others); Wed, 31 Jan 2018 14:48:14 -0500 Received: from mail-bl2nam02on0081.outbound.protection.outlook.com ([104.47.38.81]:22656 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751326AbeAaTsM (ORCPT ); Wed, 31 Jan 2018 14:48:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DllRa+lwIcGVP72ng3WQkRmlxi+DudulLqeDAMNqQj8=; b=fuBHz9VaZFZ1yI36h4cWzcN3+qwSYSR1BG9rPgQPgU6607wpz28o6tDOGY9mT+7n83gXbC+I7HUCbMDsunQv8W9iUalszBkANg4+VeRSb2Vra6zJrOpzZzEO677H7833Hf/2VWAnJirHh9lTZQOPq+ozOs91jDDOIOFZTNENWGc= Received: from DM2PR0201MB0767.namprd02.prod.outlook.com (10.160.95.13) by DM2PR0201MB0894.namprd02.prod.outlook.com (10.160.215.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Wed, 31 Jan 2018 19:48:07 +0000 Received: from DM2PR0201MB0767.namprd02.prod.outlook.com ([fe80::5d1e:ad23:462e:4de1]) by DM2PR0201MB0767.namprd02.prod.outlook.com ([fe80::5d1e:ad23:462e:4de1%14]) with mapi id 15.20.0464.012; Wed, 31 Jan 2018 19:48:00 +0000 From: Jolly Shah To: Greg KH CC: "ard.biesheuvel@linaro.org" , "mingo@kernel.org" , "matt@codeblueprint.co.uk" , "sudeep.holla@arm.com" , "hkallweit1@gmail.com" , "keescook@chromium.org" , "dmitry.torokhov@gmail.com" , "michal.simek@xilinx.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , Rajan Vaja Subject: RE: [PATCH v3 4/4] drivers: firmware: xilinx: Add debugfs interface Thread-Topic: [PATCH v3 4/4] drivers: firmware: xilinx: Add debugfs interface Thread-Index: AQHTlWotsbpFPAcnRk6nS4gBe4LqHqOEU5OAgAoaNgA= Date: Wed, 31 Jan 2018 19:48:00 +0000 Message-ID: References: <1516836074-4149-1-git-send-email-jollys@xilinx.com> <1516836074-4149-5-git-send-email-jollys@xilinx.com> <20180125093057.GA1936@kroah.com> In-Reply-To: <20180125093057.GA1936@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=JOLLYS@xilinx.com; x-originating-ip: [73.162.184.228] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM2PR0201MB0894;7:kvI4m6XHCpmhDYIte332S3ZdiuNNmP6yWCVvUeJ5nN7KsHUk0lI58tM2FJP6sxkhL4zLdyPw9k4ZyAPvngm/AarJeBtPuH0M1Y/8d3urX4l9QVQwxyE4KCs6FiZLcC1H8lWS9ilQGcaG8dxfS2XfNanzBxZJ/QAwN2VSpQaywvH/zOCplyRAGW4bGrjIVW0nUxgtLw9BA1qAf3cQvlqjruvKdRdMVa9Vv1FA1/x3Zs+Q9pvDWh67VCN7aW8ofqr5 x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10009020)(396003)(39860400002)(346002)(39380400002)(366004)(376002)(189003)(199004)(54534003)(13464003)(229853002)(107886003)(39060400002)(6246003)(26005)(3660700001)(4326008)(2906002)(2950100002)(6916009)(99286004)(575784001)(316002)(305945005)(74316002)(86362001)(105586002)(7736002)(54906003)(8676002)(81166006)(106356001)(7416002)(186003)(81156014)(5250100002)(66066001)(72206003)(2900100001)(14454004)(25786009)(7696005)(9686003)(97736004)(76176011)(5660300001)(55016002)(6436002)(53936002)(68736007)(3280700002)(59450400001)(6116002)(6506007)(3846002)(53546011)(33656002)(8936002)(102836004)(478600001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR0201MB0894;H:DM2PR0201MB0767.namprd02.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 0cefea55-20d2-42f1-aa60-08d568e388b1 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020);SRVR:DM2PR0201MB0894; x-ms-traffictypediagnostic: DM2PR0201MB0894: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(9452136761055)(85827821059158)(258649278758335)(192813158149592); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(8121501046)(5005006)(3231101)(2400082)(944501161)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041288)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM2PR0201MB0894;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0201MB0894; x-forefront-prvs: 056929CBB8 received-spf: None (protection.outlook.com: xilinx.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: +Jsje7jIJ2z5TZBqRlz7E0hBnOWi5at9WnDe2uu4xBIdiTPzLGkmDmLu6hllPiq266BbpzqUze976FOgmCx1gA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0cefea55-20d2-42f1-aa60-08d568e388b1 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jan 2018 19:48:00.1440 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0201MB0894 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, Thanks for review comments. All will be taken care in next version patch. Thanks, Jolly Shah > -----Original Message----- > From: Greg KH [mailto:gregkh@linuxfoundation.org] > Sent: Thursday, January 25, 2018 1:31 AM > To: Jolly Shah > Cc: ard.biesheuvel@linaro.org; mingo@kernel.org; matt@codeblueprint.co.uk= ; > sudeep.holla@arm.com; hkallweit1@gmail.com; keescook@chromium.org; > dmitry.torokhov@gmail.com; michal.simek@xilinx.com; robh+dt@kernel.org; > mark.rutland@arm.com; linux-arm-kernel@lists.infradead.org; linux- > kernel@vger.kernel.org; devicetree@vger.kernel.org; Jolly Shah > ; Rajan Vaja > Subject: Re: [PATCH v3 4/4] drivers: firmware: xilinx: Add debugfs interf= ace >=20 > On Wed, Jan 24, 2018 at 03:21:14PM -0800, Jolly Shah wrote: > > Firmware-debug provides debugfs interface to all APIs. >=20 > I don't understand this changelog comment, care to make it more > informational? At least describe the debugfs files you are adding so tha= t people > have a chance to understand what is going on here :) >=20 > > diff --git a/drivers/firmware/xilinx/zynqmp/Kconfig > > b/drivers/firmware/xilinx/zynqmp/Kconfig > > index 8f7709d..bdd0188 100644 > > --- a/drivers/firmware/xilinx/zynqmp/Kconfig > > +++ b/drivers/firmware/xilinx/zynqmp/Kconfig > > @@ -13,4 +13,11 @@ config ZYNQMP_FIRMWARE > > Say yes to enable zynqmp firmware interface driver. > > In doubt, say N > > > > +config ZYNQMP_FIRMWARE_DEBUG > > + bool "Enable Xilinx Zynq MPSoC firmware debug APIs" > > + default ARCH_ZYNQMP && ZYNQMP_FIRMWARE && DEBUG_FS > > + help > > + Say yes to enable zynqmp firmware interface debug APIs. > > + In doubt, say N >=20 > So your default is going to be Y if the driver is selected? That's not g= ood, just > leave the default alone please. >=20 > > + > > endmenu > > diff --git a/drivers/firmware/xilinx/zynqmp/Makefile > > b/drivers/firmware/xilinx/zynqmp/Makefile > > index 6629781..02f0c9a 100644 > > --- a/drivers/firmware/xilinx/zynqmp/Makefile > > +++ b/drivers/firmware/xilinx/zynqmp/Makefile > > @@ -2,3 +2,4 @@ > > # Makefile for Xilinx firmwares > > > > obj-$(CONFIG_ZYNQMP_FIRMWARE) +=3D firmware.o firmware-ggs.o > > +obj-$(CONFIG_ZYNQMP_FIRMWARE_DEBUG) +=3D firmware-debug.o > > diff --git a/drivers/firmware/xilinx/zynqmp/firmware-debug.c > > b/drivers/firmware/xilinx/zynqmp/firmware-debug.c > > new file mode 100644 > > index 0000000..daefc62 > > --- /dev/null > > +++ b/drivers/firmware/xilinx/zynqmp/firmware-debug.c > > @@ -0,0 +1,511 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Xilinx Zynq MPSoC Firmware layer for debugfs APIs > > + * > > + * Copyright (C) 2014-2018 Xilinx, Inc. > > + * > > + * Michal Simek > > + * Davorin Mista > > + * Jolly Shah > > + * Rajan Vaja > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define DRIVER_NAME "zynqmp-firmware" >=20 > You define this in 2 places, but only use it in one, you don't need this = at all, > please remove all instances. >=20 > > +static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 > > +*pm_api_ret) { > > + const struct zynqmp_eemi_ops *eemi_ops =3D get_eemi_ops(); > > + u32 pm_api_version; > > + int ret; > > + > > + if (!eemi_ops) > > + return -ENXIO; > > + > > + switch (pm_id) { > > + case PM_GET_API_VERSION: > > + eemi_ops->get_api_version(&pm_api_version); > > + pr_info("%s PM-API Version =3D %d.%d\n", __func__, > > + pm_api_version >> 16, pm_api_version & 0xffff); >=20 > This is a _very_ noisy function, dumping a lot of stuff to the kernel log= . Why? > Why not send it back to the caller of the debugfs file reader instead? >=20 > > + case PM_GET_NODE_STATUS: > > + ret =3D eemi_ops->get_node_status(pm_api_arg[0], > > + &pm_api_ret[0], > > + &pm_api_ret[1], > > + &pm_api_ret[2]); > > + if (!ret) > > + pr_info("GET_NODE_STATUS:\n\tNodeId: > %llu\n\tStatus: %u\n\tRequirements: %u\n\tUsage: %u\n", > > + pm_api_arg[0], pm_api_ret[0], > > + pm_api_ret[1], pm_api_ret[2]); >=20 > Multi-line dmesg messages? Not good, you just lost the logging level for= the > multiple lines :( >=20 > Again, don't do this at all, just put it in file output instead. That wa= y tools/users > can actually use it, instead of having to dig through kernel log messages= . >=20 > > +/** > > + * zynqmp_pm_api_debugfs_init - Initialize debugfs interface > > + * > > + * Return: None > > + */ > > +void zynqmp_pm_api_debugfs_init(void) { > > + struct dentry *root_dir; > > + struct dentry *d; > > + > > + /* Initialize debugfs interface */ > > + root_dir =3D debugfs_create_dir(DRIVER_NAME, NULL); > > + if (!root_dir) { > > + pr_warn("debugfs_create_dir failed\n"); >=20 > Why warn? What can a user do about this? Just return and move on. >=20 > > + return; > > + } > > + > > + d =3D debugfs_create_file("pm", 0220, root_dir, NULL, > > + &fops_zynqmp_pm_dbgfs); > > + if (!d) { > > + pr_warn("debugfs_create_file power failed\n"); > > + goto err_dbgfs; > > + } > > + > > + d =3D debugfs_create_file("api_version", 0444, root_dir, > > + NULL, &fops_zynqmp_pm_dbgfs); > > + if (!d) { > > + pr_warn("debugfs_create_file api_version failed\n"); > > + goto err_dbgfs; >=20 > Same for these files, who cares if they were not created or not at all? > No need to even check here at all, this whole function can be reduced to = just 3 > lines: > debugfs_create_dir(...); > debugfs_create_file(...); > debugfs_create_file(...); >=20 > There, nice and simple. Remember, debugfs doesn't matter, and it should = be > _really_ easy to use. Don't make it more complex than it has to be pleas= e. >=20 > thanks, >=20 > greg k-h