[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [kvm-unit-tests PATCH 02/10] arm64: fix get_"sysreg32" and ma
From: |
Andrew Jones |
Subject: |
[Qemu-arm] [kvm-unit-tests PATCH 02/10] arm64: fix get_"sysreg32" and make MPIDR 64bit |
Date: |
Mon, 16 May 2016 09:57:16 +0200 |
mrs is always 64bit, so we should always use a 64bit register.
Sometimes we'll only want to return the lower 32, but not for
MPIDR, as that does define fields in the upper 32.
Signed-off-by: Andrew Jones <address@hidden>
---
lib/arm64/asm/processor.h | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/arm64/asm/processor.h b/lib/arm64/asm/processor.h
index 84d5c7ce752b0..9a208ff729b7e 100644
--- a/lib/arm64/asm/processor.h
+++ b/lib/arm64/asm/processor.h
@@ -66,14 +66,17 @@ static inline unsigned long current_level(void)
return el & 0xc;
}
-#define DEFINE_GET_SYSREG32(reg) \
-static inline unsigned int get_##reg(void) \
+#define DEFINE_GET_SYSREG(reg, type) \
+static inline type get_##reg(void) \
{ \
- unsigned int reg; \
- asm volatile("mrs %0, " #reg "_el1" : "=r" (reg)); \
- return reg; \
+ unsigned long r; \
+ asm volatile("mrs %0, " #reg "_el1" : "=r" (r)); \
+ return (type)r; \
}
-DEFINE_GET_SYSREG32(mpidr)
+#define DEFINE_GET_SYSREG32(reg) DEFINE_GET_SYSREG(reg, unsigned int)
+#define DEFINE_GET_SYSREG64(reg) DEFINE_GET_SYSREG(reg, unsigned long)
+
+DEFINE_GET_SYSREG64(mpidr)
/* Only support Aff0 for now, gicv2 only */
#define mpidr_to_cpu(mpidr) ((int)((mpidr) & 0xff))
--
2.4.11
- [Qemu-arm] [kvm-unit-tests PATCH 00/10] arm/arm64: add gic framework, Andrew Jones, 2016/05/16
- [Qemu-arm] [kvm-unit-tests PATCH 02/10] arm64: fix get_"sysreg32" and make MPIDR 64bit,
Andrew Jones <=
- [Qemu-arm] [kvm-unit-tests PATCH 01/10] lib: xstr: allow multiple args, Andrew Jones, 2016/05/16
- [Qemu-arm] [kvm-unit-tests PATCH 05/10] arm/arm64: irq enable/disable, Andrew Jones, 2016/05/16
- [Qemu-arm] [kvm-unit-tests PATCH 03/10] arm/arm64: smp: support more than 8 cpus, Andrew Jones, 2016/05/16
- [Qemu-arm] [kvm-unit-tests PATCH 04/10] arm/arm64: add some delay routines, Andrew Jones, 2016/05/16
- [Qemu-arm] [kvm-unit-tests PATCH 06/10] arm/arm64: add initial gicv2 support, Andrew Jones, 2016/05/16
- [Qemu-arm] [kvm-unit-tests PATCH 07/10] arm64: add initial gicv3 support, Andrew Jones, 2016/05/16
- [Qemu-arm] [kvm-unit-tests PATCH 09/10] arm/arm64: gicv3: add an IPI test, Andrew Jones, 2016/05/16
- [Qemu-arm] [kvm-unit-tests PATCH 08/10] arm/arm64: gicv2: add an IPI test, Andrew Jones, 2016/05/16
- [Qemu-arm] [kvm-unit-tests PATCH 10/10] arm/arm64: gic: don't just use zero, Andrew Jones, 2016/05/16
- Re: [Qemu-arm] [kvm-unit-tests PATCH 00/10] arm/arm64: add gic framework, Christoffer Dall, 2016/05/18