Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6838741ybf; Fri, 6 Mar 2020 05:34:56 -0800 (PST) X-Google-Smtp-Source: ADFU+vvroGqcppppH5flQGmUsFTAYRDkom+JnDWl4KaHmORVUorwu6gqIRgrQ/DDQR+0F0/WN2KE X-Received: by 2002:aca:fc44:: with SMTP id a65mr2429991oii.119.1583501696554; Fri, 06 Mar 2020 05:34:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583501696; cv=none; d=google.com; s=arc-20160816; b=cK6HJbAcXKCBNa2SXpjvxVJtxjQ2LEyfLMbSDMH2b3i5ixgawAFTpV6AuAQ+Ys5CdY 5rYVm42+yvc3DfX7b5+S6U27M2xu9y4zqeE+QjeM6MOANSADbc0JQTS0mKlc84rTz3Df ZlyoECcbXHt+pcMXHdnKE72DlLQS0k7yaWn6FsaZe5fvvnqAHhJXXT0j4nIdIbQIep/e aIkS6SdqNgJ5OX+wghsWxRQ8MRR2W4F7lFVJU9XrQirx7i3H1/Y+/uS9KOKX8MCWkfUb W9POwWRP9/DB+tLsWuvG80FOgFum58HTrDzttGcrfIhDSiknCYr/Zc1Gc5OxUFG9K1Rs fzxA== 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=qfGiJMcM+UszBV/XZBaneLfiXPu8XlBCDMp6o+p1v6A=; b=C2PuD6LjfIwtBzn8szBUDGOI7/+x/6KCqIeg7P0N2X16kJhIYuKbDiwLJnX8BFt2v5 C3YPGrDqYfAn51XGu4htiW+nxEa7+zgvRHyGqKG3H++fLI2RXgq2b/uMxcbjCHNw/jCj a1a4aL/ThkxaLZe3Uu0cUrHVNCSlZFy6Mmbg2AfhmLQC/D/XZ6DSxf9bFMrczx/JfPdG jdcpmW7hlXlJsYEpgLXbELtOEtEDXphcmZ5DOYIzTL6lamY9/W7kEZJYlYyjY4DjNdtp 4Z31YvmaYTI2aHk/ksep/BHR/lG7rQdYwPxQ+5xnxTmoxSe52lVRtHlAAWUwzvoq8vbD q60A== 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 z6si1471023oth.292.2020.03.06.05.34.44; Fri, 06 Mar 2020 05:34:56 -0800 (PST) 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 S1727592AbgCFNdx (ORCPT + 99 others); Fri, 6 Mar 2020 08:33:53 -0500 Received: from foss.arm.com ([217.140.110.172]:33892 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727581AbgCFNdv (ORCPT ); Fri, 6 Mar 2020 08:33:51 -0500 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 442584B2; Fri, 6 Mar 2020 05:33:51 -0800 (PST) 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 830793F6CF; Fri, 6 Mar 2020 05:33:48 -0800 (PST) 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, clang-built-linux@googlegroups.com, x86@kernel.org Cc: Vincenzo Frascino , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Paul Burton , Thomas Gleixner , Andy Lutomirski , Ingo Molnar , Borislav Petkov , Stephen Boyd , Mark Salyzyn , Kees Cook , Peter Collingbourne , Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Nick Desaulniers Subject: [PATCH v2 19/20] lib: vdso: Enable common headers Date: Fri, 6 Mar 2020 13:32:41 +0000 Message-Id: <20200306133242.26279-20-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306133242.26279-1-vincenzo.frascino@arm.com> References: <20200306133242.26279-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 vDSO library should only include the necessary headers required for a userspace library (UAPI and a minimal set of kernel headers). To make this possible it is necessary to isolate from the kernel headers the common parts that are strictly necessary to build the library. Refactor the unified vdso code to use the common headers. Cc: Andy Lutomirski Cc: Thomas Gleixner Signed-off-by: Vincenzo Frascino --- include/vdso/datapage.h | 32 +++++++++++++++++++++++++++++--- lib/vdso/gettimeofday.c | 21 --------------------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h index c5f347cc5e55..21842a73cbcf 100644 --- a/include/vdso/datapage.h +++ b/include/vdso/datapage.h @@ -4,9 +4,19 @@ #ifndef __ASSEMBLY__ -#include -#include -#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include #define VDSO_BASES (CLOCK_TAI + 1) #define VDSO_HRES (BIT(CLOCK_REALTIME) | \ @@ -101,6 +111,22 @@ struct vdso_data { */ extern struct vdso_data _vdso_data[CS_BASES] __attribute__((visibility("hidden"))); +/* + * The generic vDSO implementation requires that gettimeofday.h + * provides: + * - __arch_get_vdso_data(): to get the vdso datapage. + * - __arch_get_hw_counter(): to get the hw counter based on the + * clock_mode. + * - gettimeofday_fallback(): fallback for gettimeofday. + * - clock_gettime_fallback(): fallback for clock_gettime. + * - clock_getres_fallback(): fallback for clock_getres. + */ +#ifdef ENABLE_COMPAT_VDSO +#include +#else +#include +#endif /* ENABLE_COMPAT_VDSO */ + #endif /* !__ASSEMBLY__ */ #endif /* __VDSO_DATAPAGE_H */ diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index f8b8ec5e63ac..e3244f74feea 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -2,30 +2,9 @@ /* * Generic userspace implementations of gettimeofday() and similar. */ -#include -#include -#include -#include -#include #include #include -/* - * The generic vDSO implementation requires that gettimeofday.h - * provides: - * - __arch_get_vdso_data(): to get the vdso datapage. - * - __arch_get_hw_counter(): to get the hw counter based on the - * clock_mode. - * - gettimeofday_fallback(): fallback for gettimeofday. - * - clock_gettime_fallback(): fallback for clock_gettime. - * - clock_getres_fallback(): fallback for clock_getres. - */ -#ifdef ENABLE_COMPAT_VDSO -#include -#else -#include -#endif /* ENABLE_COMPAT_VDSO */ - #ifndef vdso_calc_delta /* * Default implementation which works for all sane clocksources. That -- 2.25.1