Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4380757ioa; Wed, 27 Apr 2022 02:30:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGnrg+x4dZuW5QT6Q203ayRz2BBeAwIIt0IKBesgJTUTxwKFj7eQj7RtBr1xInmUJ2fzZF X-Received: by 2002:a17:902:f64d:b0:14f:fb63:f1a with SMTP id m13-20020a170902f64d00b0014ffb630f1amr28294726plg.159.1651051832453; Wed, 27 Apr 2022 02:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651051832; cv=none; d=google.com; s=arc-20160816; b=bxRpn9pRj4SJAE24pntGOtrR7AK0xG2Fkg3HfZUbzW/ztcD9RUyhY63D1ScHj5BQhH +wqTfE3Yh8kNjJJaF7Gu+H+TOUKUjQd7kM4TecfhyiB/x6Hp2DaJKH+ul3uR1bgYmBzD xfTZF7mfiyg+zlw+3K0JosrPFmJ+9/ICPvHud5VMnPvEhbx2o5ixIL6HrWOctrT5Jctf /DOLiLGxSUEQlwRz+IusnrlDAjxFXRnzz7T4+xxxD0nIVcXiZ7JCDMMLoaI7MmSyiICm ySlc61n3Vt7vY46g9CeLbYKqpGZebssjti43/yKiAMvT4DYKHZaHVWbSm3teoQD0Xdnx Gevg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2pcksL1DSCFS1Po8O5Ay6jKyhJSbBEtAucd8nfqW8JI=; b=r1zBVtoTIZMq7vYRkSfIIuwQix1W5VXRlC/LvjDXKXFXn9o9Xil8wLPA7RSZas2umg SyouvudcgbJE6vXHYjeUmcsWimoQAE0KrgvV4Sxhqi9tiBBfMSRP/ije4KcX/HymzxVq SDDV/FuhifsQvpoGfRw50cR3t9cPCxU1xj9UYwp3Rd+V+a4YvIkU27aQiRRA7+THvd6m 7bSBDGvxZKOiOMnhMxWwAZaxNnl4ZyDQvZUYELh1qKnH0E69tmqirJ+B0xK+e7wN8P6k 9nfUt3MB6hnYjU80JKjuHSc2qUhI/nGexZ+Hpw0axGHWrz5qCFU/oaoBGjtPeXVspZTH E8wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=je8v9jOX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m5-20020a170902f64500b00153b2d16543si1103081plg.331.2022.04.27.02.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 02:30:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=je8v9jOX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 837A0247EB3; Wed, 27 Apr 2022 02:11:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352638AbiDZSvF (ORCPT + 99 others); Tue, 26 Apr 2022 14:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352620AbiDZSvD (ORCPT ); Tue, 26 Apr 2022 14:51:03 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0242A90CDC; Tue, 26 Apr 2022 11:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650998873; x=1682534873; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=0hMC9FCc92/UZsP/d4xjIGjECImVMpXb8G2MfDigzBQ=; b=je8v9jOXBGMD0go0KnHsUgzKj9NurMjbZUxRv23m/FPKAOSLnVobCX4D ZjB1fYEJPBd5aZhdoAUSf0MIpyz7OqJHClzHyqC+BvR1IMCzSsNChFg2a 6xBOxN67Wd8BvHbxd1wO1I22m6bIoVb9zC7N76Sh9+q6VXvZwaiXFDLN0 XcQ9XoRPSI9LhvVqYCJVVaNMWlvsbYM33gHUAAtDgJyUOi2kLn3caaWlJ YT/oeVa8jmnbZ5vC5B4AFA7TXEEUOh7VGTxBcsE4d8yvDIJBII19tFWZU IFnXdFfu8Nm6s459iYuBrkuUFSftL7uHABbCyHVmdezKU1L3x67+WiLta w==; X-IronPort-AV: E=McAfee;i="6400,9594,10329"; a="265851409" X-IronPort-AV: E=Sophos;i="5.90,291,1643702400"; d="scan'208";a="265851409" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 11:47:52 -0700 X-IronPort-AV: E=Sophos;i="5.90,291,1643702400"; d="scan'208";a="580091108" Received: from agluck-desk3.sc.intel.com ([172.25.222.78]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 11:47:52 -0700 Date: Tue, 26 Apr 2022 11:47:50 -0700 From: "Luck, Tony" To: Greg KH Cc: hdegoede@redhat.com, markgross@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, corbet@lwn.net, andriy.shevchenko@linux.intel.com, jithu.joseph@intel.com, ashok.raj@intel.com, rostedt@goodmis.org, dan.j.williams@intel.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com Subject: Re: [PATCH v4 04/10] platform/x86/intel/ifs: Read IFS firmware image Message-ID: References: <20220419163859.2228874-1-tony.luck@intel.com> <20220422200219.2843823-1-tony.luck@intel.com> <20220422200219.2843823-5-tony.luck@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 26, 2022 at 06:36:46PM +0200, Greg KH wrote: > On Tue, Apr 26, 2022 at 09:12:37AM -0700, Luck, Tony wrote: > > If it really is too much now, I can rip it out from this submission > > and add it back when the second test is ready for public view. > > Please do, thanks. Hmmm ... maybe there were more bits than I thought. 1 file changed, 19 insertions(+), 36 deletions(-) core.c is now down to just 80 lines ... so that was a significant fraction of the file. Net change below (I'll thread it back into the patch series before reposting). Any other comments on the series? -Tony diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index 317ed3225307..489b77645b5e 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -9,10 +9,6 @@ #include "ifs.h" -enum test_types { - IFS_SAF, -}; - #define X86_MATCH(model) \ X86_MATCH_VENDOR_FAM_MODEL_FEATURE(INTEL, 6, \ INTEL_FAM6_##model, X86_FEATURE_CORE_CAPABILITIES, NULL) @@ -23,27 +19,21 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = { }; MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); -static struct ifs_device ifs_devices[] = { - [IFS_SAF] = { - .data = { - .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT, - }, - .misc = { - .name = "intel_ifs_0", - .nodename = "intel_ifs/0", - .minor = MISC_DYNAMIC_MINOR, - }, +static struct ifs_device ifs_device = { + .data = { + .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT, + }, + .misc = { + .name = "intel_ifs_0", + .nodename = "intel_ifs/0", + .minor = MISC_DYNAMIC_MINOR, }, }; -#define IFS_NUMTESTS ARRAY_SIZE(ifs_devices) - static int __init ifs_init(void) { const struct x86_cpu_id *m; - int ndevices = 0; u64 msrval; - int i; m = x86_match_cpu(ifs_cpu_ids); if (!m) @@ -61,32 +51,25 @@ static int __init ifs_init(void) if (ifs_setup_wq()) return -ENOMEM; - for (i = 0; i < IFS_NUMTESTS; i++) { - if (!(msrval & BIT(ifs_devices[i].data.integrity_cap_bit))) - continue; - - ifs_devices[i].misc.groups = ifs_get_groups(); - if (!misc_register(&ifs_devices[i].misc)) { - ndevices++; - down(&ifs_sem); - ifs_load_firmware(ifs_devices[i].misc.this_device); - up(&ifs_sem); - } - } + ifs_device.misc.groups = ifs_get_groups(); - if (!ndevices) + if ((msrval & BIT(ifs_device.data.integrity_cap_bit)) && + !misc_register(&ifs_device.misc)) { + down(&ifs_sem); + ifs_load_firmware(ifs_device.misc.this_device); + up(&ifs_sem); + } else { ifs_destroy_wq(); + return -ENODEV; + } - return ndevices ? 0 : -ENODEV; + return 0; } static void __exit ifs_exit(void) { - int i; - for (i = 0; i < IFS_NUMTESTS; i++) - if (ifs_devices[i].misc.this_device) - misc_deregister(&ifs_devices[i].misc); + misc_deregister(&ifs_device.misc); ifs_destroy_wq(); } -- 2.35.1