diff mbox series

[v2,3/3] arm64/sve: Fix a couple of magic numbers for the Z-reg count

Message ID 1560355234-25516-4-git-send-email-Dave.Martin@arm.com (mailing list archive)
State New, archived
Headers show
Series arm64/sve: Fix mutating register endianness on big-endian | expand

Commit Message

Dave Martin June 12, 2019, 4 p.m. UTC
There are some hand-written instances of "32" to express the number
of SVE Z-registers.

Since this code was written a #define was added for this, so
convert trivial instances of this magic number as appropriate.

No functional change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
---
 arch/arm64/kernel/fpsimd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Julien Grall June 20, 2019, 1:43 p.m. UTC | #1
Hi Dave,

On 6/12/19 5:00 PM, Dave Martin wrote:
> There are some hand-written instances of "32" to express the number
> of SVE Z-registers.
> 
> Since this code was written a #define was added for this, so
> convert trivial instances of this magic number as appropriate.
> 
> No functional change.
> 
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>

Cheers,
Catalin Marinas July 22, 2019, 10:32 a.m. UTC | #2
On Wed, Jun 12, 2019 at 05:00:34PM +0100, Dave P Martin wrote:
> There are some hand-written instances of "32" to express the number
> of SVE Z-registers.
> 
> Since this code was written a #define was added for this, so
> convert trivial instances of this magic number as appropriate.
> 
> No functional change.
> 
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>

Same here, Will can queue this for -rc2.

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

Patch

diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index d2f7544..a5702c3 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -376,7 +376,7 @@  static void __fpsimd_to_sve(void *sst, struct user_fpsimd_state const *fst,
 	unsigned int i;
 	__uint128_t *p;
 
-	for (i = 0; i < 32; ++i) {
+	for (i = 0; i < SVE_NUM_ZREGS; ++i) {
 		p = (__uint128_t *)ZREG(sst, vq, i);
 		*p = arm64_cpu_to_le128(fst->vregs[i]);
 	}
@@ -428,7 +428,7 @@  static void sve_to_fpsimd(struct task_struct *task)
 		return;
 
 	vq = sve_vq_from_vl(task->thread.sve_vl);
-	for (i = 0; i < 32; ++i) {
+	for (i = 0; i < SVE_NUM_ZREGS; ++i) {
 		p = (__uint128_t const *)ZREG(sst, vq, i);
 		fst->vregs[i] = arm64_le128_to_cpu(*p);
 	}