Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp1614520qtg; Tue, 21 Mar 2023 17:39:02 -0700 (PDT) X-Google-Smtp-Source: AK7set9t+NUyt40WSQMFbtfC+XAmJVnuCd6qYlwPZb5mEXSEePZLZa+VhAMU3C2+2yy7iCjdPvab X-Received: by 2002:a05:6a20:8e08:b0:da:c070:c466 with SMTP id y8-20020a056a208e0800b000dac070c466mr4097835pzj.6.1679445541742; Tue, 21 Mar 2023 17:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679445541; cv=none; d=google.com; s=arc-20160816; b=MxD6yLV/Pqo2jBnXUbI213zZvOfemwOWss3zOzGqGJzMO88R7GLay1urQQus3hC40G BaRw4FfUN7TZF7F5K6kr+JVtXak/CvLLIQGawGOJpxGxK9xuVCV5i3Tn0X+n8iQIg3vH F+z3kLkAigcnNv4yaNiUNk4wjY7UtKPmXXf9aKeVjrPcI4l2nSQ+AdGXi4hSaK8J9SZh whbAysnJpKInww11oIOZTi/VYO3roNqx4pBUdaJetxjtLHgT9xaxIjOAyDWhSB2oz6Ef 9bSheea7nUFgToN9+pJAQsVNQ0oKH0iO3k1XDQYhfrjDUkpbTVEpFE7zlHt3Ovgt1Z3a 0A7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5aECxlZxSQyDp5D99TJHlyDyr+L4LRMice6L57AuooA=; b=KRoLue+8TH8JBIauyzbn7/a3SnZaaTQewPvN1iCLi8LnOOdT353i0dvTLxM+2zijd/ 4ekLCnwAXofoTjKGf9SRAUM25h2Z2R97LDzAmc6YfXXrbZLsZyK3eg08n9KsOdwlyo+A G5b01bBRwv1WdqWQndcOFMd0Gk62ZdkqfL4jMq0dKRYRna2LGnovlpFQXwc0gVf2R6eE Wk+XT7SJ9/Sp2KBNV7A4Swtn/oIIQTruj5vFDWWCSRTbR9jLODH5HSbygsvkLtrJfuTi 22MpufK+48z7D6J33cUTLbEW0G6l3MME/alKR4bto7IfuBF7yoNbLasJB8ROp5GSavib 002A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ewoJ5mwP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e10-20020a17090a7c4a00b0023f000be67dsi19567603pjl.13.2023.03.21.17.38.50; Tue, 21 Mar 2023 17:39:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ewoJ5mwP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229799AbjCVAiG (ORCPT + 99 others); Tue, 21 Mar 2023 20:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbjCVAiF (ORCPT ); Tue, 21 Mar 2023 20:38:05 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 956B45261; Tue, 21 Mar 2023 17:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679445483; x=1710981483; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KQ8B+/SmB6Ps2PdDC2JGIJkpyzpOfVhnUhlP4BJLxJY=; b=ewoJ5mwPuOpNSeHzXqVQcq5Lh6qT+fRPqymVgq6EvET0DvTctEP2/MUh KlPd88o+YKu0pBIxFb1vHaLnu/VdTKlpE/x2j6SnDWpwQH7LnC7J2Ho7J l0YsQqopT/iNL6HM4PaUUtpwF86JZD6/KBHP4rbvpetN1aagEXZAUHzlR 1ezUxJHrD+EimeZ+ZYBnjXekTo5cDanQf5V4/gv143dBl10SB51fQ1rN4 cjg91gMFxJvFoKQe1k7RWKZ5XErCitb6e16Q1oNyLrZShFVOdAIIFWF0t NnVsTCrF2W8BRcjXaJUBv1lLS+GWwQoJhqGXcX/CDWVYumkQYMlDhf+Sr g==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="322934890" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="322934890" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="675076027" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="675076027" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:01 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, rostedt@goodmis.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v4 1/9] platform/x86/intel/ifs: Separate ifs_pkg_auth from ifs_data Date: Tue, 21 Mar 2023 17:33:51 -0700 Message-Id: <20230322003359.213046-2-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322003359.213046-1-jithu.joseph@intel.com> References: <20230301015942.462799-1-jithu.joseph@intel.com> <20230322003359.213046-1-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED 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 In preparation to supporting additional tests, remove ifs_pkg_auth from per-test scope, as it is only applicable for one test type. This will simplify ifs_init() flow when multiple tests are added. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck --- drivers/platform/x86/intel/ifs/ifs.h | 3 +-- drivers/platform/x86/intel/ifs/core.c | 10 ++++++---- drivers/platform/x86/intel/ifs/load.c | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 046e39304fd5..221413b79281 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -201,7 +201,6 @@ union ifs_status { * struct ifs_data - attributes related to intel IFS driver * @integrity_cap_bit: MSR_INTEGRITY_CAPS bit enumerating this test * @loaded_version: stores the currently loaded ifs image version. - * @pkg_auth: array of bool storing per package auth status * @loaded: If a valid test binary has been loaded into the memory * @loading_error: Error occurred on another CPU while loading image * @valid_chunks: number of chunks which could be validated. @@ -212,7 +211,6 @@ union ifs_status { */ struct ifs_data { int integrity_cap_bit; - bool *pkg_auth; int loaded_version; bool loaded; bool loading_error; @@ -241,6 +239,7 @@ static inline struct ifs_data *ifs_get_data(struct device *dev) return &d->data; } +extern bool *ifs_pkg_auth; int ifs_load_firmware(struct device *dev); int do_core_test(int cpu, struct device *dev); const struct attribute_group **ifs_get_groups(void); diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index 206a617c2e02..3176d94b1fe5 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -20,6 +20,8 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = { }; MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); +bool *ifs_pkg_auth; + static struct ifs_device ifs_device = { .data = { .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT, @@ -56,13 +58,13 @@ static int __init ifs_init(void) if (!(msrval & BIT(ifs_device.data.integrity_cap_bit))) return -ENODEV; - ifs_device.data.pkg_auth = kmalloc_array(topology_max_packages(), sizeof(bool), GFP_KERNEL); - if (!ifs_device.data.pkg_auth) + ifs_pkg_auth = kmalloc_array(topology_max_packages(), sizeof(bool), GFP_KERNEL); + if (!ifs_pkg_auth) return -ENOMEM; ret = misc_register(&ifs_device.misc); if (ret) { - kfree(ifs_device.data.pkg_auth); + kfree(ifs_pkg_auth); return ret; } @@ -72,7 +74,7 @@ static int __init ifs_init(void) static void __exit ifs_exit(void) { misc_deregister(&ifs_device.misc); - kfree(ifs_device.data.pkg_auth); + kfree(ifs_pkg_auth); } module_init(ifs_init); diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index c5c24e6fdc43..74a50e99cacd 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -192,7 +192,7 @@ static int scan_chunks_sanity_check(struct device *dev) struct ifs_work local_work; int curr_pkg, cpu, ret; - memset(ifsd->pkg_auth, 0, (topology_max_packages() * sizeof(bool))); + memset(ifs_pkg_auth, 0, (topology_max_packages() * sizeof(bool))); ret = validate_ifs_metadata(dev); if (ret) return ret; @@ -204,7 +204,7 @@ static int scan_chunks_sanity_check(struct device *dev) cpus_read_lock(); for_each_online_cpu(cpu) { curr_pkg = topology_physical_package_id(cpu); - if (ifsd->pkg_auth[curr_pkg]) + if (ifs_pkg_auth[curr_pkg]) continue; reinit_completion(&ifs_done); local_work.dev = dev; @@ -215,7 +215,7 @@ static int scan_chunks_sanity_check(struct device *dev) ret = -EIO; goto out; } - ifsd->pkg_auth[curr_pkg] = 1; + ifs_pkg_auth[curr_pkg] = 1; } ret = 0; out: -- 2.25.1