From patchwork Tue Oct 3 18:49:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 148028 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2283587vqb; Tue, 3 Oct 2023 11:49:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEW0bTYac4pGnSJQO0X8CEFrMCW1O84tI29xG6Z/08/rxqfpHGI38/5qtFC0PUttlL/7Aly X-Received: by 2002:a05:6a00:198a:b0:693:3fa4:9c56 with SMTP id d10-20020a056a00198a00b006933fa49c56mr431383pfl.25.1696358973872; Tue, 03 Oct 2023 11:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696358973; cv=none; d=google.com; s=arc-20160816; b=zWptoLwi/0RbYwVTJ3qjL9esrdp2feMLmzoU+xlIHPYKBn9ipmyCz7R3HcojRsEXWT JNe5aBoiFzJEjeH3KkG5EUPVsGfv8uX9hCsff7WaNh5fMQx4j5yZxtV3rL7q+V3I7iEu PeN6gxqBSv1hEBw/A8ELKaSWNzPtMmGq02hMVBz+yD9yPFwIXTUU/QlJ9Ef+qZp6jt5x I/ioWqLNAlAItnWH5yR5kqnTF6gbCxwLHxGFk63UE7KbPLvPjHrPk7YMxxVkTV2WzgS/ VPeTlIdMmf1q7SzPnE/mQWiBu/BnmHlxEC1XRGeW0yBeafQ+rinu0X5a3CDSSXNaqBW5 jRaw== 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=384kYcqSXczcslxfhLUgeHiD8EksTP4jNGIaqheISh0=; fh=WxcXzAXi1awalX5nBNdKiu2pCszhVA/a0vtqlN5we7w=; b=YP752C0W4s6YJUzzKHB+DAy6DVE2seTqUoazHfgNu9dbbyaMCeDz6e9EUy0NAKbDpT tgIi64g/1j/gC5+/tUw/Q2HZnKDNRKQ9JzELvn1yqplFmJPjRri58k9CFzYTN6uuD4E/ ARvbV4ybmVIBeRC5VhupRk+u+8eNWI1ecYpLaPGBEo8/vFQxToxx9l2msNMXb9I0DeWl NK6gvOJhUWI0V/LTcotY3hC2skyhWxfjVFjt64RKuENdpvOuFlWyi5OqUXf/aEz9wVK2 Y7jE+i0lla1/eONUCFxT6PKAfQvxXFGfP98XdA/ShEl82zKVGHM7T8F+h4L+yW00eYz1 xLFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=moA2ZdPk; 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 bq25-20020a056a000e1900b00690158064aasi1955605pfb.118.2023.10.03.11.49.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:49:33 -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=moA2ZdPk; 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 3C39981B6ABD; Tue, 3 Oct 2023 11:49:33 -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 S240783AbjJCSt2 (ORCPT + 17 others); Tue, 3 Oct 2023 14:49:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232143AbjJCStZ (ORCPT ); Tue, 3 Oct 2023 14:49:25 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9E95AF; 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=4gtDwlyRMPjMakfQV2TP11BN397Sa0+Y1SbuUIeH4uU=; b=moA2ZdPk44tAsFaud9YeIVkK7VTtg+0EK3FJaWGXREepsuAA8vi5b1yL rdBtnIVvdvxpcMUcOuBgf8a39mBd3le/8bmIs5y3hvDQnYwduxwT3MQzq ywm79nTv7XI2qwJsG/AGomDmrXLptNEYwDNuV98no+NTFRwS5C/m14LC7 KxF4ZiS8lSB063ey3vIMrG/TRRy3kdiTist/eGpcXyxs04+Z5qCZF6o+Y B7x6u7uQDSYpWkwgBlcwVuMSmEJrsqnqCyK9DluvKrTCQIFAoBTI/DfFx usK46W1rMczTuLUy5IIwEvHRAkppGJqzErDgWzhRfZNVOT5qD2PVwBevs Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="363221953" X-IronPort-AV: E=Sophos;i="6.03,198,1694761200"; d="scan'208";a="363221953" 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="700814541" X-IronPort-AV: E=Sophos;i="6.03,198,1694761200"; d="scan'208";a="700814541" 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 1/3] platform/x86/intel/tpmi: Add defines to get version information Date: Tue, 3 Oct 2023 11:49:14 -0700 Message-Id: <20231003184916.1860084-2-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 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 (snail.vger.email [0.0.0.0]); Tue, 03 Oct 2023 11:49:33 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778761307077013545 X-GMAIL-MSGID: 1778761307077013545 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 --- v2: No change 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 Tue Oct 3 18:49:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 148030 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2283644vqb; Tue, 3 Oct 2023 11:49:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZmtpsME7E2rQO6feoEhusVLbnrVd/6RhVY+sKE6Ihar52KcChHxB9okMYdD2RrbcxX9Q6 X-Received: by 2002:a05:6a20:3c8b:b0:12c:b10d:693d with SMTP id b11-20020a056a203c8b00b0012cb10d693dmr337403pzj.6.1696358981525; Tue, 03 Oct 2023 11:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696358981; cv=none; d=google.com; s=arc-20160816; b=os4xFKtwh7D9fHDil2qsj55v1xsuqQdFNwDEv5Ekfu4PrG5wRKfhdcc3jFgJxd2ALp XQiJ4VgcsZmVddki7TpJA/IQvW4TUtRARPOV9fAVwpZXXZkGK/JWUIio81ow41+YfO5v J6ukjPybYiYFfBOMpbBWo6/jwFaYJWf1RwYg6y9z6lOnCIMltX4rM3RVSKthqKcIj2m7 Dpi1ErpmHxPdEgzRo28fq2vtwYnaLARXbo/H2Wn5HFFzjU8CFOvK7/JNzveVLu1i5dtu aTxt8Kmh8sXQ4isy9jheY+3rQinfz1ODvt4qTJuO/JTKuHbkd+khaYJJWZ0uzKygnO00 Gxww== 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=FYsNpLr6ZS17xn3FV8XolmFl0O9m1aJ07j9xKW0nAm0=; fh=WxcXzAXi1awalX5nBNdKiu2pCszhVA/a0vtqlN5we7w=; b=mwH2wIg3LaE6gvGP8fqwzm4M7HZ6ghhY0IsBVZpXE595tHDioLIXRZAQKyUFu4o5Yh LJmJuendYOJiDzl770/dQYzYUwNxQhAvS9Y5K0oLKcBM8PxQEZPSPlVevY3yICUtBGKq kdbn3amRQxzgrfXVNGX5vbNhsgW37L65b03sx1Q5+vcohF28fXzjZ/H+moekxjv4sdwS Ug6zsRbL+eYFZb8Zb1ciItxzFZb0+2FXyWpsf3m/3jzoF2D4rVdUABgVSP1lgXCAaPOj 88KlViu+nArm8QMLxeC0Upj2dxh4bi4npTK9707IKlkHOMzZkieK75bte3RTKOXAj6HU s37A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="KIW/CSQ8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id z3-20020aa78883000000b0068c0300a3f7si2097762pfe.279.2023.10.03.11.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:49:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="KIW/CSQ8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 5989B818C78C; Tue, 3 Oct 2023 11:49:35 -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 S232201AbjJCSt0 (ORCPT + 17 others); Tue, 3 Oct 2023 14:49:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231938AbjJCStY (ORCPT ); Tue, 3 Oct 2023 14:49:24 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 109FAAB; 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=DehzMPWOQhRRRY3Bff94fnYSIwTrRyTbhg10vaC1+Ro=; b=KIW/CSQ8lREhQeFWGAcrJLKIFIOHmAFLbz6R5BgCn0Mgk8WYIGoydAbX XyyQHEiP99/eKA2q/wtnNhNkWTQEt+APoOQ81UZIzYeIygpFUSl4tMk5L usWNUzA68lMX1qyM6r1Wj6aXn4C77AQGSjd3UKz5lhwqw6MzQ6dubo5WY u1jkLRpnBQk4//a3z89PouK6gPmMCUfMdXPEokJJxRmQ+PPmg4a9mkrL9 IDkqbVH+4VlsXs7vYwyYudc1T+SRGunUUj/j0NZePjSV/D1jo3x0f4Afy M/hrkPZdilQodosAPot41I4YpNcZlvvLwOzPDeUhrWQHfnIZ+fO1BSJcj g==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="363221958" X-IronPort-AV: E=Sophos;i="6.03,198,1694761200"; d="scan'208";a="363221958" 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="700814542" X-IronPort-AV: E=Sophos;i="6.03,198,1694761200"; d="scan'208";a="700814542" 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 2/3] platform/x86: ISST: Ignore minor version change Date: Tue, 3 Oct 2023 11:49:15 -0700 Message-Id: <20231003184916.1860084-3-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 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 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]); Tue, 03 Oct 2023 11:49:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778761315192746917 X-GMAIL-MSGID: 1778761315192746917 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 SST functionality for a major and minor version. If the hardware changes major version, since offsets and definitions are changed, driver cannot continue to provide SST interface to users. Driver can still function with a minor version change as it will just miss the new functionality added by the hardware. The current implementation doesn't ignore any version change. If there is mismatch with the minor version, continue with an information log message. If there is mismatch with the major version, log error and exit. Signed-off-by: Srinivas Pandruvada --- v2 - Commit description and header change as suggested by llpo - Change log level for minor version mismatch .../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 ac5c6a812592..0b6d2c864437 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_info(&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 Tue Oct 3 18:49:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 148029 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2283620vqb; Tue, 3 Oct 2023 11:49:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQZqJQ5yoRhP4cAoNsVPcyqeuyaAuuA17ELwEAQpTnv8jD/HNDzS3qt/LflSzjdoOIBAiF X-Received: by 2002:a05:6a21:47ca:b0:137:e595:830f with SMTP id as10-20020a056a2147ca00b00137e595830fmr252840pzc.57.1696358978109; Tue, 03 Oct 2023 11:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696358978; cv=none; d=google.com; s=arc-20160816; b=cTTrwJy2ytUL85D8pfmnI0hMzpup76yXT0BUroUXBQ5xV1QZQwN9J8cWgmJmqSuGmQ NS5kfj73f2c9kUi6zVBBJcmrsodOgbHiyErK7E/kEs8f6AKeDB4zt9+WVxhtU0r3op/q iEZCrLOnlSeZs30SxqxS7pBemi2SvCVRLcVSmKkag58lBA4xeKiQdxef3Rl9ua1cW6Bh dWGI6tj2eyX9Eux8ztb3rRN5qIAO5NIdXBmKosTaPDAdYASXjo1AKzIoZXoHRzaLDK3O ywUU3SdhgGfKg3f4YymEGKFCiLLAhhowJtRhgi4jt2jw+NRRaqTQHuu7HzUUos97OWeI C5Sw== 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 Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id p18-20020a170902c71200b001c42b2b02casi1875358plp.174.2023.10.03.11.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:49:38 -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 80CF082DC62A; Tue, 3 Oct 2023 11:49:37 -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 S240812AbjJCStc (ORCPT + 17 others); Tue, 3 Oct 2023 14:49:32 -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 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:37 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778761311948082558 X-GMAIL-MSGID: 1778761311948082558 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) {