Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp263747rdb; Thu, 30 Nov 2023 04:25:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGAuyM4JehqrHD4YRhOGFIZEApMOkBC8LcRlRmISnDY6GDBFh0menPl78FxniPWwN1k5CPg X-Received: by 2002:a92:ca0e:0:b0:35d:37f9:2b3d with SMTP id j14-20020a92ca0e000000b0035d37f92b3dmr3740620ils.17.1701347125190; Thu, 30 Nov 2023 04:25:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701347125; cv=none; d=google.com; s=arc-20160816; b=ofQDWAlp0bUqwwQwfpliU5LhkQ/a4QrlbTTqoILleGfwb7bQ+BENSIY0snn537K9kM dgxGvt1Sz0qe+iPec2CWN+gez8yDiB/Wk8vv0PxMuwE8TRI+9O2XFJeXVzUXZNqnnALc 4zQFL93MZruB3Pw8smCgKX0gzsuyFNT9Q/7fYeLWmhge/WWwr6AxxajBRe7OnOMPJzF6 qgsG4AFrs6g8XUiO3xL5z6+9HT/1wC+MEcKc5B8qoqFen0pXWbNLU6dbngSE+Bg0e+ya 2iajqCPJV0vNwhi6lg24Hxy65q1ASNtPOxQw7NHzR866svw5mwQeWJtkYPP1wITvhr0+ YLWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=xIhKjJf+WQMFo/df3R0StA8nYFvgz0Bqw4wBjo3i5Go=; fh=ZWqgRrjgiHkbLCOJ/mYm1Xgevf1I8vLp2i7bNggwygM=; b=VxOGe2iRfuaM1/YKylGuqsI8T1dTEE58r2cmOUvAoqKd/h2PFUyx9HjVuLcT94qo/p iJAYNbzlRAkOoIIRjaF7BGI+AUcwi88+Uku8sBaeiMUt+14wLtgG3LHLXM7vvs9maDaU MW8K2xNc4evqR/of7uJ6LCex0messgrIjhpFgjXX6Sbk+8cPgnsTMxChMDWCmhPZJTXW sEn9xYoL5hlGHf2JrA+mN3xwgHwey4oJ3Sgc4qgqyAd4vDVIGSpEzc9aEfvCkeuy6Hh9 YmlxbVpkJ0QBTFjlIXMdX4kp/gwe5CjOGUjxFiijas+/ILd7+DMfLnJeqSkCLX6WqGEw IfHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Xv3KtM6G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id w13-20020a65534d000000b005aa7d3730dfsi1163643pgr.114.2023.11.30.04.25.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 04:25:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Xv3KtM6G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 55A7180C256A; Thu, 30 Nov 2023 04:25:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345468AbjK3MZB (ORCPT + 99 others); Thu, 30 Nov 2023 07:25:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345482AbjK3MYy (ORCPT ); Thu, 30 Nov 2023 07:24:54 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B39E41AD; Thu, 30 Nov 2023 04:25:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701347100; x=1732883100; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=4zM850+IDu5hgcsYtxWNOh0QEqOrEVkyt4Uzmx6wLPQ=; b=Xv3KtM6G/sQjwXXAxqPN4pqHeSI2SQjFcJbezlVuW8Vt7hFxJ4C6QOyc XLEC281EGImd6gaAkryPDUxfNgdqccpK9HnMY4xx8T7N5n1FxCqAun9OO TnnCsNcC4/bNRLBztamtVjJGjG5pEfo2rdQPPFXt/Zh01ZyBa6WlG0Lpd d7AMqcXVAM0fZeTIQqhuHz30v86yjoUv5BD2El+Pq45GxcpSMMCcgjImg ub+SOXIJapo6elUSavcK9u8ORX374SKRcJJCpxFsLbhHRXAdEm6qglgd2 gbYQPyvs2KN0TgkuhYOt9qBS/cSq5jPm3ZFi1Nr+zlRPGpdhufaZMtd1N g==; X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="396122814" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="396122814" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2023 04:25:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="745618835" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="745618835" Received: from bergler-mobl.ger.corp.intel.com ([10.249.33.30]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2023 04:24:58 -0800 Date: Thu, 30 Nov 2023 14:24:55 +0200 (EET) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Srinivas Pandruvada cc: Hans de Goede , markgross@kernel.org, Andy Shevchenko , platform-driver-x86@vger.kernel.org, LKML Subject: Re: [PATCH 6/6] platform/x86/intel-uncore-freq: Process read/write blocked feature status In-Reply-To: <20231128185605.3027653-7-srinivas.pandruvada@linux.intel.com> Message-ID: <80b89411-4633-4b8f-72b1-bf262174566e@linux.intel.com> References: <20231128185605.3027653-1-srinivas.pandruvada@linux.intel.com> <20231128185605.3027653-7-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1161852847-1701347099=:1808" 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,T_SCC_BODY_TEXT_LINE 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]); Thu, 30 Nov 2023 04:25:21 -0800 (PST) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1161852847-1701347099=:1808 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT On Tue, 28 Nov 2023, Srinivas Pandruvada wrote: > When a feature is read blocked, don't continue to read uncore information > and register with uncore core. > > When the feature is write blocked, continue to offer read interface but > block setting uncore limits. > > Signed-off-by: Srinivas Pandruvada > --- > .../uncore-frequency/uncore-frequency-tpmi.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > 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 4fb790552c47..de5db49a9afe 100644 > --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c > +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c > @@ -66,6 +66,7 @@ struct tpmi_uncore_struct { > int min_ratio; > struct tpmi_uncore_power_domain_info *pd_info; > struct tpmi_uncore_cluster_info root_cluster; > + bool write_blocked; > }; > > #define UNCORE_GENMASK_MIN_RATIO GENMASK_ULL(21, 15) > @@ -157,6 +158,9 @@ static int uncore_write_control_freq(struct uncore_data *data, unsigned int inpu > cluster_info = container_of(data, struct tpmi_uncore_cluster_info, uncore_data); > uncore_root = cluster_info->uncore_root; > > + if (uncore_root->write_blocked) > + return -EPERM; > + > /* Update each cluster in a package */ > if (cluster_info->root_domain) { > struct tpmi_uncore_struct *uncore_root = cluster_info->uncore_root; > @@ -233,11 +237,21 @@ static void remove_cluster_entries(struct tpmi_uncore_struct *tpmi_uncore) > > static int uncore_probe(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id) > { > + int read_blocked = 0, write_blocked = 0; > struct intel_tpmi_plat_info *plat_info; > struct tpmi_uncore_struct *tpmi_uncore; > int ret, i, pkg = 0; > int num_resources; > > + ret = tpmi_get_feature_status(auxdev, TPMI_ID_UNCORE, &read_blocked, &write_blocked); > + if (ret) > + dev_info(&auxdev->dev, "Can't read feature status: ignoring blocked status\n"); > + > + if (read_blocked) { > + dev_info(&auxdev->dev, "Firmware has blocked reads, exiting\n"); > + return -ENODEV; > + } > + > /* Get number of power domains, which is equal to number of resources */ > num_resources = tpmi_get_resource_count(auxdev); > if (!num_resources) > @@ -266,6 +280,7 @@ static int uncore_probe(struct auxiliary_device *auxdev, const struct auxiliary_ > } > > tpmi_uncore->power_domain_count = num_resources; > + tpmi_uncore->write_blocked = write_blocked; > > /* Get the package ID from the TPMI core */ > plat_info = tpmi_get_platform_data(auxdev); Reviewed-by: Ilpo J?rvinen While reviewing this, I begun to wonder why's the tpmi_get_feature_status() interface using int * as in practice these will always be converted to bool by the users? -- i. --8323329-1161852847-1701347099=:1808--