Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2152017rdb; Tue, 3 Oct 2023 11:49:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhxV/9Tta3Rr+sdWgAcXPYcWu9yZTUDqFXmpTYcrnJq/Nml6QtQqSkcHNasTrBIyUegMKO X-Received: by 2002:a05:6870:64a7:b0:1d1:40a6:e82d with SMTP id cz39-20020a05687064a700b001d140a6e82dmr390600oab.59.1696358975349; Tue, 03 Oct 2023 11:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696358975; cv=none; d=google.com; s=arc-20160816; b=ml1S8nxlSfXYHZsoZYxZV+O/Vlj9MOEmOdkJqIQ7L8ZSSK6JnLXPwsMyzWJowSK5d0 nlFY585s3bLu9Kxhr5n5gjzLdN9oMSoh+YIknH1o3DT2WRoJR/H1yv8Sp/htRP0gjMlc bs56wgXiDKAji21ak1He9mEDpGLYe5/+/PdDPO7qp+eUbRH8+OpHioHpUN7IR+suk0QQ BEFSjtinEn24QJyC1fALD+iUltBIKWYree5p6ue9HApg+pOcWuD03Is99vTcIrPnXgJ9 3SJssGvFQE4YDJIHmDAuUKlzU6U9zPBR8ARUkSAudXImDGUn2+hCGeMFOR1Q84t0VJBM 8bvQ== 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=oeAU0XBXAuB+r9czMBAJyYRA2ACT7R4wYbejJHwZui4=; fh=WxcXzAXi1awalX5nBNdKiu2pCszhVA/a0vtqlN5we7w=; b=XA+MOuasqp/Dqc0h+ciPqXlcvMUlcqDLgKWtKjJQ6sz4uW2lMrlz+2jrzBOntnSc96 gHpQU580vTlbuNrZnpeQ906HFuMuj2LOnGDYp7YDYBaGUMz7f4E1aK8ZSCEI0fgM+0DA ejvl0Alcy+Ja/5UT45AobtFpyYmLamCDoPUscTkf2sfQpu8DU71zgrVmuAHCHxmugIyr hyo2W11TpXt5KZTCsqeqAr5eaHrL3Ht1j7iDKtZZZmNVyLGz3KdgHPo2J7IHNR5OvqPa I5gpfcI0rCJjkhBzxY6hvCXCGgMPEKZNKsrc+iU+CA8JMCmtICL8BDB45Y/xfu0L9/iY xMAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mSO29+RV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i185-20020a6387c2000000b005641ddd0309si1955664pge.599.2023.10.03.11.49.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:49:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mSO29+RV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 2B25A82DC62A; Tue, 3 Oct 2023 11:49:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240811AbjJCStb (ORCPT + 99 others); Tue, 3 Oct 2023 14:49:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232185AbjJCSt0 (ORCPT ); Tue, 3 Oct 2023 14:49:26 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD4FEB0; Tue, 3 Oct 2023 11:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696358962; x=1727894962; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tHSeNTya9+mTDl4DHH37n15KCaDe9pZn/vwT9v6EpB4=; b=mSO29+RVGrjWxFY9It48AR/nIKnjTDoXXEbzpG8rR4qaEmMBktjt/DS+ tDG44bzeVrxSEkWrpperk3N/gsaEraJax+BITM1pAQefQ3QEd8R6WYb73 HxYaVUEuqKkk9S3GUh7o3zJc9Th7KkXbwHb99zexYoPNzLjcZo2j10aiU lFdq3DG7fPAT9EwPYnDIPl65CaXQlApnwdThxsuHafe4VDvUOfkbcHiPA Ye++/8L3EG40e6CnJwh+HiJXNTet+UYmYgWArj6/A6ne+brxOpqmd/dFs NGeIhXJGRScQnhiyS/04N1BWRQBigtLY7gh4FWMPvgVdh+fk9eqm+I8Uh g==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="363221961" X-IronPort-AV: E=Sophos;i="6.03,198,1694761200"; d="scan'208";a="363221961" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 11:49:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="700814545" X-IronPort-AV: E=Sophos;i="6.03,198,1694761200"; d="scan'208";a="700814545" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by orsmga003.jf.intel.com with ESMTP; 03 Oct 2023 11:49:20 -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 v2 3/3] platform/x86/intel-uncore-freq: Ignore minor version change Date: Tue, 3 Oct 2023 11:49:16 -0700 Message-Id: <20231003184916.1860084-4-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231003184916.1860084-1-srinivas.pandruvada@linux.intel.com> References: <20231003184916.1860084-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 11:49:34 -0700 (PDT) The hardware definition of every TPMI feature contains a major and minor version. When there is a change in the MMIO offset or change in the definition of a field, hardware will change major version. For addition of new fields without modifying existing MMIO offsets or fields, only the minor version is changed. Driver is developed to support uncore frequency control (UFS) for a major and minor version. If the hardware changes major version, since offsets and definitions are changed, driver cannot continue to provide UFS interface to users. Driver can still function with minor version change as it will just miss the new functionality added by the hardware. The current implementation logs information message and skips adding uncore sysfs entry for a resource for any version mismatch. Check major and minor version mismatch for every valid resource and fail on any major version mismatch by logging an error message. A valid resource has a version which is not 0xFF. If there is mismatch with the minor version, continue with a log message. Signed-off-by: Srinivas Pandruvada --- v2 - Commit description and header change - Change log levels exit on any major version mismatch .../uncore-frequency/uncore-frequency-tpmi.c | 18 ++++++++++++++---- 1 file changed, 14 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..4fb790552c47 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,21 @@ 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_err(&auxdev->dev, "Uncore: Unsupported major version:%lx\n", + TPMI_MAJOR_VERSION(pd_info->ufs_header_ver)); + ret = -ENODEV; + goto remove_clusters; } + 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) { -- 2.41.0