From patchwork Wed Aug 28 11:35:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 2850692 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A476A9F485 for ; Wed, 28 Aug 2013 11:44:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A963204A2 for ; Wed, 28 Aug 2013 11:44:33 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4DC1B20488 for ; Wed, 28 Aug 2013 11:44:32 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VEe4C-0003l5-Fe; Wed, 28 Aug 2013 11:37:41 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VEe3P-0000x7-9V; Wed, 28 Aug 2013 11:36:51 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VEe2y-0000rE-4I for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2013 11:36:28 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 28 Aug 2013 12:36:02 +0100 Received: from red-moon.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 28 Aug 2013 12:35:58 +0100 From: Lorenzo Pieralisi To: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 01/14] arm64: kernel: add MPIDR_EL1 accessors macros Date: Wed, 28 Aug 2013 12:35:53 +0100 Message-Id: <1377689766-17642-2-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1377689766-17642-1-git-send-email-lorenzo.pieralisi@arm.com> References: <1377689766-17642-1-git-send-email-lorenzo.pieralisi@arm.com> X-OriginalArrivalTime: 28 Aug 2013 11:35:58.0563 (UTC) FILETIME=[C3F14B30:01CEA3E2] X-MC-Unique: 113082812360200201 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130828_073624_467096_FE9B9307 X-CRM114-Status: GOOD ( 10.08 ) X-Spam-Score: -2.6 (--) Cc: Mark Rutland , Feng Kan , Stephen Boyd , Lorenzo Pieralisi , Russell King , Graeme Gregory , Nicolas Pitre , Marc Zyngier , Catalin Marinas , Yu Tang , Will Deacon , Sudeep KarkadaNagesha , Santosh Shilimkar , Loc Ho , Colin Cross , Kumar Sankaran , Dave Martin , Hanjun Guo , Zhou Zhu X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to simplify access to different affinity levels within the MPIDR_EL1 register values, this patch implements some preprocessor macros that allow to retrieve the MPIDR_EL1 affinity level value according to the level passed as input parameter. Signed-off-by: Lorenzo Pieralisi --- arch/arm64/include/asm/cputype.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h index 5fe138e..2c9e295 100644 --- a/arch/arm64/include/asm/cputype.h +++ b/arch/arm64/include/asm/cputype.h @@ -30,6 +30,16 @@ #define MPIDR_HWID_BITMASK 0xff00ffffff +#define MPIDR_LEVEL_BITS 8 +#define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1) + +#define MPIDR_LEVEL_SHIFT(level) ({ \ + (level == 3) ? 32 : MPIDR_LEVEL_BITS * level; \ +}) + +#define MPIDR_AFFINITY_LEVEL(mpidr, level) \ + ((mpidr >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK) \ + #define read_cpuid(reg) ({ \ u64 __val; \ asm("mrs %0, " reg : "=r" (__val)); \