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 24D3017C21C; Sun, 26 Jan 2025 14:54:38 +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=1737903279; cv=none; b=JZ5Qud54JfAO+Jfps8BcQtMdF9CkW8uk3BZF4dW8CPRPXcG05HxMng6XPtTOVOVdrmcSHznXyboxe5TYmSToZiEknTG33EjLOgNDhr3Wnk02GiLdTMKHgo33E7ZFnfEy+Y5w9bEdyTDdpVhE4tWjOMwO2e9A2kk+tZd3Sa2o/iw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737903279; c=relaxed/simple; bh=eckG5toLTQPqqD02jkGSCRDr0Q0LbjtdTQQ2/RBc5bA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uAYEcp7j8eiK0ia6u0pLZuVQDa/MZu2j43ja1BDSH8yJWfswNhuyLj4vowgb2B1MJAfnhpnGhYFy4V1SnNzeKevXStiahsmB0XWBmmQVzChoSvUMUEpdKs6Y+N/qM2wwh3R1ceg9XDSO2c1kL2VPgYYGgn+giJxSRdv3Rf6TsLE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VGgeH8Bo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VGgeH8Bo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05ED3C4CEE2; Sun, 26 Jan 2025 14:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737903278; bh=eckG5toLTQPqqD02jkGSCRDr0Q0LbjtdTQQ2/RBc5bA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGgeH8Bo7CWpr7tECTmMyR/8TMxY5ywbysc9NOUbQZhrxE3uL7VvP6tooxK3ln7j2 t+HqK4PzCG0LTHfxquWTYqFnXGQbj+INkRmf3SiG5OMdNmbKoz2NObzhWbT2GSRUHu wP09X6cA2I3DHo94MZ1Vw1mmR41982Q1Tz9DysLKDGz7FbKkbtat68SbuIDPjM2fAs MppUfWbcJvvalCafSQLzJAuHTrT6l/VHe1GmJTOWRHMBN3kU0fJecnAYTLNL34/N7T p9WblF5W6MPpZtB0NYLtpTOZpvVaJ121SqNmd0kb8bj52Y38+6KnJoSr9y0KfXg6rg vQZngN2uxDcwQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hermes Wu , AngeloGioacchino Del Regno , Dmitry Baryshkov , Sasha Levin , andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.13 30/34] drm/bridge: it6505: fix HDCP CTS KSV list wait timer Date: Sun, 26 Jan 2025 09:53:06 -0500 Message-Id: <20250126145310.926311-30-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250126145310.926311-1-sashal@kernel.org> References: <20250126145310.926311-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.13 Content-Transfer-Encoding: 8bit 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 1daa069d71f73..427b32aee6ff3 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