Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp476682ybi; Fri, 21 Jun 2019 02:55:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFfLwG36Tjfars2FH1WOLIUFD4WAJTmlEgTtlHCygccow1vxu1tk/0g6+08AC4St74P/Fv X-Received: by 2002:a17:90a:9201:: with SMTP id m1mr5558340pjo.38.1561110937725; Fri, 21 Jun 2019 02:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561110937; cv=none; d=google.com; s=arc-20160816; b=b9GmyPBFvZJ5uzEm108BmDsRZl8/KhUF8PKF7wdItYltHzHOiGVry407LKaz2UUbRd JKq7K46Z3qsBO3SCAnXYIk/XW6TYkTq5dpzgAX6Yuxl+nPhvxcexZ7oP9CUiAU1+rw0G +BttcUIrWCY6TeF1ig5k0iH69uW5Cw1mSiTYMewHgs+HphmFjcGOXjjHfFLgLNxgP9Oj sZhI2bFDZ9XcIX6Q4YX+9M6svTWEMozP35O+AZYhe7J/HZubPSgjCew3090phZ+qzPuh cLwBg6yQbk91c5SEyW3SZvxNvRXK9WapmU+Mi6gUgnnCNSpJXGb9twZVkFSP/9ggTnrZ fy5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qxVDbP0JRIHtkyQhZX/S4eDAC/YYA4PQofXGTqXiOhA=; b=eT3X0RJWwo85zyW1lYvR4ZveT51RuaiaPUKZcbMKnSwPKVajmtgut49BQBzGqoHl5m Kf55q3Bj6bnqA214knLly257OuOu0OKB+3Oom3/U7tnvchygmexj2ybIHlgvWcoWWVa6 KwabI7tJbV423CIr2TJQF+7HMK1isTbrDl05N6lhNvth8wTQbQtM43FHXQedPFQ8jJao GZYw45y7JLl2vCV8qKBylAtBWfBGHrrq7PrHteLExSanbDLZglasMvZ0UMPtOmO4U7RQ AmLe4IKJBrxROmjgX81Sf/8BfodgDRlSWzGf8QWk+hsIVJuWX3XgBa9HjfiefnixtGqi vLXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si2260924plq.95.2019.06.21.02.55.22; Fri, 21 Jun 2019 02:55:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727142AbfFUJyF (ORCPT + 99 others); Fri, 21 Jun 2019 05:54:05 -0400 Received: from foss.arm.com ([217.140.110.172]:55790 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727129AbfFUJyD (ORCPT ); Fri, 21 Jun 2019 05:54:03 -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 02DA614F6; Fri, 21 Jun 2019 02:54:03 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6D9923F246; Fri, 21 Jun 2019 02:54:00 -0700 (PDT) From: Vincenzo Frascino To: linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Ralf Baechle , Paul Burton , Daniel Lezcano , Thomas Gleixner , Mark Salyzyn , Peter Collingbourne , Shuah Khan , Dmitry Safonov <0x7f454c46@gmail.com>, Rasmus Villemoes , Huw Davies , Shijith Thotton , Andre Przywara Subject: [PATCH v7 20/25] mips: Add clock_getres entry point Date: Fri, 21 Jun 2019 10:52:47 +0100 Message-Id: <20190621095252.32307-21-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190621095252.32307-1-vincenzo.frascino@arm.com> References: <20190621095252.32307-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The generic vDSO library provides an implementation of clock_getres() that can be leveraged by each architecture. Add clock_getres() entry point on mips. Cc: Ralf Baechle Cc: Paul Burton Signed-off-by: Vincenzo Frascino --- arch/mips/include/asm/vdso/gettimeofday.h | 26 +++++++++++++++++++++++ arch/mips/vdso/vdso.lds.S | 1 + arch/mips/vdso/vgettimeofday.c | 12 +++++++++++ 3 files changed, 39 insertions(+) diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h index aa20865b288b..c59fe08b0347 100644 --- a/arch/mips/include/asm/vdso/gettimeofday.h +++ b/arch/mips/include/asm/vdso/gettimeofday.h @@ -22,6 +22,8 @@ #include #include +#define VDSO_HAS_CLOCK_GETRES 1 + #ifdef CONFIG_MIPS_CLOCK_VSYSCALL static __always_inline long gettimeofday_fallback( @@ -79,6 +81,30 @@ static __always_inline long clock_gettime_fallback( return error ? -ret : ret; } +static __always_inline int clock_getres_fallback( + clockid_t _clkid, + struct __kernel_timespec *_ts) +{ + register struct __kernel_timespec *ts asm("a1") = _ts; + register clockid_t clkid asm("a0") = _clkid; + register long ret asm("v0"); +#if _MIPS_SIM == _MIPS_SIM_ABI64 + register long nr asm("v0") = __NR_clock_getres; +#else + register long nr asm("v0") = __NR_clock_getres_time64; +#endif + register long error asm("a3"); + + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (clkid), "r" (ts), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); + + return error ? -ret : ret; +} + #ifdef CONFIG_CSRC_R4K static __always_inline u64 read_r4k_count(void) diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S index 94d90c440590..ad9f2f2c0c97 100644 --- a/arch/mips/vdso/vdso.lds.S +++ b/arch/mips/vdso/vdso.lds.S @@ -95,6 +95,7 @@ VERSION global: __vdso_clock_gettime; __vdso_gettimeofday; + __vdso_clock_getres; #endif local: *; }; diff --git a/arch/mips/vdso/vgettimeofday.c b/arch/mips/vdso/vgettimeofday.c index 1c46dace041e..48e1ab32204b 100644 --- a/arch/mips/vdso/vgettimeofday.c +++ b/arch/mips/vdso/vgettimeofday.c @@ -23,6 +23,12 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, return __cvdso_gettimeofday(tv, tz); } +int __vdso_clock_getres(clockid_t clock_id, + struct old_timespec32 *res) +{ + return __cvdso_clock_getres_time32(clock_id, res); +} + #else int __vdso_clock_gettime(clockid_t clock, @@ -37,4 +43,10 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, return __cvdso_gettimeofday(tv, tz); } +int __vdso_clock_getres(clockid_t clock_id, + struct __kernel_timespec *res) +{ + return __cvdso_clock_getres(clock_id, res); +} + #endif -- 2.21.0