From patchwork Fri Mar 6 13:32:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11423947 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C16792A for ; Fri, 6 Mar 2020 13:33:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4607920866 for ; Fri, 6 Mar 2020 13:33:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NT3EUbHD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4607920866 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JAhkJa8OTkRwLC3Gc+zQErDKMEtLKZ88ikY3dD9lwM8=; b=NT3EUbHD5cAgjk Biuc3L0fpK1SQwoOsZHlGihdXBfmVQu6FS9sYqTVKBj7xfNHdJby87mH/DENIjvyTZrs/55S2AGhQ GRx/OacBMia91Wx6nTABScydte+jhnBBs0GemYiv8Qqax0xOeRFk7i1nqG2awOZgme4GeibIlCuz6 gvc2uoEyyfh4f1/5/umjgzmltkNp9RxVG0fIkCdTC3zXPTbijqBV1B9Go5Gg2c/2+QyCZ64nuRmHL eq09fG6SRdui2Su29svPpipkUiVZ4PEs6OPhLK5TqiQj95Tm4tPec41NMXaR8Spuxa82Jiu3EpN3u beopyp4N9XjT/LKKj5/Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6D-0004QR-RO; Fri, 06 Mar 2020 13:33:09 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD61-0004Dw-Qa for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:32:59 +0000 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 F04894B2; Fri, 6 Mar 2020 05:32:56 -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 3A6F73F6CF; Fri, 6 Mar 2020 05:32:54 -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 Subject: [PATCH v2 01/20] linux/const.h: Extract common header for vDSO Date: Fri, 6 Mar 2020 13:32:23 +0000 Message-Id: <20200306133242.26279-2-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053257_904394_BA4018B7 X-CRM114-Status: GOOD ( 13.28 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Split const.h into linux and common headers to make the latter suitable for inclusion in the vDSO library. Signed-off-by: Vincenzo Frascino --- include/common/const.h | 10 ++++++++++ include/linux/const.h | 5 +---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 include/common/const.h diff --git a/include/common/const.h b/include/common/const.h new file mode 100644 index 000000000000..cc209eec47a1 --- /dev/null +++ b/include/common/const.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __COMMON_CONST_H +#define __COMMON_CONST_H + +#include + +#define UL(x) (_UL(x)) +#define ULL(x) (_ULL(x)) + +#endif /* __COMMON_CONST_H */ diff --git a/include/linux/const.h b/include/linux/const.h index 7b55a55f5911..447a5b98d5a3 100644 --- a/include/linux/const.h +++ b/include/linux/const.h @@ -1,9 +1,6 @@ #ifndef _LINUX_CONST_H #define _LINUX_CONST_H -#include - -#define UL(x) (_UL(x)) -#define ULL(x) (_ULL(x)) +#include #endif /* _LINUX_CONST_H */ From patchwork Fri Mar 6 13:32:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11423957 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1295B138D for ; Fri, 6 Mar 2020 13:33:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E4E71206D5 for ; Fri, 6 Mar 2020 13:33:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LgxBeYE3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4E71206D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9ioBBaeBEavJYTUSUYRhMaw0u8wnpmZBCDoCKMNLy7s=; b=LgxBeYE3ZcpStE FKMixTtsCVZkkGPbN/Htxamvs9WiW8Gww2D4zWkvcLTsT7lNtITzNFK6ZHb6/3MNZlE5WCX8VUNHB T3eFHTk/uUCU/OE/yS/yrGvoG/QqG1anPUlLd+ZRLsF/CMAdGvkCyDIqSEZjqgXx8mKeuixLX6T4e b4nvYiOGPjycZlZGlUHsPxwEGqgqM2cVjeaIyS4X3oGeXCqm+Fmt0x88Uha9fhha0S35TUpUI9PrL D1+ZHdiCYSwFNsTh88KIlYtqOfEtKFbv8hg4AT1BC6nx/P1KFe8yi6QSsyIQbXT1qFGxlqlPnLMvS MmmFlK7+31wa2Rx6YdZg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6Z-0004lq-HY; Fri, 06 Mar 2020 13:33:31 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD64-0004GD-HK for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:01 +0000 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 E6469101E; Fri, 6 Mar 2020 05:32:59 -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 3201D3F6CF; Fri, 6 Mar 2020 05:32:57 -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 Subject: [PATCH v2 02/20] linux/bits.h: Extract common header for vDSO Date: Fri, 6 Mar 2020 13:32:24 +0000 Message-Id: <20200306133242.26279-3-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053300_647331_71A3DBA9 X-CRM114-Status: GOOD ( 13.78 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Split bits.h into linux and common headers to make the latter suitable for inclusion in the vDSO library. Signed-off-by: Vincenzo Frascino --- include/common/bits.h | 9 +++++++++ include/linux/bits.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 include/common/bits.h diff --git a/include/common/bits.h b/include/common/bits.h new file mode 100644 index 000000000000..6da493992e52 --- /dev/null +++ b/include/common/bits.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __COMMON_BITS_H +#define __COMMON_BITS_H + +#include + +#define BIT(nr) (UL(1) << (nr)) + +#endif /* __COMMON_BITS_H */ diff --git a/include/linux/bits.h b/include/linux/bits.h index 669d69441a62..aeb76fede77a 100644 --- a/include/linux/bits.h +++ b/include/linux/bits.h @@ -3,9 +3,9 @@ #define __LINUX_BITS_H #include +#include #include -#define BIT(nr) (UL(1) << (nr)) #define BIT_ULL(nr) (ULL(1) << (nr)) #define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG)) #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) From patchwork Fri Mar 6 13:32:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11423969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64341138D for ; Fri, 6 Mar 2020 13:33:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 326D220848 for ; Fri, 6 Mar 2020 13:33:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="j/qnJ0w1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 326D220848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wRgw0c/yE0lUzh0fGRYu8zFsjqxAHgIadTJqCdk+VhU=; b=j/qnJ0w1GcKLFU 4dy2kTK/NqS0jxr35rX9/1XWbabs5lGoypkdP0hmVtuB/Hei7aueiERZpavbmRVa+IzMA22jrmGKZ 7ZJP6ZfrrhtN3CCW12xiYIacBaeO/vmZjHqCD4O1cWbnNc7UlPk1ESFwJIAZysQUdxU3KdPx7Hxbd CFp6FxvAehZCqwXOlTgKqz7F0UGSdYIgUszqBLoD4iUJuaQ/+mDnfgyygAcf+nrmQXtUnT5CVvW2w otZRMIXAkBdNFgVIEuIaPHUSx29YGhJEFB5+90byvAYRBF04KvuKfm4a0zIRVFqgAHk+LNhLfmLj5 uEyWCWqFUTY69WPsYzmQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6v-00058Z-FY; Fri, 06 Mar 2020 13:33:53 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD67-0004JR-9v for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:04 +0000 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 DC9E81063; Fri, 6 Mar 2020 05:33:02 -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 2794E3F6CF; Fri, 6 Mar 2020 05:33:00 -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 Subject: [PATCH v2 03/20] linux/limits.h: Extract common header for vDSO Date: Fri, 6 Mar 2020 13:32:25 +0000 Message-Id: <20200306133242.26279-4-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053303_408493_3D7E0AB8 X-CRM114-Status: GOOD ( 13.12 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Split limits.h into linux and common headers to make the latter suitable for inclusion in the vDSO library. Signed-off-by: Vincenzo Frascino --- include/common/limits.h | 18 ++++++++++++++++++ include/linux/limits.h | 13 +------------ 2 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 include/common/limits.h diff --git a/include/common/limits.h b/include/common/limits.h new file mode 100644 index 000000000000..587269010add --- /dev/null +++ b/include/common/limits.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __COMMON_LIMITS_H +#define __COMMON_LIMITS_H + +#define USHRT_MAX ((unsigned short)~0U) +#define SHRT_MAX ((short)(USHRT_MAX >> 1)) +#define SHRT_MIN ((short)(-SHRT_MAX - 1)) +#define INT_MAX ((int)(~0U >> 1)) +#define INT_MIN (-INT_MAX - 1) +#define UINT_MAX (~0U) +#define LONG_MAX ((long)(~0UL >> 1)) +#define LONG_MIN (-LONG_MAX - 1) +#define ULONG_MAX (~0UL) +#define LLONG_MAX ((long long)(~0ULL >> 1)) +#define LLONG_MIN (-LLONG_MAX - 1) +#define ULLONG_MAX (~0ULL) + +#endif /* __COMMON_LIMITS_H */ diff --git a/include/linux/limits.h b/include/linux/limits.h index 76afcd24ff8c..ac20d2b2edd9 100644 --- a/include/linux/limits.h +++ b/include/linux/limits.h @@ -4,19 +4,8 @@ #include #include +#include -#define USHRT_MAX ((unsigned short)~0U) -#define SHRT_MAX ((short)(USHRT_MAX >> 1)) -#define SHRT_MIN ((short)(-SHRT_MAX - 1)) -#define INT_MAX ((int)(~0U >> 1)) -#define INT_MIN (-INT_MAX - 1) -#define UINT_MAX (~0U) -#define LONG_MAX ((long)(~0UL >> 1)) -#define LONG_MIN (-LONG_MAX - 1) -#define ULONG_MAX (~0UL) -#define LLONG_MAX ((long long)(~0ULL >> 1)) -#define LLONG_MIN (-LLONG_MAX - 1) -#define ULLONG_MAX (~0ULL) #define SIZE_MAX (~(size_t)0) #define PHYS_ADDR_MAX (~(phys_addr_t)0) From patchwork Fri Mar 6 13:32:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11423979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1074F92A for ; Fri, 6 Mar 2020 13:34:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E11AB20848 for ; Fri, 6 Mar 2020 13:34:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="H6yKA21o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E11AB20848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pHZVThsfY6ksxFWZrXxGeYnU2usOI/G0Ub2vE8e7gZg=; b=H6yKA21o1FW4rs /YkcSRnfl0HzhiKIIEJUq5qEP0Ut3zog/52DUuA0zuAW4r5kQ56qBgtP+e45H5X2bYQ8fCYyomecj kCO2Q6yFZ2wXJ73PXTAgGPtep9lR9twZAAs6xprkUbBYClFiW9U/WIzw8sbaan9kMTeSHA3/ONPuk MbZVWWtO8EeQTtmajbZ8r3cH/OW3o2AbeaZVfYD7lEt0zgNa7ALMK/YHlZ8F1hFGwOcA+FO7keMQM r3Kp0Dhto7NePmvcGnQK2XPyHByP1H6ek7cwhfxQY+ywNNvY6m7S0RItEyrYHPNzp1Tt4mrk8lj2u ZCcYiWRs8gXtOIriPhpQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD78-0005NP-T1; Fri, 06 Mar 2020 13:34:06 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6A-0004N2-EG for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:08 +0000 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 D26A131B; Fri, 6 Mar 2020 05:33:05 -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 1E0EE3F6CF; Fri, 6 Mar 2020 05:33:03 -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 Subject: [PATCH v2 04/20] linux/math64.h: Extract common header for vDSO Date: Fri, 6 Mar 2020 13:32:26 +0000 Message-Id: <20200306133242.26279-5-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053306_532441_866B0B0F X-CRM114-Status: GOOD ( 16.56 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Split math64.h into linux and common headers to make the latter suitable for inclusion in the vDSO library. Signed-off-by: Vincenzo Frascino --- include/common/math64.h | 24 ++++++++++++++++++++++++ include/linux/math64.h | 20 +------------------- 2 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 include/common/math64.h diff --git a/include/common/math64.h b/include/common/math64.h new file mode 100644 index 000000000000..4e1870e40182 --- /dev/null +++ b/include/common/math64.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __COMMON_MATH64_H +#define __COMMON_MATH64_H + +static __always_inline u32 +__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) +{ + u32 ret = 0; + + while (dividend >= divisor) { + /* The following asm() prevents the compiler from + optimising this loop into a modulo operation. */ + asm("" : "+rm"(dividend)); + + dividend -= divisor; + ret++; + } + + *remainder = dividend; + + return ret; +} + +#endif /* __COMMON_MATH64_H */ diff --git a/include/linux/math64.h b/include/linux/math64.h index 65bef21cdddb..54eb486b5d1a 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h @@ -3,6 +3,7 @@ #define _LINUX_MATH64_H #include +#include #include #if BITS_PER_LONG == 64 @@ -142,25 +143,6 @@ static inline s64 div_s64(s64 dividend, s32 divisor) u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder); -static __always_inline u32 -__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) -{ - u32 ret = 0; - - while (dividend >= divisor) { - /* The following asm() prevents the compiler from - optimising this loop into a modulo operation. */ - asm("" : "+rm"(dividend)); - - dividend -= divisor; - ret++; - } - - *remainder = dividend; - - return ret; -} - #ifndef mul_u32_u32 /* * Many a GCC version messes this up and generates a 64x64 mult :-( From patchwork Fri Mar 6 13:32:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424003 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96E6F92A for ; Fri, 6 Mar 2020 13:34:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E3B7208C3 for ; Fri, 6 Mar 2020 13:34:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K6UddjNv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E3B7208C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ADgjJNPWGjPyU5UahY7CS5MrrNdqIPYOZ6mUfkYM/Ww=; b=K6UddjNv4lWeW7 YjT1NM3yV4ahxG5wbDuHMKmNhWfkaU8FlcTlbZ4b7mMHRvJwUQ8Nm+mfwmc9X8Z90ptGUE6BR5Hab MSaAKWMkHD0cbIEloOMCdsVnZmHfUCR50nmnVeyNZfAGYAIV8BcUN2ooOhKikQyTU2kdUJgmnmLKk 59baRIaKFLu+xJhLbYjm4d9ZblJXgZOK1qyHfmMOU5p0KwqHVwvyPLxQKYTV8TWoepX/wVMc65jvP +nDOsMON7Es4azxdNEvL4XOshCMJUqCh9KOzQKwbgLM/dLjyTm1thf4AV0iJiJ4hc4V41rXyi2ZlA cqWrImL/s8AmFD0W+9EA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD7V-0005lq-IN; Fri, 06 Mar 2020 13:34:29 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6D-0004Qa-MR for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:11 +0000 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 C83834B2; Fri, 6 Mar 2020 05:33:08 -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 13A6D3F6CF; Fri, 6 Mar 2020 05:33:05 -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 Subject: [PATCH v2 05/20] linux/time.h: Extract common header for vDSO Date: Fri, 6 Mar 2020 13:32:27 +0000 Message-Id: <20200306133242.26279-6-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053309_839638_DA4812A2 X-CRM114-Status: GOOD ( 13.38 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Split time.h into linux and common headers to make the latter suitable for inclusion in the vDSO library. Signed-off-by: Vincenzo Frascino --- include/common/time.h | 12 ++++++++++++ include/linux/time.h | 5 +---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 include/common/time.h diff --git a/include/common/time.h b/include/common/time.h new file mode 100644 index 000000000000..90eb9bdb40ec --- /dev/null +++ b/include/common/time.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __COMMON_TIME_H +#define __COMMON_TIME_H + +#include + +struct timens_offset { + s64 sec; + u64 nsec; +}; + +#endif /* __COMMON_TIME_H */ diff --git a/include/linux/time.h b/include/linux/time.h index 8ef5e5cc9f57..617a01e2c8bb 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -111,9 +111,6 @@ static inline bool itimerspec64_valid(const struct itimerspec64 *its) */ #define time_between32(t, l, h) ((u32)(h) - (u32)(l) >= (u32)(t) - (u32)(l)) -struct timens_offset { - s64 sec; - u64 nsec; -}; +# include #endif From patchwork Fri Mar 6 13:32:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424005 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 92DBE138D for ; Fri, 6 Mar 2020 13:34:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6C95E206D5 for ; Fri, 6 Mar 2020 13:34:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Gqpuc23r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C95E206D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KLOAxmLCePUfksw8rOpTHZx6um2SuikSDOrWlXy28Zw=; b=Gqpuc23rSAE/Jd jlPkG12GTiE5eigudwQYqYaZ9Idav/LPr1R6XxVjeQEAOypDkzcMhNhAxoO14DY33sKUGKJcriWZP b1T+4lv/Z4u9AjNj/VijlLpDinf8N/a0CNkbU49jNHbfKCp346WTT2d73DANkgRZnxYycui1yHFFq ewT7OiHc3NTgozEY4lwfF7Ne8CqV0k6K63c6Z9R1tvfMimsmOMG4nzinEmVqlBFVhT0mhOwxpzCgS VZyZU8HwcGbmMfC9ORw/W8OvgXGz488XMH5eyYb+8y7fprtsZhyJdsvzFsXIZm5vOQOnOS0zyfeBZ uwk0CFto1CTxfkMkTL5A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD7e-0005xO-SV; Fri, 06 Mar 2020 13:34:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6G-0004U0-Po for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:14 +0000 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 BF0E1101E; Fri, 6 Mar 2020 05:33:11 -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 0971D3F6CF; Fri, 6 Mar 2020 05:33:08 -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 Subject: [PATCH v2 06/20] linux/time32.h: Extract common header for vDSO Date: Fri, 6 Mar 2020 13:32:28 +0000 Message-Id: <20200306133242.26279-7-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053312_895097_017694C7 X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Split time32.h into linux and common headers to make the latter suitable for inclusion in the vDSO library. Signed-off-by: Vincenzo Frascino --- include/common/time32.h | 17 +++++++++++++++++ include/linux/time32.h | 13 +------------ 2 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 include/common/time32.h diff --git a/include/common/time32.h b/include/common/time32.h new file mode 100644 index 000000000000..d5b85abdfaf1 --- /dev/null +++ b/include/common/time32.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __COMMON_TIME32_H +#define __COMMON_TIME32_H + +typedef s32 old_time32_t; + +struct old_timespec32 { + old_time32_t tv_sec; + s32 tv_nsec; +}; + +struct old_timeval32 { + old_time32_t tv_sec; + s32 tv_usec; +}; + +#endif /* __COMMON_TIME32_H */ diff --git a/include/linux/time32.h b/include/linux/time32.h index cf9320cd2d0b..e75dd5f9df8f 100644 --- a/include/linux/time32.h +++ b/include/linux/time32.h @@ -11,18 +11,7 @@ #include #include - -typedef s32 old_time32_t; - -struct old_timespec32 { - old_time32_t tv_sec; - s32 tv_nsec; -}; - -struct old_timeval32 { - old_time32_t tv_sec; - s32 tv_usec; -}; +#include struct old_itimerspec32 { struct old_timespec32 it_interval; From patchwork Fri Mar 6 13:32:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DBC90138D for ; Fri, 6 Mar 2020 13:35:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B5439206D5 for ; Fri, 6 Mar 2020 13:35:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZYTMNNcv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5439206D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tMTAeRLnIOVva9r1lnD/QYMRTo6mmYpJWNaZX+Dcvgo=; b=ZYTMNNcvugZCt5 udtCOIqo+/4eYLbz9yi0RI5OkxwDXiDVwddxrCeUtbk3DvnQWvTH7V9SqzWND7WTtDvA4RTCmatSe iZiUoa7WUzjQQcD99dl2a8cEornwiCdXiy/JSeX63GbvcMeEx7vqfEfuVu6YnmXcnEUZhiS+ATi8Z clIEBYFjDy5E+W4KBIvgQuh8aPIKawTSEfppqsqj6JjyOBGkGTZd+vfuUz6vruKpP1rOvY6fkIgBg xQmQbnGE6oejvjjkaJNMlV/4yy5glnPhcSjuKayO5DxcvvnO4yRMJkChxQWN7iEpqLr45JkEVQZYf Xmdl1+b2Kj+l2JJm571Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD7x-0006Ez-QO; Fri, 06 Mar 2020 13:34:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6J-0004X7-RD for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:17 +0000 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 B900A31B; Fri, 6 Mar 2020 05:33:14 -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 00F583F6CF; Fri, 6 Mar 2020 05:33:11 -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 Subject: [PATCH v2 07/20] linux/time64.h: Extract common header for vDSO Date: Fri, 6 Mar 2020 13:32:29 +0000 Message-Id: <20200306133242.26279-8-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053315_938386_803696B4 X-CRM114-Status: GOOD ( 14.29 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Split time64.h into linux and common headers to make the latter suitable for inclusion in the vDSO library. Signed-off-by: Vincenzo Frascino --- include/common/time64.h | 14 ++++++++++++++ include/linux/time64.h | 10 +--------- 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 include/common/time64.h diff --git a/include/common/time64.h b/include/common/time64.h new file mode 100644 index 000000000000..ff5a72fafb30 --- /dev/null +++ b/include/common/time64.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __COMMON_TIME64_H +#define __COMMON_TIME64_H + +/* Parameters used to convert the timespec values: */ +#define MSEC_PER_SEC 1000L +#define USEC_PER_MSEC 1000L +#define NSEC_PER_USEC 1000L +#define NSEC_PER_MSEC 1000000L +#define USEC_PER_SEC 1000000L +#define NSEC_PER_SEC 1000000000L +#define FSEC_PER_SEC 1000000000000000LL + +#endif /* __COMMON_TIME64_H */ diff --git a/include/linux/time64.h b/include/linux/time64.h index 19125489ae94..3d8b3739e885 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h @@ -3,6 +3,7 @@ #define _LINUX_TIME64_H #include +#include typedef __s64 time64_t; typedef __u64 timeu64_t; @@ -19,15 +20,6 @@ struct itimerspec64 { struct timespec64 it_value; }; -/* Parameters used to convert the timespec values: */ -#define MSEC_PER_SEC 1000L -#define USEC_PER_MSEC 1000L -#define NSEC_PER_USEC 1000L -#define NSEC_PER_MSEC 1000000L -#define USEC_PER_SEC 1000000L -#define NSEC_PER_SEC 1000000000L -#define FSEC_PER_SEC 1000000000000000LL - /* Located here for timespec[64]_valid_strict */ #define TIME64_MAX ((s64)~((u64)1 << 63)) #define TIME64_MIN (-TIME64_MAX - 1) From patchwork Fri Mar 6 13:32:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424009 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 340F392A for ; Fri, 6 Mar 2020 13:35:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D96720848 for ; Fri, 6 Mar 2020 13:35:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oKP4cxOp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D96720848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+1+70P+gSSSSn+nn96va6Tpq7QgvY2VVSt37u4rG9HE=; b=oKP4cxOpq2j78m FrDzjVwdRB4pta+ZRJgpy7TitYDWjsA+2/fVULWtFoOqOLoTsw1U0vc0pEkOG474yR/ZUdsLmbKJy VfnHW+CD8cskK5O0/5exFoLm68qSb8EOdRd4m9XYTU9ZoTdpqVDzsNrEfu5MMIIbwvb8+M0QyM5qo p5cOEPgdLIxPCNDNJ7fIx/BMEElkIVdV6crbQfO/owzys7Uu+1GORa7LGMYiE0YRFNdMbRTL9zbPi oUnuy4XrieK9M0vT2bPApYxiRtjheLPlm5bOCtGmWYL91J2KeTWoKixbSWLUo5nzQ8wy5SV8hxpil vEZothCtVVZ4x5VxVX3Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD8H-0007gU-3j; Fri, 06 Mar 2020 13:35:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6M-0004aE-5Q for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:19 +0000 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 AE5DD4B2; Fri, 6 Mar 2020 05:33:17 -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 ECC3E3F6CF; Fri, 6 Mar 2020 05:33:14 -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 Subject: [PATCH v2 08/20] linux/jiffies.h: Extract common header for vDSO Date: Fri, 6 Mar 2020 13:32:30 +0000 Message-Id: <20200306133242.26279-9-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053318_258140_BA51D274 X-CRM114-Status: GOOD ( 14.28 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Split jiffies.h into linux and common headers to make the latter suitable for inclusion in the vDSO library. Signed-off-by: Vincenzo Frascino --- include/common/jiffies.h | 11 +++++++++++ include/linux/jiffies.h | 4 +--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 include/common/jiffies.h diff --git a/include/common/jiffies.h b/include/common/jiffies.h new file mode 100644 index 000000000000..ff0207f00550 --- /dev/null +++ b/include/common/jiffies.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __COMMON_JIFFIES_H +#define __COMMON_JIFFIES_H + +#include /* for HZ */ +#include + +/* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */ +#define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ) + +#endif /* __COMMON_JIFFIES_H */ diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index e3279ef24d28..710539d1e39b 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -8,6 +8,7 @@ #include #include #include +#include #include /* for HZ */ #include @@ -59,9 +60,6 @@ extern int register_refined_jiffies(long clock_tick_rate); -/* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */ -#define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ) - /* TICK_USEC is the time between ticks in usec assuming SHIFTED_HZ */ #define TICK_USEC ((USEC_PER_SEC + HZ/2) / HZ) From patchwork Fri Mar 6 13:32:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424011 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8292A92A for ; Fri, 6 Mar 2020 13:35:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CB78206D5 for ; Fri, 6 Mar 2020 13:35:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l8VYvPMa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CB78206D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Lxtxkq92ZaP6P7dgsvJkCGXgC9eXcNIYi4By+QubTz4=; b=l8VYvPMaDG7gQp jTcagDk5Fm1JtckoXkRbDQHvKyb2NheJbjyrJxeC9fAWyPvgZQ9FHvS0IPwBOss2BUFPC9QfNA2Qw XQqizdjjdKx/u+uSeJouPtc/mRACoEkwatvp2WJJk1PglkryX4eKnzN9Q7k/DuD4blwUdR0d9m1og QhvDhl8elGi9AOprZNy1QQNBBEmH8NIjpEHmU5fsoExN3S7JWgeUa5/4oeB7LuD+EXvyBSBFFWckP csPixvmzmRccOBQk5hwfswU4oxYrtvQvdM4RnpPU8m56nllKNcc3r/yVlMyPqrKaPeHp98lLB+sCt jcvPzTgGsKGzQrCIz3Uw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD8Z-0007xi-Le; Fri, 06 Mar 2020 13:35:35 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6P-0004dv-JA for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:23 +0000 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 A70D81063; Fri, 6 Mar 2020 05:33:20 -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 E57DA3F6CF; Fri, 6 Mar 2020 05:33:17 -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 Subject: [PATCH v2 09/20] linux/ktime.h: Extract common header for vDSO Date: Fri, 6 Mar 2020 13:32:31 +0000 Message-Id: <20200306133242.26279-10-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053321_685062_23228117 X-CRM114-Status: GOOD ( 14.94 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Split ktime.h into linux and common headers to make the latter suitable for inclusion in the vDSO library. Signed-off-by: Vincenzo Frascino --- include/common/ktime.h | 16 ++++++++++++++++ include/linux/ktime.h | 9 +-------- 2 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 include/common/ktime.h diff --git a/include/common/ktime.h b/include/common/ktime.h new file mode 100644 index 000000000000..4dd6c6762ad4 --- /dev/null +++ b/include/common/ktime.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __COMMON_KTIME_H +#define __COMMON_KTIME_H + +#include + +/* + * The resolution of the clocks. The resolution value is returned in + * the clock_getres() system call to give application programmers an + * idea of the (in)accuracy of timers. Timer values are rounded up to + * this resolution values. + */ +#define LOW_RES_NSEC TICK_NSEC +#define KTIME_LOW_RES (LOW_RES_NSEC) + +#endif /* __COMMON_KTIME_H */ diff --git a/include/linux/ktime.h b/include/linux/ktime.h index d1fb05135665..c456b33c80e1 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -216,14 +216,7 @@ static inline __must_check bool ktime_to_timespec64_cond(const ktime_t kt, } } -/* - * The resolution of the clocks. The resolution value is returned in - * the clock_getres() system call to give application programmers an - * idea of the (in)accuracy of timers. Timer values are rounded up to - * this resolution values. - */ -#define LOW_RES_NSEC TICK_NSEC -#define KTIME_LOW_RES (LOW_RES_NSEC) +#include static inline ktime_t ns_to_ktime(u64 ns) { From patchwork Fri Mar 6 13:32:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424015 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B52992A for ; Fri, 6 Mar 2020 13:36:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 260E2206CC for ; Fri, 6 Mar 2020 13:36:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="I3FjISD4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 260E2206CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gk69/645Mw9O7F+OK4A7TrAw3brO/rnfYDj+B5LeidI=; b=I3FjISD4YBD+KL ttFviW3okgOv4Fbiy88h7rDZq8lTX932+imI8MuFcNBVJ52b8hGtDvKS0y4c/6f+/p7w8sz8p9woq EJpeF2vyfeDYCOm4PF2d+Sut5zOrXPk8NQX7/GO40uYaY9GwbuPuUaMul3sbVI6jnnyil0lDRuX5L 3SBXKyoI758t+y07h6Hl3IhqeSDyqPQukhcjCwK17dxzuzY2WZqVb52JHDkBPJIIgErxjG/yNvwcS k+vxx6W6cun1ElzirWmB3C0QLXlNBSFbxowHJifG45GkSrPHOjOKas4O8LtaSuoSYb7qQ8HXvEdOK AlM/XLocaH2NAX8PU4hw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD92-0008RV-U6; Fri, 06 Mar 2020 13:36:04 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6S-0004ge-IR for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:29 +0000 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 9F9CA31B; Fri, 6 Mar 2020 05:33:23 -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 DCD743F6CF; Fri, 6 Mar 2020 05:33:20 -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 Subject: [PATCH v2 10/20] common: Introduce processor.h Date: Fri, 6 Mar 2020 13:32:32 +0000 Message-Id: <20200306133242.26279-11-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053324_769392_F4174562 X-CRM114-Status: GOOD ( 12.07 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Introduce processor.h to contain all the processor specific functions that are suitable for vDSO inclusion. Signed-off-by: Vincenzo Frascino --- include/common/processor.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 include/common/processor.h diff --git a/include/common/processor.h b/include/common/processor.h new file mode 100644 index 000000000000..f9f971cb4235 --- /dev/null +++ b/include/common/processor.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2020 ARM Ltd. + */ +#ifndef __COMMON_PROCESSOR_H +#define __COMMON_PROCESSOR_H + +#ifndef __ASSEMBLY__ + +#include + +#endif /* __ASSEMBLY__ */ + +#endif /* __COMMON_PROCESSOR_H */ From patchwork Fri Mar 6 13:32:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424013 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9806892A for ; Fri, 6 Mar 2020 13:35:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A3D6206CC for ; Fri, 6 Mar 2020 13:35:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FkhB50fq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A3D6206CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9oRNwpHfCp/NPZxqP52Rc4tLXNsV2EHUe1bB0GExeRo=; b=FkhB50fqt/k7Br uc+ph6yLXOfXxHK1tgLVvHJfW20x78DZ8BDx4oKWq14pV4zEs8MJSxVKPHLQ7rCotTD2RGeIuJO44 pjmOL8UQZnxGHODJ9slFPdd6/ldI5YRHx+xiTEbIiyap77OIQczdktPeeiR2Bs98ztZkjHy3m6Go+ IHmWbyKNzhnBsTqCP3W0FMcvk66uIBYiRatRUJAcTCECSx1N/yNIozEfa7/xrPzs9rvDPyhuEtdyJ PP2nBAQcLvG6eyrICM6aLb4fVqg+oFbRm474gdRY7WGxJLQP/2QDxAzoFH2S5MRrTqHmpyP2pY8ng veI7R3DHOHOoqYrYbHIQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD8p-0008Cv-6F; Fri, 06 Mar 2020 13:35:51 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6V-0004jL-7x for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:29 +0000 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 96D9F4B2; Fri, 6 Mar 2020 05:33:26 -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 D58623F6CF; Fri, 6 Mar 2020 05:33:23 -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 Subject: [PATCH v2 11/20] linux/elfnote.h: Replace elf.h with UAPI equivalent Date: Fri, 6 Mar 2020 13:32:33 +0000 Message-Id: <20200306133242.26279-12-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053327_410995_B5A96CEC X-CRM114-Status: GOOD ( 13.04 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Replace linux/elf.h with UAPI equivalent in elfnote.h to make the header suitable for vDSO inclusion. Signed-off-by: Vincenzo Frascino Reported-by: kbuild test robot --- include/linux/elfnote.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h index f236f5b931b2..594d4e78654f 100644 --- a/include/linux/elfnote.h +++ b/include/linux/elfnote.h @@ -59,7 +59,7 @@ ELFNOTE_END #else /* !__ASSEMBLER__ */ -#include +#include /* * Use an anonymous structure which matches the shape of * Elf{32,64}_Nhdr, but includes the name and desc data. The size and From patchwork Fri Mar 6 13:32:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424017 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E586D138D for ; Fri, 6 Mar 2020 13:36:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C32D2206CC for ; Fri, 6 Mar 2020 13:36:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WuU0hZGI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C32D2206CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8g3q0VtBKrlA5HSThnFgjQsqJfk7dBrt8cRVw8eYSz0=; b=WuU0hZGINfn/qJ HmSjcAn3lRdmDP8e5rFpIaVp4KDpI5p7UUYifk42J6kJKPWZ8PxqP8WVGNJrL+C6NW0wRFflE9tIj ETvWFDU7hhKGIytVlJmo5DbjrQUKq1ElX732V9iEACAKvhqkruTHOQGYA/aC36RnoxgRsye0K6yUS PfQ73Wz9gtCbsfIL3LvwSQBZ2eiNZZt81X6Eb7bxE8saEU8aeH0x1A1G8BG+ygbLJYctFrr1B9SSF iXW8kgNI0lAr7erktJDF3iUfsUreik9H5iMqxmNA6PFFH3PSXOpEhUzFSM/uhi8oodBFSsS1+Bbki 9o5EaePzd21kdKQV+wpg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD9L-0000RZ-O2; Fri, 06 Mar 2020 13:36:23 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6Y-0004m6-BE for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:32 +0000 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 A91361063; Fri, 6 Mar 2020 05:33:29 -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 CD8843F6CF; Fri, 6 Mar 2020 05:33:26 -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 Subject: [PATCH v2 12/20] arm64: Introduce asm/common/processor.h Date: Fri, 6 Mar 2020 13:32:34 +0000 Message-Id: <20200306133242.26279-13-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053330_488732_22986C1C X-CRM114-Status: GOOD ( 14.74 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Introduce asm/common/processor.h to contain all the arm64 specific functions that are suitable for vDSO inclusion. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/common/processor.h | 31 +++++++++++++++++++++++ arch/arm64/include/asm/processor.h | 16 ++---------- 2 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 arch/arm64/include/asm/common/processor.h diff --git a/arch/arm64/include/asm/common/processor.h b/arch/arm64/include/asm/common/processor.h new file mode 100644 index 000000000000..d02b0f392923 --- /dev/null +++ b/arch/arm64/include/asm/common/processor.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2020 ARM Ltd. + */ +#ifndef __ASM_COMMON_PROCESSOR_H +#define __ASM_COMMON_PROCESSOR_H + +#ifndef __ASSEMBLY__ + +#include + +#ifdef CONFIG_COMPAT +#if defined(CONFIG_ARM64_64K_PAGES) && defined(CONFIG_KUSER_HELPERS) +/* + * With CONFIG_ARM64_64K_PAGES enabled, the last page is occupied + * by the compat vectors page. + */ +#define TASK_SIZE_32 UL(0x100000000) +#else +#define TASK_SIZE_32 (UL(0x100000000) - PAGE_SIZE) +#endif /* CONFIG_ARM64_64K_PAGES */ +#endif /* CONFIG_COMPAT */ + +static inline void cpu_relax(void) +{ + asm volatile("yield" ::: "memory"); +} + +#endif /* __ASSEMBLY__ */ + +#endif /* __ASM_COMMON_PROCESSOR_H */ diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 5ba63204d078..2866afc33f24 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -28,6 +28,8 @@ #include #include +#include + #include #include #include @@ -47,15 +49,6 @@ #define TASK_SIZE_64 (UL(1) << vabits_actual) #ifdef CONFIG_COMPAT -#if defined(CONFIG_ARM64_64K_PAGES) && defined(CONFIG_KUSER_HELPERS) -/* - * With CONFIG_ARM64_64K_PAGES enabled, the last page is occupied - * by the compat vectors page. - */ -#define TASK_SIZE_32 UL(0x100000000) -#else -#define TASK_SIZE_32 (UL(0x100000000) - PAGE_SIZE) -#endif /* CONFIG_ARM64_64K_PAGES */ #define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ TASK_SIZE_32 : TASK_SIZE_64) #define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \ @@ -256,11 +249,6 @@ extern void release_thread(struct task_struct *); unsigned long get_wchan(struct task_struct *p); -static inline void cpu_relax(void) -{ - asm volatile("yield" ::: "memory"); -} - /* Thread switching */ extern struct task_struct *cpu_switch_to(struct task_struct *prev, struct task_struct *next); From patchwork Fri Mar 6 13:32:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424019 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7BC0A138D for ; Fri, 6 Mar 2020 13:36:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41D8C2072D for ; Fri, 6 Mar 2020 13:36:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XxX1b/nU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41D8C2072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9ONg3mwdxfy7hO+BCNEoz2I5FJBN73FhV2aJ+r4gqYE=; b=XxX1b/nU7ZjgWx bGpRa0AD1Wd8+xDHKIkHwv99NsdGh16E/4IGEkCC+1oH0meOco1fN7idaE/KLKsrMyz0AqygoK8ii XgmN/27Akgx45vQ8KFOXtin2JyUO0MUjz3zqRAef5H6fCkpinQtcKSxegBkE4Mu8D+V8MaIc2XTHN SuefGP4C+/hGDXrM74ON7M9wxoSp7ZmBJ6K8YoZ9so1sOJt4T5OIhx6BTlJkwKhnIHRA6NLSe7ARE lufcYBIPvtRZ7Ws0WLxHP/IHK6WueO02mQCw0+4tycZpgCe7bNxf/EcUGY8dp8IsD3bF42PKNrurh UZdMsw1YYejiwKXXUvXg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD9h-0000mc-8T; Fri, 06 Mar 2020 13:36:45 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6b-0004pW-73 for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:34 +0000 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 BDA7231B; Fri, 6 Mar 2020 05:33:32 -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 DF1373F6CF; Fri, 6 Mar 2020 05:33:29 -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 Subject: [PATCH v2 13/20] arm64: vdso: Include common headers in the vdso library Date: Fri, 6 Mar 2020 13:32:35 +0000 Message-Id: <20200306133242.26279-14-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053333_306002_E2B0EDF3 X-CRM114-Status: GOOD ( 10.75 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 vdso implementation to include common headers. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/vdso/gettimeofday.h | 1 - arch/arm64/kernel/vdso/vgettimeofday.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h index b08f476b72b4..cc3456416096 100644 --- a/arch/arm64/include/asm/vdso/gettimeofday.h +++ b/arch/arm64/include/asm/vdso/gettimeofday.h @@ -8,7 +8,6 @@ #ifndef __ASSEMBLY__ #include -#include #define __VDSO_USE_SYSCALL ULLONG_MAX diff --git a/arch/arm64/kernel/vdso/vgettimeofday.c b/arch/arm64/kernel/vdso/vgettimeofday.c index 747635501a14..4236cf34d7d9 100644 --- a/arch/arm64/kernel/vdso/vgettimeofday.c +++ b/arch/arm64/kernel/vdso/vgettimeofday.c @@ -5,8 +5,6 @@ * Copyright (C) 2018 ARM Limited * */ -#include -#include int __kernel_clock_gettime(clockid_t clock, struct __kernel_timespec *ts) From patchwork Fri Mar 6 13:32:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424021 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60D3D138D for ; Fri, 6 Mar 2020 13:37:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 097D42072D for ; Fri, 6 Mar 2020 13:37:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lOVbQCu0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 097D42072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fenenZMzczzTGHxffIZrra81vGFY9qKRvQrFH945us8=; b=lOVbQCu0w8+Cwp e2h5R3LQXt9OgnBkcxkG/J1eGPBwWu+9DY5XRuGTEE2mTWslbbGTwNhU+yeOfj1CQV6f0UjYH7Dmy oYCxSNjroy05JauMNW0OB3vBY7MkwIBXlWdOvu2ySfMdQsXr3FgJcYbeQWN9KDRHKIfH2vdqCQY8l 0zq9RM+IuGzQquaRE6LIgQT4lnrAP20S65uo/oW44g2BEahBxO/+CbbeXze1AuqhB1GrdngQcVBEB atpGSgr6fIRz5yzumlJ/Gh0tRmtnonPYlwrigBVQ/pGetPm/5l3DulbPBNEtmtsxpeCvLf4fMlMO1 efKXLR3TPoo5lsXcHSvg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD9w-00010i-5h; Fri, 06 Mar 2020 13:37:00 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6f-0004tL-0v for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:40 +0000 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 29EC14B2; Fri, 6 Mar 2020 05:33:36 -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 F36443F6CF; Fri, 6 Mar 2020 05:33:32 -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 Subject: [PATCH v2 14/20] arm64: vdso32: Include common headers in the vdso library Date: Fri, 6 Mar 2020 13:32:36 +0000 Message-Id: <20200306133242.26279-15-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053337_253872_9D9C3D1D X-CRM114-Status: GOOD ( 11.12 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 vdso32 implementation to include common headers. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/vdso/compat_gettimeofday.h | 2 +- arch/arm64/kernel/vdso32/vgettimeofday.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/vdso/compat_gettimeofday.h b/arch/arm64/include/asm/vdso/compat_gettimeofday.h index 537b1e695365..a1f21474f11f 100644 --- a/arch/arm64/include/asm/vdso/compat_gettimeofday.h +++ b/arch/arm64/include/asm/vdso/compat_gettimeofday.h @@ -8,7 +8,7 @@ #ifndef __ASSEMBLY__ #include -#include +#include #include diff --git a/arch/arm64/kernel/vdso32/vgettimeofday.c b/arch/arm64/kernel/vdso32/vgettimeofday.c index 54fc1c2ce93f..9366ceb635a1 100644 --- a/arch/arm64/kernel/vdso32/vgettimeofday.c +++ b/arch/arm64/kernel/vdso32/vgettimeofday.c @@ -5,9 +5,6 @@ * Copyright (C) 2018 ARM Limited * */ -#include -#include - int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts) { From patchwork Fri Mar 6 13:32:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424023 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A82992A for ; Fri, 6 Mar 2020 13:37:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5C75D2072D for ; Fri, 6 Mar 2020 13:37:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eONz7FUs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C75D2072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9ctPx58G0TCP6bVsYuRPPb1S5ohE2EpNBRY3l8IKgpQ=; b=eONz7FUsq2/cHp BdBRmJIIG1TLBmg6AYvQprWLDdrGBj0n3OPRpr3gaARojB0TH68GjJZRIMUj1ocbPMZZbBBMiaZ3r yErOyDPhJ1EP/4K7A9kM+ZewgByPJzRFKnVKUpMfi1gMJGnnVEPHgfVaJF9PXZJVwQpD5aUwz+1oS sq/Utk3Laljq9JbvexSRRhRg1luJZt6kMdHBibTfTB11beL+VUsE1kcCZQBLJel4h70Mb2Bpc4M34 ugp/GHbRsTFXpV26YwyP329Uh1KPsFJZRufJo/Uk1MO5GyGUn4cuOpD8/dE+djb+Jjm7WzdMHF39M 0U/jqwc2ha6qBwlW0whA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jADAB-0001Lf-E9; Fri, 06 Mar 2020 13:37:15 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6i-0004wl-5t for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:42 +0000 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 48DA231B; Fri, 6 Mar 2020 05:33:39 -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 6D45D3F6CF; Fri, 6 Mar 2020 05:33:36 -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 Subject: [PATCH v2 15/20] arm64: Introduce asm/common/arch_timer.h Date: Fri, 6 Mar 2020 13:32:37 +0000 Message-Id: <20200306133242.26279-16-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053340_357635_E1D89250 X-CRM114-Status: GOOD ( 17.22 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Introduce asm/common/arch_timer.h to contain all the arm64 specific code. This allows to replace the second isb() in __arch_get_hw_counter() with a fake dependent stack read of the counter which improves the vdso library peformances of ~4.5%. Below the results of vdsotest [1] ran for 100 iterations. Before the patch: ================= clock-gettime-monotonic: syscall: 771 nsec/call clock-gettime-monotonic: libc: 130 nsec/call clock-gettime-monotonic: vdso: 111 nsec/call ... clock-gettime-realtime: syscall: 762 nsec/call clock-gettime-realtime: libc: 130 nsec/call clock-gettime-realtime: vdso: 111 nsec/call After the patch: ================ clock-gettime-monotonic: syscall: 792 nsec/call clock-gettime-monotonic: libc: 124 nsec/call clock-gettime-monotonic: vdso: 106 nsec/call ... clock-gettime-realtime: syscall: 776 nsec/call clock-gettime-realtime: libc: 124 nsec/call clock-gettime-realtime: vdso: 106 nsec/call [1] https://github.com/nathanlynch/vdsotest Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/arch_timer.h | 29 ++++--------------- arch/arm64/include/asm/common/arch_timer.h | 33 ++++++++++++++++++++++ arch/arm64/include/asm/vdso/gettimeofday.h | 7 +++-- 3 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 arch/arm64/include/asm/common/arch_timer.h diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h index 7ae54d7d333a..6567e20a76b2 100644 --- a/arch/arm64/include/asm/arch_timer.h +++ b/arch/arm64/include/asm/arch_timer.h @@ -164,24 +164,7 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl) isb(); } -/* - * Ensure that reads of the counter are treated the same as memory reads - * for the purposes of ordering by subsequent memory barriers. - * - * This insanity brought to you by speculative system register reads, - * out-of-order memory accesses, sequence locks and Thomas Gleixner. - * - * http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/631195.html - */ -#define arch_counter_enforce_ordering(val) do { \ - u64 tmp, _val = (val); \ - \ - asm volatile( \ - " eor %0, %1, %1\n" \ - " add %0, sp, %0\n" \ - " ldr xzr, [%0]" \ - : "=r" (tmp) : "r" (_val)); \ -} while (0) +#include static __always_inline u64 __arch_counter_get_cntpct_stable(void) { @@ -189,7 +172,7 @@ static __always_inline u64 __arch_counter_get_cntpct_stable(void) isb(); cnt = arch_timer_reg_read_stable(cntpct_el0); - arch_counter_enforce_ordering(cnt); + cnt = arch_counter_enforce_ordering(cnt); return cnt; } @@ -199,7 +182,7 @@ static __always_inline u64 __arch_counter_get_cntpct(void) isb(); cnt = read_sysreg(cntpct_el0); - arch_counter_enforce_ordering(cnt); + cnt = arch_counter_enforce_ordering(cnt); return cnt; } @@ -209,7 +192,7 @@ static __always_inline u64 __arch_counter_get_cntvct_stable(void) isb(); cnt = arch_timer_reg_read_stable(cntvct_el0); - arch_counter_enforce_ordering(cnt); + cnt = arch_counter_enforce_ordering(cnt); return cnt; } @@ -219,12 +202,10 @@ static __always_inline u64 __arch_counter_get_cntvct(void) isb(); cnt = read_sysreg(cntvct_el0); - arch_counter_enforce_ordering(cnt); + cnt = arch_counter_enforce_ordering(cnt); return cnt; } -#undef arch_counter_enforce_ordering - static inline int arch_timer_arch_init(void) { return 0; diff --git a/arch/arm64/include/asm/common/arch_timer.h b/arch/arm64/include/asm/common/arch_timer.h new file mode 100644 index 000000000000..b11bd67a366e --- /dev/null +++ b/arch/arm64/include/asm/common/arch_timer.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2020 ARM Ltd. + */ +#ifndef __ASM_COMMON_ARCH_TIMER_H +#define __ASM_COMMON_ARCH_TIMER_H + +#include + +/* + * Ensure that reads of the counter are treated the same as memory reads + * for the purposes of ordering by subsequent memory barriers. + * + * This insanity brought to you by speculative system register reads, + * out-of-order memory accesses, sequence locks and Thomas Gleixner. + * + * http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/631195.html + * + */ +static u64 arch_counter_enforce_ordering(u64 val) +{ + u64 tmp, _val = (val); + + asm volatile( + " eor %0, %1, %1\n" + " add %0, sp, %0\n" + " ldr xzr, [%0]" + : "=r" (tmp) : "r" (_val)); + + return _val; +} + +#endif /* __ASM_COMMON_ARCH_TIMER_H */ diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h index cc3456416096..628bb3b187c4 100644 --- a/arch/arm64/include/asm/vdso/gettimeofday.h +++ b/arch/arm64/include/asm/vdso/gettimeofday.h @@ -8,6 +8,7 @@ #ifndef __ASSEMBLY__ #include +#include #define __VDSO_USE_SYSCALL ULLONG_MAX @@ -83,10 +84,10 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) isb(); asm volatile("mrs %0, cntvct_el0" : "=r" (res) :: "memory"); /* - * This isb() is required to prevent that the seq lock is - * speculated.# + * arch_counter_enforce_ordering() is required to prevent that + * the seq lock is speculated. */ - isb(); + res = arch_counter_enforce_ordering(res); return res; } From patchwork Fri Mar 6 13:32:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424025 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7696C138D for ; Fri, 6 Mar 2020 13:37:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 54A222072D for ; Fri, 6 Mar 2020 13:37:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QbRpC8Rd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54A222072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KC1p68qj582YeQmg3u5FVPS6kyqHd0UF1XpGa3niJVs=; b=QbRpC8RdvLwB+A tE/G7Xz/udRIXQ6ztrXWQutQ8S1vVFdIQQkexEpkl39PTsMRiY5ZrHV1BE4q+2RkSgdfZ/qiwQOeo o75TAkYmGBGGEgAU8q+SBHfpd669dADcUM+XxN83sQziCW+UTA4ltUuP7vPmZPJZvJI/efhRJ3+vo Jhzd7A13mGBFJWEgLTe8CbXO+MCgEJN9hE+Hk9mQsTQWHuJBNNV0sefHvISn7Ck5eDLUFDXpK4N/F rN1YEVSA1tvNs505vfLPlWwdwhmcrlTett38LnlfIT0ova5dLr8pBKiTt+MQltWBWM6hJOoL8kqYI yv0NHAgumDo87kS8BAWw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jADAT-0001bB-H4; Fri, 06 Mar 2020 13:37:33 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6k-0004zH-TR for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:45 +0000 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 5E0AA1063; Fri, 6 Mar 2020 05:33:42 -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 7F30B3F6CF; Fri, 6 Mar 2020 05:33:39 -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 Subject: [PATCH v2 16/20] mips: vdso: Enable mips to use common headers Date: Fri, 6 Mar 2020 13:32:38 +0000 Message-Id: <20200306133242.26279-17-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053343_070786_097A1504 X-CRM114-Status: GOOD ( 15.03 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Paul Burton , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Enable mips to use only the common headers in the implementation of the vDSO library. Cc: Paul Burton Signed-off-by: Vincenzo Frascino --- arch/mips/include/asm/common/processor.h | 27 +++++++++++++++++++++++ arch/mips/include/asm/processor.h | 16 +------------- arch/mips/include/asm/vdso/gettimeofday.h | 4 ---- 3 files changed, 28 insertions(+), 19 deletions(-) create mode 100644 arch/mips/include/asm/common/processor.h diff --git a/arch/mips/include/asm/common/processor.h b/arch/mips/include/asm/common/processor.h new file mode 100644 index 000000000000..d2ee5d397d2b --- /dev/null +++ b/arch/mips/include/asm/common/processor.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2020 ARM Ltd. + */ +#ifndef __ASM_COMMON_PROCESSOR_H +#define __ASM_COMMON_PROCESSOR_H + +#ifndef __ASSEMBLY__ + +#ifdef CONFIG_CPU_LOONGSON64 +/* + * Loongson-3's SFB (Store-Fill-Buffer) may buffer writes indefinitely when a + * tight read loop is executed, because reads take priority over writes & the + * hardware (incorrectly) doesn't ensure that writes will eventually occur. + * + * Since spin loops of any kind should have a cpu_relax() in them, force an SFB + * flush from cpu_relax() such that any pending writes will become visible as + * expected. + */ +#define cpu_relax() smp_mb() +#else +#define cpu_relax() barrier() +#endif + +#endif /* __ASSEMBLY__ */ + +#endif /* __ASM_COMMON_PROCESSOR_H */ diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h index 7619ad319400..b7eca25e2066 100644 --- a/arch/mips/include/asm/processor.h +++ b/arch/mips/include/asm/processor.h @@ -22,6 +22,7 @@ #include #include #include +#include /* * System setup and hardware flags.. @@ -385,21 +386,6 @@ unsigned long get_wchan(struct task_struct *p); #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29]) #define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status) -#ifdef CONFIG_CPU_LOONGSON64 -/* - * Loongson-3's SFB (Store-Fill-Buffer) may buffer writes indefinitely when a - * tight read loop is executed, because reads take priority over writes & the - * hardware (incorrectly) doesn't ensure that writes will eventually occur. - * - * Since spin loops of any kind should have a cpu_relax() in them, force an SFB - * flush from cpu_relax() such that any pending writes will become visible as - * expected. - */ -#define cpu_relax() smp_mb() -#else -#define cpu_relax() barrier() -#endif - /* * Return_address is a replacement for __builtin_return_address(count) * which on certain architectures cannot reasonably be implemented in GCC diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h index a58687e26c5d..e8ab2fafe067 100644 --- a/arch/mips/include/asm/vdso/gettimeofday.h +++ b/arch/mips/include/asm/vdso/gettimeofday.h @@ -13,12 +13,8 @@ #ifndef __ASSEMBLY__ -#include -#include - #include #include -#include #include #include From patchwork Fri Mar 6 13:32:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424027 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 411EE92A for ; Fri, 6 Mar 2020 13:37:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 15AA72072D for ; Fri, 6 Mar 2020 13:37:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mzryt+5I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15AA72072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3emod2GaYi8qgAw8q2krh+N8rwX0WZrH1BaOL7KxhNM=; b=mzryt+5IpVt6v4 Vg23y8qoWSI3cglZTBoEGg9TXWx0VbWyIgsNL7V4ya/MUP2JRd/qicUlqQ9lTOn/wPIWaA/+Xg1JL 5MQOurUwS7lbYxq907mHP7j9F/ENjtxRstCGhkMzfNKbKnmtdKW/qJtTHc5sHyf4ibVmr/lUkqYIJ BjqGhF4yycZmh2VmOllKy88h3R1pmdvKmauzTCNGobnZKua+KDzu+m/0rUX5XlsS0T0ogsSKf6jw/ mdVQUCEg4ZRPBimH3Q6IAdKMupVWigK58F90v0Og9NqzgIZ5xeqh72Lrj3oUAzud3FQBCI9rtTvXe ED8Glr3Yw4rxamKM79Vg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jADAo-0001vs-LK; Fri, 06 Mar 2020 13:37:54 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6p-00052z-0q for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:48 +0000 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 560C7106F; Fri, 6 Mar 2020 05:33:45 -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 946EA3F6CF; Fri, 6 Mar 2020 05:33:42 -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 Subject: [PATCH v2 17/20] x86: vdso: Enable x86 to use common headers Date: Fri, 6 Mar 2020 13:32:39 +0000 Message-Id: <20200306133242.26279-18-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053347_116734_86DDF638 X-CRM114-Status: GOOD ( 14.78 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Enable x86 to use only the common headers in the implementation of the vDSO library. Cc: Thomas Gleixner Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Borislav Petkov Signed-off-by: Vincenzo Frascino --- arch/x86/include/asm/common/processor.h | 23 +++++++++++++++++++++++ arch/x86/include/asm/processor.h | 12 +----------- 2 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 arch/x86/include/asm/common/processor.h diff --git a/arch/x86/include/asm/common/processor.h b/arch/x86/include/asm/common/processor.h new file mode 100644 index 000000000000..60ca2ee6e672 --- /dev/null +++ b/arch/x86/include/asm/common/processor.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2020 ARM Ltd. + */ +#ifndef __ASM_COMMON_PROCESSOR_H +#define __ASM_COMMON_PROCESSOR_H + +#ifndef __ASSEMBLY__ + +/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ +static __always_inline void rep_nop(void) +{ + asm volatile("rep; nop" ::: "memory"); +} + +static __always_inline void cpu_relax(void) +{ + rep_nop(); +} + +#endif /* __ASSEMBLY__ */ + +#endif /* __ASM_COMMON_PROCESSOR_H */ diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 09705ccc393c..d66c5dd42cff 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -26,6 +26,7 @@ struct vm86; #include #include #include +#include #include #include @@ -677,17 +678,6 @@ static inline unsigned int cpuid_edx(unsigned int op) return edx; } -/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ -static __always_inline void rep_nop(void) -{ - asm volatile("rep; nop" ::: "memory"); -} - -static __always_inline void cpu_relax(void) -{ - rep_nop(); -} - /* * This function forces the icache and prefetched instruction stream to * catch up with reality in two very specific cases: From patchwork Fri Mar 6 13:32:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424045 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B74F592A for ; Fri, 6 Mar 2020 13:38:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 866702072D for ; Fri, 6 Mar 2020 13:38:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jbBY+mLC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 866702072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OoQ59Vrf48s8SElwJkMZ/ayJ5zSfaVEC24qmdgzpuN0=; b=jbBY+mLCSPVat4 oCxrbZXmL+H6HSxeSDncO5cnTJr3wLrhgfPhlNOu6D04ylY2O22RL1+JaE4fvZgDEpnFWU4J6IMYP gLXYf31i0W05zbK1LRkbF2OeIxMiw0SGAIG4iOP9oeWAveI3upjpJQq1SDfHLA2POUJNcrKgFIGmU UjlfqD3aE+RvRUNa1SkjyIVCHmidb+qdW2L7xa+f8ngIoyDHpyty92ypnlMaIsO9IvsrYvjB9+Vnk 5Z3BGkVfNrmvFOTzlRK8aPBn0CdLu7wnny82PxV69VPjejxd/y2S5ha5p9AMnIPdPYIQarFkhCDXq 19qptZ4FM4/S6kB12q/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jADB8-0002DC-6H; Fri, 06 Mar 2020 13:38:14 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6q-00054m-ND for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:50 +0000 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 4CE1831B; Fri, 6 Mar 2020 05:33:48 -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 8BFAA3F6CF; Fri, 6 Mar 2020 05:33:45 -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 Subject: [PATCH v2 18/20] arm: vdso: Enable arm to use common headers Date: Fri, 6 Mar 2020 13:32:40 +0000 Message-Id: <20200306133242.26279-19-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053348_876879_A8C7855C X-CRM114-Status: GOOD ( 15.77 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Enable arm to use only the common headers in the implementation of the vDSO library. Cc: Russell King Signed-off-by: Vincenzo Frascino --- arch/arm/include/asm/common/cp15.h | 38 ++++++++++++++++++++++++ arch/arm/include/asm/common/processor.h | 22 ++++++++++++++ arch/arm/include/asm/cp15.h | 20 +------------ arch/arm/include/asm/processor.h | 11 +------ arch/arm/include/asm/vdso/gettimeofday.h | 4 +-- 5 files changed, 64 insertions(+), 31 deletions(-) create mode 100644 arch/arm/include/asm/common/cp15.h create mode 100644 arch/arm/include/asm/common/processor.h diff --git a/arch/arm/include/asm/common/cp15.h b/arch/arm/include/asm/common/cp15.h new file mode 100644 index 000000000000..d1412c80120f --- /dev/null +++ b/arch/arm/include/asm/common/cp15.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2020 ARM Ltd. + */ +#ifndef __ASM_COMMON_CP15_H +#define __ASM_COMMON_CP15_H + +#ifndef __ASSEMBLY__ + +#ifdef CONFIG_CPU_CP15 + +#include + +#define __ACCESS_CP15(CRn, Op1, CRm, Op2) \ + "mrc", "mcr", __stringify(p15, Op1, %0, CRn, CRm, Op2), u32 +#define __ACCESS_CP15_64(Op1, CRm) \ + "mrrc", "mcrr", __stringify(p15, Op1, %Q0, %R0, CRm), u64 + +#define __read_sysreg(r, w, c, t) ({ \ + t __val; \ + asm volatile(r " " c : "=r" (__val)); \ + __val; \ +}) +#define read_sysreg(...) __read_sysreg(__VA_ARGS__) + +#define __write_sysreg(v, r, w, c, t) asm volatile(w " " c : : "r" ((t)(v))) +#define write_sysreg(v, ...) __write_sysreg(v, __VA_ARGS__) + +#define BPIALL __ACCESS_CP15(c7, 0, c5, 6) +#define ICIALLU __ACCESS_CP15(c7, 0, c5, 0) + +#define CNTVCT __ACCESS_CP15_64(1, c14) + +#endif /* CONFIG_CPU_CP15 */ + +#endif /* __ASSEMBLY__ */ + +#endif /* __ASM_COMMON_CP15_H */ diff --git a/arch/arm/include/asm/common/processor.h b/arch/arm/include/asm/common/processor.h new file mode 100644 index 000000000000..0e76f3cb0d0d --- /dev/null +++ b/arch/arm/include/asm/common/processor.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2020 ARM Ltd. + */ +#ifndef __ASM_COMMON_PROCESSOR_H +#define __ASM_COMMON_PROCESSOR_H + +#ifndef __ASSEMBLY__ + +#if __LINUX_ARM_ARCH__ == 6 || defined(CONFIG_ARM_ERRATA_754327) +#define cpu_relax() \ + do { \ + smp_mb(); \ + __asm__ __volatile__("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"); \ + } while (0) +#else +#define cpu_relax() barrier() +#endif + +#endif /* __ASSEMBLY__ */ + +#endif /* __ASM_COMMON_PROCESSOR_H */ diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h index d2453e2d3f1f..fe47a65130ab 100644 --- a/arch/arm/include/asm/cp15.h +++ b/arch/arm/include/asm/cp15.h @@ -50,25 +50,7 @@ #ifdef CONFIG_CPU_CP15 -#define __ACCESS_CP15(CRn, Op1, CRm, Op2) \ - "mrc", "mcr", __stringify(p15, Op1, %0, CRn, CRm, Op2), u32 -#define __ACCESS_CP15_64(Op1, CRm) \ - "mrrc", "mcrr", __stringify(p15, Op1, %Q0, %R0, CRm), u64 - -#define __read_sysreg(r, w, c, t) ({ \ - t __val; \ - asm volatile(r " " c : "=r" (__val)); \ - __val; \ -}) -#define read_sysreg(...) __read_sysreg(__VA_ARGS__) - -#define __write_sysreg(v, r, w, c, t) asm volatile(w " " c : : "r" ((t)(v))) -#define write_sysreg(v, ...) __write_sysreg(v, __VA_ARGS__) - -#define BPIALL __ACCESS_CP15(c7, 0, c5, 6) -#define ICIALLU __ACCESS_CP15(c7, 0, c5, 0) - -#define CNTVCT __ACCESS_CP15_64(1, c14) +#include extern unsigned long cr_alignment; /* defined in entry-armv.S */ diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h index 614bf829e454..c098d95a88fa 100644 --- a/arch/arm/include/asm/processor.h +++ b/arch/arm/include/asm/processor.h @@ -14,6 +14,7 @@ #include #include #include +#include #ifdef __KERNEL__ #define STACK_TOP ((current->personality & ADDR_LIMIT_32BIT) ? \ @@ -85,16 +86,6 @@ extern void release_thread(struct task_struct *); unsigned long get_wchan(struct task_struct *p); -#if __LINUX_ARM_ARCH__ == 6 || defined(CONFIG_ARM_ERRATA_754327) -#define cpu_relax() \ - do { \ - smp_mb(); \ - __asm__ __volatile__("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"); \ - } while (0) -#else -#define cpu_relax() barrier() -#endif - #define task_pt_regs(p) \ ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) diff --git a/arch/arm/include/asm/vdso/gettimeofday.h b/arch/arm/include/asm/vdso/gettimeofday.h index fe6e1f65932d..ffb88cef8cbb 100644 --- a/arch/arm/include/asm/vdso/gettimeofday.h +++ b/arch/arm/include/asm/vdso/gettimeofday.h @@ -7,9 +7,9 @@ #ifndef __ASSEMBLY__ -#include -#include +#include #include +#include #include #define VDSO_HAS_CLOCK_GETRES 1 From patchwork Fri Mar 6 13:32:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424047 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0C2B92A for ; Fri, 6 Mar 2020 13:38:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 937A120848 for ; Fri, 6 Mar 2020 13:38:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cBhThpxp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 937A120848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JHVaeTjXsXLhzFi7Yw8+IQJKyQkauo5+UmTe8f+XMrE=; b=cBhThpxpfpBpUI XsSBPjAzJxqAK3gniuUBLod6spwkHrkVpu4mXDD4GwS7IgcAxW3mJ8G3Q/AA/Par8h7wngWoF/94g 5wGBAAWcCnqTnVzJwEmjyjbDjcWibX4VB7cxFOJetDjri97sP3SvSdfhtVUvmPJXONex3orY5jORm lQBJxFyKjDQteFOwuc5HFgK2/lfcvBq9sKRJi22sTH75hlitlWDxXmID0f0/SY89MVXU3RjosK5Bp 0W3T3XxB9WXnVPcfmTyPzfigzWHONK09t3H/ZeE/nL1o6auQTmzm+pVq5WFrQWJLRIMUZuavAw5eF nn42S5cg5Ze1Sqq1t0SQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jADBS-0002SI-34; Fri, 06 Mar 2020 13:38:34 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6t-000575-Pv for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:53 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053351_955775_264F165C X-CRM114-Status: GOOD ( 12.74 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 From patchwork Fri Mar 6 13:32:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 11424049 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F40C14BC for ; Fri, 6 Mar 2020 13:38:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 08FB42072D for ; Fri, 6 Mar 2020 13:38:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AinDvb7s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08FB42072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1WyglA32IxrHYiPN0gWL+ca79zOoOUL2OskizY+iSCM=; b=AinDvb7swZrmyG q5fxRSyEgkYyK3g0atXPkFnPVu4x/ljI9CYkiVj5O3j5dnICE4mCMtpf9+b1EMykkXUjluHBBx5Cx t2OtNVOovVOnasESE+sYeB/9DDog96l+SSIvVMqkO56bpAFNf2MZt6I7dJNUP4wVZEpcI1Se1oayv FvNQHj97Wtfkbg9EOljOWv7CaS6sFhNqr49+SROZK6F83IHZEDQQm3eILHTizWj+wGNP5FdInvyMf bEZXJu8oihyk2H/7HR4RpYSshMyKYvh16WJqUsFwNeWy1TPUK2jd2yK8Kwh7ay/RVHYV7clexnRpL n9LIn/8P9HCGzaEh8J9g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jADBi-0002hP-1K; Fri, 06 Mar 2020 13:38:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAD6w-0005AR-PE for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2020 13:33:57 +0000 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 557BF1063; Fri, 6 Mar 2020 05:33:54 -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 79F4A3F6CF; Fri, 6 Mar 2020 05:33:51 -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 Subject: [PATCH v2 20/20] arm64: vdso32: Enable Clang Compilation Date: Fri, 6 Mar 2020 13:32:42 +0000 Message-Id: <20200306133242.26279-21-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200306_053354_903083_0743B892 X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, Kees Cook , Arnd Bergmann , Stephen Boyd , Catalin Marinas , Will Deacon , Russell King , Mark Salyzyn , Paul Burton , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Peter Collingbourne , Andrei Vagin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Enable Clang Compilation for the vdso32 library. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor # build --- arch/arm64/kernel/vdso32/Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile index 04df57b43cb1..650cfc5757eb 100644 --- a/arch/arm64/kernel/vdso32/Makefile +++ b/arch/arm64/kernel/vdso32/Makefile @@ -10,7 +10,18 @@ include $(srctree)/lib/vdso/Makefile # Same as cc-*option, but using CC_COMPAT instead of CC ifeq ($(CONFIG_CC_IS_CLANG), y) -CC_COMPAT ?= $(CC) +COMPAT_GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE_COMPAT)elfedit)) +COMPAT_GCC_TOOLCHAIN := $(realpath $(COMPAT_GCC_TOOLCHAIN_DIR)/..) + +CLANG_CC_COMPAT := $(CC) +CLANG_CC_COMPAT += --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%)) +CLANG_CC_COMPAT += --prefix=$(COMPAT_GCC_TOOLCHAIN_DIR) +CLANG_CC_COMPAT += -no-integrated-as -Qunused-arguments +ifneq ($(COMPAT_GCC_TOOLCHAIN),) +CLANG_CC_COMPAT += --gcc-toolchain=$(COMPAT_GCC_TOOLCHAIN) +endif + +CC_COMPAT ?= $(CLANG_CC_COMPAT) else CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc endif