Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2866623pxb; Tue, 24 Aug 2021 09:23:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbtE8VspLce9MXXnnWEhzfOOpPFQlUFm47K4Fymi4JaozL93oEK1YeVxUAZmbquSaxWQh4 X-Received: by 2002:a17:907:2126:: with SMTP id qo6mr13683344ejb.476.1629822225192; Tue, 24 Aug 2021 09:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629822225; cv=none; d=google.com; s=arc-20160816; b=AxWipnIAeZ2MBQ/s0OIC2yRbLDe+rMCRnjt2SE6+66Shet8IyQVc3f/iybDlS6thc8 83M9EOORqwu5KCfOdfP6pBX+fOQx4CQgomyAXNySwSck2K7Eg+CStGyKVWo4+28l0T30 6gYJCF+Tu1wT00W05wh6o5WFwGJT8WxW0fSiGn14MPkx67dw+LjEcXSHYoz8/l2E680B OUDHnqtCCW62kfZ4NKGAA115rgErfrPN5Ce2pv/Fh+MqK1fzN0GD1uRF7AYMqac4AbEP P8HP0xNeEJzg476bNMUdU8mEs11sdbIhdHIsw6NN2MddKEc2hAoRaPrnvVDwv/hdc5Wg K2fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=WtQuBVAdOJFM5VBEk/7G+erq04JIBDEd8SHNed/8ZFY=; b=nm+QbyChgyUyuun925NLNZKlkUQCIHmguoEqH9w5sUe4YJvmf4PbH7ENu9qL5OO2Ob No+olVS4NvAxHjJUxph0JX7yfuR9elfwLduNSyBKvimLYRve/g8HL/Uwk4o4zRowOmgZ LZe6es4ySsfxWKaQQiu10g/Muih+BamuTRmqi51V78trMnst0LDNghdF3J4e0AnD9CQ0 NmfAuQtaSV7yxbJsUkv8BqVOj3qV6mVuNgxZTwWmTAm2MPVKwfUgP1433EzUdmlnPf+N sjHYafW999TQk4gf7vvyCWNq6aaAzFal0YGQqZtmFFvyaVMLcGpQr4c4IFw+RhC/qJFE klKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n25si1278410ejl.672.2021.08.24.09.23.11; Tue, 24 Aug 2021 09:23:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231285AbhHXQVn (ORCPT + 99 others); Tue, 24 Aug 2021 12:21:43 -0400 Received: from foss.arm.com ([217.140.110.172]:37894 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229712AbhHXQVn (ORCPT ); Tue, 24 Aug 2021 12:21:43 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B745431B; Tue, 24 Aug 2021 09:20:58 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.90.204]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A8BDB3F766; Tue, 24 Aug 2021 09:20:56 -0700 (PDT) Date: Tue, 24 Aug 2021 17:20:54 +0100 From: Mark Rutland To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Daniel Lezcano , Thomas Gleixner , Peter Shier , Raghavendra Rao Ananta , Ricardo Koller , Oliver Upton , Will Deacon , Catalin Marinas , Linus Walleij , kernel-team@android.com Subject: Re: [PATCH 02/13] clocksource/arm_arch_timer: Extend write side of timer register accessors to u64 Message-ID: <20210824162054.GG96738@C02TD0UTHF1T.local> References: <20210809152651.2297337-1-maz@kernel.org> <20210809152651.2297337-3-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210809152651.2297337-3-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 09, 2021 at 04:26:40PM +0100, Marc Zyngier wrote: > The various accessors for the timer sysreg and MMIO registers are > currently hardwired to 32bit. However, we are about to introduce > the use of the CVAL registers, which require a 64bit access. > > Upgrade the write side of the accessors to take a 64bit value > (the read side is left untouched as we don't plan to ever read > back any of these registers). > > No functional change expected. > > Signed-off-by: Marc Zyngier Looks good, builds cleanly, and boots fine on both arm/arm64: Reviewed-by: Mark Rutland Tested-by: Mark Rutland Mark. > --- > arch/arm/include/asm/arch_timer.h | 10 +++++----- > arch/arm64/include/asm/arch_timer.h | 2 +- > drivers/clocksource/arm_arch_timer.c | 10 +++++----- > 3 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h > index 0c09afaa590d..88075c7f4bfd 100644 > --- a/arch/arm/include/asm/arch_timer.h > +++ b/arch/arm/include/asm/arch_timer.h > @@ -24,24 +24,24 @@ int arch_timer_arch_init(void); > * the code. At least it does so with a recent GCC (4.6.3). > */ > static __always_inline > -void arch_timer_reg_write_cp15(int access, enum arch_timer_reg reg, u32 val) > +void arch_timer_reg_write_cp15(int access, enum arch_timer_reg reg, u64 val) > { > if (access == ARCH_TIMER_PHYS_ACCESS) { > switch (reg) { > case ARCH_TIMER_REG_CTRL: > - asm volatile("mcr p15, 0, %0, c14, c2, 1" : : "r" (val)); > + asm volatile("mcr p15, 0, %0, c14, c2, 1" : : "r" ((u32)val)); > break; > case ARCH_TIMER_REG_TVAL: > - asm volatile("mcr p15, 0, %0, c14, c2, 0" : : "r" (val)); > + asm volatile("mcr p15, 0, %0, c14, c2, 0" : : "r" ((u32)val)); > break; > } > } else if (access == ARCH_TIMER_VIRT_ACCESS) { > switch (reg) { > case ARCH_TIMER_REG_CTRL: > - asm volatile("mcr p15, 0, %0, c14, c3, 1" : : "r" (val)); > + asm volatile("mcr p15, 0, %0, c14, c3, 1" : : "r" ((u32)val)); > break; > case ARCH_TIMER_REG_TVAL: > - asm volatile("mcr p15, 0, %0, c14, c3, 0" : : "r" (val)); > + asm volatile("mcr p15, 0, %0, c14, c3, 0" : : "r" ((u32)val)); > break; > } > } > diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h > index 8e3b2ac60c30..107afb721749 100644 > --- a/arch/arm64/include/asm/arch_timer.h > +++ b/arch/arm64/include/asm/arch_timer.h > @@ -89,7 +89,7 @@ static inline notrace u64 arch_timer_read_cntvct_el0(void) > * the code. > */ > static __always_inline > -void arch_timer_reg_write_cp15(int access, enum arch_timer_reg reg, u32 val) > +void arch_timer_reg_write_cp15(int access, enum arch_timer_reg reg, u64 val) > { > if (access == ARCH_TIMER_PHYS_ACCESS) { > switch (reg) { > diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c > index 9db5c16e31e7..0b2bac3ef7ce 100644 > --- a/drivers/clocksource/arm_arch_timer.c > +++ b/drivers/clocksource/arm_arch_timer.c > @@ -100,27 +100,27 @@ early_param("clocksource.arm_arch_timer.evtstrm", early_evtstrm_cfg); > */ > > static __always_inline > -void arch_timer_reg_write(int access, enum arch_timer_reg reg, u32 val, > +void arch_timer_reg_write(int access, enum arch_timer_reg reg, u64 val, > struct clock_event_device *clk) > { > if (access == ARCH_TIMER_MEM_PHYS_ACCESS) { > struct arch_timer *timer = to_arch_timer(clk); > switch (reg) { > case ARCH_TIMER_REG_CTRL: > - writel_relaxed(val, timer->base + CNTP_CTL); > + writel_relaxed((u32)val, timer->base + CNTP_CTL); > break; > case ARCH_TIMER_REG_TVAL: > - writel_relaxed(val, timer->base + CNTP_TVAL); > + writel_relaxed((u32)val, timer->base + CNTP_TVAL); > break; > } > } else if (access == ARCH_TIMER_MEM_VIRT_ACCESS) { > struct arch_timer *timer = to_arch_timer(clk); > switch (reg) { > case ARCH_TIMER_REG_CTRL: > - writel_relaxed(val, timer->base + CNTV_CTL); > + writel_relaxed((u32)val, timer->base + CNTV_CTL); > break; > case ARCH_TIMER_REG_TVAL: > - writel_relaxed(val, timer->base + CNTV_TVAL); > + writel_relaxed((u32)val, timer->base + CNTV_TVAL); > break; > } > } else { > -- > 2.30.2 >