From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 0C5D83A0E8F; Mon, 27 Apr 2026 23:35:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777332918; cv=pass; b=f36ezF6mkEg3WEPvSYlCtXkPRXE+YoN+53I5Ftr2s74wxdg76/HNUlRMBqcltn1UdX1fxpnezsoKaxpFwNWm0Uly0qFU8GQN8wFRUFsjJ7eDhzcZCv41nHf5hVSvXtnbicFxVrWk1sjvA+qFUwwSYSq9C9PdKn0fAyi9ZalU1N4= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777332918; c=relaxed/simple; bh=Wj97nLtVslQ2cqa/YhIQV24TtSPqr2fgofwHmb8eJ2M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AT0y+rR+PZ4UmX3zcGbR/d5XmRKJ5+UnjDfy0OxD8dOePW5fscf5biRqDinA66xHsOCwAzwVXDnx79GzoRoaoxG2GEkgrjFYenHVmLIfQZMoC+iVrebrhLcmP+QMXIBpzJ0vtpJlCG1Vqj5kBEkyHwW7LbaW9J8BZjF0yPgI48w= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=deborah.brouwer@collabora.com header.b=Ab1rwY+6; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=deborah.brouwer@collabora.com header.b="Ab1rwY+6" ARC-Seal: i=1; a=rsa-sha256; t=1777332847; cv=none; d=zohomail.com; s=zohoarc; b=TIvZDav/emZ9t5hu2vdGYc1tZ57x0K6eynOlRJWLgZz7CQjjs+TCu9oXodPZ+8yFdDPF5uH9JdMk/W/TpmTTTuR5IkumNkGyXj94tsCKS+XxwI++uwx4iD2n8de6egGWmueequrIzIZt8aeRxFG+oPeBOx86Pg1nHKiU4H7bCh4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777332847; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ce0vIe+47DP4mD9eCdC1YbJkykW70zc0cW8iUQuXKIg=; b=ggyzL70cWIpvA/vY/eHXUI07n6SCogbQfR9uuMcDNtnw8F4AQ7mYlevHTgvQfwzI36xzA1ZjGI20ZK02apDZRz6oHKuTrq4FTRFro/Sl8LltVkLPXOSuqSIzCdRUN1ALOX+iqA76ENzVEP4kME6nodcXiUzWuxEPw86LPvMgcoE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=deborah.brouwer@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1777332847; s=zohomail; d=collabora.com; i=deborah.brouwer@collabora.com; h=Date:Date:From:From:To:To:Cc:Cc:Subject:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:Message-Id:Reply-To; bh=Ce0vIe+47DP4mD9eCdC1YbJkykW70zc0cW8iUQuXKIg=; b=Ab1rwY+6qtP/XA1OECDXe2ByqNgKTj9sNWdHJXnv67FbwhRh7LKWPidbJDYG8rhH wuft1oE7mFO10+hkTYtycuWYk/5xavftZGltnM8r3ePQm8xcLWN8BpQgn3qHmo6nUk9 yRi4sxLxiYLdnum1LN+SvwfeE612GzgrAjr9rGZY= Received: by mx.zohomail.com with SMTPS id 1777332845471162.98488952114496; Mon, 27 Apr 2026 16:34:05 -0700 (PDT) Date: Mon, 27 Apr 2026 16:34:04 -0700 From: Deborah Brouwer To: Andreas Hindborg Cc: Daniel Almeida , Alice Ryhl , Danilo Krummrich , David Airlie , Simona Vetter , Benno Lossin , Gary Guo , Miguel Ojeda , Boqun Feng , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Trevor Gross , FUJITA Tomonori , Frederic Weisbecker , Thomas Gleixner , Anna-Maria Behnsen , John Stultz , Stephen Boyd , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, boris.brezillon@collabora.com, beata.michalska@arm.com, lyude@redhat.com, acourbot@nvidia.com, work@onurozkan.dev, alvin.sun@linux.dev Subject: Re: [PATCH v4 19/20] rust: time: add arch_timer_get_rate wrapper Message-ID: References: <20260424-b4-fw-boot-v4-v4-0-a5d91050789d@collabora.com> <20260424-b4-fw-boot-v4-v4-19-a5d91050789d@collabora.com> <87wlxsrgqr.fsf@t14s.mail-host-address-is-not-set> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87wlxsrgqr.fsf@t14s.mail-host-address-is-not-set> On Mon, Apr 27, 2026 at 09:42:52AM +0200, Andreas Hindborg wrote: > "Deborah Brouwer" writes: > > > Provide a safe Rust wrapper for arch_timer_get_rate(). > > > > The underlying C helper returns 0 when the ARM architectural timer > > is not available or not yet initialized. Map this to Option to > > make the absence of a valid rate explicit to Rust callers. > > > > This allows Rust drivers to query the system timer frequency and > > select appropriate time sources when programming hardware timeouts. > > > > Signed-off-by: Deborah Brouwer > > Looks good to me, but it is weird that this is defined for non-arm targets. > > Even if this is available for all architectures in C code, would it make > sense to gate it on the target being Arm in Rust? In Tyr, I’m calling time::arch_timer_get_rate() unconditionally and using it as an optional source (falling back to the GPU timer when it is not available). If we gated the Rust API on ARM targets, that would require adding target-specific cfgs at each call site or break non-ARM builds. Since the API already models absence as None, my thinking was to keep it available on all targets and let callers fall back, as Tyr does with the GPU clock. > > > Best regards, > Andreas Hindborg >