From patchwork Sat Mar 4 01:27:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dixit, Ashutosh" X-Patchwork-Id: 13159749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3063C61DA3 for ; Sat, 4 Mar 2023 01:27:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0B01610E16F; Sat, 4 Mar 2023 01:27:12 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8EBB010E16E; Sat, 4 Mar 2023 01:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677893230; x=1709429230; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cf8qTsQL9n+9ZW3V0b2dzTWUXXWsNNH1jbgz1VYPlzw=; b=Fe2OI7WxI4+k3G0K9sdL9BbiNqwdMPgbNbvB2wDTBhZ2isLSaTiMXve+ h5yyXU4Up6WhLRBJCm2xA9gf6T2kq3czhbnXugtWwuXaMnwr8NCXT1UgB 2oU8UwHnBV12gsVrG/TLRKbpVRFZwI1ofgdpzrv53NQx0D0ze+QxR5KzB HAaCkhUqrY2PVUnuOWTEwpaXmB43U45+2HlIdJQy8QxPLTJC4Ulm4purt zyAhGTJ60aaTfYqaqoohP+3AXMw0r9GObmksA69bOJMuHziwe5l07jVsK ShUGFP8ke5sGNIm7RjsGhBQgA+Vr51/K1jskaXTW0ydNKCIzv9nhpd/hu A==; X-IronPort-AV: E=McAfee;i="6500,9779,10638"; a="323504928" X-IronPort-AV: E=Sophos;i="5.98,232,1673942400"; d="scan'208";a="323504928" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 17:27:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10638"; a="849684690" X-IronPort-AV: E=Sophos;i="5.98,232,1673942400"; d="scan'208";a="849684690" Received: from orsosgc001.jf.intel.com ([10.165.21.138]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 17:27:09 -0800 From: Ashutosh Dixit To: intel-gfx@lists.freedesktop.org Subject: [PATCH 1/2] drm/i915/pmu: Use only freq bits for falling back to requested freq Date: Fri, 3 Mar 2023 17:27:04 -0800 Message-Id: <20230304012705.70003-2-ashutosh.dixit@intel.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20230304012705.70003-1-ashutosh.dixit@intel.com> References: <20230304012705.70003-1-ashutosh.dixit@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vinay Belgaumkar , dri-devel@lists.freedesktop.org, Tvrtko Ursulin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On newer generations, the GEN12_RPSTAT1 register contains more than freq information, e.g. see GEN12_VOLTAGE_MASK. Therefore use only the freq bits to decide whether to fall back to requested freq. Signed-off-by: Ashutosh Dixit --- drivers/gpu/drm/i915/i915_pmu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index 52531ab28c5f..f0a1e36915b8 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -393,10 +393,8 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns) * case we assume the system is running at the intended * frequency. Fortunately, the read should rarely fail! */ - val = intel_rps_read_rpstat_fw(rps); - if (val) - val = intel_rps_get_cagf(rps, val); - else + val = intel_rps_get_cagf(rps, intel_rps_read_rpstat_fw(rps)); + if (!val) val = rps->cur_freq; add_sample_mult(&pmu->sample[__I915_SAMPLE_FREQ_ACT], From patchwork Sat Mar 4 01:27:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dixit, Ashutosh" X-Patchwork-Id: 13159751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A096C61DA3 for ; Sat, 4 Mar 2023 01:27:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B979F10E78E; Sat, 4 Mar 2023 01:27:13 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id EE8EF10E16E; Sat, 4 Mar 2023 01:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677893231; x=1709429231; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7dpECU4MqObJRz0NzkxNZ7JG9chBk9PRUu+NmDoady4=; b=XiLZ6SXVuher3QocpjGlnDQ0AL2HQZb2ZbaVspQmaCBH+E+f3kgcFji4 sDNo6xGLc78paopcey99azILoY+e0DdvdsdATFQwNmIu604QfxCsmSrb4 SqTjUKqdehPVM/9D/gxet5bMNa9jEY5aX6B8Ic0fH7n6LxLo0fFKhSqJ+ 6Vgx5xjOExUmAJ8pbmKFHN3f9ZGUceI9ZKvsf2FVcLSv0PWVBZyvVakfW ueK0ygxctD40XnXa3MBnTdTj3IwAqlr4RkXdF+/7K17SSrcxK8Um908Dw 1htT+IzUVfYb8kJprX0NwPwN9oq+2uipQMA40l974zuW/gYGts+UTWV39 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10638"; a="323504929" X-IronPort-AV: E=Sophos;i="5.98,232,1673942400"; d="scan'208";a="323504929" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 17:27:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10638"; a="849684693" X-IronPort-AV: E=Sophos;i="5.98,232,1673942400"; d="scan'208";a="849684693" Received: from orsosgc001.jf.intel.com ([10.165.21.138]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 17:27:10 -0800 From: Ashutosh Dixit To: intel-gfx@lists.freedesktop.org Subject: [PATCH 2/2] drm/i915/pmu: Use correct requested freq for SLPC Date: Fri, 3 Mar 2023 17:27:05 -0800 Message-Id: <20230304012705.70003-3-ashutosh.dixit@intel.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20230304012705.70003-1-ashutosh.dixit@intel.com> References: <20230304012705.70003-1-ashutosh.dixit@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vinay Belgaumkar , dri-devel@lists.freedesktop.org, Tvrtko Ursulin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" SLPC does not use 'struct intel_rps'. Use UNSLICE_RATIO bits from GEN6_RPNSWREQ for SLPC. See intel_rps_get_requested_frequency. Bspec: 52745 Signed-off-by: Ashutosh Dixit --- drivers/gpu/drm/i915/i915_pmu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index f0a1e36915b8..5ee836610801 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -394,8 +394,13 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns) * frequency. Fortunately, the read should rarely fail! */ val = intel_rps_get_cagf(rps, intel_rps_read_rpstat_fw(rps)); - if (!val) - val = rps->cur_freq; + if (!val) { + if (intel_uc_uses_guc_slpc(>->uc)) + val = intel_rps_read_punit_req(rps) >> + GEN9_SW_REQ_UNSLICE_RATIO_SHIFT; + else + val = rps->cur_freq; + } add_sample_mult(&pmu->sample[__I915_SAMPLE_FREQ_ACT], intel_gpu_freq(rps, val), period_ns / 1000);