[PATCH 0/4] arm64: mm: a few small cleanups

STALE1904d

14 messages, 4 authors, 2021-06-15 · open the first message on its own page

[PATCH 0/4] arm64: mm: a few small cleanups

From: Dong Aisheng <aisheng.dong@nxp.com>
Date: 2021-05-18 10:23:37

No function change

Dong Aisheng (4):
  arm64: mm: remove unneeded SWAPPER_INIT_MAP_SIZE
  arm64: mm: fix the count comments in compute_indices
  arm64: mm: drop unused __pa(__idmap_text_start)
  arm64: head: fix code comments in set_cpu_boot_mode_flag

 arch/arm64/include/asm/kernel-pgtable.h | 3 ---
 arch/arm64/kernel/head.S                | 5 ++---
 2 files changed, 2 insertions(+), 6 deletions(-)

-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH 1/4] arm64: mm: remove unneeded SWAPPER_INIT_MAP_SIZE

From: Dong Aisheng <aisheng.dong@nxp.com>
Date: 2021-05-18 10:24:17

Since commit cdef5f6e9e0e ("arm64: mm: allocate pagetables anywhere"),
arm64 kernel supports allocate pagetables anywhere and this macro
definition is not used anymore.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 arch/arm64/include/asm/kernel-pgtable.h | 3 ---
 1 file changed, 3 deletions(-)
diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h
index d44df9d62fc9..e2f103cce7c1 100644
--- a/arch/arm64/include/asm/kernel-pgtable.h
+++ b/arch/arm64/include/asm/kernel-pgtable.h
@@ -100,9 +100,6 @@
 #define SWAPPER_TABLE_SHIFT	PMD_SHIFT
 #endif
 
-/* The size of the initial kernel direct mapping */
-#define SWAPPER_INIT_MAP_SIZE	(_AC(1, UL) << SWAPPER_TABLE_SHIFT)
-
 /*
  * Initial memory map attributes.
  */
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH 2/4] arm64: mm: fix the count comments in compute_indices

From: Dong Aisheng <aisheng.dong@nxp.com>
Date: 2021-05-18 10:25:10

'count - 1' is confusing and not comply with the real code running.
'count' actually represents the extra entries required, no need minus 1.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 arch/arm64/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 96873dfa67fd..b70db34458ec 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -195,7 +195,7 @@ SYM_CODE_END(preserve_boot_args)
 	and	\iend, \iend, \istart	// iend = (vend >> shift) & (ptrs - 1)
 	mov	\istart, \ptrs
 	mul	\istart, \istart, \count
-	add	\iend, \iend, \istart	// iend += (count - 1) * ptrs
+	add	\iend, \iend, \istart	// iend += count * ptrs
 					// our entries span multiple tables
 
 	lsr	\istart, \vstart, \shift
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH 3/4] arm64: mm: drop unused __pa(__idmap_text_start)

From: Dong Aisheng <aisheng.dong@nxp.com>
Date: 2021-05-18 10:26:15

x5 is not used in the following map_memory. Instead,
__pa(__idmap_text_start) is stored in x3 which is used later.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 arch/arm64/kernel/head.S | 1 -
 1 file changed, 1 deletion(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index b70db34458ec..d266b4c6287d 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -354,7 +354,6 @@ SYM_FUNC_START_LOCAL(__create_page_tables)
 #endif
 1:
 	ldr_l	x4, idmap_ptrs_per_pgd
-	mov	x5, x3				// __pa(__idmap_text_start)
 	adr_l	x6, __idmap_text_end		// __pa(__idmap_text_end)
 
 	map_memory x0, x1, x3, x6, x7, x3, x4, x10, x11, x12, x13, x14
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH 4/4] arm64: head: fix code comments in set_cpu_boot_mode_flag

From: Dong Aisheng <aisheng.dong@nxp.com>
Date: 2021-05-18 10:26:48

Up to here, the CPU boot mode can either be EL1 or EL2.
Correct the code comments a bit.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 arch/arm64/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index d266b4c6287d..3b88000841d9 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -550,7 +550,7 @@ SYM_FUNC_START_LOCAL(set_cpu_boot_mode_flag)
 	cmp	w0, #BOOT_CPU_MODE_EL2
 	b.ne	1f
 	add	x1, x1, #4
