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 D749F156F3C; Thu, 13 Feb 2025 14:57:57 +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=1739458677; cv=none; b=ldYFpj6TKfuXMVksNnYQd5mWWbmGcUu2wfGcMgeFghcm2J4fDtaQ+UffmHRtApVikuTlrW516wGRoszReiOF2eDX7lR8xnUL8m2nXb1lwZKY99W6IB+NCs5ezZbUS4cp3O2i4h1uMJi3pWZMr+Hv0PO2g1om1cJjvj4FfsiffCI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739458677; c=relaxed/simple; bh=igf16KDvPjeMXKQ5Pz1I4WwjoFFMQAJQ7BQhRkKuy+8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qfk0SJeOeggN0wJXAOX8Eo5A+BGPlinvoJSxaY1s6z1spb09evwOsWm3RzJM8h83KBRFwOrP2b0oYDXk7ZQT/HjBz1kXkG18LTEuyOD/wxaZj1qYQCtXYAfECfibiL9PL4zu2pisFvDTxD/VwxzDJ/t8saJbSQk8XKtmhaYQsYw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WEPR57Et; 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="WEPR57Et" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 468DBC4CED1; Thu, 13 Feb 2025 14:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739458677; bh=igf16KDvPjeMXKQ5Pz1I4WwjoFFMQAJQ7BQhRkKuy+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WEPR57EtWCD6Ss6k7UORTg8uCUhW7SHsZDV/KKf19DkJd8L1FzqVa6xJih6e6dxlB ZSWWGSqINzi3gZ7tzacpMLMEkps7G1+9Rn44zttP6DYnKeKz6pOsoHckfA+LA+74W0 jfDAUykGHbtL7dH3yqbl3WzUTaA4aFxTxFk0h5qI= 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.13 048/443] drm/bridge: it6505: fix HDCP CTS KSV list wait timer Date: Thu, 13 Feb 2025 15:23:33 +0100 Message-ID: <20250213142442.477062942@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250213142440.609878115@linuxfoundation.org> References: <20250213142440.609878115@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.13-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 029755ee21e23..faee8e2e82a05 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2061,12 +2061,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; @@ -2075,13 +2076,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