From patchwork Mon Sep 25 19:43:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 144552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1448543vqu; Mon, 25 Sep 2023 12:58:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtHAt5qxvWd5NV/3yFdjfbsdynXl+2cAJJjZtCtdkaIGxtZJglxC1k0GxTmbDrKhYun+5q X-Received: by 2002:a17:902:e882:b0:1c3:6667:5ff1 with SMTP id w2-20020a170902e88200b001c366675ff1mr7347478plg.27.1695671895780; Mon, 25 Sep 2023 12:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695671895; cv=none; d=google.com; s=arc-20160816; b=bZ3Jv/BmbSpXbpk4h9/qmsH+FrhIA41wQnz5sgJwOgfm7x7Cnhs47ePltcNS8LUdJ3 hqiEhy2fXVa0sP/Ii5f/ZwpLdneOV67AwYAE/kWQoiqCUKRgS2lt3WILuyIuEsxxRtGa HtzvMAmwPWRu4ppzekgQjnU4IMz7SC28zLJ1EtdyJQa0ij8WC3vyoXFWs0NCm0OftODi Esa8EWUau8AwmOzOznu9BRNXu3E6jAa3kqiF4LA8ZPu8JYG960HNcH9WHwA4hKXXvQC+ 3OGNpzjuyyS3z3kth/s4t4O97GYFpV02A2/vNX48u4Fs+nztxSrftCedHSRRHJb4A96r yO8g== 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=giBEtyyMQklJV/ErZjCX0Q7tqAV27oKX6910IFOz5ZA=; fh=WxcXzAXi1awalX5nBNdKiu2pCszhVA/a0vtqlN5we7w=; b=k52P/tY8SMQPSPrmvtAca1PqKR0Um1cENqRVp8FHikWved4Nbm0JQbCq5N4jQfNxk5 jhbZCBYEtosZlf2EMDMThvKRy7nk0pMSVRgsYvoNuHDP+w3wVn6nbWqr8YhzM6hE4tWP 3A7vNNjlW0bTsfTD0rl7gk1B8H0SiTwV/Gako/f/bHzfIVFFLzMrxuzhvB+1AzMEKvNH WEVHnWVCkyU4TZpvGKz7LU+N8u4VtnH7ouSr27BbF3S65ME289Xt3kkt+7U/wZu8A9Pg I4c469NtlbzQTA1qMdR8eKl36RH9K+VD9eB+YIBLjSTveEAIGD6U8DLCXcJEcvRK9qkP x1og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Ofr8zJR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id k15-20020a170902c40f00b001b895572179si11476140plk.184.2023.09.25.12.58.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 12:58:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Ofr8zJR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id AFE5580E60B0; Mon, 25 Sep 2023 12:43:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233321AbjIYTn4 (ORCPT + 29 others); Mon, 25 Sep 2023 15:43:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232973AbjIYTnz (ORCPT ); Mon, 25 Sep 2023 15:43:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4642103; Mon, 25 Sep 2023 12:43:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695671029; x=1727207029; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lRTLuTl4WdS58LnOlekBfjmptPkvpaho5X1jf3CRbHo=; b=Ofr8zJR/tVc85BxdtsGgVPgG6iZh1kMmH0/5jRimVvY8z6z072013k0u B4t75GcLpPAXSRSGiW+W3fKtpyh7X7rizqjfkuu5L7QSXdLq7GeAw5jkq LCJ8AhWHW0YwM6qAJN2Z/A7jZXACFjql/ZkbTA/cxd4JAcM5FoR2Bdqjc 1cpeTj5b5nBA69Xa56vvNJ+nUjB/pT1mzOw/UIzCxnDfkOEJTJ6HsAlUw EF2ohYt8mTg/u8kgX/s5wfiToUlErsOSSRWDL4365gMuXu+fJq+StMxRo N2PcS8VIjKAaGFuriwSfQxKrt2XCr5LjlnER7lI6AiiekOS0szjH6AA4o Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="360743062" X-IronPort-AV: E=Sophos;i="6.03,176,1694761200"; d="scan'208";a="360743062" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 12:43:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="872194749" X-IronPort-AV: E=Sophos;i="6.03,176,1694761200"; d="scan'208";a="872194749" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by orsmga004.jf.intel.com with ESMTP; 25 Sep 2023 12:43:39 -0700 From: Srinivas Pandruvada To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH 1/3] platform/x86/intel/tpmi: Add defines to get version information Date: Mon, 25 Sep 2023 12:43:36 -0700 Message-Id: <20230925194338.966639-2-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230925194338.966639-1-srinivas.pandruvada@linux.intel.com> References: <20230925194338.966639-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 12:43:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778040853770168122 X-GMAIL-MSGID: 1778040853770168122 Add defines to get major and minor version from a TPMI version field value. This will avoid code duplication to convert in every feature driver. Also add define for invalid version field. Signed-off-by: Srinivas Pandruvada --- include/linux/intel_tpmi.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/intel_tpmi.h b/include/linux/intel_tpmi.h index 04d937ad4dc4..ee07393445f9 100644 --- a/include/linux/intel_tpmi.h +++ b/include/linux/intel_tpmi.h @@ -6,6 +6,12 @@ #ifndef _INTEL_TPMI_H_ #define _INTEL_TPMI_H_ +#include + +#define TPMI_VERSION_INVALID 0xff +#define TPMI_MINOR_VERSION(val) FIELD_GET(GENMASK(4, 0), val) +#define TPMI_MAJOR_VERSION(val) FIELD_GET(GENMASK(7, 5), val) + /** * struct intel_tpmi_plat_info - Platform information for a TPMI device instance * @package_id: CPU Package id From patchwork Mon Sep 25 19:43:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 144791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1781959vqu; Tue, 26 Sep 2023 02:28:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkn09rO57xihmzIS/TcnEzsDehUjuPscawz4ESjf97eCsfjRNR8TInTR+yNg+zoeDdDLfE X-Received: by 2002:a05:6358:7a2:b0:145:707f:ebe1 with SMTP id n34-20020a05635807a200b00145707febe1mr5916502rwj.12.1695720490640; Tue, 26 Sep 2023 02:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695720490; cv=none; d=google.com; s=arc-20160816; b=zoHGjj7uIm+HKsRSvBsi6v8QSaFMV5ci8bwvqfZRG3vLys69CNSzk92ArMJj+FK3id DKxb5nXdsyeUiQcRB07drQAa8Xld53FVGkGLCfw0sIvgn9OYM9ORg/rm9ENUcwF6XGJ6 BRAOJUErpvNVSuqXaKLOPxy9l4UzRirA+fdmm9TpOYzykTbxrRKvqj7Gd2jujOfo1zF9 mFvVFvxyl7X6tFlRsxJYPQU3vtFuhIN0KCcEChtgs1uKPEI3BTLAANw1qf9nDWmNy8Sg Z7d4bjl+GJStG/kIgcCNnzO/wOxJN0MGhu9xUckYduNoZsmYgT7ZKr4lQnGTx3QrFmW7 5NGg== 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=3rvNlDzaDAsx4GrFylz2yurEiQgvNtF9raFCsmZwIV4=; fh=WxcXzAXi1awalX5nBNdKiu2pCszhVA/a0vtqlN5we7w=; b=qnQz5gbOf2Ktp0iRWrISjJW80TX/wT/iX5ZYeywqjyuCGDdL2UgRhMckEJSbNQ6mAm sRGDBml/5DeVE4iLpwyaMJSaTlQunV360Yr3H4O00NzdLAz5y1SM0xmYGPaHmzv9ZzWq RUPd7vNBx4ZWh5gP0egODbVnd78ijWXe36+QJuY2xjNfWwR5U3kpsT2fWfri38tAu0fd cQ9WEddfaTIFW0kA50+ovljUPWWLru8sIUx/jPBcyXTknvNIiscLyVgIUJdi8fR11vZU Lr/BVM8xKlBpsexPiuRw48UUvFZS8859oyT4Fm7wLNwsEJLUPXhJB1c+aNR7c1EQL0cG Npvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DR7rfQY7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id e26-20020a63545a000000b005704f061aecsi12463658pgm.279.2023.09.26.02.28.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 02:28:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DR7rfQY7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 9C2BB80CE7C2; Mon, 25 Sep 2023 12:44:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233340AbjIYTn5 (ORCPT + 29 others); Mon, 25 Sep 2023 15:43:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233216AbjIYTnz (ORCPT ); Mon, 25 Sep 2023 15:43:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 284EC101; Mon, 25 Sep 2023 12:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695671029; x=1727207029; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Qc58uCA2qyiU/pC/xc6SIaVgCU5JFHqYtmabPIVw1Kw=; b=DR7rfQY77zqh4ix3iOI29fThoKIpQtkCKqcPjfd7ZfJGZOZef/LBqhYc Hdv26A1EJ1XzkV0CXqjZn3RMuM8w8+GEL0jfqksePUOEi6WgyyRWQIhRh iaAWad+wgZowrzPrx/14EH0qDKRvY06k4+8ncqPFXNalpSZBcBCiva2r4 1uRHjkZZHvzQ3NUSKkawMxwGzFR0UWaTV9Yia8MUNtNeQ6bD+EVTl5YyL f3devJweahoNx8UTods8np6A+LNTCITD0wsSiv71IB6skQMBQNsi9Gv7P iXkvex6UVUDOs0NPGbWuak0uZaK2qlhkMm6xbBBBtfc/QAnTAZa9eVMfK w==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="360743071" X-IronPort-AV: E=Sophos;i="6.03,176,1694761200"; d="scan'208";a="360743071" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 12:43:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="872194750" X-IronPort-AV: E=Sophos;i="6.03,176,1694761200"; d="scan'208";a="872194750" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by orsmga004.jf.intel.com with ESMTP; 25 Sep 2023 12:43:39 -0700 From: Srinivas Pandruvada To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH 2/3] platform/x86: ISST : Check major minor version Date: Mon, 25 Sep 2023 12:43:37 -0700 Message-Id: <20230925194338.966639-3-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230925194338.966639-1-srinivas.pandruvada@linux.intel.com> References: <20230925194338.966639-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 12:44:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778091809122289967 X-GMAIL-MSGID: 1778091809122289967 Parse major and minor version number from the version field. If there is a mismatch for major version, exit from further processing for that domain. If there is mismatch in minor version, driver continue to process with an error message. Minor version change doesn't change offsets and bit structures of TPMI fields. Signed-off-by: Srinivas Pandruvada --- .../x86/intel/speed_select_if/isst_tpmi_core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c index 63faa2ea8327..37f17e229419 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c @@ -30,7 +30,8 @@ #include "isst_if_common.h" /* Supported SST hardware version by this driver */ -#define ISST_HEADER_VERSION 1 +#define ISST_MAJOR_VERSION 0 +#define ISST_MINOR_VERSION 1 /* * Used to indicate if value read from MMIO needs to get multiplied @@ -352,12 +353,19 @@ static int sst_main(struct auxiliary_device *auxdev, struct tpmi_per_power_domai pd_info->sst_header.cp_offset *= 8; pd_info->sst_header.pp_offset *= 8; - if (pd_info->sst_header.interface_version != ISST_HEADER_VERSION) { - dev_err(&auxdev->dev, "SST: Unsupported version:%x\n", - pd_info->sst_header.interface_version); + if (pd_info->sst_header.interface_version == TPMI_VERSION_INVALID) + return -ENODEV; + + if (TPMI_MAJOR_VERSION(pd_info->sst_header.interface_version) != ISST_MAJOR_VERSION) { + dev_err(&auxdev->dev, "SST: Unsupported major version:%lx\n", + TPMI_MAJOR_VERSION(pd_info->sst_header.interface_version)); return -ENODEV; } + if (TPMI_MINOR_VERSION(pd_info->sst_header.interface_version) != ISST_MINOR_VERSION) + dev_err(&auxdev->dev, "SST: Ignore: Unsupported minor version:%lx\n", + TPMI_MINOR_VERSION(pd_info->sst_header.interface_version)); + /* Read SST CP Header */ *((u64 *)&pd_info->cp_header) = readq(pd_info->sst_base + pd_info->sst_header.cp_offset); From patchwork Mon Sep 25 19:43:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 144548 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1443255vqu; Mon, 25 Sep 2023 12:46:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFifwbefKMsznB2/Z8gllQMrn2L8dl8T9wMd9PpFDoAWhzvH+SFrS3zF3mOfEMGCNLxx5Qp X-Received: by 2002:a05:6a00:1494:b0:68b:a137:373d with SMTP id v20-20020a056a00149400b0068ba137373dmr896258pfu.17.1695671161454; Mon, 25 Sep 2023 12:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695671161; cv=none; d=google.com; s=arc-20160816; b=S9W3BWN2BdbWERbjjhjAqc/XPp71iLOv8TaF98c2plsVLeMHI/lfSRWJim5hm+djUj kS12s588fSaJO07vlemc0NFl2QL0U0tQKw18KPJigUwxy5itBVTh7CT78iKgrLKg1CBy 1xGQwL2qN+asIU2krDsuPBP0tOmdUqeHmNlcSoL/J6SlYPNXKni4fALJPD+AxyLk7wtu 0dwB1tgB/Oor66BUvfQik2IdxM10nkGVlMeLCduP3D/bi/eLoAWsRyWNvkqJoNW1QT56 69828TWxABzbs++FO3VveyZh/joMuHcgsmZAEXfBSUn1PapKijxZIjvPQb7blRZij5hw TvKQ== 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=nckGQ1uEFjGJdj5oHkOkA2ke9+eH/Oj0GB1rUQr5GEY=; fh=WxcXzAXi1awalX5nBNdKiu2pCszhVA/a0vtqlN5we7w=; b=BLw+NX1xwNuIZsPMECrh/Yf642mkctOOIAQQzp5jWwDrD5SSsaifjPvHHoxSFg8ZHe K4FPuNDcUG8tQyyqcCtSkHwzRcFHg0jq8vqfnUqevaD8dnECE/LqyuaNA+tTLmBCa9Qd isNQW7lhNNttoZI9HpHbRrRIAvEqCAMqTrq8er626sX3zl1UGjt7/wsPA5/j69MoaYaT ZQuHY+JDm3fGNF4P61DQYhRdg8+kJglihD/qq5wSidc20UyCjcb9hEzbIDNIwlZX5qsO ab+hJGBxCiQkuF8gskyChYAoUd69/ekqNXXrkQCSNHXnQtE8i/qejVTgpAB7iOHP7ggV nnCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lebiT1f1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id e22-20020a62aa16000000b0069100706960si10259783pff.116.2023.09.25.12.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 12:46:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lebiT1f1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id CE52D80E6C51; Mon, 25 Sep 2023 12:44:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233352AbjIYTn6 (ORCPT + 29 others); Mon, 25 Sep 2023 15:43:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233315AbjIYTn4 (ORCPT ); Mon, 25 Sep 2023 15:43:56 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A20BF107; Mon, 25 Sep 2023 12:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695671029; x=1727207029; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FzGXYJzua9BF2gVVYPV7cyhWIVoAmAwcBTCIDmW0JcQ=; b=lebiT1f1DOewuSPXL3eh+6gT1GRQ/E0Wig2GfvVQxODyBDv2f4qnZBiI s+aYM1ZcdzsRw/Y6OVoeGROMvaky2lTxyu5hzbYzufoSDWoHImYTbZA8l ihE/awRPaFLjJZRw1mofh0PEqAtcNodb1Hulj+IpJxS4ULcN9rOnWn2h8 lkGAY4c5cDyTfXWbP3SjrIqDy2IW2kyc5fdfudDsM4eYffJoncDd3bDKp OVugdeXbUGoZ1fYdCs8siLgsBnezIPkrThApfw3+A34EULjIdGHELzmnC VbQkhcK6+NPy2WUwYBtpkjy0Yx2Ok/xElPFN63nU89r+NVTLh35Xk3GDa w==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="360743073" X-IronPort-AV: E=Sophos;i="6.03,176,1694761200"; d="scan'208";a="360743073" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 12:43:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="872194751" X-IronPort-AV: E=Sophos;i="6.03,176,1694761200"; d="scan'208";a="872194751" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by orsmga004.jf.intel.com with ESMTP; 25 Sep 2023 12:43:39 -0700 From: Srinivas Pandruvada To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH 3/3] platform/x86/intel-uncore-freq: Check major minor version Date: Mon, 25 Sep 2023 12:43:38 -0700 Message-Id: <20230925194338.966639-4-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230925194338.966639-1-srinivas.pandruvada@linux.intel.com> References: <20230925194338.966639-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 12:44:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778040083718693212 X-GMAIL-MSGID: 1778040083718693212 Parse major and minor version number from the version field. If there is a mismatch for major version, exit from further processing for that domain. If there is mismatch in minor version, driver continue to process with an error message. Minor version change doesn't change offsets and bit structures of TPMI fields. Signed-off-by: Srinivas Pandruvada --- .../uncore-frequency/uncore-frequency-tpmi.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c index 7d0a67f8b517..4d63ee6bc6d2 100644 --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c @@ -28,7 +28,8 @@ #include "uncore-frequency-common.h" -#define UNCORE_HEADER_VERSION 1 +#define UNCORE_MAJOR_VERSION 0 +#define UNCORE_MINOR_VERSION 1 #define UNCORE_HEADER_INDEX 0 #define UNCORE_FABRIC_CLUSTER_OFFSET 8 @@ -302,12 +303,20 @@ static int uncore_probe(struct auxiliary_device *auxdev, const struct auxiliary_ /* Check for version and skip this resource if there is mismatch */ header = readq(pd_info->uncore_base); pd_info->ufs_header_ver = header & UNCORE_VERSION_MASK; - if (pd_info->ufs_header_ver != UNCORE_HEADER_VERSION) { - dev_info(&auxdev->dev, "Uncore: Unsupported version:%d\n", - pd_info->ufs_header_ver); + + if (pd_info->ufs_header_ver == TPMI_VERSION_INVALID) + continue; + + if (TPMI_MAJOR_VERSION(pd_info->ufs_header_ver) != UNCORE_MAJOR_VERSION) { + dev_info(&auxdev->dev, "Uncore: Unsupported major version:%lx\n", + TPMI_MAJOR_VERSION(pd_info->ufs_header_ver)); continue; } + if (TPMI_MINOR_VERSION(pd_info->ufs_header_ver) != UNCORE_MINOR_VERSION) + dev_info(&auxdev->dev, "Uncore: Ignore: Unsupported minor version:%lx\n", + TPMI_MINOR_VERSION(pd_info->ufs_header_ver)); + /* Get Cluster ID Mask */ cluster_mask = FIELD_GET(UNCORE_LOCAL_FABRIC_CLUSTER_ID_MASK, header); if (!cluster_mask) {