From nobody Thu Oct 2 12:06:48 2025 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 D8A792F3C21; Wed, 17 Sep 2025 14:02:22 +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=1758117744; cv=none; b=g00IwGXk+/YxBbc1NYbKLWSWMLBI2O4bk0WgEGg9FDcxPThkaWXFAJ84+8zgAfeyWVBZ1Cr5/+IXHko/fiKUuz5cstz2Lt4+B1AjnBuI1q+F3UeJjd4B8tOKrgoXVSIWaU++pdD14dKvmobbbVDaEGqdD0VZLUeHu6gadwhmUQM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758117744; c=relaxed/simple; bh=zMIzJ15FbxyFeuQIxSk4GNU8RIcZLfNhISbA3hu5yNQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PJf8eCGBuUCeUsZZDzuyltfl8e6ccU5tpl9HNSHh3PfMa6yz7AXqZ6Fg8jCNnsk4anyR7TdUQGI3QG8/FiRds99p2cYJI/JuG/mqScbMguLU+XQLar3gCVU0Z5CKHe22t9OPm6+bqP9fyCdNZRilFkgGfSO2O04AFS9HNtfVPUM= 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=Q/ql4mj7; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=+t6hmZOf; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Q/ql4mj7"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="+t6hmZOf" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1758117733; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j+biOGKKguDUuRUAhQ0+dLthYNe28/1HU1RGsMJffvw=; b=Q/ql4mj7Oqha+n1+zWFMHqf6AN0NJY+yf8D5vjlijtUN7GKN76OsAHWTo+9VOy/rJHZ2IT 4CYpfHnWdwKUM6nnKJFUpm6cpWO8kXH0qekaujtfqB+aCcrZkcxWkxzhqNXvxq6+fj0gIo RUKT/fQAG1ob6HEmhcZl4wuTdlo6E7wWmVmiw3iAZz+HC29hRnAmUMCqNQSh5L/l9zq1+F B0snSBWJgyLP//MeSZJdvLKbCEp3knyRLar+vKpkyeuXtXDCyAO84fQR1EAQsd7aoN2JM5 LKc46ePgxXh9T9KfnzDphlGm1SnT/VASy/e640MqttQAG+3jCvBZ8f78IKHFMw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1758117733; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j+biOGKKguDUuRUAhQ0+dLthYNe28/1HU1RGsMJffvw=; b=+t6hmZOfY/qlclhLwxtdQbKthvuYmaF5Oc4VwtZI8vjD3ivseTq1MjM9W5AWz+ifnnvfs1 VODjJJD3lU6k/XCg== Date: Wed, 17 Sep 2025 16:00:36 +0200 Subject: [PATCH v3 34/36] sparc64: vdso: Implement clock_gettime64() 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: quoted-printable Message-Id: <20250917-vdso-sparc64-generic-2-v3-34-3679b1bc8ee8@linutronix.de> References: <20250917-vdso-sparc64-generic-2-v3-0-3679b1bc8ee8@linutronix.de> In-Reply-To: <20250917-vdso-sparc64-generic-2-v3-0-3679b1bc8ee8@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Arnd Bergmann , "David S. Miller" , Andreas Larsson , Nick Alcock , John Stultz , Stephen Boyd , John Paul Adrian Glaubitz , Shuah Khan , Catalin Marinas , Will Deacon , Theodore Ts'o , "Jason A. Donenfeld" , Russell King , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Nagarathnam Muthusamy , Shannon Nelson Cc: linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-s390@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1758117712; l=3230; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=zMIzJ15FbxyFeuQIxSk4GNU8RIcZLfNhISbA3hu5yNQ=; b=9BbtDwHAenbMghoU6tM/Syy/OgZuKlkxcwIxGWN87y87xZOmS4MtwmZNMkF8EXZ9HCyqVMysv eVjBlZHre0vACPgZ5sMHt1rPiS2p/7jwHLAT08LAfIpGHsUqzEYgjgq X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= To be y2038-safe, 32-bit userspace needs to explicitly call the 64-bit safe time APIs. Implement clock_gettime64() in the 32-bit vDSO. Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/sparc/include/asm/vdso/gettimeofday.h | 20 ++++++++++++++++++-- arch/sparc/vdso/vclock_gettime.c | 8 ++++++++ arch/sparc/vdso/vdso32/vdso32.lds.S | 2 ++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/arch/sparc/include/asm/vdso/gettimeofday.h b/arch/sparc/includ= e/asm/vdso/gettimeofday.h index a35875fba45470ba961a7df3ae52bc17d2a4a4a0..b0c80c8a28bb71e16398ab38904= ba826457ac71d 100644 --- a/arch/sparc/include/asm/vdso/gettimeofday.h +++ b/arch/sparc/include/asm/vdso/gettimeofday.h @@ -101,6 +101,8 @@ static __always_inline u64 __arch_get_hw_counter(s32 cl= ock_mode, const struct vd "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62", \ "cc", "memory" =20 +#ifdef CONFIG_SPARC64 + static __always_inline long clock_gettime_fallback(clockid_t clock, struct __kernel_timespec *ts) { @@ -113,7 +115,20 @@ long clock_gettime_fallback(clockid_t clock, struct __= kernel_timespec *ts) return o0; } =20 -#ifndef CONFIG_SPARC64 +#else /* !CONFIG_SPARC64 */ + +static __always_inline +long clock_gettime_fallback(clockid_t clock, struct __kernel_timespec *ts) +{ + register long num __asm__("g1") =3D __NR_clock_gettime64; + register long o0 __asm__("o0") =3D clock; + register long o1 __asm__("o1") =3D (long) ts; + + __asm__ __volatile__(SYSCALL_STRING : "=3Dr" (o0) : "r" (num), + "0" (o0), "r" (o1) : SYSCALL_CLOBBERS); + return o0; +} + static __always_inline long clock_gettime32_fallback(clockid_t clock, struct old_timespec32 *ts) { @@ -125,7 +140,8 @@ long clock_gettime32_fallback(clockid_t clock, struct o= ld_timespec32 *ts) "0" (o0), "r" (o1) : SYSCALL_CLOBBERS); return o0; } -#endif + +#endif /* CONFIG_SPARC64 */ =20 static __always_inline long gettimeofday_fallback(struct __kernel_old_timeval *tv, struct timezon= e *tz) diff --git a/arch/sparc/vdso/vclock_gettime.c b/arch/sparc/vdso/vclock_gett= ime.c index 093a7ff4dafce1cf0af5af4c303bef86e159858a..1d9859392e4cfd285349cf9155c= a1fc25d3a7b41 100644 --- a/arch/sparc/vdso/vclock_gettime.c +++ b/arch/sparc/vdso/vclock_gettime.c @@ -48,4 +48,12 @@ int __vdso_clock_gettime(clockid_t clock, struct old_tim= espec32 *ts) int clock_gettime(clockid_t, struct old_timespec32 *) __weak __alias(__vdso_clock_gettime); =20 +int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts) +{ + return __cvdso_clock_gettime(clock, ts); +} + +int clock_gettime64(clockid_t, struct __kernel_timespec *) + __weak __alias(__vdso_clock_gettime64); + #endif diff --git a/arch/sparc/vdso/vdso32/vdso32.lds.S b/arch/sparc/vdso/vdso32/v= dso32.lds.S index 53575ee154c492f9503efdd8f995ac2a035203c7..a14e4f77e6f2222b855df27cc7a= 0d0a4f98bd4ac 100644 --- a/arch/sparc/vdso/vdso32/vdso32.lds.S +++ b/arch/sparc/vdso/vdso32/vdso32.lds.S @@ -17,6 +17,8 @@ VERSION { global: clock_gettime; __vdso_clock_gettime; + clock_gettime64; + __vdso_clock_gettime64; gettimeofday; __vdso_gettimeofday; local: *; --=20 2.51.0