From nobody Mon Jun 22 02:48:49 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 E18FE13AA20; Mon, 2 Sep 2024 10:02:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725271363; cv=none; b=t+khQVp1HyHmbEvUXU49A7/A0H1fVN5+Wp7tAFXeGH1MXxqbuw3T63129U8jde4laQrmz+tsCQguHxPF2hceGoJvYcMuyzczkrjG8hj+Srdoyn7jayUlPwjOHUGSASuizFat/ZCeIoIc7jEXfbmrXGxgWmsRCKKG+m0dg8ScHUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725271363; c=relaxed/simple; bh=+Ccpy757Xo2QQBLtqeMfI4RURw9qaPYoXr2k+lsFhEA=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=sAVyFyuUM6WwVPI5ny+BGtjgJvW5A6VZTatulHBjjBHeF52BvAjpIRJ1QfubbD98B+OazWMnzqWShW/dxa5oY9n/ka9tlr3DNFmp8M5wAiGgjkEO7zd/AX7OlIY6IBlFoPbTVy185lI5BYyJJ6N7LqjeYurh4Ua55IYi01+6Ct8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=riG4JvVq; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xXZaSHp4; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="riG4JvVq"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xXZaSHp4" Date: Mon, 02 Sep 2024 10:02:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1725271360; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jAinpoIOYSPGCi971NxeKgs1budYuEapKTh7AShqhTc=; b=riG4JvVqoRt1jFUpFkXPtC9XjsNOUuaM8ziqE6utTM73KB2KYYvoj9WUISYusOUTjBnQhz gWEmKmTQNSQACii+s5EXd3GRdaj3xwdG4NdJcJiMZLZB23Dff/bEl1IdaHbQ6gpDY0h07n 7JgTLDQ2ywwypEfAeRI5CMTaUH1nf28UeLgFQJGNXYVCd25u4Sh24ZbRJDv/3mnioDZ8Dg qtnRUjtzC6WvDu5zCn9DmtMLjfeS02Exczkk1UfJRY9R6qVyhq9OaKsgb+W48QrF2iEU77 Pzjealvc+2Z1asisZdkOVUzOeT2IOOXRc9197FyUVEFWc1cvY5VZKVhj14StPw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1725271360; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jAinpoIOYSPGCi971NxeKgs1budYuEapKTh7AShqhTc=; b=xXZaSHp4pjIUrvWYPSjIphhXB880oZNBIpLf7sKEqAitZlFGkooiygTzl6RRYXjc200Srl ihmp0eF8W4LgS8AA== From: "tip-bot2 for Jacky Bai" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/urgent] clocksource/drivers/imx-tpm: Fix next event not taking effect sometime Cc: stable@vger.kernel.org, Jacky Bai , Peng Fan , Ye Li , Jason Liu , Frank Li , Daniel Lezcano , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240725193355.1436005-2-Frank.Li@nxp.com> References: <20240725193355.1436005-2-Frank.Li@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <172527135957.2215.13837921315515857683.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/urgent branch of tip: Commit-ID: 3d5c2f8e75a55cfb11a85086c71996af0354a1fb Gitweb: https://git.kernel.org/tip/3d5c2f8e75a55cfb11a85086c71996af0= 354a1fb Author: Jacky Bai AuthorDate: Thu, 25 Jul 2024 15:33:55 -04:00 Committer: Daniel Lezcano 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@vger.kernel.org Fixes: 059ab7b82eec ("clocksource/drivers/imx-tpm: Add imx tpm timer suppor= t") Signed-off-by: Jacky Bai Reviewed-by: Peng Fan Reviewed-by: Ye Li Reviewed-by: Jason Liu Signed-off-by: Frank Li Link: https://lore.kernel.org/r/20240725193355.1436005-2-Frank.Li@nxp.com Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-imx-tpm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clocksource/timer-imx-tpm.c b/drivers/clocksource/time= r-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 =3D tpm_read_counter(); =20 /* + * Need to wait CNT increase at least 1 cycle to make sure + * the C0V has been updated into HW. + */ + if ((next & 0xffffffff) !=3D readl(timer_base + TPM_C0V)) + while (now =3D=3D 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