Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp302599lqp; Wed, 12 Jun 2024 01:56:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU6ZR8BFMiHp0WFIMaLm9WDFt1tEl46CG3MggkVQCgm1OC7NmG1enhk7kVDiRBX5UXPBUNod7vC6zZDH9XySaw2bp/WxE6nqmqh2oRY1A== X-Google-Smtp-Source: AGHT+IEi6TU2i7LakNCyoxtGzDjgpkKB+lIq5+kH9scalMScnok7FRB037+Dl/P3MgLs0E6foI7k X-Received: by 2002:a17:906:489:b0:a6e:7e1f:2eae with SMTP id a640c23a62f3a-a6f4800b167mr68264766b.74.1718182595749; Wed, 12 Jun 2024 01:56:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718182595; cv=pass; d=google.com; s=arc-20160816; b=mxaSaMbVrD3LxFUXQtOuKtSVIJv8Wq0tw3v/Oqgsm1XK+nKy1PU6EUgcuyGV+9uX+X X4BHf1kN/k4ItY/7wqa60l/7tjxanZE8MKFhENhajT8xANar43+CB3u3UDz4sW3d/Cpd LqJ/Qaj83LSQzqMW5ZBQzyqCbdv8IaussrdCO0I8+j9JLwUONk8u9MJJfV27gQCLWWGS SopL8DgWDr5P+cYXKOgpaH4bADTDvL/Jxdn2xuRbp/MoVwp/2pr4JKb1XKWH/J+q5AU/ 7nf+Tkuvw7dFrxEehVn4PIMnfkLRt9IHbC1cRrlp28hjPNBeuAuwqM8PocjfLcLQS2FV 4kTA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:feedback-id:dkim-signature:dkim-signature; bh=e5M+mHpk8VIMJ+B95zDLNN/F7+/sf0MKyuTyQ+Iojtk=; fh=YYvVLFwqFeNI2PTddZOHQhqA0EB2/YgnNjGyEDtLfKQ=; b=uUy7tXIKgiPd7V1KiTMrfFxohWCPx3HJIK0C54BaaxzO9Qi8oFmDjiIwc3kQX21ToL enl3w56VWki8R+GEemllCGEvbQKZw1UELxQ7ph3v1IL3ZZY3e9PtYOq7EZDQYSbVHFN3 BL4kjOZC4NKRylGdXEnMK/PWjXbzu8aj0gYctfEFoz3HxVDgUs1cH14oyAR8JC/15w4R bDxUYjbPT1rgI1PTLpFy+/O9wnHoCofIKnSpTK8Cb+pB+V4uq1WA11/1SkMcxTpL2V+k +ZqG8vOiMucUq5W4gcAYGOp6e2hBD/+t+O0dhCBhheV7Ge92mo/49tT9MnuVpii/ec5X WHPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=G3tiSlWE; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=lVUw7ihc; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-211220-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f37b754efsi159476066b.63.2024.06.12.01.56.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 01:56:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211220-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=G3tiSlWE; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=lVUw7ihc; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-211220-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4C5CB1F2331E for ; Wed, 12 Jun 2024 08:56:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F1AA16D4D7; Wed, 12 Jun 2024 08:54:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="G3tiSlWE"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="lVUw7ihc" Received: from fhigh3-smtp.messagingengine.com (fhigh3-smtp.messagingengine.com [103.168.172.154]) (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 E4B3416EBFB; Wed, 12 Jun 2024 08:54:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718182485; cv=none; b=vEzPDflfgBQHixUSBllWioyIw6LDxMIn2b8gul3DT0Je/+IC8D6vXk02oy/Tvnd67K4PZJfWRrx2omvCihGjwItP+8YJNl4b41mc16VKqC+z3V/YBZQdJ7mLLOrDy9s7PH7S3FKyAkdJrS0KxbXbslkqmYwxCVWBJge8c/bYvUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718182485; c=relaxed/simple; bh=mjI/mjh69onU/yGH22kAjkQ4UV9AJXLhATGHNzoYz3Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pgY7HIkx7n13QBobbBd5j/ix6vbu4MLgWcfNydLNbe/eFwYxxop81P3VmqG2woPCclFOsp/ucd+85M/8fJH213vJPpuq3Iz0wAjYC79C1MHWkwvnHRJXpTHP2+nDQsfJosJzN3b+5dl272o+le027nzeCRpfZ45wezeYu6jGr54= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=G3tiSlWE; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=lVUw7ihc; arc=none smtp.client-ip=103.168.172.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 0FDCC11401E7; Wed, 12 Jun 2024 04:54:43 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 12 Jun 2024 04:54:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1718182483; x=1718268883; bh=e5M+mHpk8VIMJ+B95zDLNN/F7+/sf0MKyuTyQ+Iojtk=; b= G3tiSlWEkLFIxer/OA0/Xlflt2MfvS4HDu0puWaPvA32sWsjpVQjGFWVK3nWY2Fl fGrwg2U8CXhJ3qB/MLgQp2RZngV4ITMy5UtuUlD5k1jnVIxdU1k+Wv5vTg8Kcykf 85KVSfCiERZcC7WHLovdHFDX0GlCmn2ahAuKWQO4lGR5+mDgh9TufDy9KrMdSA8D 3sJFA+Oo51nBwH5K+QkOmoTqLcBhPsDgOKCOMw5MY+1mvrBetBeKyjyNh52I5czU Y1aZaUy8sbmtC+8nwAd0l7fSjrIJJjsRUfqx6hIisIk9NkGZACOEDYDq26vpPae3 uXF9Dr7hJcOCq1Zz/hHD5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1718182483; x= 1718268883; bh=e5M+mHpk8VIMJ+B95zDLNN/F7+/sf0MKyuTyQ+Iojtk=; b=l VUw7ihcPKso+UWzYEGBLrNiiT+Tyql/4HNysEns8aB/48fA3h4zlC7KO9+p/2Ama ME4qh03kuGNSOCmpE8WWpghcmmosVCeVO/oyxUvlKsix7oEyWfX3LRuP5dLnC85E 6CK+EYBYE68eLRVCucZ3AYe2qeGOOJI0WBVRU+ygSYNhFbig4+xLbhVhOisxAskH d6o80l6BqodGUUfpatFgajfVmG/nRX+TKMU0JJLXfzKpgj22+A4R00/IV1ezoSL2 EuFBDH7TRLNsz2RLKAA18QdO8pfnp0CmoEvEEakt+70iCP3sNWQGJjEqk7bdS56k KOvjBeQO7dUSXdkNY1BwQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedugedgtdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepveevteehgefggeejkeejtddtteeuleduheevjefgjeetvdfh udegtefglefhveeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Jun 2024 04:54:41 -0400 (EDT) From: Jiaxun Yang Date: Wed, 12 Jun 2024 09:54:34 +0100 Subject: [PATCH v2 7/7] clocksource: mips-gic-timer: Correct sched_clock width Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240612-mips-clks-v2-7-a57e6f49f3db@flygoat.com> References: <20240612-mips-clks-v2-0-a57e6f49f3db@flygoat.com> In-Reply-To: <20240612-mips-clks-v2-0-a57e6f49f3db@flygoat.com> To: Thomas Bogendoerfer , Serge Semin , Daniel Lezcano , Thomas Gleixner Cc: "Maciej W. Rozycki" , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2015; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=mjI/mjh69onU/yGH22kAjkQ4UV9AJXLhATGHNzoYz3Q=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhrTMJPefrdFGosqqyTq+R9SWHJijwn3e7veB48fOnxNs+ +KxR2xyRykLgxgXg6yYIkuIgFLfhsaLC64/yPoDM4eVCWQIAxenAExk8lpGhgtHoj8qX/Yx95V4 r1MxS8ZzOfdJoRUHt0w96Sv/oFHZey7D/woXc0nFyxpcsiqbt5870uj+aw+7yE33z/yXtP4scEk 25QMA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Counter width of GIC is configurable and can be read from a register. Use width value from the register for sched_clock. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Jiaxun Yang --- drivers/clocksource/mips-gic-timer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c index 7a03d94c028a..110347707ff9 100644 --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c @@ -19,6 +19,7 @@ static DEFINE_PER_CPU(struct clock_event_device, gic_clockevent_device); static int gic_timer_irq; static unsigned int gic_frequency; +static unsigned int gic_count_width; static bool __read_mostly gic_clock_unstable; static void gic_clocksource_unstable(char *reason); @@ -186,15 +187,14 @@ static void gic_clocksource_unstable(char *reason) static int __init __gic_clocksource_init(void) { - unsigned int count_width; int ret; /* Set clocksource mask. */ - count_width = read_gic_config() & GIC_CONFIG_COUNTBITS; - count_width >>= __ffs(GIC_CONFIG_COUNTBITS); - count_width *= 4; - count_width += 32; - gic_clocksource.mask = CLOCKSOURCE_MASK(count_width); + gic_count_width = read_gic_config() & GIC_CONFIG_COUNTBITS; + gic_count_width >>= __ffs(GIC_CONFIG_COUNTBITS); + gic_count_width *= 4; + gic_count_width += 32; + gic_clocksource.mask = CLOCKSOURCE_MASK(gic_count_width); /* Calculate a somewhat reasonable rating value. */ if (mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ)) @@ -264,7 +264,7 @@ static int __init gic_clocksource_of_init(struct device_node *node) if (mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ)) { sched_clock_register(mips_cm_is64 ? gic_read_count_64 : gic_read_count_2x32, - 64, gic_frequency); + gic_count_width, gic_frequency); } return 0; -- 2.43.0