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 0A0011FF1C4; Sun, 26 Jan 2025 14:56:49 +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=1737903410; cv=none; b=Af0DpHuU8SRixUySIqrK5qoyseQT0FGhBPblGNAcG9Lmwm2J2ULbJN31FnnvUkf2KSE5tpYQP9asjoECv67dauZoJXBJ8qGuikyrNZUkjeyQo+N63qBW0LsmJNjyt6POr0wY0OiWQQ7wLlSUbkMODd6ianI31AlnR9Pl5M61w6k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737903410; c=relaxed/simple; bh=rQAleI2TfFPkBl+b/CusrIsnR/Ylev6Dxm6qv/Uw0Aw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J0RbD5OXZ+8x4v397VhohRdQWsF0vkIxl36urU26PDLkUJUfRvlNLimJWsD2Mp6LovgKm9bMtHHHXo2xgLSEMudIdbxAX28xMj9/k9YS636OBSgVqGpolaPgsTCAFR06YCbs7Zxs8QBA3NFfDVzZ8mE8rRa+2SE4ggCVuKpnv84= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s/OWbaW9; 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="s/OWbaW9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC0B4C4CED3; Sun, 26 Jan 2025 14:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737903409; bh=rQAleI2TfFPkBl+b/CusrIsnR/Ylev6Dxm6qv/Uw0Aw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s/OWbaW945CyeV5761VdZ6rbixjoogAHJoGHDHzEo/Aqxl5UuZpDzhy4sDgxuS1e3 r8rD0PKHmCfNzTmwoIYYDvIKvcy2vcvKSCOhadifqyPiONLvKwhAjedLMAr7iy4uxw LJ6Ecc9TxHsXe65+FGhfDeWHSjGV+ANsxgiar3r9+oZ6nGGRlQVX5cO7YlsAbpmDvQ k+bi3AbXdgohKZlUvXBsOmGNzEC/fa9UA6/BUWSxIblIYombmdr6Ln92eCeI87/pKt cZQB6m8T+fHzyR7usvARW1/kIiNUA0KpY45eUwnJgXsEUhEz+sYycVwQ1W5pk8jcta meUfuO6386jIQ== 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.6 16/17] drm/bridge: it6505: fix HDCP CTS KSV list wait timer Date: Sun, 26 Jan 2025 09:56:11 -0500 Message-Id: <20250126145612.937679-16-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250126145612.937679-1-sashal@kernel.org> References: <20250126145612.937679-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.6.74 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 b23e6f663b18f..cedba2a76f014 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