From patchwork Mon Jun 18 15:30:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zubin Mithra X-Patchwork-Id: 10472093 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 D3DC5601D7 for ; Mon, 18 Jun 2018 15:32:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C32BC28A35 for ; Mon, 18 Jun 2018 15:32:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7FC028A39; Mon, 18 Jun 2018 15:32:48 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI 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 25D3028A35 for ; Mon, 18 Jun 2018 15:32:48 +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=clbvrXTG86GIH2alq2T3kSO3/XZHn0vPqmC1cAIk/S4=; b=Ajls20EavQOLpxhwcQdylHGdx3 ta6MOXFXZHyZAUM1G5CwJ01NxymUeYJNVGsfmRoY4I92lkMPEb0epMjK5Fj1WGf5BsnKfsRc8Bl0W tqd9kxSXJ2+M5uo6GRGsVdtbEG4Sn8ESdEjDnkdWsKqydDszP16lDv/NwCayhIJ4p5RLiRoBcQVge FECE41DK3gQM4PaGBEppM13xXwLiWTd5NBOK4qZ+1OUV/E5YS/Wa92OzcA0I39Rc3Lt0NMJqgKdzL DMSyAFSn1r5g6VVOQ2zCB8gAv0bXjuwsMECh7Eeyik0Sdc17HXa9iSneIoZWUmTva7ushyB/fCors XPEBNwxw==; 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 1fUw8y-0001Ip-5h; Mon, 18 Jun 2018 15:32:36 +0000 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUw7g-0000W4-Ie for linux-arm-kernel@lists.infradead.org; Mon, 18 Jun 2018 15:31:18 +0000 Received: by mail-pl0-x242.google.com with SMTP id z9-v6so9224497plk.11 for ; Mon, 18 Jun 2018 08:31:06 -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=h1QzMzg2Tv1KMBS50EicS/zdZlzSAybQ9WbzPP6GNx8=; b=cNid5Jjyqd8lTcyic9Tf4U+qri2cZXzj0ZlKLHqWiJ4zOs1lpyUM4iqapQr1qPLXtc 6ouBo1ehEnSdD/z1GHNhdwkRFrQQoGkYdI5J/GlWKCnNRDVxQerjUugxK6gAcefAzcAU CFFXyEuCkR4q5o6l6XN3se/wbGFlUl2j7A37k= 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=h1QzMzg2Tv1KMBS50EicS/zdZlzSAybQ9WbzPP6GNx8=; b=PqZtTRMtrB0ZMc+OO1BAGuCSOlPEkX7zyEBHXzujnOgmes/gzy0xZS4X77ST9uGsjx G/XV5jr7Ppt+5gRvCcRAWpvfn/02jFwWZMSP67bdjmpe5ITae1AmBQjsc4zLboNN8hn1 0D2lCruDfaieEGbnS8SDwphwTraaf/a3nynnP59Un6Ynhl4lc0mS11cjJOYZL7DS6TFC tjjMGWGD3ywZoWTfFk4ggDK8j8huNlRyaITcW/0BTcQOLCeA5V+ODFgahQD8TRxaJRgw WPje3MlQfmPGMMW4JpADwfoDBBJHAzeZOqToWwSadBsaM8THC2R8G6jTNadzF7f/GXUa XzHA== X-Gm-Message-State: APt69E04O55cMa6+9lP8ilB7jHUmJqyFGfRj3b4d7wR2oxw6khTioZVE r2KiVTTexJb00iEBuFoDjcp+yWlsjMM= X-Google-Smtp-Source: ADUXVKInn2O3ggaYJ6Lmd7YJppeoe7xjrP2AeuXhYdxZ0PjILujM9MEm3CJx9fvnhxk5QvgVXManEw== X-Received: by 2002:a17:902:57d8:: with SMTP id g24-v6mr14643937plj.116.1529335865574; Mon, 18 Jun 2018 08:31:05 -0700 (PDT) Received: from zsm1.corp.google.com ([2620:0:1000:1610:f9fa:7119:2984:84b5]) by smtp.googlemail.com with ESMTPSA id j10-v6sm32138359pfj.158.2018.06.18.08.31.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 08:31:04 -0700 (PDT) From: Zubin Mithra To: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, ard.biesheuvel@linaro.org, keescook@google.com, groeck@chromium.org Subject: [RFC v2 2/4] arm: factor out current_stack_pointer Date: Mon, 18 Jun 2018 08:30:51 -0700 Message-Id: <20180618153053.186224-3-zsm@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180618153053.186224-1-zsm@chromium.org> References: <20180618153053.186224-1-zsm@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180618_083116_641643_A3D44B05 X-CRM114-Status: GOOD ( 16.82 ) 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: zsm@chromium.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_stack_pointer into its own header and have all the users include this header explicitly. Signed-off-by: Zubin Mithra --- arch/arm/include/asm/percpu.h | 2 ++ arch/arm/include/asm/stack_pointer.h | 9 +++++++++ arch/arm/include/asm/thread_info.h | 7 +------ arch/arm/kernel/return_address.c | 1 + arch/arm/kernel/stacktrace.c | 1 + arch/arm/kernel/unwind.c | 1 + 6 files changed, 15 insertions(+), 6 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 4a351e0aba0e..61fa0379ea85 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,12 +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