Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6838382ybf; Fri, 6 Mar 2020 05:34:30 -0800 (PST) X-Google-Smtp-Source: ADFU+vttT7drPXepVt+RTFbmj4N0W84hoYLK08JN8CnwxuvqIqCLSB3Z788Ue8Kq5F6UQtk/QVm2 X-Received: by 2002:a05:6830:11a:: with SMTP id i26mr2630924otp.180.1583501669808; Fri, 06 Mar 2020 05:34:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583501669; cv=none; d=google.com; s=arc-20160816; b=c/bEzyCMn3Fi6MPqdWV8yTbld3D1pYYPCc9quaQdovyE6fitJ2BXEc75qRrMNafvi2 OwiR45gAsA2BLejQ3poWp7S1+onvHWP+uEMm11pORBzT5/Vr7qMpKzDmpMA3RZhBqqOJ HcZpYlr0amcYt3fWrq4MAXO3aA37BItR6kvj9GeHvxVK3zESPxBUc54HCnI+9Cfrx+GZ t6+6y4Fl5rX2l/jlIDxE/nJV9UddBAsEoZ5hDaiUpxqddIjW3LJT5g5nMighPoUqSHaN /nj83rvLyG5jvCeMyrntTe5rkPNaBaAVq8BYWDqdPeImhGaTF34VB6+RfhUT8nHMuLl+ bOzQ== 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=rQIdHvvQDIkXDDlaz0kTIppIxDXrLQ4IXhA/6Ox1q90=; b=Q/oid8Z4yu5jbspPsHHDzQabuvF/SA3cmzjumOMkcdRgOPSK44TUZOdj6TRnehwFQd N20I8Dx5l9KpwHtuw2jr78bnY/uCEvJriTaAF+Nk37AovkRI+1DUXaXUmElHVvVrKmt4 MT1ogaurUzg6Rh+eFRSe1+f0frSAV+yeb2Gx2ML0WrfmVYlYop/m8j0ZlqDGh5nnXiNa 9Y4Bcb0CQIdvzm5+kvYny18TMG9qDcIGDwanyUfOEJ3eBUAIRHVv/XWLhNO9+wnFS8MQ PjZudNYVYi942mBaK2P+BV/JblBMziSqbdMzzQZiYq9Ou7oMCZXT7RGxASk2Zn1QwwLN cG4Q== 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 y13si1381121oto.33.2020.03.06.05.34.13; Fri, 06 Mar 2020 05:34:29 -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 S1727493AbgCFNdb (ORCPT + 99 others); Fri, 6 Mar 2020 08:33:31 -0500 Received: from foss.arm.com ([217.140.110.172]:33666 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727484AbgCFNda (ORCPT ); Fri, 6 Mar 2020 08:33:30 -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 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 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 , Will Deacon 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The vDSO library should only include the necessary headers required for a userspace library (UAPI and a minimal set of kernel headers). To make this possible it is necessary to isolate from the kernel headers the common parts that are strictly necessary to build the library. 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); -- 2.25.1