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);