From patchwork Wed Oct 4 02:02:10 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: 148133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2468883vqb; Tue, 3 Oct 2023 19:02:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJnftIvyx1n0NLso4bsamYmZKxo6mYsAk62LRShR5+Py5oGQZr1Rc8Jw4LnQg+xXY0BFRz X-Received: by 2002:a17:90a:fb52:b0:274:7db1:f50f with SMTP id iq18-20020a17090afb5200b002747db1f50fmr1515453pjb.15.1696384965457; Tue, 03 Oct 2023 19:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696384965; cv=none; d=google.com; s=arc-20160816; b=iVw9yOmB9qpQKxblkaG3WNInuJMFb/9XerU+cg40YXdJwFFypuF/2xbOryFoUWV+Lw rEV5cc8EWyztweX8mhVOiYwhTCUfEQ11qdp6JXZ7aKhDE0Ev3gEmLUWbtgg+d1sKDo3e 6YT/Fevtm0e8UJkUfh7jE/vua/7MhiVUSDuGFJ7rFnkh6NyFlVa+pyZyZKUZepkTDNtP Ss+kkZaeEalPT4dzu1lETcQK88vMgYdKAiYBrSCXZukxGPNac03tzrjBja5oPStQSwDc RdmankA95YC4Ldqd3NpqPk3hdVi19cNlaLRn6iFIvkt5CsMfTVKjpHAy2zqVAFp4T2F6 0hOg== 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=duT1KdEywGAc7LqNmi9h6REjtQJW0ywzcT/24rPP8vU=; fh=d9G4dsZtlI8UONIvGKwhW94hCYEPGxy6CqYeKEG646A=; b=vq1YAVbhs5JsyIrPMAQ46cDoX1LxBplzo1DN2SsqSzGVr9UMqe52GbR/6miwbo4qGn 5dMHGT9o9K1uQfwEjKnQvm8gQ/mTtWpJI1nYmL/dSxQ6qO7ZiV0KhMAdhh58BzdyOmSg 8/nXePMkdHwG9QCJgP2hB4rWvlJJ8JKW10jNjzm0WEoUEsWF9UmlpIiV7uFxa4PmgXv/ Z1wpr7wk6BXeNKIzmoVhz93tAPwtBy0UGKTleo9wbasG3Wim2XZeF/2yIFxs9Kc2HYH+ tx5NKhnum3V/CsJwPQJw868ddKOKgQdRCSfJVYAHRgwbS6pUYKs4tm1gX/3v2hhpTH1S MeTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="BzwvMj/3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f31-20020a17090a702200b0027762924984si498243pjk.183.2023.10.03.19.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 19:02:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="BzwvMj/3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 4E70C81BDF0D; Tue, 3 Oct 2023 19:02:44 -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 S240998AbjJDCCk (ORCPT + 17 others); Tue, 3 Oct 2023 22:02:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240992AbjJDCCj (ORCPT ); Tue, 3 Oct 2023 22:02:39 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33183DA; Tue, 3 Oct 2023 19:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696384956; x=1727920956; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=kybFOdQBSnJfzmsSI4DdnlKj3rqQZE+fkrrxVtulqwo=; b=BzwvMj/3WQOo9369tUbOM8A7AsAfZOqQ9e8ZQD0wsOwlVMFB0FCY4WBk gjwqBS6IATiVe8QhfGS0FQEoz5ZxymrBZpW+iifh1mLJ2HJI6U/zmqmoc WrIZBnDeeGfpqolyRyNlZO3U883UOFOX9EbkZuATECrM0jjkuHVmXjvsK KdJxuWgOGspoz65XYPNNUGTkHQK1sCbEAhUOmrr7G7Pa2d9BBC1MyN9dh A7jtsLwc1rpCaEFmIPIkoZcyLCaxsTZJ91QEesoR2kzCNurgbBS0CfEpG LWTnU+m+C9VUnaGF9QqVBQVj3GLBTux3ZvjJtEtxs5xkVgUI7vidw8CWn Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="1625860" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="1625860" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orvoesa101.jf.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="700926287" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="700926287" Received: from linux.intel.com ([10.54.29.200]) by orsmga003.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 19:02:22 -0700 Received: from debox1-desk4.intel.com (unknown [10.209.24.172]) by linux.intel.com (Postfix) with ESMTP id 7DE5C580CBC; 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 01/13] platform/x86/intel/vsec: Move structures to header Date: Tue, 3 Oct 2023 19:02:10 -0700 Message-Id: <20231004020222.193445-2-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,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:44 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778788561537886832 X-GMAIL-MSGID: 1778788561537886832 In preparation for exporting an API to register Intel Vendor Specific Extended Capabilities (VSEC) from other drivers, move needed structures to the header file. Signed-off-by: David E. Box Reviewed-by: Ilpo Järvinen --- V2 - New patch splitting previous PATCH 1 drivers/platform/x86/intel/vsec.c | 35 ------------------------------ drivers/platform/x86/intel/vsec.h | 36 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/drivers/platform/x86/intel/vsec.c b/drivers/platform/x86/intel/vsec.c index c1f9e4471b28..e82a009be630 100644 --- a/drivers/platform/x86/intel/vsec.c +++ b/drivers/platform/x86/intel/vsec.c @@ -24,13 +24,6 @@ #include "vsec.h" -/* Intel DVSEC offsets */ -#define INTEL_DVSEC_ENTRIES 0xA -#define INTEL_DVSEC_SIZE 0xB -#define INTEL_DVSEC_TABLE 0xC -#define INTEL_DVSEC_TABLE_BAR(x) ((x) & GENMASK(2, 0)) -#define INTEL_DVSEC_TABLE_OFFSET(x) ((x) & GENMASK(31, 3)) -#define TABLE_OFFSET_SHIFT 3 #define PMT_XA_START 0 #define PMT_XA_MAX INT_MAX #define PMT_XA_LIMIT XA_LIMIT(PMT_XA_START, PMT_XA_MAX) @@ -39,34 +32,6 @@ static DEFINE_IDA(intel_vsec_ida); static DEFINE_IDA(intel_vsec_sdsi_ida); static DEFINE_XARRAY_ALLOC(auxdev_array); -/** - * struct intel_vsec_header - Common fields of Intel VSEC and DVSEC registers. - * @rev: Revision ID of the VSEC/DVSEC register space - * @length: Length of the VSEC/DVSEC register space - * @id: ID of the feature - * @num_entries: Number of instances of the feature - * @entry_size: Size of the discovery table for each feature - * @tbir: BAR containing the discovery tables - * @offset: BAR offset of start of the first discovery table - */ -struct intel_vsec_header { - u8 rev; - u16 length; - u16 id; - u8 num_entries; - u8 entry_size; - u8 tbir; - u32 offset; -}; - -enum intel_vsec_id { - VSEC_ID_TELEMETRY = 2, - VSEC_ID_WATCHER = 3, - VSEC_ID_CRASHLOG = 4, - VSEC_ID_SDSI = 65, - VSEC_ID_TPMI = 66, -}; - static const char *intel_vsec_name(enum intel_vsec_id id) { switch (id) { diff --git a/drivers/platform/x86/intel/vsec.h b/drivers/platform/x86/intel/vsec.h index 0fd042c171ba..8900cb95afd3 100644 --- a/drivers/platform/x86/intel/vsec.h +++ b/drivers/platform/x86/intel/vsec.h @@ -11,9 +11,45 @@ #define VSEC_CAP_SDSI BIT(3) #define VSEC_CAP_TPMI BIT(4) +/* Intel DVSEC offsets */ +#define INTEL_DVSEC_ENTRIES 0xA +#define INTEL_DVSEC_SIZE 0xB +#define INTEL_DVSEC_TABLE 0xC +#define INTEL_DVSEC_TABLE_BAR(x) ((x) & GENMASK(2, 0)) +#define INTEL_DVSEC_TABLE_OFFSET(x) ((x) & GENMASK(31, 3)) +#define TABLE_OFFSET_SHIFT 3 + struct pci_dev; struct resource; +enum intel_vsec_id { + VSEC_ID_TELEMETRY = 2, + VSEC_ID_WATCHER = 3, + VSEC_ID_CRASHLOG = 4, + VSEC_ID_SDSI = 65, + VSEC_ID_TPMI = 66, +}; + +/** + * struct intel_vsec_header - Common fields of Intel VSEC and DVSEC registers. + * @rev: Revision ID of the VSEC/DVSEC register space + * @length: Length of the VSEC/DVSEC register space + * @id: ID of the feature + * @num_entries: Number of instances of the feature + * @entry_size: Size of the discovery table for each feature + * @tbir: BAR containing the discovery tables + * @offset: BAR offset of start of the first discovery table + */ +struct intel_vsec_header { + u8 rev; + u16 length; + u16 id; + u8 num_entries; + u8 entry_size; + u8 tbir; + u32 offset; +}; + enum intel_vsec_quirks { /* Watcher feature not supported */ VSEC_QUIRK_NO_WATCHER = BIT(0),