From patchwork Wed Oct 4 02:02:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 148131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2468838vqb; Tue, 3 Oct 2023 19:02:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFW8DM60nuQJMMCK6ddeGAuO6OQGSKTJzskOuqEugHs54mIeQoUppohH03RJBrBU9WwDA8L X-Received: by 2002:a05:6358:8a0:b0:143:27e:d3cf with SMTP id m32-20020a05635808a000b00143027ed3cfmr1240412rwj.4.1696384955750; Tue, 03 Oct 2023 19:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696384955; cv=none; d=google.com; s=arc-20160816; b=Q8wui7GN0RgQ/CtsEampOmLr6PAdbXT4QIiV5dtBW8JmR2RwIjjEqrAP7zKhM3ncrP LeCteoymx6CPVtzfVXCzpxHiBacr6Q+MwzG38MHkS3cJSIkWKIRIdCemE4JcFdx8qw4h Epw7qMIO3qFnBrsfpUIiSF6Lj7AimXkzWzD74Bgg9KAfVcyEWuWnzPmdzx9Pcxljt+nZ 2+ZymjETZBHsTGqJ2qM/XP3zlDDQrm6Om4anYKEOxkf8I7i0cPhl2J++SAilX61OyfAE xz9ACtLTnGw9kjHPMoBc4EyjOAbLpG99XfslvySpMROlwEPZtyQGe3IGy7giZhHTF6jQ cLvg== 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:to:from :dkim-signature; bh=7unNtmHMRhz+Zz/FkTC4uv3a/huJ8BRq1jk2akiwHiw=; fh=d9G4dsZtlI8UONIvGKwhW94hCYEPGxy6CqYeKEG646A=; b=rSf415msfzHs0GUQ6I+STNMBZV9xEU5JsVNk01s2Jn1xYpzLqRSwn7ufuPFvSfSjzX RrtDKRXW8moBvFMbRhnDRZ6NzWbG2Ut2q1YZKco/8VgBoSG5DPzjBtSNiWZswfw+XbOZ ul6wDwUkoRPToduH+cOdLKbu0vxJz9UfyiYDIBg8lXVA3+XaVi2YP7zc5uQR5R464T24 NV8s234j57pv1kWDkEELn31U8k7w5p1j2W/LSCBimTTmUNpPZ7YEBbKH6UL5AhDQznpB pmbNLlD3Q0teO3Te6ZNeG8oLmwvYxff874C2gf1+iFU1iR54lswBUz5QEvom51f2vrxl gSTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CuHeVqIC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cv1-20020a17090afd0100b002636d222400si508925pjb.14.2023.10.03.19.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 19:02:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CuHeVqIC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 1382781BBA1E; Tue, 3 Oct 2023 19:02:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240660AbjJDCC2 (ORCPT + 17 others); Tue, 3 Oct 2023 22:02:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240586AbjJDCC1 (ORCPT ); Tue, 3 Oct 2023 22:02:27 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87E88AB; Tue, 3 Oct 2023 19:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696384944; x=1727920944; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=oNAtKvQWvA46KMHMDJuy+Zf5ymmMJr0mCAXpFzt/M/s=; b=CuHeVqICLNuhv+AAF/arKoPV+zpTvnFoUo8TkMeGLM7wA1rlB9MxUdFg CAXqf5+lxMl02I4v26rK2xHFu9rA5R/JVX5mFkpwpGtISP33SPA0ddH+u pS0Ym6ENp9i1lX1meVoyhQW09KxpywbO2kVd9uT5a4IxUBCGEkpFZ4z6B j0obxrtJImUV0P9yuCFDbzIxt2UeWttFJ5BIdzDrJPR0LLz392QuBWD8n 1tdN+Pr96nGA/EWlHLnFlsJu3XoiS3YAQ2lZraNL1u1OpYS9AhHGs4wpf RSE2U18tWNG9XzY/+b2nwWIT9u5TlbnrJP9h5BR1742MhBrAUMoC/m7pw w==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="413947548" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="413947548" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 19:02:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="841596674" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="841596674" Received: from linux.intel.com ([10.54.29.200]) by FMSMGA003.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 19:02:23 -0700 Received: from debox1-desk4.intel.com (unknown [10.209.24.172]) by linux.intel.com (Postfix) with ESMTP id E5BE3580D99; Tue, 3 Oct 2023 19:02:22 -0700 (PDT) From: "David E. Box" To: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, ilpo.jarvinen@linux.intel.com, rajvi.jingar@linux.intel.com Subject: [PATCH V2 05/13] platform/x86/intel/pmt: Add header to struct intel_pmt_entry Date: Tue, 3 Oct 2023 19:02:14 -0700 Message-Id: <20231004020222.193445-6-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004020222.193445-1-david.e.box@linux.intel.com> References: <20231004020222.193445-1-david.e.box@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 03 Oct 2023 19:02:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778788551173394624 X-GMAIL-MSGID: 1778788551173394624 The PMT header is passed to several functions. Instead, store the header in struct intel_pmt_entry which is also passed to these functions and shorten the argument list. This simplifies the calls in preparation for later changes. Signed-off-by: David E. Box Reviewed-by: Ilpo Järvinen --- V2 - no change drivers/platform/x86/intel/pmt/class.c | 8 +++----- drivers/platform/x86/intel/pmt/class.h | 16 ++++++++-------- drivers/platform/x86/intel/pmt/crashlog.c | 2 +- drivers/platform/x86/intel/pmt/telemetry.c | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c index 32608baaa56c..142a24e3727d 100644 --- a/drivers/platform/x86/intel/pmt/class.c +++ b/drivers/platform/x86/intel/pmt/class.c @@ -159,12 +159,12 @@ static struct class intel_pmt_class = { }; static int intel_pmt_populate_entry(struct intel_pmt_entry *entry, - struct intel_pmt_header *header, struct intel_vsec_device *ivdev, struct resource *disc_res) { struct pci_dev *pci_dev = ivdev->pcidev; struct device *dev = &ivdev->auxdev.dev; + struct intel_pmt_header *header = &entry->header; u8 bir; /* @@ -313,7 +313,6 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespa struct intel_vsec_device *intel_vsec_dev, int idx) { struct device *dev = &intel_vsec_dev->auxdev.dev; - struct intel_pmt_header header; struct resource *disc_res; int ret; @@ -323,16 +322,15 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespa if (IS_ERR(entry->disc_table)) return PTR_ERR(entry->disc_table); - ret = ns->pmt_header_decode(entry, &header, dev); + ret = ns->pmt_header_decode(entry, dev); if (ret) return ret; - ret = intel_pmt_populate_entry(entry, &header, intel_vsec_dev, disc_res); + ret = intel_pmt_populate_entry(entry, intel_vsec_dev, disc_res); if (ret) return ret; return intel_pmt_dev_register(entry, ns, dev); - } EXPORT_SYMBOL_NS_GPL(intel_pmt_dev_create, INTEL_PMT); diff --git a/drivers/platform/x86/intel/pmt/class.h b/drivers/platform/x86/intel/pmt/class.h index db11d58867ce..e477a19f6700 100644 --- a/drivers/platform/x86/intel/pmt/class.h +++ b/drivers/platform/x86/intel/pmt/class.h @@ -18,7 +18,15 @@ #define GET_BIR(v) ((v) & GENMASK(2, 0)) #define GET_ADDRESS(v) ((v) & GENMASK(31, 3)) +struct intel_pmt_header { + u32 base_offset; + u32 size; + u32 guid; + u8 access_type; +}; + struct intel_pmt_entry { + struct intel_pmt_header header; struct bin_attribute pmt_bin_attr; struct kobject *kobj; void __iomem *disc_table; @@ -29,19 +37,11 @@ struct intel_pmt_entry { int devid; }; -struct intel_pmt_header { - u32 base_offset; - u32 size; - u32 guid; - u8 access_type; -}; - struct intel_pmt_namespace { const char *name; struct xarray *xa; const struct attribute_group *attr_grp; int (*pmt_header_decode)(struct intel_pmt_entry *entry, - struct intel_pmt_header *header, struct device *dev); }; diff --git a/drivers/platform/x86/intel/pmt/crashlog.c b/drivers/platform/x86/intel/pmt/crashlog.c index bbb3d61d09f4..4014c02cafdb 100644 --- a/drivers/platform/x86/intel/pmt/crashlog.c +++ b/drivers/platform/x86/intel/pmt/crashlog.c @@ -223,10 +223,10 @@ static const struct attribute_group pmt_crashlog_group = { }; static int pmt_crashlog_header_decode(struct intel_pmt_entry *entry, - struct intel_pmt_header *header, struct device *dev) { void __iomem *disc_table = entry->disc_table; + struct intel_pmt_header *header = &entry->header; struct crashlog_entry *crashlog; if (!pmt_crashlog_supported(entry)) diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c index 39cbc87cc28a..f86080e8bebd 100644 --- a/drivers/platform/x86/intel/pmt/telemetry.c +++ b/drivers/platform/x86/intel/pmt/telemetry.c @@ -58,10 +58,10 @@ static bool pmt_telem_region_overlaps(struct intel_pmt_entry *entry, } static int pmt_telem_header_decode(struct intel_pmt_entry *entry, - struct intel_pmt_header *header, struct device *dev) { void __iomem *disc_table = entry->disc_table; + struct intel_pmt_header *header = &entry->header; if (pmt_telem_region_overlaps(entry, dev)) return 1;