Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp774877pxb; Tue, 5 Apr 2022 22:48:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjfMymdU6l4bdxZeO+GJUbtObfT+Vr4LqbN8jklaxTInm7H/q7BeFkk8579V8+K06nMQ2R X-Received: by 2002:a17:902:d4cc:b0:154:3a3b:4172 with SMTP id o12-20020a170902d4cc00b001543a3b4172mr6777570plg.165.1649224105241; Tue, 05 Apr 2022 22:48:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649224105; cv=none; d=google.com; s=arc-20160816; b=QuZNIyvKi4k0B9c8rjgQcK6ed8iwJgoL8lhiBQENwhNawYOGFOd5chSj5RlYB2G3ZH 1uoEBqlQz6+uSfhGvJOqP0sUTlnyBBf0dAKNqXwqIf2LbzxVVhyasK6Oy+nz7hC4eO/7 Nu6sjbw1tqYoSDZ1rpomUHh9eWlBaE6ebg+0whTXDhvkA/D6QHm/2IGPTBqlV4PGhA42 ebhbBTeDidS2RSG9H4+uAuSxcDTpGBZODPWuqmqxTzYuhboEiRL09dksbikMnnt5zUji 4zqCNZFq72ZwIVPUNZYPoZTRmtWg8x/bSAQBXfEZu1cgABtRyK3YpwWsy9vvsXqUl5XQ 8NQA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kfin7lbEnimhw/Ke5e42fwMjl3opnXCwvfXMQI387cU=; b=Pc+7sl58pTezKKI3Hk3QTbCBkk+iewlRjlH+3A2VRAF0/tL04OeK1jijzqU1Sz6eKz zrCOYSG4DxYgx6ZPSNh0fzqfBTD1y0eSVfJ3gVavmiTiemPawYx74iLjNyDLfVE+FNfA M5SUJ7RRpPUr2ERzDfpYM2DUKtr71IPS16XFFCo7jmcZwSjW4ryNbWKIZqg9wAE3DpOs gmX2nC47vGeukaKxNTq5oX8Rda0XCVoVREfRSQRV/CTPExcA3aiRdl7XWbc3SacJtL0u AKXAJRM718JOy+ZVSTOVB9doh00goUuLvXTWbb1jfe3UqkuFKJOHV+ibnyqSXT3cHO+V IkLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YZQYowiX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l13-20020a63570d000000b003989e2adf5esi15300111pgb.370.2022.04.05.22.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 22:48:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YZQYowiX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3778F4975F2; Tue, 5 Apr 2022 22:20:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839993AbiDFBGp (ORCPT + 99 others); Tue, 5 Apr 2022 21:06:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234314AbiDEKGd (ORCPT ); Tue, 5 Apr 2022 06:06:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A04405A586; Tue, 5 Apr 2022 02:55:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 30B016157A; Tue, 5 Apr 2022 09:55:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C62EC385A1; Tue, 5 Apr 2022 09:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152506; bh=Pr4aKhIQBUBvr2CVTrgZDggDkLUzxmhsvq+8w46iZfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YZQYowiXcbm1NHD8Bvuks1nwg8thJHtrYPE5WCKzIos7Zah+xUax1cPq/zpOJrYfG LBK+8u6GHhj2rAmReRvqLcNzSwhbSD2xpOKXTEvc540npb1rPsfdzBAc2CgSZsnqBp usxzjYi+nZc0DmFfAZRgJzJet66wNYYPjA1MPlkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Stanislav Lisovskiy , Tvrtko Ursulin Subject: [PATCH 5.15 784/913] drm/i915: Treat SAGV block time 0 as SAGV disabled Date: Tue, 5 Apr 2022 09:30:46 +0200 Message-Id: <20220405070403.335304555@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Ville Syrjälä commit 1937f3feb0e84089ae4065e09c871b8ab4676f01 upstream. For modern platforms the spec explicitly states that a SAGV block time of zero means that SAGV is not supported. Let's extend that to all platforms. Supposedly there should be no systems where this isn't true, and it'll allow us to: - use the same code regardless of older vs. newer platform - wm latencies already treat 0 as disabled, so this fits well with other related code - make it a bit more clear when SAGV is used vs. not - avoid overflows from adding U32_MAX with a u16 wm0 latency value which could cause us to miscalculate the SAGV watermarks on tgl+ Cc: stable@vger.kernel.org Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20220309164948.10671-2-ville.syrjala@linux.intel.com Reviewed-by: Stanislav Lisovskiy (cherry picked from commit d8f5855b31c0523ea3b171db8dfb998830e8735d) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -3713,8 +3713,7 @@ skl_setup_sagv_block_time(struct drm_i91 MISSING_CASE(DISPLAY_VER(dev_priv)); } - /* Default to an unusable block time */ - dev_priv->sagv_block_time_us = -1; + dev_priv->sagv_block_time_us = 0; } /* @@ -5635,7 +5634,7 @@ static void skl_compute_plane_wm(const s result->min_ddb_alloc = max(min_ddb_alloc, blocks) + 1; result->enable = true; - if (DISPLAY_VER(dev_priv) < 12) + if (DISPLAY_VER(dev_priv) < 12 && dev_priv->sagv_block_time_us) result->can_sagv = latency >= dev_priv->sagv_block_time_us; } @@ -5666,7 +5665,10 @@ static void tgl_compute_sagv_wm(const st struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); struct skl_wm_level *sagv_wm = &plane_wm->sagv.wm0; struct skl_wm_level *levels = plane_wm->wm; - unsigned int latency = dev_priv->wm.skl_latency[0] + dev_priv->sagv_block_time_us; + unsigned int latency = 0; + + if (dev_priv->sagv_block_time_us) + latency = dev_priv->sagv_block_time_us + dev_priv->wm.skl_latency[0]; skl_compute_plane_wm(crtc_state, 0, latency, wm_params, &levels[0],