Skip to contentSkip to conversation

arm64: mm: use ubfm for dcache_line_size

PATCH New Jingoo Han 2 participants 2 messages Jan 20, 2014 – Jan 21, 2014 arm64

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH v2 1/1 arm64: mm: use ubfm for dcache_line_size

Use 'ubfm' for the bitfield move instruction; thus, single instruction can be used instead of two instructions, when getting the minimum D-cache line size from CTR_EL0 register.

---
Change since v1
- Remove unnecessary prefix '0x' from immediates, per Will Deacon
- Add '#' to immediates for consistency, per Ard Biesheuvel

 arch/arm64/mm/proc-macros.S |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm64/mm/proc-macros.S +1 -2
index 8957b82..005d29e 100644
@@ -38,8 +38,7 @@
  */
 	.macro	dcache_line_size, reg, tmp
 	mrs	\tmp, ctr_el0			// read CTR
-	lsr	\tmp, \tmp, #16
-	and	\tmp, \tmp, #0xf		// cache line size encoding
+	ubfm	\tmp, \tmp, #16, #19		// cache line size encoding
 	mov	\reg, #4			// bytes per word
 	lsl	\reg, \reg, \tmp		// actual cache line size
 	.endm
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 1/1 arm64: mm: use ubfm for dcache_line_size

Quoted 5 lines · Jingoo Han

Use 'ubfm' for the bitfield move instruction; thus, single instruction can be used instead of two instructions, when getting the minimum D-cache line size from CTR_EL0 register.

Thanks,

Will

Quoted 27 lines

---
Change since v1
- Remove unnecessary prefix '0x' from immediates, per Will Deacon
- Add '#' to immediates for consistency, per Ard Biesheuvel

 arch/arm64/mm/proc-macros.S |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm64/mm/proc-macros.S +1 -2
index 8957b82..005d29e 100644
@@ -38,8 +38,7 @@
  */
 	.macro	dcache_line_size, reg, tmp
 	mrs	\tmp, ctr_el0			// read CTR
-	lsr	\tmp, \tmp, #16
-	and	\tmp, \tmp, #0xf		// cache line size encoding
+	ubfm	\tmp, \tmp, #16, #19		// cache line size encoding
 	mov	\reg, #4			// bytes per word
 	lsl	\reg, \reg, \tmp		// actual cache line size
 	.endm
Signature · 1 line
1.7.10.4