Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp103000rdb; Mon, 18 Sep 2023 09:17:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlUPSDXvAwcs4C1KWtYRjieK+dD892kNSsdbl8b4yeeQdQmTQteSlOZWkN6TBb/vz41vLX X-Received: by 2002:a05:6a00:2313:b0:68a:6926:78ac with SMTP id h19-20020a056a00231300b0068a692678acmr9411076pfh.22.1695053838905; Mon, 18 Sep 2023 09:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695053838; cv=none; d=google.com; s=arc-20160816; b=PrktL9P0yGhZUON950WcsOID8fp9EiZkI1utzKFs/MfldQH+sm2YC9wbXbyD7mhqg9 bUwI74/M513CWdTIxAGH4JJReJO9VPV5A6dQWQQQgFYO1v36RDKLGOi+vg0575Ch1Htr ijYLutsMI5piAzNCpiyFq1JOHaEP5PUJ7VE2DhXuFt/OhwbHtCJI53a5f9f6kxCC7tfu hoXCSn2Pvp5fypx5eFpCgu1QdzR/Ck/hXY5CNY3GJZ6TACs6PM8qNeTrwM7PpG/qK5hO GQxtgwD9hQJpJASO+R5EzKUguGVOfB9AHIUCSMm7ZZFYoFdVpV8qDfwwFSQALfLyTmtt 9nRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-id:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=sq4b/RHXcr5Z0v8/iyhXqTS7cRnfjuQ4DiKIm8/wXzY=; fh=knovX9t61jpnbObYxxriknJ14Ci2g8GoY2rHFhQ2MlQ=; b=R940/ZGQ2BHst31v3LVhVAQpI40Tr2z0AQ6NmoBZauh3ihTchvKUr6ciDpXh7OYcvw rGPdc/QD1XSY84Xjn7xwb+DBVS/hhpZpkEDDLwRV3rQj+O/YGShd7qkLVfCNuJk3CWyR 1OOnXdfVrHUO3T9ES6nRU81FU8vJ8D8DAzuC0x3EbhwUG9t8Al9nrnw6Bsil1ENkJDM9 MuRdU+FLeYtBaFXwl3+G4bccN/1tD3oKAUVWC0d8Fwr7pCtCYwWDeHZoiViRL6N2cEbx EjJezryBDK2GiNYyCeBHG89TeAkk6i+BpbPDBd/dMN92rf5p3Lu/W/O0SO7aIEyYkuV5 ZQwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Cm4KyVpw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id j11-20020a056a00234b00b0068fc9c6eafdsi8448269pfj.137.2023.09.18.09.17.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 09:17:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Cm4KyVpw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 6E156807E931; Mon, 18 Sep 2023 01:50:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234758AbjIRItz (ORCPT + 99 others); Mon, 18 Sep 2023 04:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240866AbjIRItm (ORCPT ); Mon, 18 Sep 2023 04:49:42 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF31E9B; Mon, 18 Sep 2023 01:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695026977; x=1726562977; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version:content-id; bh=2YUUS/Nrfwe4zxrCrHdl4H8tP/8zB6mvDXjfShJFfIE=; b=Cm4KyVpwa331JuP/bolAu28XW2SyoeKxBcCK8FMwTrpoS3z9i7MZCGDH PmAGHFiEZb+ezsgrxEwnOAMG9/9SPVuzIthA2VK3lc1yHzXYz/o1vDC7D YFvLVElPCtl/5i1rZX6XmK5UMw7S8v2Nz2FObdW/lF6UkngOBwXa5RHL0 scHds4e9xZOLqPYx47RdGnBothR500q6SPRXJo3TuSz823pAmPV3+iaG0 eSj8TXkXb/YC/9lpiZqUU8Cf5AuqhWWXndVc7CVJj/ElqrYYAUZ+v5wgR bfCZ2XCTr81ThLebs7tHOUhTVbNTuEgAaEbeU93eHk2PSUMmh1XBrfvSH A==; X-IronPort-AV: E=McAfee;i="6600,9927,10836"; a="364643555" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="364643555" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2023 01:49:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10836"; a="835944512" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="835944512" Received: from nprotaso-mobl1.ccr.corp.intel.com ([10.252.49.156]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2023 01:49:32 -0700 Date: Mon, 18 Sep 2023 11:49:26 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: "Joseph, Jithu" cc: Hans de Goede , markgross@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rostedt@goodmis.org, ashok.raj@intel.com, tony.luck@intel.com, LKML , platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, pengfei.xu@intel.com Subject: Re: [PATCH 03/10] platform/x86/intel/ifs: Image loading for new generations In-Reply-To: Message-ID: <10fe57c-c926-9de4-be84-21a0f8abab6d@linux.intel.com> References: <20230913183348.1349409-1-jithu.joseph@intel.com> <20230913183348.1349409-4-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1901495400-1695026647=:1832" Content-ID: <871ef1de-2fef-353b-b85c-d89c1a5cbdba@linux.intel.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 18 Sep 2023 01:50:36 -0700 (PDT) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1901495400-1695026647=:1832 Content-Type: text/plain; CHARSET=ISO-8859-15 Content-Transfer-Encoding: 8BIT Content-ID: <546965c1-b17-8942-fff1-fb6f7a96532@linux.intel.com> On Fri, 15 Sep 2023, Joseph, Jithu wrote: > On 9/15/2023 9:46 AM, Ilpo J?rvinen wrote: > > On Wed, 13 Sep 2023, Jithu Joseph wrote: > > > >> Scan image loading flow for newer IFS generations (1 and 2) are slightly > >> different from that of current generation (0). In newer schemes, > >> loading need not be done once for each socket as was done in gen0. > >> > >> Also the width of CHUNK related bitfields in SCAN_HASHES_STATUS MSR has > >> increased from 8 -> 16 bits. Similarly there are width differences > >> for CHUNK_AUTHENTICATION_STATUS too. > >> > >> Further the parameter to AUTHENTICATE_AND_COPY_CHUNK is passed > >> differently in newer generations. > >> > >> Signed-off-by: Jithu Joseph > >> Reviewed-by: Tony Luck > >> Tested-by: Pengfei Xu > >> --- > >> drivers/platform/x86/intel/ifs/ifs.h | 27 ++++++ > >> drivers/platform/x86/intel/ifs/load.c | 113 +++++++++++++++++++++++++- > >> 2 files changed, 138 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h > >> index d666aeed20fc..886dc74de57d 100644 > >> --- a/drivers/platform/x86/intel/ifs/ifs.h > >> +++ b/drivers/platform/x86/intel/ifs/ifs.h > >> @@ -137,6 +137,8 @@ > >> #define MSR_CHUNKS_AUTHENTICATION_STATUS 0x000002c5 > >> #define MSR_ACTIVATE_SCAN 0x000002c6 > >> #define MSR_SCAN_STATUS 0x000002c7 > >> +#define MSR_SAF_CTRL 0x000004f0 > >> + > >> #define SCAN_NOT_TESTED 0 > >> #define SCAN_TEST_PASS 1 > >> #define SCAN_TEST_FAIL 2 > >> @@ -158,6 +160,19 @@ union ifs_scan_hashes_status { > >> }; > >> }; > >> > >> +union ifs_scan_hashes_status_gen2 { > >> + u64 data; > >> + struct { > >> + u16 chunk_size; > >> + u16 num_chunks; > >> + u8 error_code; > >> + u32 chunks_in_stride :9; > >> + u32 rsvd :2; > >> + u32 max_core_limit :12; > >> + u32 valid :1; > > > > This doesn't look it would be guaranteed to provide the alignment you seem > > to want for the fields. > > To Quote Tony from an earlier response to a similar query[1] > > "This driver is X86_64 specific (and it seems > incredibly unlikely that some other architecture will copy this h/w > interface so closely that they want to re-use this driver. There's an x86_64 > ABI that says how bitfields in C are allocated." > > > > [1] https://lore.kernel.org/lkml/SJ1PR11MB6083EBD2D2826E0A247AF242FCD19@SJ1PR11MB6083.namprd11.prod.outlook.com/ Hi, I was actually not that worried about this from portability perspective but from placing u32 bitfield after u8 which according to some info I read about this topic way back would not get the alignment you're after. As I could not find anything concrete which "says" (does somebody have some reference for something which actually documents this?) something about x86_64 I ended up using pahole and checked that gcc did not leave hole there so it seems to be fine after all. I think Tony's "proof" is pretty invalid. He doesn't differentiate HW interface related bitfields from those which are not HW interface related (to the extent that in fact most of those bitfields likely are not HW interface related). -- i. --8323329-1901495400-1695026647=:1832--