Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2135589lqb; Mon, 27 May 2024 08:58:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUhNE5Fl0pMsxna2++QFz3cG8+OQJtUB2/92kXvb0bhlmBdwnQ+RzdwRvUJBt+VXDh16YM1Ua/tIVOMKaIN7Ngaqex5rm4ROGnstXxRdg== X-Google-Smtp-Source: AGHT+IFU/7IucdnRBSs9J/RU4uo2a+Yv4Ne2GM0FDRHPNTU3KOckhYV7QhgCMkNtkue8Xrm9E//x X-Received: by 2002:a05:6a00:44cc:b0:6f3:f447:57de with SMTP id d2e1a72fcca58-6f8f36f9044mr11739589b3a.19.1716825522388; Mon, 27 May 2024 08:58:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716825522; cv=pass; d=google.com; s=arc-20160816; b=SOrqjNgGLX4N0gnoNoAPO4h91GqtvFhzuQd2SF65Eej00D5500qrJ7pKB5BhiVhzhe Zr2UGCnN4VU9LMFN1XIZn2G3iQrFazRFL7GLWqZfmbwamvbVj+sVqSIefABJBZHAnp1o C5axJ/XLsKnVgO8+i/gxbz/FYpAuyUV+pgQIet0HBAuOwmQCu0Ld/uW3Nn9BKuqenvwm HVh9T8luAzK4nuK1ckE0Lo7Euhj4vRlTgLX3oribBnPBOCgFD/FEE9m8PbjXL7L7sDm4 wqcCEVpzukTptGxYZTKHyepcmvJPOxpYv4XCMVgIXqG0G7iwvI0P2SneB9wPXpGjP6ea DtjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=iWrH8s0HgipnxikmiKvoWS+Y3TJn/3HsJ/qkGf8lcaY=; fh=Ol5VNWhjCVllOL+thi77ZTZzNgQ/oPeQIbTQtwNbyhU=; b=tdzxePMtlEUvPyCSi8l49oyDcbWYtwJcSIUJujIPuFw/Gxe49JgOox3RGckIgetXco 25cjA0l/ee29zlUPZ9reERhmxOYhSnmKJ6yajUsdEcJR7vUHXQJPYfHhT2NGrYxqeAiW kLl6DcW0NE7/1/5RmhpCwvPPS0FWEbOBD6t6ZadeIOdYdmz15uCGCEKZ2MjfPECXeS0r c9U4JIJSMA4xyQD4q71fRSv8MMVgHpS250DL9H3FliF79xcve6ztyLEmRdfMuZVVocTj 15C8jDwbOpWoKxmNLEoalBMvtfYXKfhDI6jDhbd9vAW9sA1QW+qXHpu1TZ9Z1USz1HGa ZPrQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=I4v0fBz3; dkim=neutral (no key) header.i=@linutronix.de header.b=2OWIUhQr; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-191098-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191098-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-68221b75734si7297656a12.149.2024.05.27.08.58.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 08:58:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191098-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=I4v0fBz3; dkim=neutral (no key) header.i=@linutronix.de header.b=2OWIUhQr; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-191098-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191098-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 18EA02832E2 for ; Mon, 27 May 2024 15:51:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1662261FFA; Mon, 27 May 2024 15:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="I4v0fBz3"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2OWIUhQr" 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 0A2FD17E8E2; Mon, 27 May 2024 15:51:26 +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=1716825088; cv=none; b=ZMapQBCGkFxJTnIge/3A0Wv6rOBJ3nN8nfsmq7OB/xkIgFkxKjKZvCWLiVHUhej9q+NZvfg5++MHypnqx1d8DZ+OvMkwQnsj2wrPf9HoWywIyXyH2A0u9tYPcQgqJjexr8JdxEiqNybB3qUC8l1UoYW95TI5fc5HChjXpSoKONg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716825088; c=relaxed/simple; bh=6i4gd8J4KRT2ZQgVgP185Z+O7p9xL8wu8xsohxPyeKE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=ItXQE/X3kprV177f6u5VmCps07gMNWS3VvGI3aneBGiAuJuS8VfbGxHjuPBYGvilcVEVR/PAVQSJQs3M8WEB2Nf9IlCYdqUt60TgOUU+0Zrh1kP5SuP6I/KgRDrUSS1XEqt3Nl2VS9Dudady42wAGYeS6usen4BOZTuodctRi6s= 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=I4v0fBz3; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2OWIUhQr; 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 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1716825085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iWrH8s0HgipnxikmiKvoWS+Y3TJn/3HsJ/qkGf8lcaY=; b=I4v0fBz3bJImtrw8YX/tQPY9d4C5qdDuLZprK7pfqNybqDRHzCnieIVcSjCMdqOIsNlddX WpOw2tBHYLf4PoiS4h1BZf84hHuTknyjIXU6XbaORSLV3ii0jA2KulQpeOWNynLGgr97qo /44IQ+8OakKxfiHvKJNcEfsZsLM11sKNu2O9TKSCAR8qWntmTAWlek3WVnP+hn9ifbmQvx mElh4VMht95N2BZV2zek9zR/XhZRzS1Hh46sP5Gv6D/3nUcmReEfwdYV1SICHnD0o63TqX ZRuIbjv8DskE9DvtSisIdFp9/u6rrrrVwDjvDQlBDs1BmHnQXMl6oU1M2jWTxg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1716825085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iWrH8s0HgipnxikmiKvoWS+Y3TJn/3HsJ/qkGf8lcaY=; b=2OWIUhQrmt1EzQTNsZ0eAKLiptoz2yrlLQPIZ/7qyCJA5MmeIct02qNJuqlW2weJszwd1j alAOtzRCAixG/oBg== To: Jiaxun Yang , Huacai Chen , Thomas Bogendoerfer , Daniel Lezcano Cc: linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jiaxun Yang Subject: Re: [PATCH v2] clocksource: Add node counter timer driver for MIPS/Loongson64 In-Reply-To: <20240517-loongson_nodecnt-v2-1-5bd0bb20ff5f@flygoat.com> References: <20240517-loongson_nodecnt-v2-1-5bd0bb20ff5f@flygoat.com> Date: Mon, 27 May 2024 17:51:25 +0200 Message-ID: <87sey3b6de.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Jiaxun! On Fri, May 17 2024 at 18:13, Jiaxun Yang wrote: > +static void __iomem *nodecnt_reg; > +static u64 (*nodecnt_read_fn)(void); > + > +static u64 notrace nodecnt_read_2x32(void) > +{ > + unsigned int hi, hi2, lo; > + > + do { > + hi = readl_relaxed(nodecnt_reg + 4); > + lo = readl_relaxed(nodecnt_reg); > + hi2 = readl_relaxed(nodecnt_reg + 4); > + } while (hi2 != hi); > + > + return (((u64) hi) << 32) + lo; > +} > + > +static u64 notrace nodecnt_read_64(void) > +{ > + return readq_relaxed(nodecnt_reg); > +} > + > +static u64 notrace nodecnt_read_csr(void) > +{ > + return csr_readq(LOONGSON_CSR_NODECNT); > +} > + > +static u64 nodecnt_clocksource_read(struct clocksource *cs) > +{ > + return nodecnt_read_fn(); What's this indirection for? Why dont you update > +static struct clocksource nodecnt_clocksource = { > + .name = "nodecnt", > + .read = nodecnt_clocksource_read, the read function pointer here and spare the indirection? Thanks tglx