-1:	str	w0, [x1]			// This CPU has booted in EL1
+1:	str	w0, [x1]			// Save CPU boot mode
 	dmb	sy
 	dc	ivac, x1			// Invalidate potentially stale cache line
 	ret
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 1/4] arm64: mm: remove unneeded SWAPPER_INIT_MAP_SIZE

From: Mark Rutland <mark.rutland@arm.com>
Date: 2021-05-18 12:15:58

On Tue, May 18, 2021 at 06:14:02PM +0800, Dong Aisheng wrote:
Since commit cdef5f6e9e0e ("arm64: mm: allocate pagetables anywhere"),
arm64 kernel supports allocate pagetables anywhere and this macro
definition is not used anymore.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.
quoted hunk
---
 arch/arm64/include/asm/kernel-pgtable.h | 3 ---
 1 file changed, 3 deletions(-)
diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h
index d44df9d62fc9..e2f103cce7c1 100644
--- a/arch/arm64/include/asm/kernel-pgtable.h
+++ b/arch/arm64/include/asm/kernel-pgtable.h
@@ -100,9 +100,6 @@
 #define SWAPPER_TABLE_SHIFT	PMD_SHIFT
 #endif
 
-/* The size of the initial kernel direct mapping */
-#define SWAPPER_INIT_MAP_SIZE	(_AC(1, UL) << SWAPPER_TABLE_SHIFT)
-
 /*
  * Initial memory map attributes.
  */
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 4/4] arm64: head: fix code comments in set_cpu_boot_mode_flag

From: Mark Rutland <mark.rutland@arm.com>
Date: 2021-05-18 12:16:00

On Tue, May 18, 2021 at 06:14:05PM +0800, Dong Aisheng wrote:
Up to here, the CPU boot mode can either be EL1 or EL2.
Correct the code comments a bit.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.
quoted hunk
---
 arch/arm64/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index d266b4c6287d..3b88000841d9 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -550,7 +550,7 @@ SYM_FUNC_START_LOCAL(set_cpu_boot_mode_flag)
 	cmp	w0, #BOOT_CPU_MODE_EL2
 	b.ne	1f
 	add	x1, x1, #4
-1:	str	w0, [x1]			// This CPU has booted in EL1
+1:	str	w0, [x1]			// Save CPU boot mode
 	dmb	sy
 	dc	ivac, x1			// Invalidate potentially stale cache line
 	ret
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 3/4] arm64: mm: drop unused __pa(__idmap_text_start)

From: Mark Rutland <mark.rutland@arm.com>
Date: 2021-05-18 12:21:26

On Tue, May 18, 2021 at 06:14:04PM +0800, Dong Aisheng wrote:
x5 is not used in the following map_memory. Instead,
__pa(__idmap_text_start) is stored in x3 which is used later.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
It might be worth noting that this hasn't been used since commit:

  0370b31e48454d8c ("arm64: Extend early page table code to allow for larger kernels")

Either way:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.
quoted hunk
---
 arch/arm64/kernel/head.S | 1 -
 1 file changed, 1 deletion(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index b70db34458ec..d266b4c6287d 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -354,7 +354,6 @@ SYM_FUNC_START_LOCAL(__create_page_tables)
 #endif
 1:
 	ldr_l	x4, idmap_ptrs_per_pgd
-	mov	x5, x3				// __pa(__idmap_text_start)
 	adr_l	x6, __idmap_text_end		// __pa(__idmap_text_end)
 
 	map_memory x0, x1, x3, x6, x7, x3, x4, x10, x11, x12, x13, x14
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 2/4] arm64: mm: fix the count comments in compute_indices

From: Mark Rutland <mark.rutland@arm.com>
Date: 2021-05-18 12:37:52

On Tue, May 18, 2021 at 06:14:03PM +0800, Dong Aisheng wrote:
'count - 1' is confusing and not comply with the real code running.
'count' actually represents the extra entries required, no need minus 1.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
This looks right to me, but I'm not all that familiar with this code.

Steve, does this make sense to you?

Mark.
quoted hunk
---
 arch/arm64/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 96873dfa67fd..b70db34458ec 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -195,7 +195,7 @@ SYM_CODE_END(preserve_boot_args)
 	and	\iend, \iend, \istart	// iend = (vend >> shift) & (ptrs - 1)
 	mov	\istart, \ptrs
 	mul	\istart, \istart, \count
-	add	\iend, \iend, \istart	// iend += (count - 1) * ptrs
+	add	\iend, \iend, \istart	// iend += count * ptrs
 					// our entries span multiple tables
 
 	lsr	\istart, \vstart, \shift
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 2/4] arm64: mm: fix the count comments in compute_indices

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2021-06-15 14:02:12

