From patchwork Wed Aug 16 13:17:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergej Proskurin X-Patchwork-Id: 9903775 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 9F09A60231 for ; Wed, 16 Aug 2017 13:20:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 913CD289EE for ; Wed, 16 Aug 2017 13:20:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85BB5289F0; Wed, 16 Aug 2017 13:20:45 +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 16DA6289E9 for ; Wed, 16 Aug 2017 13:20:45 +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 1dhyCw-0000l4-QJ; Wed, 16 Aug 2017 13:18:02 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhyCu-0000hm-OY for xen-devel@lists.xenproject.org; Wed, 16 Aug 2017 13:18:00 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id 42/25-01859-70644995; Wed, 16 Aug 2017 13:17:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRWlGSWpSXmKPExsXSPJ+BQ5fdbUq kwYLz0hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aCGydYCjaJVfxZuZC9gbFTuIuRi0NIYCOj xPp/E5ggnE2MEu9/LGDuYuTkYBMwkJjyeiUriC0ioCRxb9VksCJmgSnMEnf/3gMrEhbwlehvW 8gOYrMIqErMbl4MFucVsJGYfmIpG4gtISAvMbF3GiOIzSlgK3G/9T0LiC0EVPOysYVpAiP3Ak aGVYwaxalFZalFusYGeklFmekZJbmJmTm6hgbGermpxcWJ6ak5iUnFesn5uZsYgT6uZ2Bg3MH YecLvEKMkB5OSKG+Q1pRIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8Rq5AOcGi1PTUirTMHGCw waQlOHiURHiNXIDSvMUFibnFmekQqVOMuhyvJvz/xiTEkpeflyolznsPpEgApCijNA9uBCzwL zHKSgnzMjIwMAjxFKQW5WaWoMq/YhTnYFQS5jUBuYQnM68EbtMroCOYgI640j4J5IiSRISUVA Njc52nvkzY1L/tt/7L5czMznaaWHTn1LuA7LZz+mwCyz+4RG5o7cqN5TSavCnHPdGAfw/Ljzk xBVIODzn4wlclSSedlM6Xy5pjmjjrS9HnR65lYk4/An5O0HZzu2WiXrp5XuL+1M4vc2xCzLTE 137w5Vv+faV/mojA1gcaRjtqfn7Zo3p9tYISS3FGoqEWc1FxIgBZbUNxdwIAAA== X-Env-Sender: proskurin@sec.in.tum.de X-Msg-Ref: server-11.tower-31.messagelabs.com!1502889479!79397637!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 51713 invoked from network); 16 Aug 2017 13:17:59 -0000 Received: from mail-out1.informatik.tu-muenchen.de (HELO mail-out1.informatik.tu-muenchen.de) (131.159.0.8) by server-11.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 16 Aug 2017 13:17:59 -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 A72C51132061A; Wed, 16 Aug 2017 15:17:47 +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 995461F035; Wed, 16 Aug 2017 15:17:47 +0200 (CEST) From: Sergej Proskurin To: xen-devel@lists.xenproject.org Date: Wed, 16 Aug 2017 15:17:38 +0200 Message-Id: <20170816131744.13051-8-proskurin@sec.in.tum.de> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170816131744.13051-1-proskurin@sec.in.tum.de> References: <20170816131744.13051-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 v9 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. v9: Add Reviewed-by Stenafo Stabellini. --- 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 25af085af0..0130ac864f 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