From patchwork Fri Sep 22 21:30:24 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: 143693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5896424vqi; Fri, 22 Sep 2023 15:15:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3QHvE5vDtqQMODS7aX1hbZmwd3ETiHKVGujupE9KWOqdZotLrgyyAYHTETulltJzSF3SV X-Received: by 2002:a05:6a00:230b:b0:68f:f0bb:7de1 with SMTP id h11-20020a056a00230b00b0068ff0bb7de1mr765971pfh.11.1695420943446; Fri, 22 Sep 2023 15:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695420943; cv=none; d=google.com; s=arc-20160816; b=BXBv/cscCF7maps25tgHc8hDPdW7UrH/Of1lYt0hrKidAhtRqZAgjCzMiwb5t9f+XM WzmDucat5dKjyDTsMbw9F330nQ/j5qCivefOcB2FgKoa0XvnW2PwvKY3PZPhnZ0rpe6c EPrFhE/n7xnltE/ZLbipD92VE1jNWVzRmiprcwxBewj/v5ZFpUcNyJ4l2lwVDMszlFJy D0YAaqT0tis5Ojmbipp8PlvmX4fLoYuOfQwwonAxqiVcUOcvqBhXIw6D/1IGdQqIFiLe eLRXc/2KFtsfbG9AWAM5clbWmSAopjCFCmGJJcySxWORjftjNarwk4KHhzTvy2HD3nnL bh4A== 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=P9ckwuuJLjWKzpr/9Bw1XBZoUeFEMUoOaGUnXUT5IAM=; fh=WoyaDCqoIurK3gigUbTB/Xr+1NkeBdRjn5eZTIYeUNs=; b=dzb5w2FeglcOgYuBOzlfdsPZ/9Jubbjb5SiyRB6yyT978lj4lT9xyrOhqMOAzxzknm QIx+4s4vZ9T4S1ekr7OHtszhiBKQrV6/t9SmCmrQTmPaUoJBjY5CDawOLJXi506QHw+g OaHvHVkecQ0xEPBsP8BI8IXHSfCGReI7o2bHcszet3aWuf3ky0kYlVMNAyTacroKoxCd sv8YT+cA5mvNhskUxdVz5dhgzZOcdt+qAAwsm+LogKI4Xiazcz93dwYZb7YxgiZ+6U6K /gsck8OXACRNiYK3mApG8hbDp+2CpnDxvVuLF1HX2oMh4ewkgz/cGd5xe1O+8BMoFM5e SzeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="BMK4X/mJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g20-20020a056a001a1400b00690208f6d56si4823742pfv.340.2023.09.22.15.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 15:15:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="BMK4X/mJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 10C4781DF975; Fri, 22 Sep 2023 14:31:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbjIVVat (ORCPT + 28 others); Fri, 22 Sep 2023 17:30:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229941AbjIVVak (ORCPT ); Fri, 22 Sep 2023 17:30:40 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26D76F7; Fri, 22 Sep 2023 14:30:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695418234; x=1726954234; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=B3jXLZXwTJVzHRrKfu3fgGwj9H3NPlZpu7Vkx4l8KvA=; b=BMK4X/mJjCsIk+89i/9oA4yPsyILDlmdOU+mvYRemZo7bib0wwnjF9lL 8Bzf5vu2ahfZENHEs9NyTndYtE106gm0LrXNz9qes0gQRyAnly85iIY2h 0DRX8KDN3T0zbKbcTcisUs6fnoMWrOfxlfdSuNi0xanw4NWkqNPuaN40H K48DFTJOA+ecGeqrANumqFEwnvqRmG8AfwPVJwvUH1zUxlRcUz9gAzXZT OgcSt3DLr10k/tC7vzNCpQXun1E4T+QpjLQyLhASKzt+/RaROA2KvuJY9 +CRbxcWDFF4vaaMVDk/AVOo4J7Z8lDfODhHR08RxIN8UGX5A229TTkgNJ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="371264688" X-IronPort-AV: E=Sophos;i="6.03,169,1694761200"; d="scan'208";a="371264688" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 14:30:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="747685313" X-IronPort-AV: E=Sophos;i="6.03,169,1694761200"; d="scan'208";a="747685313" Received: from linux.intel.com ([10.54.29.200]) by orsmga002.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 14:30:33 -0700 Received: from debox1-desk4.intel.com (unknown [10.212.188.234]) by linux.intel.com (Postfix) with ESMTP id 03328580DB2; Fri, 22 Sep 2023 14:30:33 -0700 (PDT) From: "David E. Box" To: linux-kernel@vger.kernel.org, david.e.box@linux.intel.com, platform-driver-x86@vger.kernel.org, ilpo.jarvinen@linux.intel.com, rajvi.jingar@linux.intel.com Subject: [PATCH 03/11] platform/x86/intel/pmt: Add header to struct intel_pmt_entry Date: Fri, 22 Sep 2023 14:30:24 -0700 Message-Id: <20230922213032.1770590-4-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230922213032.1770590-1-david.e.box@linux.intel.com> References: <20230922213032.1770590-1-david.e.box@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=2.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 22 Sep 2023 14:31:40 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777777711333877240 X-GMAIL-MSGID: 1777777711333877240 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 --- 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;