From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9twW-0003tC-Db for qemu-devel@nongnu.org; Mon, 06 Jun 2016 08:47:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9twQ-0005k3-VN for qemu-devel@nongnu.org; Mon, 06 Jun 2016 08:47:44 -0400 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]:37047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9twQ-0005j2-Oc for qemu-devel@nongnu.org; Mon, 06 Jun 2016 08:47:38 -0400 Received: by mail-wm0-x230.google.com with SMTP id k204so25584891wmk.0 for ; Mon, 06 Jun 2016 05:47:38 -0700 (PDT) From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1465064165-14885-3-git-send-email-drjones@redhat.com> Date: Mon, 06 Jun 2016 13:47:50 +0100 Message-ID: <87bn3eiivd.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [kvm-unit-tests PATCH v2 02/10] arm64: fix get_"sysreg32" and make MPIDR 64bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Jones Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, pbonzini@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, andre.przywara@arm.com, peter.maydell@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com Andrew Jones writes: > 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 > --- > 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) I guess this is a hang-over the kernel style to use int/long over u32/u64? Otherwise: Reviewed-by: Alex Bennée > + > +DEFINE_GET_SYSREG64(mpidr) > > /* Only support Aff0 for now, gicv2 only */ > #define mpidr_to_cpu(mpidr) ((int)((mpidr) & 0xff)) -- Alex Bennée