Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6838661ybf; Fri, 6 Mar 2020 05:34:50 -0800 (PST) X-Google-Smtp-Source: ADFU+vvvI/L70OgLtxX3ng1+7A1Q6reSTFdNBuYa+qA/7id5T8aN7cgxchS7qtvRbKwNAS02jvP1 X-Received: by 2002:a9d:3c1:: with SMTP id f59mr2608022otf.170.1583501690071; Fri, 06 Mar 2020 05:34:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583501690; cv=none; d=google.com; s=arc-20160816; b=lTEGzqck5rcNZbgbC2i+c6u5WH1ADKfY9r1sxIaYXpBmrfc64wLFPhXWjFhGm9Wyet 1EjoOfqduZoEsddn8Bv1skeOOZ7H0x55zkV3sKaRTxO3CaTnMeQdikq+qmr4gK9mhxf6 FBci10C81hXn2shKtiUvLTiCzrnBXfegcM6EQIzbmnHBGM1W1lx1YRTCeanBGq8fHjV9 nUuTJx4s2zsnQlO1jQHZt44vx4iR3shRyfmJn6isVscEY+/UFSaZ1P1jCxgbgJCUaaFt RvsG+eplL/ant1pOYQgN/FuMC4d9GCJ1WzgRFqmX6Ndg3bitnS/Zne+ViNtkO04kOHKy VT5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fkQY5XdeXfffPT06jfu52F8NXbd8qga4W7i9+9o+WpM=; b=bQAPeP/x0/YlhOfoUVfnmH6aWs24Diq0WJVaiS/Oqc8T98n7e9QGQnxOISWOWBcYaW eMp0fbiFFE5oF+1mMmsO0hsv1eLtMuGrjjKegU2JrNR8D3h3Lmww61KfFJaC1asbS3W0 KDSB/X6aiFrbH4DZUdd+3FIiftsQvNADORRLrWt3elCM4XQd8UGPJBRSvp6WR/26cV7k Dg1jrvIoU4Oi2nqeHMr6TxkyPR8DJVlzlXC8YeWResncGK9qzb0vNxH81Nv5B7vy9s77 P/vLoWGQsRE39BGOSPQqNSct/IWJZxYlmXHnRl7g4TLaVLpo7eHbuPPeMGYRCmJtvSQg ig5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si1469927otr.27.2020.03.06.05.34.36; Fri, 06 Mar 2020 05:34:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727577AbgCFNdv (ORCPT + 99 others); Fri, 6 Mar 2020 08:33:51 -0500 Received: from foss.arm.com ([217.140.110.172]:33860 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727554AbgCFNdt (ORCPT ); Fri, 6 Mar 2020 08:33:49 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 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 Cc: Vincenzo Frascino , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Paul Burton , Thomas Gleixner , Andy Lutomirski , Ingo Molnar , Borislav Petkov , Stephen Boyd , Mark Salyzyn , Kees Cook , Peter Collingbourne , Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Nick Desaulniers Subject: [PATCH v2 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.25.1