lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <172527135957.2215.13837921315515857683.tip-bot2@tip-bot2>
Date: Mon, 02 Sep 2024 10:02:39 -0000
From: "tip-bot2 for Jacky Bai" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: stable@...r.kernel.org, Jacky Bai <ping.bai@....com>,
 Peng Fan <peng.fan@....com>, Ye Li <ye.li@....com>,
 Jason Liu <jason.hui.liu@....com>, Frank Li <Frank.Li@....com>,
 Daniel Lezcano <daniel.lezcano@...aro.org>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject: [tip: timers/urgent] clocksource/drivers/imx-tpm: Fix next event not
 taking effect sometime

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     3d5c2f8e75a55cfb11a85086c71996af0354a1fb
Gitweb:        https://git.kernel.org/tip/3d5c2f8e75a55cfb11a85086c71996af0354a1fb
Author:        Jacky Bai <ping.bai@....com>
AuthorDate:    Thu, 25 Jul 2024 15:33:55 -04:00
Committer:     Daniel Lezcano <daniel.lezcano@...aro.org>
CommitterDate: Mon, 02 Sep 2024 10:04:15 +02:00

clocksource/drivers/imx-tpm: Fix next event not taking effect sometime

The value written into the TPM CnV can only be updated into the hardware
when the counter increases. Additional writes to the CnV write buffer are
ignored until the register has been updated. Therefore, we need to check
if the CnV has been updated before continuing. This may require waiting for
1 counter cycle in the worst case.

Cc: stable@...r.kernel.org
Fixes: 059ab7b82eec ("clocksource/drivers/imx-tpm: Add imx tpm timer support")
Signed-off-by: Jacky Bai <ping.bai@....com>
Reviewed-by: Peng Fan <peng.fan@....com>
Reviewed-by: Ye Li <ye.li@....com>
Reviewed-by: Jason Liu <jason.hui.liu@....com>
Signed-off-by: Frank Li <Frank.Li@....com>
Link: https://lore.kernel.org/r/20240725193355.1436005-2-Frank.Li@nxp.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
---
 drivers/clocksource/timer-imx-tpm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/clocksource/timer-imx-tpm.c b/drivers/clocksource/timer-imx-tpm.c
index cd23caf..92c025b 100644
--- a/drivers/clocksource/timer-imx-tpm.c
+++ b/drivers/clocksource/timer-imx-tpm.c
@@ -91,6 +91,14 @@ static int tpm_set_next_event(unsigned long delta,
 	now = tpm_read_counter();
 
 	/*
+	 * Need to wait CNT increase at least 1 cycle to make sure
+	 * the C0V has been updated into HW.
+	 */
+	if ((next & 0xffffffff) != readl(timer_base + TPM_C0V))
+		while (now == tpm_read_counter())
+			;
+
+	/*
 	 * NOTE: We observed in a very small probability, the bus fabric
 	 * contention between GPU and A7 may results a few cycles delay
 	 * of writing CNT registers which may cause the min_delta event got

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