Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6171276pxb; Tue, 16 Feb 2021 19:15:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwN41gHh1zdD6JiiDmG5CcJaXakFjSb9POez/62hsu/yqDRSmbSh+v4UhLRmR1k0AufX7to X-Received: by 2002:a17:907:7295:: with SMTP id dt21mr24186050ejc.518.1613531729795; Tue, 16 Feb 2021 19:15:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613531729; cv=none; d=google.com; s=arc-20160816; b=zcsqxC59okL0sqPu5epggoJ0yMesxx9AEu91iOLyz4mGVApptdAFIKodj91/adK3q5 EG9erUMtHiz/+PrxX0x2VLXyZH5n6sbxGBHudvk9Xq9u7lcYBLJPUoUBwsg+TWvig1nG SaPSC+0Prmc6e6z0nKyFZ6wKuforxl61xtKe7rkfChipumW5udyR3+buWvXJ9c6BvCyA r/ME6f73SfqllYKsbZFQzDmz/LNqB1pLg6Hulq1sx5PVcP4+Bor5jNYHuDpK0jE/OnUW zpXBMJngF7gn338gpaDIuqq/xuDFXy96wk3Gp7KKEMiSBidOsfnGOBmntixdroNNhydJ D5/w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=oFGrBJPKqfvgLkksZDaaK4VeUcWGvcONB5s1v8mHWEI=; b=QBhFg9wM3ZSXhBXmNyqj8unUbdYUoQ2tULEkkRFf1WOpnp9L4oK8/5gj/1szvB3lQq gSDmt3fw67/7/aL0qhj4XmUzBhyBg3OY9G5SDw6WyYpo/qZUHLW9twNNPIQXqPRW5dYm JNwqVyT/zxWQA/xl+l6i4fBXkOHlJrwf3Pz70NzPLFvhaeZ8bdPxgBqiVKMzgyw8+9ut 8XLAcUOplf6ZOF1yGV2RhQv6mguF2jyrUkMIKbhGW6EC0vOULYrDAeGe+kqzyvQ2ELzp QekrOGSMe9Lv42vGqIliitcTQJQhGtJ0W8MxP7fWD+x/gdf1dhykCsnGMLytY6ZwkqPa Kruw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NAV6Kdrd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c3si447607eds.352.2021.02.16.19.15.05; Tue, 16 Feb 2021 19:15:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NAV6Kdrd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230179AbhBQCzh (ORCPT + 99 others); Tue, 16 Feb 2021 21:55:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43231 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbhBQCzg (ORCPT ); Tue, 16 Feb 2021 21:55:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613530450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=oFGrBJPKqfvgLkksZDaaK4VeUcWGvcONB5s1v8mHWEI=; b=NAV6KdrdVz9WPZq8D7hCZSIduiBoj8E0tmOhFyme7WcvbzHkw3cL3/DF9spF/zbU9ajUSA u9vDccQrsQ7SI/PlgmkGEHBjo/Mp0XW5eK32IOm3xu92aoLBunC3OERgvBXot62TGABp2F qADossYo18bIK6MAlAMK8TzjtmDyvtM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-536-cClbJUquP3CnzgS4T2u9bg-1; Tue, 16 Feb 2021 21:54:08 -0500 X-MC-Unique: cClbJUquP3CnzgS4T2u9bg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 253A18030BB; Wed, 17 Feb 2021 02:54:07 +0000 (UTC) Received: from Whitewolf.redhat.com (ovpn-113-106.rdu2.redhat.com [10.10.113.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 697DB10016FA; Wed, 17 Feb 2021 02:54:05 +0000 (UTC) From: Lyude Paul To: intel-gfx@lists.freedesktop.org Cc: Imre Deak , Rodrigo Vivi , Tejas Upadhyay , Matt Roper , Jani Nikula , Joonas Lahtinen , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 1/2] drm/i915/gen9bc: Handle TGP PCH during suspend/resume Date: Tue, 16 Feb 2021 21:53:36 -0500 Message-Id: <20210217025337.1929015-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tejas Upadhyay For Legacy S3 suspend/resume GEN9 BC needs to enable and setup TGP PCH. v2: * Move Wa_14010685332 into it's own function - vsyrjala * Add TODO comment about figuring out if we can move this workaround - imre v3: * Rename cnp_irq_post_reset() to cnp_display_clock_wa() * Add TODO item mentioning we need to clarify which platforms this workaround applies to * Just use ibx_irq_reset() in gen8_irq_reset(). This code should be functionally equivalent on gen9 bc to the code v2 added * Drop icp_hpd_irq_setup() call in spt_hpd_irq_setup(), this looks to be more or less identical to spt_hpd_irq_setup() minus additionally enabling one port. Will update i915 to use icp_hpd_irq_setup() for ICP in a separate patch. Cc: Matt Roper Signed-off-by: Tejas Upadhyay Signed-off-by: Lyude Paul --- drivers/gpu/drm/i915/i915_irq.c | 52 +++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 98145a7f28a4..f86b147f588f 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -3040,6 +3040,24 @@ static void valleyview_irq_reset(struct drm_i915_private *dev_priv) spin_unlock_irq(&dev_priv->irq_lock); } +static void cnp_display_clock_wa(struct drm_i915_private *dev_priv) +{ + struct intel_uncore *uncore = &dev_priv->uncore; + + /* + * Wa_14010685332:icl+ + * TODO: Clarify which platforms this applies to + * TODO: Figure out if this workaround can be applied in the s0ix suspend/resume handlers as + * on earlier platforms and whether the workaround is also needed for runtime suspend/resume + */ + if (INTEL_PCH_TYPE(dev_priv) == PCH_CNP || + (INTEL_PCH_TYPE(dev_priv) >= PCH_TGP && INTEL_PCH_TYPE(dev_priv) < PCH_DG1)) { + intel_uncore_rmw(uncore, SOUTH_CHICKEN1, SBCLK_RUN_REFCLK_DIS, + SBCLK_RUN_REFCLK_DIS); + intel_uncore_rmw(uncore, SOUTH_CHICKEN1, SBCLK_RUN_REFCLK_DIS, 0); + } +} + static void gen8_irq_reset(struct drm_i915_private *dev_priv) { struct intel_uncore *uncore = &dev_priv->uncore; @@ -3061,8 +3079,9 @@ static void gen8_irq_reset(struct drm_i915_private *dev_priv) GEN3_IRQ_RESET(uncore, GEN8_DE_MISC_); GEN3_IRQ_RESET(uncore, GEN8_PCU_); - if (HAS_PCH_SPLIT(dev_priv)) - ibx_irq_reset(dev_priv); + ibx_irq_reset(dev_priv); + + cnp_display_clock_wa(dev_priv); } static void gen11_display_irq_reset(struct drm_i915_private *dev_priv) @@ -3104,15 +3123,7 @@ static void gen11_display_irq_reset(struct drm_i915_private *dev_priv) if (INTEL_PCH_TYPE(dev_priv) >= PCH_ICP) GEN3_IRQ_RESET(uncore, SDE); - /* Wa_14010685332:cnp/cmp,tgp,adp */ - if (INTEL_PCH_TYPE(dev_priv) == PCH_CNP || - (INTEL_PCH_TYPE(dev_priv) >= PCH_TGP && - INTEL_PCH_TYPE(dev_priv) < PCH_DG1)) { - intel_uncore_rmw(uncore, SOUTH_CHICKEN1, - SBCLK_RUN_REFCLK_DIS, SBCLK_RUN_REFCLK_DIS); - intel_uncore_rmw(uncore, SOUTH_CHICKEN1, - SBCLK_RUN_REFCLK_DIS, 0); - } + cnp_display_clock_wa(dev_priv); } static void gen11_irq_reset(struct drm_i915_private *dev_priv) @@ -3764,9 +3775,19 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) } } +static void icp_irq_postinstall(struct drm_i915_private *dev_priv) +{ + struct intel_uncore *uncore = &dev_priv->uncore; + u32 mask = SDE_GMBUS_ICP; + + GEN3_IRQ_INIT(uncore, SDE, ~mask, 0xffffffff); +} + static void gen8_irq_postinstall(struct drm_i915_private *dev_priv) { - if (HAS_PCH_SPLIT(dev_priv)) + if (INTEL_PCH_TYPE(dev_priv) >= PCH_ICP) + icp_irq_postinstall(dev_priv); + else if (HAS_PCH_SPLIT(dev_priv)) ibx_irq_postinstall(dev_priv); gen8_gt_irq_postinstall(&dev_priv->gt); @@ -3775,13 +3796,6 @@ static void gen8_irq_postinstall(struct drm_i915_private *dev_priv) gen8_master_intr_enable(dev_priv->uncore.regs); } -static void icp_irq_postinstall(struct drm_i915_private *dev_priv) -{ - struct intel_uncore *uncore = &dev_priv->uncore; - u32 mask = SDE_GMBUS_ICP; - - GEN3_IRQ_INIT(uncore, SDE, ~mask, 0xffffffff); -} static void gen11_irq_postinstall(struct drm_i915_private *dev_priv) { -- 2.29.2