From patchwork Fri Mar 9 09:06:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 10270093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6938E60211 for ; Fri, 9 Mar 2018 09:11:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 626FA29D9C for ; Fri, 9 Mar 2018 09:11:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 571E229D9E; Fri, 9 Mar 2018 09:11:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BAF2829D9F for ; Fri, 9 Mar 2018 09:11:12 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=rbxAk+g8mMc+m3IvuARd6aeb0l2UkkyUn9EavM8/ZAo=; b=Ucv9ml4PaaKwSHuh9OPuvMlOQN EzwZXO4+PCCj6IjSxZr2f6g+BeB//7UPwleYXHY7m/5KyZTDYXTQhuCI2cJOnb1wjiKbFISO7Q0z3 N4akQpxoHWk7DsmWk8Q+7GbFWV8H9YtnBP01pc8W1WYv410A51qRNBcm6/CvMD2925xdHECpDXoW+ eKtSMxxIKertszQiyMOP/7rA4+xgGVejBdkJCOAZhzOkaHvYJSRTys9Af+KrzEVDUwkiwCWiKbuIV l9Blkxoo9z2MFcrQti+yI3+ydv9TlHfkJIvmcktBQ93JO0XyUzqWMrctM7zKytir3VzDJi9YWx0+7 AAu5+wcA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euE3K-0005wS-NA; Fri, 09 Mar 2018 09:11:02 +0000 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euE12-0003LM-As for linux-arm-kernel@lists.infradead.org; Fri, 09 Mar 2018 09:08:56 +0000 Received: by mail-pl0-x243.google.com with SMTP id v9-v6so4916158plp.12 for ; Fri, 09 Mar 2018 01:08:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yjQVxkWq4QIuL72uZALaqCwZ0BHnqtI+lqgPJjXvmDE=; b=Zz7zYctCSbiQnVxeekbfmFFvZuf6hYLzQMLxZR9O/0OGnhEUHVMbU3sZlVxTnVGE4t KFv1uu2hUDl6eR2dqxUrJxo1yoYSZSc4nsnLpYhbTWFtm1Xj6DlayOkhi1JiK4D2beG0 VH+OgwruDDSvYJzDvvoA3WkmZwWkGQxnbvaGg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yjQVxkWq4QIuL72uZALaqCwZ0BHnqtI+lqgPJjXvmDE=; b=Ndn6LA3Yl6HwFMRUVhg6oVhY9YRCyVUtJHypML8y04Y393xGHhEa2A4B0cV/OfQZtL XZTykkIKCGWUhqCC6pP8ErUtbxviW2Js8wuJ3qsTSmU4t69k6ZiOzXKBBoniVOPe8NS3 SbrSJUgZDZ+qX2JQxmEtoPSKNfs9qPCBEd0CWH8lFRrAMZxx/2UFoINFI5r4hOqo4CAj MzTbBwPcO3/hA5BNX7ket+uG//8c8TIkbBSL383+e1x/ZeRvYAJeeL6G5TR9PR7Qro0G uJr6OaAg9qfJSeaWYv5fxgn5XLpAGzNZjr+D0AgQcUTWcejef7Y/EQSqYCek8lbvNXm7 i2Wg== X-Gm-Message-State: APf1xPA1o9e6IHb+BLdbOTHMk6lvBh1PKAYPAFPGE2yN5GcYappcWm5t /w8mUaSrfFO078QyFRq5OJM/4w== X-Google-Smtp-Source: AG47ELuQo91H2rPeuhYYrmKhlgJXsudo6VPqQjenDO+ZZb/mk0oYC86EmxfW4dwxoPWYq5lQFtuWNg== X-Received: by 2002:a17:902:63:: with SMTP id 90-v6mr26552525pla.125.1520586509451; Fri, 09 Mar 2018 01:08:29 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id c7sm1961752pfg.36.2018.03.09.01.08.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 01:08:28 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , broonie@linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 04/39] arm64: move TASK_* definitions to Date: Fri, 9 Mar 2018 17:06:47 +0800 Message-Id: <20180309090722.26279-5-alex.shi@linaro.org> X-Mailer: git-send-email 2.16.2.440.gc6284da In-Reply-To: <20180309090722.26279-1-alex.shi@linaro.org> References: <20180309090722.26279-1-alex.shi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_010841_170576_BFC83BFC X-CRM114-Status: GOOD ( 15.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Shi , Yury Norov , James Morse , Laura Abbott MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yury Norov commit eef94a3d09aab upstream. ILP32 series [1] introduces the dependency on for TASK_SIZE macro. Which in turn requires , and include , giving a circular dependency, because TASK_SIZE is currently located in . In other architectures, TASK_SIZE is defined in , and moving TASK_SIZE there fixes the problem. Discussion: https://patchwork.kernel.org/patch/9929107/ [1] https://github.com/norov/linux/tree/ilp32-next CC: Will Deacon CC: Laura Abbott Cc: Ard Biesheuvel Cc: Catalin Marinas Cc: James Morse Suggested-by: Mark Rutland Signed-off-by: Yury Norov Signed-off-by: Will Deacon Signed-off-by: Alex Shi --- arch/arm64/include/asm/memory.h | 17 ----------------- arch/arm64/include/asm/processor.h | 23 +++++++++++++++++++++-- arch/arm64/kernel/entry.S | 2 +- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 853953cd1f08..1af98f8660a4 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -43,10 +43,6 @@ * (VA_BITS - 1)) * VA_BITS - the maximum number of bits for virtual addresses. * VA_START - the first kernel virtual address. - * TASK_SIZE - the maximum size of a user space task. - * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area. - * The module space lives between the addresses given by TASK_SIZE - * and PAGE_OFFSET - it must be within 128MB of the kernel text. */ #define VA_BITS (CONFIG_ARM64_VA_BITS) #define VA_START (UL(0xffffffffffffffff) << VA_BITS) @@ -56,19 +52,6 @@ #define PCI_IO_END (MODULES_VADDR - SZ_2M) #define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE) #define FIXADDR_TOP (PCI_IO_START - SZ_2M) -#define TASK_SIZE_64 (UL(1) << VA_BITS) - -#ifdef CONFIG_COMPAT -#define TASK_SIZE_32 UL(0x100000000) -#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) ? \ - TASK_SIZE_32 : TASK_SIZE_64) -#else -#define TASK_SIZE TASK_SIZE_64 -#endif /* CONFIG_COMPAT */ - -#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 4)) /* * Physical vs virtual RAM address space conversion. These are diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index d08559528927..12d5b2b97f04 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -19,6 +19,10 @@ #ifndef __ASM_PROCESSOR_H #define __ASM_PROCESSOR_H +#define TASK_SIZE_64 (UL(1) << VA_BITS) + +#ifndef __ASSEMBLY__ + /* * Default implementation of macro that returns current * instruction pointer ("program counter"). @@ -35,7 +39,22 @@ #include #include -#ifdef __KERNEL__ +/* + * TASK_SIZE - the maximum size of a user space task. + * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area. + */ +#ifdef CONFIG_COMPAT +#define TASK_SIZE_32 UL(0x100000000) +#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) ? \ + TASK_SIZE_32 : TASK_SIZE_64) +#else +#define TASK_SIZE TASK_SIZE_64 +#endif /* CONFIG_COMPAT */ + +#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 4)) + #define STACK_TOP_MAX TASK_SIZE_64 #ifdef CONFIG_COMPAT #define AARCH32_VECTORS_BASE 0xffff0000 @@ -47,7 +66,6 @@ extern phys_addr_t arm64_dma_phys_limit; #define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit - 1) -#endif /* __KERNEL__ */ struct debug_info { /* Have we suspended stepping by a debugger? */ @@ -188,4 +206,5 @@ static inline void spin_lock_prefetch(const void *x) int cpu_enable_pan(void *__unused); +#endif /* __ASSEMBLY__ */ #endif /* __ASM_PROCESSOR_H */ diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index dccd0c2e9023..fbb4fdd370b9 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include