From patchwork Thu Mar 15 17:08:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zubin Mithra X-Patchwork-Id: 10285387 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 40AAD6061F for ; Thu, 15 Mar 2018 17:28:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3075828999 for ; Thu, 15 Mar 2018 17:28:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2547928B82; Thu, 15 Mar 2018 17:28:09 +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 6E2FE28999 for ; Thu, 15 Mar 2018 17:28:08 +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=F4H5qacpCxpoZsEnuwDypWMWCPz1iyx7w2TKa6TTBZo=; b=VbOReGwayxsVFsOCVb0KiFMI+X BIVVLeFakw1LjitwNAF1hLE7OgHjTSuXYw59dbKcWMT9B6sHJs97VZCHllMd4tkIJpXvZ9rCNKblu lJDJAGfFm5p6ZRfNsyk34eW4pa5rntwMGyJh6+qzXkEn6d+Xbzi9yFzaxfMI6unYI4T32ev4N7tMi vrU5/64iChI0TcomOxVtJMwqaqPcgO4B+SabS+TfxwoPCHhHrCvSGfHPJzdljYJ9ZKieUcZ83eU71 lshC6Beh7CvPcpotCuqKdSvULygeBP4p0xnfdO2BlJ5JuJdLEiUGPklHemEFGVLk5vNV9vJyI2vzI /VqNOE7w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewWfc-0001Tn-3h; Thu, 15 Mar 2018 17:28:04 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewWbz-00063p-8A for linux-arm-kernel@bombadil.infradead.org; Thu, 15 Mar 2018 17:24:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SyjVEzPnEUWHJkHXCOmoW1MCQFmtpKDjYFz5GSKv/Kw=; b=JPxTT59xIXwn9lJvJOXywsKcZ C3rUamuGEa2ycQfAM8wlsIKEwm+gmTTPjxrCtD5F2uYg2FK0PuKKm2NJmLF1s5hBIoIMYMBfYqTP/ OGVPvuk+jJwmLs34rSoUKOCi7A21YRl9qllJx4twR9ozVxWatw5SZpzjkFd9ElGORALUATVXKv5TV RaumJKCBOlJUZ1KjxjptKLTXPZtCbkSjGTsfuRMu8vIkYWxcMcGpwYG2xcuE2faBglJZa1283tgjU TNFbajGXVG5Xxl6qMe8fXjLcgQbIRYwCmvOaIi88V4BCRzXuv1Zr/8DXmdXtMH5Xu+X6ZdPDwYqos ABxwowsuA==; Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewWNu-0005Sy-Og for linux-arm-kernel@lists.infradead.org; Thu, 15 Mar 2018 17:09:53 +0000 Received: by mail-wr0-x243.google.com with SMTP id l8so9071005wrg.5 for ; Thu, 15 Mar 2018 10:09:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SyjVEzPnEUWHJkHXCOmoW1MCQFmtpKDjYFz5GSKv/Kw=; b=GZ2ezCNePQzcckQY1pWeBGLEx97T7RjV06/aLxx2XYaokyVBc89339C4nOnaJ05z4p r9JNyp3CKz5q/MWZbGdgVmU2MUqgZ0fZKvN5O+mTV9mR3DJdb+C1n7l1lzpmiUW193+u f8k1vMpYNYbvxXkHj31s/D0NVREey0EhWxfD4= 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=SyjVEzPnEUWHJkHXCOmoW1MCQFmtpKDjYFz5GSKv/Kw=; b=rdqSHWO6UMs+rtVyDO+SSsW6dOdjllYC03M5uq4oELYSRzi2FaiYir+31tbacclDvr y5LTzVefATSDH0CEawhFAWzQncqvkwZe1VZnmXjQcyu2ST96iaqCTD9AiUsAslnyN2lu SXXaUFqZajDbEU8u3juyY/B9yjZYisAGqdMAPj5p+1Ekc+KHdpcHyqWXd2LIiuAgjwvW t/rwutdp5S0GSv4ojLHT7xkEzz651nbUf1juwKyrQ9MA0LyxYQV1yQXXhPxrukxIvJ0M d27Qlo7/EaRb670p9/yfoxSauqlgDsti/30om1APqba1c7YcLbiWk+qagQtj5CZfi4Rn Gv8g== X-Gm-Message-State: AElRT7FoF7kpLFEBi1ISOZ+1iFTFFAWjn1EIErrR2j3/Mu/cfDL6+Y33 tD1oE+P4/6BtGbWW1LvEoc58GwDuNDU= X-Google-Smtp-Source: AG47ELs2wUtERx17769WeShk76yXjh+NB/5kxZ0qBrEqWNKhm0H/pUTvTDk0uageHnIMiN8WFeE/NA== X-Received: by 10.223.128.201 with SMTP id 67mr7740917wrl.131.1521133774745; Thu, 15 Mar 2018 10:09:34 -0700 (PDT) Received: from zsm1.lan (host-2-98-223-64.as13285.net. [2.98.223.64]) by smtp.googlemail.com with ESMTPSA id j21sm7273460wrb.49.2018.03.15.10.09.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 10:09:33 -0700 (PDT) From: Zubin Mithra To: linux-arm-kernel@lists.infradead.org Subject: [RFC 1/3] arm: factor out current_stack_pointer Date: Thu, 15 Mar 2018 17:08:57 +0000 Message-Id: <20180315170859.93893-2-zsm@chromium.org> X-Mailer: git-send-email 2.16.2.804.g6dcf76e118-goog In-Reply-To: <20180315170859.93893-1-zsm@chromium.org> References: <20180315170859.93893-1-zsm@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180315_170946_793546_A5262022 X-CRM114-Status: GOOD ( 19.88 ) 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: mark.rutland@arm.com, keescook@chromium.org, Zubin Mithra , ard.biesheuvel@linaro.org 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 Multiple header files that rely on current_stack_pointer do not have the necessary include , and are thus fragile to changes in the header soup. Subsequent patches will affect the header soup such that including will result in a circular header include. Factor current_thread_info into its own header and have all the users include this header explicitely. Signed-off-by: Zubin Mithra Acked-by: Mark Rutland --- arch/arm/include/asm/percpu.h | 2 ++ arch/arm/include/asm/stack_pointer.h | 9 +++++++++ arch/arm/include/asm/thread_info.h | 6 +----- arch/arm/kernel/return_address.c | 1 + arch/arm/kernel/stacktrace.c | 1 + arch/arm/kernel/unwind.c | 1 + 6 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 arch/arm/include/asm/stack_pointer.h diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h index a89b4076cde4..6a19e634d0cf 100644 --- a/arch/arm/include/asm/percpu.h +++ b/arch/arm/include/asm/percpu.h @@ -16,6 +16,8 @@ #ifndef _ASM_ARM_PERCPU_H_ #define _ASM_ARM_PERCPU_H_ +#include + /* * Same as asm-generic/percpu.h, except that we store the per cpu offset * in the TPIDRPRW. TPIDRPRW only exists on V6K and V7 diff --git a/arch/arm/include/asm/stack_pointer.h b/arch/arm/include/asm/stack_pointer.h new file mode 100644 index 000000000000..5a6a8c6d9208 --- /dev/null +++ b/arch/arm/include/asm/stack_pointer.h @@ -0,0 +1,9 @@ +#ifndef __ASM_STACK_POINTER_H +#define __ASM_STACK_POINTER_H + +/* + * how to get the current stack pointer in C + */ +register unsigned long current_stack_pointer asm ("sp"); + +#endif diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index e71cc35de163..56317024d221 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -25,6 +25,7 @@ struct task_struct; #include +#include typedef unsigned long mm_segment_t; @@ -75,11 +76,6 @@ struct thread_info { .addr_limit = KERNEL_DS, \ } -/* - * how to get the current stack pointer in C - */ -register unsigned long current_stack_pointer asm ("sp"); - /* * how to get the thread information struct from C */ diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c index 36ed35073289..d76e64250816 100644 --- a/arch/arm/kernel/return_address.c +++ b/arch/arm/kernel/return_address.c @@ -14,6 +14,7 @@ #if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) #include +#include #include struct return_address_data { diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index a56e7c856ab5..d519b8e0797f 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -4,6 +4,7 @@ #include #include +#include #include #include diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c index 0bee233fef9a..860f8ac187e0 100644 --- a/arch/arm/kernel/unwind.c +++ b/arch/arm/kernel/unwind.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include