From patchwork Fri Nov 1 13:39:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 13859414 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 E115FE6B278 for ; Fri, 1 Nov 2024 13:48:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 84AB810E9BC; Fri, 1 Nov 2024 13:48:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="cTEx1ivC"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA95C10E9BC for ; Fri, 1 Nov 2024 13:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730468888; x=1762004888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qHZOUrkm/ZaJN+m/34Pm/uch+oOTLFMm4mYs6hXKpLs=; b=cTEx1ivCo8D50Lx1DHfQhGezmH3E9UK2Kbsil30HeyDAOwaSywjOhQCZ NnritXDkYhViwQetBTnEWD6ppFx9PxjdpZ8kwYVlmrNYJwYL4Ak3Kpji/ NxQFct1ENRjcTtQdhCKxKbIfUsYfGUxxz9kux6dCtGRCx5Z4c110vqlT7 dkHckRG89Yv4qSxY/sJDvmLAHShzFPD8hzwtN0i2BPP9TJZVVofQSKRYT kYjKH3WxIlw4c/btPi+Q+92Kl7e4twTdONY6k+MafIom6XXhYTIDTQw/h JnVaYnO9GSTN9UZUmQZ9221TsW4Jcui3gHk5jhMZKh+xDqM+Yyd0j2Wbw g==; X-CSE-ConnectionGUID: 9GDtyqa+RHWD/J7fAi6Whw== X-CSE-MsgGUID: eVtiThW9QW+Xs+K/KmKorA== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="52800114" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="52800114" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2024 06:48:08 -0700 X-CSE-ConnectionGUID: Qq1B7JFQSZCrWiU6+fn6Nw== X-CSE-MsgGUID: +IZNDDbHTtuV0pPm3AUcAw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,249,1725346800"; d="scan'208";a="113750920" Received: from sorvi2.fi.intel.com ([10.237.72.194]) by orviesa002.jf.intel.com with ESMTP; 01 Nov 2024 06:48:06 -0700 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, gustavo.sousa@intel.com, raag.jadav@intel.com, Mika Kahola Subject: [PATCH v4 1/2] drm/i915/xe3lpd: Power request asserting/deasserting Date: Fri, 1 Nov 2024 15:39:23 +0200 Message-ID: <20241101133924.245817-2-mika.kahola@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101133924.245817-1-mika.kahola@intel.com> References: <20241101133924.245817-1-mika.kahola@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" There is a HW issue that arises when there are race conditions between TCSS entering/exiting TC7 or TC10 states while the driver is asserting/deasserting TCSS power request. As a workaround, Display driver will implement a mailbox sequence to ensure that the TCSS is in TC0 when TCSS power request is asserted/deasserted. The sequence is the following 1. Read mailbox command status and wait until run/busy bit is clear 2. Write mailbox data value '1' for power request asserting and '0' for power request deasserting 3. Write mailbox command run/busy bit and command value with 0x1 4. Read mailbox command and wait until run/busy bit is clear before continuing power request. v2: Rename WA function (Gustavo) Limit WA only for PTL platform with a TODO note (Gustavo) Add TCSS_DISP_MAILBOX_IN_CMD_RUN_BUSY for clarity when writing register data (Gustavo) Move register defs from i915_reg.h to intel_cx0_phy_regs.h (Gustavo) v3: Use "struct intel_display" instead of "struct drm_i915_private" (Jani) Move defs above C10 definitions in the intel_cx0_phy_regs.h file (Gustavo) Move drm_WARN_ON() inside WA function (Gustavo) Rename workaround function as wa_14020908590() (Gustvo) Use boolean enable instead of if-else structure (Raag) v4: Drop drm_WARN_ON() (Raag) Fix function definition to fit into a single line (Raag) Reviewed-by: Raag Jadav Signed-off-by: Mika Kahola --- .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 8 +++++ drivers/gpu/drm/i915/display/intel_tc.c | 31 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h index f0e5c196eae4..5a0b55cca4a3 100644 --- a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h @@ -200,6 +200,14 @@ #define XELPDP_SSC_ENABLE_PLLA REG_BIT(1) #define XELPDP_SSC_ENABLE_PLLB REG_BIT(0) +#define TCSS_DISP_MAILBOX_IN_CMD _MMIO(0x161300) +#define TCSS_DISP_MAILBOX_IN_CMD_RUN_BUSY REG_BIT(31) +#define TCSS_DISP_MAILBOX_IN_CMD_CMD_MASK REG_GENMASK(7, 0) +#define TCSS_DISP_MAILBOX_IN_CMD_DATA(val) (TCSS_DISP_MAILBOX_IN_CMD_RUN_BUSY | \ + REG_FIELD_PREP(TCSS_DISP_MAILBOX_IN_CMD_CMD_MASK, val)) + +#define TCSS_DISP_MAILBOX_IN_DATA _MMIO(0x161304) + /* C10 Vendor Registers */ #define PHY_C10_VDR_PLL(idx) (0xC00 + (idx)) #define C10_PLL0_FRACEN REG_BIT8(4) diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c index b16c4d2d4077..e40d55f4c0c4 100644 --- a/drivers/gpu/drm/i915/display/intel_tc.c +++ b/drivers/gpu/drm/i915/display/intel_tc.c @@ -1013,6 +1013,30 @@ xelpdp_tc_phy_wait_for_tcss_power(struct intel_tc_port *tc, bool enabled) return true; } +static void wa_14020908590(struct intel_display *display, bool enable) +{ + /* check if mailbox is running busy */ + if (intel_de_wait_for_clear(display, TCSS_DISP_MAILBOX_IN_CMD, + TCSS_DISP_MAILBOX_IN_CMD_RUN_BUSY, 10)) { + drm_dbg_kms(display->drm, + "Timeout waiting for TCSS mailbox run/busy bit to clear\n"); + return; + } + + intel_de_write(display, TCSS_DISP_MAILBOX_IN_DATA, enable); + intel_de_write(display, TCSS_DISP_MAILBOX_IN_CMD, + TCSS_DISP_MAILBOX_IN_CMD_RUN_BUSY | + TCSS_DISP_MAILBOX_IN_CMD_DATA(0x1)); + + /* wait to clear mailbox running busy bit before continuing */ + if (intel_de_wait_for_clear(display, TCSS_DISP_MAILBOX_IN_CMD, + TCSS_DISP_MAILBOX_IN_CMD_RUN_BUSY, 10)) { + drm_dbg_kms(display->drm, + "Timeout after writing data to mailbox. Mailbox run/busy bit did not clear\n"); + return; + } +} + static void __xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool enable) { struct drm_i915_private *i915 = tc_to_i915(tc); @@ -1022,6 +1046,13 @@ static void __xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool ena assert_tc_cold_blocked(tc); + /* + * Gfx driver WA 14020908590 for PTL tcss_rxdetect_clkswb_req/ack + * handshake violation when pwwreq= 0->1 during TC7/10 entry + */ + if (DISPLAY_VER(i915) == 30) + wa_14020908590(&i915->display, enable); + val = intel_de_read(i915, reg); if (enable) val |= XELPDP_TCSS_POWER_REQUEST; From patchwork Fri Nov 1 13:39:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 13859443 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 533A2E6B27C for ; Fri, 1 Nov 2024 13:48:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E902A10E9C1; Fri, 1 Nov 2024 13:48:10 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mfNmRQwa"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id D714010E9C0 for ; Fri, 1 Nov 2024 13:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730468890; x=1762004890; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lDCkM0GCjnqN7TF6mXgSEnBsQpg+HX2bOUDmSmD3wtI=; b=mfNmRQwaHto4gfHy0N2pCaiNhIRJ2I/nZHVBtsCgNX6eM7bqpcrS7e3B s9zUJNK6GDCpTOwVyLwgHWQ2DJ4gQuv7S3K7AQNqTmdZctpKSkH3CL7in I8RYGP5ptqePUt8f4+4f71U6jbw7U3vaaNChxitwiiFw+NDs4RTHkaaCq c3NFwZcNVxvqiNGP5+OgP/EUD9ha06ApZgmAV4dUil9oHxqCt4CGvTnFa ibpRMgF7DlS1hX9oMZBVKHnNwq8gYxOm0F8km2ScCfMFjQpf/PiftoMYY WabqhA77pXsU0UH0YAoaREtBRkhVh4Uq0TmhNCA9HJ7At2ZlNu/271WAG g==; X-CSE-ConnectionGUID: sMckA2y7RKqb0JgqvpF3fA== X-CSE-MsgGUID: BB2efMKpTWGAs8M0qOAjqg== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="52800116" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="52800116" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2024 06:48:10 -0700 X-CSE-ConnectionGUID: 7T9OTc+8R0ybEFW3jaQplg== X-CSE-MsgGUID: 640fIhUxTdeY6bynBp+NOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,249,1725346800"; d="scan'208";a="113750926" Received: from sorvi2.fi.intel.com ([10.237.72.194]) by orviesa002.jf.intel.com with ESMTP; 01 Nov 2024 06:48:08 -0700 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, gustavo.sousa@intel.com, raag.jadav@intel.com, Mika Kahola Subject: [PATCH v4 2/2] drm/i915/display: Use struct intel_display instead of struct drm_i915_private Date: Fri, 1 Nov 2024 15:39:24 +0200 Message-ID: <20241101133924.245817-3-mika.kahola@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101133924.245817-1-mika.kahola@intel.com> References: <20241101133924.245817-1-mika.kahola@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Let's start using struct intel_display instead of struct drm_i915_private when introducing new code. No functional changes. Signed-off-by: Mika Kahola --- drivers/gpu/drm/i915/display/intel_tc.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c index e40d55f4c0c4..385c838ee996 100644 --- a/drivers/gpu/drm/i915/display/intel_tc.c +++ b/drivers/gpu/drm/i915/display/intel_tc.c @@ -97,6 +97,11 @@ static struct drm_i915_private *tc_to_i915(struct intel_tc_port *tc) return to_i915(tc->dig_port->base.base.dev); } +static struct intel_display *tc_to_intel_display(struct intel_tc_port *tc) +{ + return to_intel_display(tc->dig_port->base.base.dev); +} + static bool intel_tc_port_in_mode(struct intel_digital_port *dig_port, enum tc_port_mode mode) { @@ -1039,9 +1044,9 @@ static void wa_14020908590(struct intel_display *display, bool enable) static void __xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool enable) { - struct drm_i915_private *i915 = tc_to_i915(tc); + struct intel_display *display = tc_to_intel_display(tc); enum port port = tc->dig_port->base.port; - i915_reg_t reg = XELPDP_PORT_BUF_CTL1(i915, port); + i915_reg_t reg = XELPDP_PORT_BUF_CTL1(display, port); u32 val; assert_tc_cold_blocked(tc); @@ -1050,15 +1055,15 @@ static void __xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool ena * Gfx driver WA 14020908590 for PTL tcss_rxdetect_clkswb_req/ack * handshake violation when pwwreq= 0->1 during TC7/10 entry */ - if (DISPLAY_VER(i915) == 30) - wa_14020908590(&i915->display, enable); + if (DISPLAY_VER(display) == 30) + wa_14020908590(display, enable); - val = intel_de_read(i915, reg); + val = intel_de_read(display, reg); if (enable) val |= XELPDP_TCSS_POWER_REQUEST; else val &= ~XELPDP_TCSS_POWER_REQUEST; - intel_de_write(i915, reg, val); + intel_de_write(display, reg, val); } static bool xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool enable)