Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2980490ybi; Mon, 1 Jul 2019 23:43:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsD68RxAS1Hr94ydv6CV+vhfk8rssfDeC3Rr6WdjMwNnFSF8AkTeWTXgJCzdRTrx5owSeH X-Received: by 2002:a17:90a:bd8c:: with SMTP id z12mr3777397pjr.60.1562049784393; Mon, 01 Jul 2019 23:43:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562049784; cv=none; d=google.com; s=arc-20160816; b=hkeizk44LWQbZobSGuZyxScvaKmdmVZV9Odvjm9ezfCszg8St+ytKSwM0RvnG80KLN BzblVA0ypqPbND8jHR2ONtJPbaT+rFE9JOzFyfNyfoTzNYvxUS0EBzJjZ0KbJXw6SCEi 1/2tIEq+iB7k31Ne7kl4JkO+7MPwUspgEP3mopjkJCrGx84Lev8P73OcMYpeKyYCAQ0e K/HR8jR8voznim19zVwtvEYs/Hv5Cv37LLTJBjRAWRfyUabAxhuW+i5MjgDwRoDZTNbL 7F6YWvJTefqGFdKaww+CEC83xpMnQ4GIOhObmYQL24ABsuV+09qsQbAWhgnJbaQJOar0 H/SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=hzHeKM2KkWxtNRZz2h5uY99gDvFlZMpOL+ylqpj5c+g=; b=xYLWo5cbiiKRFz8NKZj1nCboA/Elc8xKx95DtPZOtxbX2etAm/3gC71vFP0fXlm5tF ScJSNt+0cRnSP0VQB7vqimgytXJx+BBcsGUxTs0kOQQMlTjrKR7jYpo1mPXp6DS3O3w2 lOoTOC3Eu8gxGZyjVDKyeH0KTBfUlVQuQRfZqikORsLOtGGd+GMWRD7PzBRPgX+/a6My dNCP2fGNPqAjVgq9ynjgqF3zBYQkN6McZhx5IrWBKsGEsLDCgxxmIT1zqah1P8D/DS+f +sr5JSwog2w6EMYUW5u18BGBXJClZN44S1rkZZUlHiJXPSYmP/uhxVIwGUUvwsur/Cl6 X6VQ== 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 o1si12369262plb.337.2019.07.01.23.42.47; Mon, 01 Jul 2019 23:43:04 -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; 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 S1726150AbfGBGmV (ORCPT + 99 others); Tue, 2 Jul 2019 02:42:21 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:37511 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfGBGmV (ORCPT ); Tue, 2 Jul 2019 02:42:21 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hiCUc-0004as-UN; Tue, 02 Jul 2019 08:42:18 +0200 Received: from mfe by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1hiCUc-0006Zv-Ff; Tue, 02 Jul 2019 08:42:18 +0200 Date: Tue, 2 Jul 2019 08:42:18 +0200 From: Marco Felsch To: Anson Huang Cc: Daniel Baluta , Aisheng Dong , Abel Vesa , Shawn Guo , Sascha Hauer , Linux Kernel Mailing List , Daniel Baluta , dl-linux-imx , Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel Subject: Re: [PATCH] soc: imx-scu: Add SoC UID(unique identifier) support Message-ID: <20190702064218.25vzkxds3bjfzy3m@pengutronix.de> References: <20190626070706.24930-1-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 08:40:14 up 45 days, 12:58, 49 users, load average: 0.17, 0.08, 0.04 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anson, On 19-06-27 07:01, Anson Huang wrote: > Hi, Daniel > > > -----Original Message----- > > From: Daniel Baluta > > Sent: Thursday, June 27, 2019 2:44 PM > > To: Anson Huang > > Cc: Shawn Guo ; Sascha Hauer > > ; Pengutronix Kernel Team > > ; Fabio Estevam ; Aisheng > > Dong ; Abel Vesa ; linux- > > arm-kernel ; Linux Kernel Mailing List > > ; dl-linux-imx ; Daniel > > Baluta > > Subject: Re: [PATCH] soc: imx-scu: Add SoC UID(unique identifier) support > > > > On Thu, Jun 27, 2019 at 3:48 AM Anson Huang > > wrote: > > > > > > Hi, Daniel > > > > > > > -----Original Message----- > > > > From: Daniel Baluta > > > > Sent: Wednesday, June 26, 2019 8:42 PM > > > > To: Anson Huang > > > > Cc: Shawn Guo ; Sascha Hauer > > > > ; Pengutronix Kernel Team > > > > ; Fabio Estevam ; > > Aisheng > > > > Dong ; Abel Vesa ; linux- > > > > arm-kernel ; Linux Kernel > > > > Mailing List ; dl-linux-imx > > > > ; Daniel Baluta > > > > Subject: Re: [PATCH] soc: imx-scu: Add SoC UID(unique identifier) > > > > support > > > > > > > > On Wed, Jun 26, 2019 at 10:06 AM wrote: > > > > > > > > > > From: Anson Huang > > > > > > > > > > Add i.MX SCU SoC's UID(unique identifier) support, user can read > > > > > it from sysfs: > > > > > > > > > > root@imx8qxpmek:~# cat /sys/devices/soc0/soc_uid > > > > > 7B64280B57AC1898 > > > > > > > > > > Signed-off-by: Anson Huang > > > > > --- > > > > > drivers/soc/imx/soc-imx-scu.c | 35 > > > > > +++++++++++++++++++++++++++++++++++ > > > > > 1 file changed, 35 insertions(+) > > > > > > > > > > diff --git a/drivers/soc/imx/soc-imx-scu.c > > > > > b/drivers/soc/imx/soc-imx-scu.c index 676f612..8d322a1 100644 > > > > > --- a/drivers/soc/imx/soc-imx-scu.c > > > > > +++ b/drivers/soc/imx/soc-imx-scu.c > > > > > @@ -27,6 +27,36 @@ struct imx_sc_msg_misc_get_soc_id { > > > > > } data; > > > > > } __packed; > > > > > > > > > > +struct imx_sc_msg_misc_get_soc_uid { > > > > > + struct imx_sc_rpc_msg hdr; > > > > > + u32 uid_low; > > > > > + u32 uid_high; > > > > > +} __packed; > > > > > + > > > > > +static ssize_t soc_uid_show(struct device *dev, > > > > > + struct device_attribute *attr, char > > > > > +*buf) { > > > > > + struct imx_sc_msg_misc_get_soc_uid msg; > > > > > + struct imx_sc_rpc_msg *hdr = &msg.hdr; > > > > > + u64 soc_uid; > > > > > + > > > > > + hdr->ver = IMX_SC_RPC_VERSION; > > > > > + hdr->svc = IMX_SC_RPC_SVC_MISC; > > > > > + hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID; > > > > > + hdr->size = 1; > > > > > + > > > > > + /* the return value of SCU FW is in correct, skip return > > > > > + value check */ > > > > > > > > Why do you mean by "in correct"? > > > > > > I made a mistake, it should be "incorrect", the existing SCFW of this > > > API returns an error value even this API is successfully called, to > > > make it work with current SCFW, I have to skip the return value check > > > for this API for now. Will send V2 patch to fix this typo. > > > > Thanks Anson! It makes sense now. It is a little bit sad though because we > > won't know when there is a "real" error :). > > > > Lets update the comment to be more specific: > > > > /* SCFW FW API always returns an error even the function is successfully > > executed, so skip returned value */ > > OK, as for external users, the SCFW formally released has this issue, so for now > I have to skip the return value check for this API, once next SCFW release has this issue > fixed, I will add a patch to check the return value. Do you really keep track of that? Please can you add a FIXME: or TODO: tag and add the firmware version containing that bug? Regards, Marco > Thanks, > Anson. > > > > > > > > > + imx_scu_call_rpc(soc_ipc_handle, &msg, true); > > > > > + > > > > > + soc_uid = msg.uid_high; > > > > > + soc_uid <<= 32; > > > > > + soc_uid |= msg.uid_low; > > > > > + > > > > > + return sprintf(buf, "%016llX\n", soc_uid); > > > > > > > > snprintf? > > > > > > The snprintf is to avoid buffer overflow, which in this case, I don't > > > know the size of "buf", and the value(u64) to be printed is with fixed > > > length of 64, so I think sprint is just OK. > > > > Ok. -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |