From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03ECA3FB3B; Thu, 13 Feb 2025 15:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739460142; cv=none; b=ijp4e7RvF+3YjS9bQ4OXNenbdl4LDgH4vOitBzD5ajldNmtSldfulahmhJYoJ6OE9X6IYOdW8JXIizO/AjK6H9ubafSxWouGAtrfhPB1uIBK82bJZoFmLmrxIaw+dzbBTa7ckxPY4ABjLG4lLN+lXQGOU3a2Jh6fHXPno0OHUqU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739460142; c=relaxed/simple; bh=FkeMhyWFf3Ir4x5Y6R65htc8G23SAMXO/YVD/6bXc/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b5o6xiEct46n1UCSagjBaipnAte+wu4aMdvbEEBOT6KmjDjW0RKbiemu6u44W8n5pYa/psMTGtTUtdN1hxyV1VGxtFbeUNG3uTC0Pm39IFcTk+B1v9vRvHQgrHnsfxe55oAGdioRC+fdFGZ0jG7+zYEjXhMPLIqptYt4GFZO9hs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2jdxeoN2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2jdxeoN2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F15B5C4CED1; Thu, 13 Feb 2025 15:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739460140; bh=FkeMhyWFf3Ir4x5Y6R65htc8G23SAMXO/YVD/6bXc/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2jdxeoN2o9ZzK3qtssJb6mIIR7WQ/0upd3QCUwh8jNcET8CPQs2bXX4NreEIuB1da 3m9lJlt4nxSHzr0pZEHHKHpXl43xmYOFvcYpcopSg4krwobCH9EbH91D/nFC44q75o SC321mZszuZ2xRP9zTyY5uIj3qTrIaWIOmBYPvX8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hermes Wu , AngeloGioacchino Del Regno , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 6.6 026/273] drm/bridge: it6505: fix HDCP CTS KSV list wait timer Date: Thu, 13 Feb 2025 15:26:38 +0100 Message-ID: <20250213142408.394357970@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250213142407.354217048@linuxfoundation.org> References: <20250213142407.354217048@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hermes Wu [ Upstream commit 9f9eef9ec1a2b57d95a86fe81df758e8253a7766 ] HDCP must disabled encryption and restart authentication after waiting KSV for 5s. The original method uses a counter in a waitting loop that may wait much longer than it is supposed to. Use time_after() for KSV wait timeout. Signed-off-by: Hermes Wu Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Dmitry Baryshkov Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-9-e0fdd4844703@ite.corp-partner.google.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/ite-it6505.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index 552d33c4325af..fe33b988d7523 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2058,12 +2058,13 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work) struct it6505 *it6505 = container_of(work, struct it6505, hdcp_wait_ksv_list); struct device *dev = it6505->dev; - unsigned int timeout = 5000; - u8 bstatus = 0; + u8 bstatus; bool ksv_list_check; + /* 1B-04 wait ksv list for 5s */ + unsigned long timeout = jiffies + + msecs_to_jiffies(5000) + 1; - timeout /= 20; - while (timeout > 0) { + for (;;) { if (!it6505_get_sink_hpd_status(it6505)) return; @@ -2072,13 +2073,12 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work) if (bstatus & DP_BSTATUS_READY) break; - msleep(20); - timeout--; - } + if (time_after(jiffies, timeout)) { + DRM_DEV_DEBUG_DRIVER(dev, "KSV list wait timeout"); + goto timeout; + } - if (timeout == 0) { - DRM_DEV_DEBUG_DRIVER(dev, "timeout and ksv list wait failed"); - goto timeout; + msleep(20); } ksv_list_check = it6505_hdcp_part2_ksvlist_check(it6505); -- 2.39.5