* [PATCH V2] arm64/mm: Drop <asm/page-def.h>
@ 2021-08-20 11:05 Anshuman Khandual
2021-08-20 18:35 ` Catalin Marinas
0 siblings, 1 reply; 4+ messages in thread
From: Anshuman Khandual @ 2021-08-20 11:05 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, linux-kernel
PAGE_SHIFT (PAGE_SIZE and PAGE_MASK) which is derived from ARM64_PAGE_SHIFT
should be moved into <asm/page.h> instead like in case for other platforms,
and then subsequently <asm/page-def.h> can be just dropped off completely.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This applies on 5.14-rc6.
Changes in V2:
- Moved PAGE_XXX macros into <asm/page.h> instead of <asm/pgtable-hwdef.h>
- Changed the commit message accordingly
Changes in V1:
https://lore.kernel.org/lkml/1629441331-19530-1-git-send-email-anshuman.khandual@arm.com/
arch/arm64/include/asm/memory.h | 2 +-
arch/arm64/include/asm/page-def.h | 18 ------------------
arch/arm64/include/asm/page.h | 4 +++-
3 files changed, 4 insertions(+), 20 deletions(-)
delete mode 100644 arch/arm64/include/asm/page-def.h
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index 824a3655dd93..649d26396f9e 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -12,7 +12,7 @@
#include <linux/const.h>
#include <linux/sizes.h>
-#include <asm/page-def.h>
+#include <asm/page.h>
/*
* Size of the PCI I/O space. This must remain a power of two so that
diff --git a/arch/arm64/include/asm/page-def.h b/arch/arm64/include/asm/page-def.h
deleted file mode 100644
index 2403f7b4cdbf..000000000000
--- a/arch/arm64/include/asm/page-def.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Based on arch/arm/include/asm/page.h
- *
- * Copyright (C) 1995-2003 Russell King
- * Copyright (C) 2017 ARM Ltd.
- */
-#ifndef __ASM_PAGE_DEF_H
-#define __ASM_PAGE_DEF_H
-
-#include <linux/const.h>
-
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT CONFIG_ARM64_PAGE_SHIFT
-#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK (~(PAGE_SIZE-1))
-
-#endif /* __ASM_PAGE_DEF_H */
diff --git a/arch/arm64/include/asm/page.h b/arch/arm64/include/asm/page.h
index 993a27ea6f54..95c58b00bb71 100644
--- a/arch/arm64/include/asm/page.h
+++ b/arch/arm64/include/asm/page.h
@@ -8,7 +8,9 @@
#ifndef __ASM_PAGE_H
#define __ASM_PAGE_H
-#include <asm/page-def.h>
+#define PAGE_SHIFT CONFIG_ARM64_PAGE_SHIFT
+#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE-1))
#ifndef __ASSEMBLY__
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V2] arm64/mm: Drop <asm/page-def.h>
2021-08-20 11:05 [PATCH V2] arm64/mm: Drop <asm/page-def.h> Anshuman Khandual
@ 2021-08-20 18:35 ` Catalin Marinas
2021-08-31 3:45 ` Anshuman Khandual
0 siblings, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2021-08-20 18:35 UTC (permalink / raw)
To: Anshuman Khandual
Cc: linux-arm-kernel, Will Deacon, linux-kernel, Mark Rutland
On Fri, Aug 20, 2021 at 04:35:16PM +0530, Anshuman Khandual wrote:
> PAGE_SHIFT (PAGE_SIZE and PAGE_MASK) which is derived from ARM64_PAGE_SHIFT
> should be moved into <asm/page.h> instead like in case for other platforms,
> and then subsequently <asm/page-def.h> can be just dropped off completely.
These were moved to page-def.h as part of commit b6531456ba27 ("arm64:
factor out PAGE_* and CONT_* definitions") to avoid some circular header
dependencies.
> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> index 824a3655dd93..649d26396f9e 100644
> --- a/arch/arm64/include/asm/memory.h
> +++ b/arch/arm64/include/asm/memory.h
> @@ -12,7 +12,7 @@
>
> #include <linux/const.h>
> #include <linux/sizes.h>
> -#include <asm/page-def.h>
> +#include <asm/page.h>
In 5.14-rc3, asm/page.h still includes asm/memory.h.
--
Catalin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] arm64/mm: Drop <asm/page-def.h>
2021-08-20 18:35 ` Catalin Marinas
@ 2021-08-31 3:45 ` Anshuman Khandual
2021-09-01 13:28 ` Catalin Marinas
0 siblings, 1 reply; 4+ messages in thread
From: Anshuman Khandual @ 2021-08-31 3:45 UTC (permalink / raw)
To: Catalin Marinas; +Cc: linux-arm-kernel, Will Deacon, linux-kernel, Mark Rutland
On 8/21/21 12:05 AM, Catalin Marinas wrote:
> On Fri, Aug 20, 2021 at 04:35:16PM +0530, Anshuman Khandual wrote:
>> PAGE_SHIFT (PAGE_SIZE and PAGE_MASK) which is derived from ARM64_PAGE_SHIFT
>> should be moved into <asm/page.h> instead like in case for other platforms,
>> and then subsequently <asm/page-def.h> can be just dropped off completely.
>
> These were moved to page-def.h as part of commit b6531456ba27 ("arm64:
> factor out PAGE_* and CONT_* definitions") to avoid some circular header
> dependencies.
>
>> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
>> index 824a3655dd93..649d26396f9e 100644
>> --- a/arch/arm64/include/asm/memory.h
>> +++ b/arch/arm64/include/asm/memory.h
>> @@ -12,7 +12,7 @@
>>
>> #include <linux/const.h>
>> #include <linux/sizes.h>
>> -#include <asm/page-def.h>
>> +#include <asm/page.h>
>
> In 5.14-rc3, asm/page.h still includes asm/memory.h.
Dropping <asm/memory.h> from <asm/page.h> does not seem to cause
any problem, will change that. Afterwards build tested it across
page sizes and also with some random configs. Is that circular
dependency still present ? Also wondering why was <asm/memory.h>
included in <asm/page.h> to begin with ?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] arm64/mm: Drop <asm/page-def.h>
2021-08-31 3:45 ` Anshuman Khandual
@ 2021-09-01 13:28 ` Catalin Marinas
0 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2021-09-01 13:28 UTC (permalink / raw)
To: Anshuman Khandual
Cc: linux-arm-kernel, Will Deacon, linux-kernel, Mark Rutland
On Tue, Aug 31, 2021 at 09:15:30AM +0530, Anshuman Khandual wrote:
> On 8/21/21 12:05 AM, Catalin Marinas wrote:
> > On Fri, Aug 20, 2021 at 04:35:16PM +0530, Anshuman Khandual wrote:
> >> PAGE_SHIFT (PAGE_SIZE and PAGE_MASK) which is derived from ARM64_PAGE_SHIFT
> >> should be moved into <asm/page.h> instead like in case for other platforms,
> >> and then subsequently <asm/page-def.h> can be just dropped off completely.
> >
> > These were moved to page-def.h as part of commit b6531456ba27 ("arm64:
> > factor out PAGE_* and CONT_* definitions") to avoid some circular header
> > dependencies.
> >
> >> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> >> index 824a3655dd93..649d26396f9e 100644
> >> --- a/arch/arm64/include/asm/memory.h
> >> +++ b/arch/arm64/include/asm/memory.h
> >> @@ -12,7 +12,7 @@
> >>
> >> #include <linux/const.h>
> >> #include <linux/sizes.h>
> >> -#include <asm/page-def.h>
> >> +#include <asm/page.h>
> >
> > In 5.14-rc3, asm/page.h still includes asm/memory.h.
>
> Dropping <asm/memory.h> from <asm/page.h> does not seem to cause
> any problem, will change that. Afterwards build tested it across
> page sizes and also with some random configs. Is that circular
> dependency still present ? Also wondering why was <asm/memory.h>
> included in <asm/page.h> to begin with ?
asm/memory.h is not included by any of the generic files, however it has
essential definitions like PAGE_OFFSET, THREAD_SIZE. The expectations
from the arch code is to have these defined in asm/page.h (see the
asm-generic/page.h), hence the inclusion. It probably gets included by
other arch headers and that's why you don't get any errors, but I
wouldn't rely on this.
I don't remember how we ended up with a separate memory.h file. On arm64
we inherited it from arch/arm.
--
Catalin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-01 13:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 11:05 [PATCH V2] arm64/mm: Drop <asm/page-def.h> Anshuman Khandual
2021-08-20 18:35 ` Catalin Marinas
2021-08-31 3:45 ` Anshuman Khandual
2021-09-01 13:28 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).