Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp749316pxj; Wed, 16 Jun 2021 12:41:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5hDi3P796WFDbKbkjTjbRm2DSG5571V6aFh/IalnQ5ZyDBqZXNR1oDcslKsPCDYMYXHEv X-Received: by 2002:a92:c911:: with SMTP id t17mr809597ilp.299.1623872481145; Wed, 16 Jun 2021 12:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623872481; cv=none; d=google.com; s=arc-20160816; b=s8CrYiIdPcrB3TRU9MSv3KMRz6GiFYbUU5WOlb1jj6gOatyM3QkMUxf+Boir0J7BG/ tqpNsOwr9t7Qsct+Elcu+lYxdZf0QkEGly9EcnZ8AQjnMAErpi4GXmVuqKghDmWyLgqq gsL5SOVIttUteFvK/uI+GaWIVu+HdH9TQUTa7vYd/7XmgTaInRSQwq3TuiOi98JNgGYe 4BSsXpKk5MPF57wVH91rx18Chik0Y5+uVEsahLfsSwK7QwbcV1d3S1eMD+XEilWEjpmY NRKPRq7z9xGQLTdE7+t7DCp1BunflXdSYteLscG5E784r9eQTPreQyMxhs37YzMt5kkv x+OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=GYmUClIDSh4In5HC3RPOMKcWqvKI50xLfrBU8dITE50=; b=MpBl6DKGjzi1nbeG4n8mh5uytpKxh578fJ2jy5h4uyPo2Ke7940pCzsDonMs8PCUBb ZTK21xP2J4q32DgxQH0oqIZe540WZ5l0OMMbrFc1vBZqeso09yqfQ6siIndYeKyIQeQm 2jRNxqZcqg8b0n9L0xYoqMbfrzZ5mePvD5m6Zg5cLCraqsc+0FSzUH/4TSzNMuyg0B+N eXGr+M0ixsyDNsTW7Y10ocUKkgjq6SU/G0oMggDS2Fu2V62MtFEcTF+A+FCpQv/H1Sbv O+vec7NAryqqn3mqmg3Sa/erFEbrF4wrJoycChgLP7InT+qFo4PqjO+kCvKDmtFLm6br v8Sg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g12si3398936iok.10.2021.06.16.12.41.08; Wed, 16 Jun 2021 12:41:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233304AbhFPNkV (ORCPT + 99 others); Wed, 16 Jun 2021 09:40:21 -0400 Received: from mga05.intel.com ([192.55.52.43]:43845 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbhFPNkV (ORCPT ); Wed, 16 Jun 2021 09:40:21 -0400 IronPort-SDR: kv3+Idm+FfQcjrU+N8TYyMNFDTHKW4dfh+6anFBJIZisS62qYlEG2MGqlJBZwwcqkXEeT0BRej 8p53QVnxLJCA== X-IronPort-AV: E=McAfee;i="6200,9189,10016"; a="291808022" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="291808022" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 06:38:14 -0700 IronPort-SDR: BkBI40BZYJIqmAd92J8juCou6h4VCZDnNSF1hrjCtf1OVenWDFpsnilaEUQ5bjV6kDkMrIhtAg U0oAN4uWUo3g== X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="637455199" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 06:38:12 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1ltVk8-002pSk-Un; Wed, 16 Jun 2021 16:38:08 +0300 Date: Wed, 16 Jun 2021 16:38:08 +0300 From: Andy Shevchenko To: "Aneesh Kumar K.V" Cc: Vaibhav Jain , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Oliver O'Halloran Subject: Re: [PATCH v1 1/1] powerpc/papr_scm: Properly handle UUID types and API Message-ID: References: <20210415134637.17770-1-andriy.shevchenko@linux.intel.com> <8e724a87-da78-9fc9-073e-cbbfea0ff97e@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8e724a87-da78-9fc9-073e-cbbfea0ff97e@linux.ibm.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 16, 2021 at 03:05:31PM +0530, Aneesh Kumar K.V wrote: > On 4/16/21 2:39 PM, Andy Shevchenko wrote: > > On Fri, Apr 16, 2021 at 01:28:21PM +0530, Aneesh Kumar K.V wrote: > > > On 4/15/21 7:16 PM, Andy Shevchenko wrote: > > > > Parse to and export from UUID own type, before dereferencing. > > > > This also fixes wrong comment (Little Endian UUID is something else) > > > > and should fix Sparse warnings about assigning strict types to POD. > > > > > > > > Fixes: 43001c52b603 ("powerpc/papr_scm: Use ibm,unit-guid as the iset cookie") > > > > Fixes: 259a948c4ba1 ("powerpc/pseries/scm: Use a specific endian format for storing uuid from the device tree") > > > > Cc: Oliver O'Halloran > > > > Cc: Aneesh Kumar K.V > > > > Signed-off-by: Andy Shevchenko > > > > --- > > > > Not tested > > > > arch/powerpc/platforms/pseries/papr_scm.c | 13 ++++++++----- > > > > 1 file changed, 8 insertions(+), 5 deletions(-) > > > > > > > > diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c > > > > index ae6f5d80d5ce..4366e1902890 100644 > > > > --- a/arch/powerpc/platforms/pseries/papr_scm.c > > > > +++ b/arch/powerpc/platforms/pseries/papr_scm.c > > > > @@ -1085,8 +1085,9 @@ static int papr_scm_probe(struct platform_device *pdev) > > > > u32 drc_index, metadata_size; > > > > u64 blocks, block_size; > > > > struct papr_scm_priv *p; > > > > + u8 uuid_raw[UUID_SIZE]; > > > > const char *uuid_str; > > > > - u64 uuid[2]; > > > > + uuid_t uuid; > > > > int rc; > > > > /* check we have all the required DT properties */ > > > > @@ -1129,16 +1130,18 @@ static int papr_scm_probe(struct platform_device *pdev) > > > > p->hcall_flush_required = of_property_read_bool(dn, "ibm,hcall-flush-required"); > > > > /* We just need to ensure that set cookies are unique across */ > > > > - uuid_parse(uuid_str, (uuid_t *) uuid); > > > > + uuid_parse(uuid_str, &uuid); > > > > + > > > > /* > > > > * cookie1 and cookie2 are not really little endian > > > > - * we store a little endian representation of the > > > > + * we store a raw buffer representation of the > > > > * uuid str so that we can compare this with the label > > > > * area cookie irrespective of the endian config with which > > > > * the kernel is built. > > > > */ > > > > - p->nd_set.cookie1 = cpu_to_le64(uuid[0]); > > > > - p->nd_set.cookie2 = cpu_to_le64(uuid[1]); > > > > + export_uuid(uuid_raw, &uuid); > > > > + p->nd_set.cookie1 = get_unaligned_le64(&uuid_raw[0]); > > > > + p->nd_set.cookie2 = get_unaligned_le64(&uuid_raw[8]); > > > > > > ok that does the equivalent of cpu_to_le64 there. So we are good. But the > > > comment update is missing the details why we did that get_unaligned_le64. > > > Maybe raw buffer representation is the correct term? > > > Should we add an example in the comment. ie, > > > > > /* > > > * Historically we stored the cookie in the below format. > > > for a uuid str 72511b67-0b3b-42fd-8d1d-5be3cae8bcaa > > > cookie1 was 0xfd423b0b671b5172 cookie2 was 0xaabce8cae35b1d8d > > > */ > > > > I'm fine with the comment. At least it will shed a light on the byte ordering > > we are expecting. > > > > Will you be sending an update? Also it will be good to list the sparse > warning in the commit message? I'll send an update but I rephrase to remove mention of Sparse. I have no Sparse build for this architecture. If you have one, try to build with `make W=1 C=1 CF=-D__CHECK_ENDIAN__ ...` which will enable warnings about restricted types assignment. -- With Best Regards, Andy Shevchenko