From patchwork Thu May 26 07:58:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 9136761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 199446075C for ; Thu, 26 May 2016 08:01:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CE34280B2 for ; Thu, 26 May 2016 08:01:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01922279E2; Thu, 26 May 2016 08:01:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B1476279E2 for ; Thu, 26 May 2016 08:01:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5qCT-0007Pr-4I; Thu, 26 May 2016 07:59:25 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5qCS-0007Pg-J3 for xen-devel@lists.xen.org; Thu, 26 May 2016 07:59:24 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 2F/8E-00586-BDCA6475; Thu, 26 May 2016 07:59:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRWlGSWpSXmKPExsVyMfSOtu7tNW7 hBkuvCVos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkvlt9gLmjhqjh4chtzA+Mxji5GLg4hgUmM Essm9LOCOCwC85glLm1vYuxi5OSQEOhnlVh5JBbCjpFomHmNDcKulHizfS9zFyMHULeSRMeEC ohBPxklZk9/D1bDJqAi8f0NyFCQejOJ8ydnMoHYIgLSEtc+XwabzyyQKXHjy0R2EFtYIETi7b U+sHoWAVWJVb1nwebwClhI7HjfDjVHSeLVlWMsIDangKXEj+ZeZhBbCKhmyePZjBMYBRcwMqx i1ChOLSpLLdI1tNBLKspMzyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAgMOAYg2MHYtN3z EKMkB5OSKK+4uFu4EF9SfkplRmJxRnxRaU5q8SFGGQ4OJQneR6uBcoJFqempFWmZOcDQh0lLc PAoifA+B0nzFhck5hZnpkOkTjEac2z5fW0tE8e2qffWMgmx5OXnpUqJ864GKRUAKc0ozYMbBI vJS4yyUsK8jECnCfEUpBblZpagyr9iFOdgVBLm/QUyhSczrwRu3yugU5iATvH/4gxySkkiQkq qgVE/6cH9Gt7t1aturgwuXpIpwsr51P3NMaaZS2zv57qGeqm8yZxxaIV06lH3GU1HpUzZ+eKu vm5L3efBZ/unNqG45HPue7ZNqe3fFa+JFV6YeEGk6h3zXMdj1z4uXDqzTT5+KufXHbum7VPQK Us8wZjxIH7eKp/Qk22/UxLCXp1ikt0ytUvXk0eJpTgj0VCLuag4EQAJi7GqxAIAAA== X-Env-Sender: wei.chen@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1464249562!41687393!1 X-Originating-IP: [209.85.220.43] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21749 invoked from network); 26 May 2016 07:59:23 -0000 Received: from mail-pa0-f43.google.com (HELO mail-pa0-f43.google.com) (209.85.220.43) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 26 May 2016 07:59:23 -0000 Received: by mail-pa0-f43.google.com with SMTP id eu11so18249547pad.3 for ; Thu, 26 May 2016 00:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OdaMjuPmEYGcFWsG++UBmtyuugMz8ayG2yiy4mjkDDw=; b=PBvLCE/hM3nBjvNwycDc0NsSOFt7D4dH2PXAqJLu5lF+IJ5OWd5QZy6BR4yKye5Slq 7fQtUxE/2mcdFMSpQpRuWO+ylc/2z7PRHI7wB6KKfoPs66Om97864vIpTX8iuhgsUL0w 9K/nn3MteB9fpqPW5BxgknMXi04IEW++Bqu20= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OdaMjuPmEYGcFWsG++UBmtyuugMz8ayG2yiy4mjkDDw=; b=JE8SvMB3WuPVywqKbAqf1lxF1VF2qx/TbqNj0s995Ph/nkZkCXHMitJjV5hLf/O30r vDsq1r9hMs46s3u27p3hcq7di5Vyy3THuPA3Z0ANxroDc6qng/PrMhuZ/9+jvB5n0ru2 f2SOuzYxkmwJY4x0Axqz//1UUFiawLGTn4ykHjtHIJmsJuwO8D89iEjwbi5HpdA+iWQY Z7yQhUsEbIsofoGoFv3rX+vdrB/xElOWXgB4Rjc4eDu2jSj+Qza8F8l0xdRdN1ffyZYT QKJyEqr9ylxclc7Sx4h+YHbOJNKe1GZYcpM0ZXGB1QqgewqV63bT5zrA65oPCC5Hk/54 B3LQ== X-Gm-Message-State: ALyK8tLYIpHVkfu+jHU3gL5bn3CQutiLz6Qaz5+xTTz+qB0hj2TvYQFVEsnz7vaJWFayyHbx X-Received: by 10.67.30.101 with SMTP id kd5mr11968107pad.93.1464249561796; Thu, 26 May 2016 00:59:21 -0700 (PDT) Received: from localhost.members.linode.com ([2400:8900::f03c:91ff:fe56:1324]) by smtp.gmail.com with ESMTPSA id v27sm3686855pfi.49.2016.05.26.00.59.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2016 00:59:21 -0700 (PDT) From: Wei Chen X-Google-Original-From: Wei Chen To: xen-devel@lists.xen.org Date: Thu, 26 May 2016 15:58:41 +0800 Message-Id: <20160526075843.25236-3-Wei.Chen@linaro.org> X-Mailer: git-send-email 2.9.0.rc0 In-Reply-To: <20160526075843.25236-1-Wei.Chen@linaro.org> References: <20160526075843.25236-1-Wei.Chen@linaro.org> Cc: julien.grall@arm.com, sstabellini@kernel.org, Wei Chen , steve.capper@arm.com Subject: [Xen-devel] [PATCH v2 2/4] xen/arm: Make AFFINITY_MASK generate correct mask for level3 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The original affinity shift bits algorithm in AFFINITY_MASK is buggy, it could not generate correct affinity shift bits of level3. The macro MPIDR_LEVEL_SHIFT can calculate level3 affinity shift bits correctly. We use this macro in AFFINITY_MASK to generate correct mask for level3. Signed-off-by: Wei Chen Reviewed-by: Julien Grall --- v2: Add Julien's reviewed-by. --- xen/include/asm-arm/processor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index 7de9c8e..b4cce7e 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -21,7 +21,6 @@ #define MPIDR_HWID_MASK _AC(0xffffff,U) #define MPIDR_INVALID (~MPIDR_HWID_MASK) #define MPIDR_LEVEL_BITS (8) -#define AFFINITY_MASK(level) ~((_AC(0x1,U) << ((level) * MPIDR_LEVEL_BITS)) - 1) /* @@ -37,6 +36,8 @@ #define MPIDR_AFFINITY_LEVEL(mpidr, level) \ ((mpidr >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK) +#define AFFINITY_MASK(level) ~((_AC(0x1,UL) << MPIDR_LEVEL_SHIFT(level)) - 1) + /* TTBCR Translation Table Base Control Register */ #define TTBCR_EAE _AC(0x80000000,U) #define TTBCR_N_MASK _AC(0x07,U)