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 22FD9226CE4; Mon, 2 Jun 2025 15:11: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=1748877117; cv=none; b=iXRq223uHwU21RzY1mMy31WE8qZ2hpkMuk1913ZG1Dd8iV+Z7uwS2t6m2eK0UqzdR1pEkyD7xNg5odndbfIpNrcDg2RLJcwKENxYA/Z8n4RWJicCR6zy2twDcRCfg9NolPukOQQaowa0WaR9k0u8/5kiUFj4YX6gtXhGQzfR/Og= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877117; c=relaxed/simple; bh=DdeYCVmIjsaHCXJTq7YhEBKHt/8X2c9vMLuNE+qxi5Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NlHh4X8a7qSXpMT7QltoGCqhVAGARwIlR7GGtRob92cnQZWpR9B0TjlRvsC9iFDyJEBZnLW+Fac0ukaldt28KKzQR+X5rwnGegKnYAkLwwddbkvCXualcFtA5faa4O95Y5bQ0skmu9CaeEOFMD7L2k60AjB8ntzTxXaJ3iWUVqY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JPfH1Xql; 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="JPfH1Xql" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 622FDC4CEEB; Mon, 2 Jun 2025 15:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748877117; bh=DdeYCVmIjsaHCXJTq7YhEBKHt/8X2c9vMLuNE+qxi5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPfH1XqlNPU5cJs0wuFEnJpNgQ0uBIowoj897sPRupor4Neq2VjNJXhMYkgonhXVi QyiJb5WFFmWtdnKpJiccKLzMfQSN+SofulBy1qeS3UutlSWnOrTKotk9vkmH5RpKWY WqbIobMPQoSTIlhlWqPmU4RpCD82d/Etr7a4n1R0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Paul Burton , Chao-ying Fu , Dragan Mladjenovic , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Serge Semin , Gregory CLEMENT , Daniel Lezcano , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 6.1 147/325] clocksource: mips-gic-timer: Enable counter when CPUs start Date: Mon, 2 Jun 2025 15:47:03 +0200 Message-ID: <20250602134325.784688630@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134319.723650984@linuxfoundation.org> References: <20250602134319.723650984@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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Burton [ Upstream commit 3128b0a2e0cf6e07aa78e5f8cf7dd9cd59dc8174 ] In multi-cluster MIPS I6500 systems there is a GIC in each cluster, each with its own counter. When a cluster powers up the counter will be stopped, with the COUNTSTOP bit set in the GIC_CONFIG register. In single cluster systems, it has been fine to clear COUNTSTOP once in gic_clocksource_of_init() to start the counter. In multi-cluster systems, this will only have started the counter in the boot cluster, and any CPUs in other clusters will find their counter stopped which will break the GIC clock_event_device. Resolve this by having CPUs clear the COUNTSTOP bit when they come online, using the existing gic_starting_cpu() CPU hotplug callback. This will allow CPUs in secondary clusters to ensure that the cluster's GIC counter is running as expected. Signed-off-by: Paul Burton Signed-off-by: Chao-ying Fu Signed-off-by: Dragan Mladjenovic Signed-off-by: Aleksandar Rikalo Reviewed-by: Philippe Mathieu-Daudé Tested-by: Serge Semin Tested-by: Gregory CLEMENT Acked-by: Daniel Lezcano Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- drivers/clocksource/mips-gic-timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c index b3ae38f367205..39c70b5ac44c9 100644 --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c @@ -114,6 +114,9 @@ static void gic_update_frequency(void *data) static int gic_starting_cpu(unsigned int cpu) { + /* Ensure the GIC counter is running */ + clear_gic_config(GIC_CONFIG_COUNTSTOP); + gic_clockevent_cpu_init(cpu, this_cpu_ptr(&gic_clockevent_device)); return 0; } @@ -248,9 +251,6 @@ static int __init gic_clocksource_of_init(struct device_node *node) pr_warn("Unable to register clock notifier\n"); } - /* And finally start the counter */ - clear_gic_config(GIC_CONFIG_COUNTSTOP); - /* * It's safe to use the MIPS GIC timer as a sched clock source only if * its ticks are stable, which is true on either the platforms with -- 2.39.5