From patchwork Wed Aug 9 08:20:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergej Proskurin X-Patchwork-Id: 9889839 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 8FA9660384 for ; Wed, 9 Aug 2017 08:23:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E59528618 for ; Wed, 9 Aug 2017 08:23:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72FA6286D2; Wed, 9 Aug 2017 08:23:58 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 C0F0428618 for ; Wed, 9 Aug 2017 08:23:57 +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 1dfMFA-0006Zj-4w; Wed, 09 Aug 2017 08:21:32 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfMF8-0006WF-1J for xen-devel@lists.xenproject.org; Wed, 09 Aug 2017 08:21:30 +0000 Received: from [85.158.139.211] by server-16.bemta-5.messagelabs.com id 69/B0-01712-906CA895; Wed, 09 Aug 2017 08:21:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsXSPJ+BQ/f/0a5 Ig6nLDSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyzzQvYCi6IVqyfc4yxgXGjUBcjJ4eQwEZG iV+H5bsYuYDsTYwSj59OYwdJsAkYSEx5vZIVxBYRUJK4t2oyE0gRs8AUZom7f+8xgySEBXwld r9rZAOxWQRUJWYc2wXWwCtgLbH193+wGgkBeYmJvdMYQWxOARuJHXcgbCGgmmnHzjFPYORewM iwilGjOLWoLLVI19hAL6koMz2jJDcxM0fX0MBULze1uDgxPTUnMalYLzk/dxMj0MP1DAyMOxg nrPI7xCjJwaQkyrtJuzNSiC8pP6UyI7E4I76oNCe1+BCjDAeHkgTvjyNdkUKCRanpqRVpmTnA UINJS3DwKInw3gZJ8xYXJOYWZ6ZDpE4x6nK8mvD/G5MQS15+XqqUOK8pMHCFBECKMkrz4EbAw v4So6yUMC8jAwODEE9BalFuZgmq/CtGcQ5GJWHefSCreDLzSuA2vQI6ggnoiAjfTpAjShIRUl INjHsfHy5zPPUuMdG4ZJ2/xRbzmNPSMjlFXX9Ue7UkhernhBr9n1Qptaek8Pwj20BrnupbO5/ XPVm3kHndiu315dFbomd7rCiVNFrw1ULI746LyRKzo7G9Pt9Sklp+ez+/kO6nprjwciSvA++M JC7ONDP1ZT8EDoUeKOf1MUmzyIvtEPJ+FCasxFKckWioxVxUnAgAp+0jJHYCAAA= X-Env-Sender: proskurin@sec.in.tum.de X-Msg-Ref: server-13.tower-206.messagelabs.com!1502266879!90973417!1 X-Originating-IP: [131.159.0.8] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 45131 invoked from network); 9 Aug 2017 08:21:19 -0000 Received: from mail-out1.informatik.tu-muenchen.de (HELO mail-out1.informatik.tu-muenchen.de) (131.159.0.8) by server-13.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Aug 2017 08:21:19 -0000 Received: from files.sec.in.tum.de (files.sec.in.tum.de [131.159.50.1]) by services.sec.in.tum.de (Postfix) with ESMTP id 08DA010DD29F2; Wed, 9 Aug 2017 10:21:07 +0200 (CEST) Received: from thanatos.sec.in.tum.de (thanatos.sec.in.tum.de [131.159.50.57]) by files.sec.in.tum.de (Postfix) with ESMTP id EF2171F047; Wed, 9 Aug 2017 10:21:06 +0200 (CEST) From: Sergej Proskurin To: xen-devel@lists.xenproject.org Date: Wed, 9 Aug 2017 10:20:32 +0200 Message-Id: <20170809082038.3236-8-proskurin@sec.in.tum.de> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170809082038.3236-1-proskurin@sec.in.tum.de> References: <20170809082038.3236-1-proskurin@sec.in.tum.de> Cc: Stefano Stabellini , Wei Liu , George Dunlap , Sergej Proskurin , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH v8 07/13] arm/mem_access: Introduce GENMASK_ULL bit operation 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 current implementation of GENMASK is capable of creating bitmasks of 32-bit values on AArch32 and 64-bit values on AArch64. As we need to create masks for 64-bit values on AArch32 as well, in this commit we introduce the GENMASK_ULL bit operation. Please note that the GENMASK_ULL implementation has been lifted from the linux kernel source code. Signed-off-by: Sergej Proskurin Reviewed-by: Stefano Stabellini --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: Wei Liu --- v6: As similar patches have been already submitted and NACKED in the past, we resubmit this patch with 'THE REST' maintainers in Cc to discuss whether this patch shall be applied into common or put into ARM related code. v7: Change the introduced macro BITS_PER_LONG_LONG to BITS_PER_LLONG. Define BITS_PER_LLONG also in asm-x86/config.h in order to allow global usage of the introduced macro GENMASK_ULL. Remove previously unintended whitespace elimination in the function get_bitmask_order as it is not the right patch to address cleanup. --- xen/include/asm-arm/config.h | 2 ++ xen/include/asm-x86/config.h | 2 ++ xen/include/xen/bitops.h | 3 +++ 3 files changed, 7 insertions(+) diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h index 5b6f3c985d..7da94698e1 100644 --- a/xen/include/asm-arm/config.h +++ b/xen/include/asm-arm/config.h @@ -19,6 +19,8 @@ #define BITS_PER_LONG (BYTES_PER_LONG << 3) #define POINTER_ALIGN BYTES_PER_LONG +#define BITS_PER_LLONG 64 + /* xen_ulong_t is always 64 bits */ #define BITS_PER_XEN_ULONG 64 diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h index bc0730fd9d..8b1de07dbc 100644 --- a/xen/include/asm-x86/config.h +++ b/xen/include/asm-x86/config.h @@ -15,6 +15,8 @@ #define BITS_PER_BYTE 8 #define POINTER_ALIGN BYTES_PER_LONG +#define BITS_PER_LLONG 64 + #define BITS_PER_XEN_ULONG BITS_PER_LONG #define CONFIG_PAGING_ASSISTANCE 1 diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h index bd0883ab22..e2019b02a3 100644 --- a/xen/include/xen/bitops.h +++ b/xen/include/xen/bitops.h @@ -10,6 +10,9 @@ #define GENMASK(h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK_ULL(h, l) \ + (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LLONG - 1 - (h)))) + /* * ffs: find first bit set. This is defined the same way as * the libc and compiler builtin ffs routines, therefore