Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp197250pxb; Fri, 16 Apr 2021 03:23:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzIf9QxyIc3siyJ4Y4ZvK29kkeyXzWKByFIltJzHPRrz7axp9q+DzzDV1kEN9cDGyYvls6 X-Received: by 2002:a05:6402:40c9:: with SMTP id z9mr9245731edb.24.1618568585934; Fri, 16 Apr 2021 03:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618568585; cv=none; d=google.com; s=arc-20160816; b=IcC0gzqS4RoiSiyD3mXyVS3rEdNOSYKGHfyeEbVrcsSxa8Btz2m3KBoP7QW4RaXGPp h6WrF58kxpVgxuZWc95yu9gnbXawwg4PDbRH5I3wh2rz9NLVWAqN25cJgO51ugi3iRl5 4uBnliU4fjuuRqOP421N2fesk9JMcy3aqSf9qSI6JWZEWFpC+Ix9sSzHPUsF+3lzQgdp xt5hVijOrxs/5jVIFItMwbJwmO3580++1nkDGxjY0R40sLj7rDVgW3RjQfbZjDhQLuOx r3rzDln4LFChMtureSoqNTgZRudH/Y0+fF9m9VcgwIGVlnfhxlaAf8gVyfZMz/LhEIXX zT8w== 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=olqwQnDyjcoytl2rixoigtYzsZwtoPZzkzIs9C3jjHU=; b=EmU6s7aggwJg/+Tuo7SZDIlbeqo8ruVGGfwn02iTgdPZp5/46cWvWxB03JgILm88cz LTQjP9rGnHvV06xK5w+oG5uFxy0tZYUYEnBf0IIg+bqBdjKPIdGF+SIpepCfJ+wDuQyN tP9XDkdWqc4+2ztSzeWJbhKzJARIkVxGlhP62bMV5wc49clA61VKKVrC6co5VvpwlNfB E+mjwvVcr2FgXPiGEmUd8uP5+eN6IFCwPelIyKiYWwSY3zWdB/cDUWEQ88lDDfI6cW3u WjU/amoyGl/CaukUn2Js7yK3lWoMyltA2OBQEYl7z6yre+4/shKbEQyJbVXOYkbrOwkE B3hg== 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 bt22si4380379edb.246.2021.04.16.03.22.42; Fri, 16 Apr 2021 03:23:05 -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 S241360AbhDPJJl (ORCPT + 99 others); Fri, 16 Apr 2021 05:09:41 -0400 Received: from mga17.intel.com ([192.55.52.151]:57482 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241354AbhDPJJj (ORCPT ); Fri, 16 Apr 2021 05:09:39 -0400 IronPort-SDR: v0lZtNmdy28HfPmnEzqO6CadWn2HIUBM5g4k340Bvpta2I0L1ttLIYjvQSw0jl2mh/1LH+Mv08 hMqTmlfKJe5w== X-IronPort-AV: E=McAfee;i="6200,9189,9955"; a="175120531" X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="175120531" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2021 02:09:14 -0700 IronPort-SDR: Yo/3KwkOHpa5Wf4bKNcz6VeTmOGVjM3sJsowFc8GKwZSCiEqLG1ZnjTPBZ6Gazj3PDH3eznpcX EwTwxrokmsrg== X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="399857691" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2021 02:09:12 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lXKTN-004bZv-0X; Fri, 16 Apr 2021 12:09:09 +0300 Date: Fri, 16 Apr 2021 12:09:09 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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. > > /* might be zero */ > > p->metadata_size = metadata_size; -- With Best Regards, Andy Shevchenko