On Tue, May 18, 2021 at 01:35:11PM +0100, Mark Rutland wrote:
On Tue, May 18, 2021 at 06:14:03PM +0800, Dong Aisheng wrote:
quoted
'count - 1' is confusing and not comply with the real code running.
'count' actually represents the extra entries required, no need minus 1.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
This looks right to me, but I'm not all that familiar with this code.

Steve, does this make sense to you?

Mark.
quoted
---
 arch/arm64/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 96873dfa67fd..b70db34458ec 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -195,7 +195,7 @@ SYM_CODE_END(preserve_boot_args)
 	and	\iend, \iend, \istart	// iend = (vend >> shift) & (ptrs - 1)
 	mov	\istart, \ptrs
 	mul	\istart, \istart, \count
-	add	\iend, \iend, \istart	// iend += (count - 1) * ptrs
+	add	\iend, \iend, \istart	// iend += count * ptrs
 					// our entries span multiple tables
The comment was updated to match the code. The code also looks ok to me:
iend is inclusive and count denotes the extra entries required rather
than the actual number of entries.

Also cc'ing Will, I think he missed this series.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 1/4] arm64: mm: remove unneeded SWAPPER_INIT_MAP_SIZE

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2021-06-15 14:02:12

On Tue, May 18, 2021 at 06:14:02PM +0800, Dong Aisheng wrote:
quoted hunk
Since commit cdef5f6e9e0e ("arm64: mm: allocate pagetables anywhere"),
arm64 kernel supports allocate pagetables anywhere and this macro
definition is not used anymore.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 arch/arm64/include/asm/kernel-pgtable.h | 3 ---
 1 file changed, 3 deletions(-)
diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h
index d44df9d62fc9..e2f103cce7c1 100644
--- a/arch/arm64/include/asm/kernel-pgtable.h
+++ b/arch/arm64/include/asm/kernel-pgtable.h
@@ -100,9 +100,6 @@
 #define SWAPPER_TABLE_SHIFT	PMD_SHIFT
 #endif
 
-/* The size of the initial kernel direct mapping */
-#define SWAPPER_INIT_MAP_SIZE	(_AC(1, UL) << SWAPPER_TABLE_SHIFT)
It looks like Will merged Anshuman's equivalent
(https://lore.kernel.org/r/1623665411-20055-1-git-send-email-anshuman.khandual@arm.com)
as he wasn't cc'ed on this series.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 4/4] arm64: head: fix code comments in set_cpu_boot_mode_flag

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2021-06-15 14:02:17

On Tue, May 18, 2021 at 06:14:05PM +0800, Dong Aisheng wrote:
Up to here, the CPU boot mode can either be EL1 or EL2.
Correct the code comments a bit.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>

And cc'ing Will.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 3/4] arm64: mm: drop unused __pa(__idmap_text_start)

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2021-06-15 16:18:30

+ Will

On Tue, May 18, 2021 at 06:14:04PM +0800, Dong Aisheng wrote:
x5 is not used in the following map_memory. Instead,
__pa(__idmap_text_start) is stored in x3 which is used later.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 0/4] arm64: mm: a few small cleanups

From: Will Deacon <will@kernel.org>
Date: 2021-06-15 22:12:56

On Tue, 18 May 2021 18:14:01 +0800, Dong Aisheng wrote:
No function change

Dong Aisheng (4):
  arm64: mm: remove unneeded SWAPPER_INIT_MAP_SIZE
  arm64: mm: fix the count comments in compute_indices
  arm64: mm: drop unused __pa(__idmap_text_start)
  arm64: head: fix code comments in set_cpu_boot_mode_flag

[...]
Applied to arm64 (for-next/mm), thanks!

[1/4] arm64: mm: remove unneeded SWAPPER_INIT_MAP_SIZE
      https://git.kernel.org/arm64/c/0f473ac746a9
[2/4] arm64: mm: fix the count comments in compute_indices
      https://git.kernel.org/arm64/c/c70fe14f83ae
[3/4] arm64: mm: drop unused __pa(__idmap_text_start)
      https://git.kernel.org/arm64/c/f91671b5418b
[4/4] arm64: head: fix code comments in set_cpu_boot_mode_flag
      https://git.kernel.org/arm64/c/7957a3db01bf

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help