From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9yKW-0004Ne-5f for qemu-devel@nongnu.org; Mon, 06 Jun 2016 13:28:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9yKT-0008Lx-0l for qemu-devel@nongnu.org; Mon, 06 Jun 2016 13:28:48 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:38390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9yKS-0008LJ-7u for qemu-devel@nongnu.org; Mon, 06 Jun 2016 13:28:44 -0400 Received: by mail-wm0-x22b.google.com with SMTP id m124so81612214wme.1 for ; Mon, 06 Jun 2016 10:28:44 -0700 (PDT) From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <20160606163238.GB23505@leverpostej> Date: Mon, 06 Jun 2016 18:28:57 +0100 Message-ID: <87ziqygrae.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 03/10] arm/arm64: smp: support more than 8 cpus List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark Rutland Cc: Andrew Jones , kvm@vger.kernel.org, marc.zyngier@arm.com, andre.przywara@arm.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, pbonzini@redhat.com, kvmarm@lists.cs.columbia.edu Mark Rutland writes: > On Mon, Jun 06, 2016 at 05:22:49PM +0100, Alex Bennée wrote: >> Andrew Jones writes: >> > +#define MPIDR_LEVEL_SHIFT(level) \ >> > + (((1 << level) >> 1) << 3) >> > +#define MPIDR_AFFINITY_LEVEL(mpidr, level) \ >> > + ((mpidr >> MPIDR_LEVEL_SHIFT(level)) & 0xff) >> >> Doesn't Aff3 break this little macro? It sits at 32:39 with a gap for >> MT, RES0, U, RES1 for bits 25:31 > > It works, it's just a little bit magic: Ahh the magic was too subtle for my eyes, perhaps a comment for the wary. > > (gdb) p (((1 << 0) >> 1) << 3) > $1 = 0 > (gdb) p (((1 << 1) >> 1) << 3) > $2 = 8 > (gdb) p (((1 << 2) >> 1) << 3) > $3 = 16 > (gdb) p (((1 << 3) >> 1) << 3) > $4 = 32 > (gdb) > > We do the same in arch/arm64/include/asm/cputype.h since b058450f38c337d1 > ("arm64: kernel: add MPIDR_EL1 accessors macros"). I see the truth of it ;-) > > Thanks, > Mark. -- Alex Bennée