From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19E12C433EF for ; Mon, 4 Jul 2022 13:05:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/XMxpy5loTGsrjjcQXIHrQXiZ6Nv7RGikkpqR8LJnR0=; b=A/Oe80/3b8Pyh+ pPqOmDrbs5yUG6HwtohMeO/F6kA2kaHlCgcO5PY31LaEd2l/4uCNN60KLnDHHv5gOeZo9xpQqitKb lQ87SYaBffqNO04uGCHNOwg0YmNpddI42wwQE4H1f1pEdpcE3eSp3fQkcS/U9E1f3jgl+ZznrQ4wp HqqTdEKKUknL0nl0BQWBFOsCTC7ipDtL7Mrj/wTe3BxCSlTV6lSHYDod9Xz9iaIkiE0EY5UYoOkpZ TRB6YhcorDpcoPM1E8Dj17xQTHS2pLVF8baF199RTrK1AFX5pKCXJVaODvOXELKbLMAJZQCNdUjfG UgOhisLPjKpd5OJ0gzgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8Lk8-0091HC-GE; Mon, 04 Jul 2022 13:04:00 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8Lk5-0091Fm-2K for linux-arm-kernel@lists.infradead.org; Mon, 04 Jul 2022 13:03:58 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 62842B80EFE; Mon, 4 Jul 2022 13:03:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CC17C3411E; Mon, 4 Jul 2022 13:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656939833; bh=cJp1NDfuF8+m+OS7O4Zj+kewBfen92Yxy52f2sRvsFU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YRUiih3/9pQeTFGqwkYQo5jOqQxepj9rtSa7LEUCVVCLCSiEyK9xoVl3HYLlKrrSS 3yR3/N996dJBt0jcE6incSOiN/Ls2UOvtB93ix8AyqxMpUvREVDxGnccQRP2j8JfkJ nsWeYcY7MSc74ZtHhWxCMwl3o/zeaJLbz3yF6tZK5THRZ91Ya+NSSsuB/ANrrCIZ1a OSo1kL2sid0JFNYd8rPcOi51Pp+KPTm8O7Gy80AJ8RkBXsdCkIY5+hzRGp/cZ8cLIW 2OcbeJZe8z37a9Lnr3PMQ2uneUvnxmUTLo5DXBB+MwL1L1dqqZ7wEWFknXHvqtGiQv 0GygLi7BWjlug== Date: Mon, 4 Jul 2022 14:03:48 +0100 From: Will Deacon To: Mark Brown Cc: Catalin Marinas , Mark Rutland , Joey Gouly , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v6 03/27] arm64/sysreg: Add LINKER_SCRIPT guards for sysreg.h Message-ID: <20220704130347.GA31684@willie-the-truck> References: <20220629102834.36569-1-broonie@kernel.org> <20220629102834.36569-4-broonie@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220629102834.36569-4-broonie@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220704_060357_445592_8FD671FD X-CRM114-Status: GOOD ( 24.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 29, 2022 at 11:28:10AM +0100, Mark Brown wrote: > In subsequent patches sysreg.h and gpr-num.h will be included from other > headers which can be included from linker scripts (e.g. via cache.h), and > contain assember macro directives that don't work in linker scripts (e.g. > `.macro` and `.irp`). > > To avoid needing LINKER_SCRIPT guards in every file which could have a > transitive dependency, add those directly to sysreg.h and gpr-num.h. > > Signed-off-by: Mark Brown > --- > arch/arm64/include/asm/gpr-num.h | 3 +++ > arch/arm64/include/asm/sysreg.h | 2 ++ > 2 files changed, 5 insertions(+) > > diff --git a/arch/arm64/include/asm/gpr-num.h b/arch/arm64/include/asm/gpr-num.h > index 05da4a7c5788..72c44f63fb41 100644 > --- a/arch/arm64/include/asm/gpr-num.h > +++ b/arch/arm64/include/asm/gpr-num.h > @@ -4,12 +4,15 @@ > > #ifdef __ASSEMBLY__ > > +#ifndef LINKER_SCRIPT > + > .irp num,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 > .equ .L__gpr_num_x\num, \num > .equ .L__gpr_num_w\num, \num > .endr > .equ .L__gpr_num_xzr, 31 > .equ .L__gpr_num_wzr, 31 > +#endif /* !LINKER_SCRIPT */ > > #else /* __ASSEMBLY__ */ > > diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h > index 42ff95dba6da..6c7be1a2114b 100644 > --- a/arch/arm64/include/asm/sysreg.h > +++ b/arch/arm64/include/asm/sysreg.h > @@ -1219,6 +1219,7 @@ > > #ifdef __ASSEMBLY__ > > +#ifndef LINKER_SCRIPT > .macro mrs_s, rt, sreg > __emit_inst(0xd5200000|(\sreg)|(.L__gpr_num_\rt)) > .endm > @@ -1226,6 +1227,7 @@ > .macro msr_s, sreg, rt > __emit_inst(0xd5000000|(\sreg)|(.L__gpr_num_\rt)) > .endm > +#endif /* !LINKER_SCRIPT */ Hmm, this feels quite fragile to me as we have quite a few asm/ headers using the '.macro' directive and having to add LINKER_SCRIPT guards because of transitive includes is going to catch people out. With your series applied on a temporary branch, it looks like the only issue is the use of L1_CACHE_BYTES in hyp.lds.S and I think this is because asm/cache.h is wrongly pulling things into the ASSEMBLY block. The diff below fixes things for me and means we can drop the guards in this patch. What do you think? Will --->8 diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index 3abedf304ec1..8bedb981439a 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -5,16 +5,10 @@ #ifndef __ASM_CACHE_H #define __ASM_CACHE_H -#include -#include -#include - #define CTR_CACHE_MINLINE_MASK \ (0xf << CTR_EL0_DMINLINE_SHIFT | \ CTR_EL0_IMINLINE_MASK << CTR_EL0_IMINLINE_SHIFT) -#define CTR_L1IP(ctr) SYS_FIELD_GET(CTR_EL0, L1Ip, ctr) - #define L1_CACHE_SHIFT (6) #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) @@ -40,6 +34,10 @@ #include #include +#include +#include +#include + #ifdef CONFIG_KASAN_SW_TAGS #define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) #elif defined(CONFIG_KASAN_HW_TAGS) @@ -51,6 +49,8 @@ static inline unsigned int arch_slab_minalign(void) #define arch_slab_minalign() arch_slab_minalign() #endif +#define CTR_L1IP(ctr) SYS_FIELD_GET(CTR_EL0, L1Ip, ctr) + #define ICACHEF_ALIASING 0 #define ICACHEF_VPIPT 1 extern unsigned long __icache_flags; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel