From patchwork Fri Oct 22 10:47:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TGluIExpdSDvvIjliJjmnpfvvIk=?= X-Patchwork-Id: 12577559 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDA9DC433EF for ; Fri, 22 Oct 2021 10:48:22 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7A3EF611CB for ; Fri, 22 Oct 2021 10:48:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7A3EF611CB Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.214949.373828 (Exim 4.92) (envelope-from ) id 1mds5o-00067a-V0; Fri, 22 Oct 2021 10:48:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 214949.373828; Fri, 22 Oct 2021 10:48:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds5o-000672-P4; Fri, 22 Oct 2021 10:48:08 +0000 Received: by outflank-mailman (input) for mailman id 214949; Fri, 22 Oct 2021 10:48:07 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds5n-00063s-Ot for xen-devel@lists.xenproject.org; Fri, 22 Oct 2021 10:48:07 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 899cacfa-3325-11ec-83b2-12813bfff9fa; Fri, 22 Oct 2021 10:48:06 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 899cacfa-3325-11ec-83b2-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1634899686; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IFE0UJWngehF/A2SEsMzjIMw1cebKLctc7j7VVKm2kg=; b=DYDcyYc2cqpGUHTxjTE64aII/dVtmZZvJfdO814hzVxBmtIrZIXti2ht h7sLs9lHr4po4BlJ4HNgnW7yfTb28HlQ/4pc5e+WiqjWERIR4p1x5UXU/ JkI6VtslI/kJjMk5UJANpf/r67ZejCG/uYWmCA8Zq9DOn1WdA9GIRM+Qy s=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 9ODWXCtlXJsgGAcpdr47VuOgrNDlPEua4piplJW1s+UBl/uFlNhmUT04tLNIP0bkikNn7t5Hmt 4gjBemsZz5YwqZs+MV3N+qbVlE7KNlcga3fIwiA/LmmCdwUVAQtshXMHFR/9jTCKEKOngq9zj0 +kQAsiW/SEmaInkPqRIWCiPmzfjqxzYVjiozt8hqofY1qpjMBaXQi/7dLsMOnt/PjrCsCYCuJU qCM0mNQNOlXATNqHUPSzpZGv+DW05yM1JTgTEu3NJlqtdwzl9Vyd8Yv2Fi+CvDIq0/+2jbSFT1 sSITJLNRVutURWfvnG5j84wI X-SBRS: 5.1 X-MesageID: 55807250 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED Iron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2 403Cid+8D0GCLeWSnCOqeY7dAlWRVBmVcGeg5EGLYarf1s5cFzN/teMmNvNjaQ+xP8L/goJl 1ngMnJlJK3X3Cyed1/SMy07NNsCn/9X9BoGAMDlBn7ws1BLXGplxP53m0IfceZ1+ep94+RzS vVZKcyMDu4WEmbM+igHbIm7p4tnLUz5iQWLNiujQT4+Y58/GFCZpo66JlPipHsUEy66lcoiu Ln8hAnVdoUOGlZ5B8HMZfPxk17o5SoBmPh/VlfjK8VIfBm+65BjLiH816dlI8wFJRjZ6CGd0 gKaXUURqeXX+tdn+9jVn6GU6YyuFrImTEZdGmDa65ewNDXboTX/kdMRDr7QcGmEBm3u+aika eFE9N3GMaUKzARQro5xM7d31qZitdHhkKBXk1Z/F3LRYlX1Vr45eiua3dNCv7Fmz6NCvVfkQ VqG/9RXNOnbOM7hF1JNdgMpYv7aiKMRkzjWq/80PF/79Gl8+7/eCRdeOByFiSp8KrppMdx6n bd96ZBOswHv2AA3NtumjzxP8zXeJ3MNZKwrq5UGDdK5kQEs0FxDPcTRByKeDEtjsDmQ3p3G+ gOpuZc= IronPort-HdrOrdr: A9a23:lQQukavz14qfGMCrNNHCFY4O7skDTtV00zEX/kB9WHVpmszxra 6TdZMgpHnJYVcqKQkdcL+7WJVoLUmxyXcx2/h1AV7AZniAhILLFvAA0WKK+VSJcEeSygce79 YFT0EXMqyIMbEQt6fHCWeDfOrIuOP3kpyVuQ== X-IronPort-AV: E=Sophos;i="5.87,172,1631592000"; d="scan'208";a="55807250" From: Lin Liu To: CC: Lin Liu , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , "Stefano Stabellini" , Wei Liu Subject: [PATCH v2 1/7] xen: implement byteswap.h Date: Fri, 22 Oct 2021 10:47:22 +0000 Message-ID: <89afdafa9020ab77b9d662bd5c8f7b2d31e53c5c.1634897942.git.lin.liu@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 swab() is massively over complicated and can be simplified by builtins. The compilers provide builtin function to swap bytes. * gcc: https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html * clang: https://clang.llvm.org/docs/LanguageExtensions.html This patch simplify swab() with builtins and fallback for old compilers. Signed-off-by: Lin Liu --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Stefano Stabellini Cc: Wei Liu Changes in v2: - Add fallback for compilers without __builtin_bswap - Implement with plain C instead of macros --- xen/include/xen/byteswap.h | 93 ++++++++++++++++++++++++++++++++++++++ xen/include/xen/compiler.h | 12 +++++ 2 files changed, 105 insertions(+) create mode 100644 xen/include/xen/byteswap.h diff --git a/xen/include/xen/byteswap.h b/xen/include/xen/byteswap.h new file mode 100644 index 0000000000..848a4bbaee --- /dev/null +++ b/xen/include/xen/byteswap.h @@ -0,0 +1,93 @@ +#ifndef _BYTESWAP_H +#define _BYTESWAP_H + +#include + +#if !__has_builtin(__builtin_bswap16) +static always_inline uint16_t __builtin_bswap16(uint16_t val) +{ + return ((val & 0x00FF) << 8) | ((val & 0xFF00) >> 8); +} +#endif + +#if !__has_builtin(__builtin_bswap32) +static always_inline uint32_t __builtin_bswap32(uint32_t val) +{ + return ((val & 0x000000FF) << 24) | + ((val & 0x0000FF00) << 8) | + ((val & 0x00FF0000) >> 8) | + ((val & 0xFF000000) >> 24); +} +#endif + +#if !__has_builtin(__builtin_bswap64) +static always_inline uint64_t __builtin_bswap64(uint64_t val) +{ + return ((val & 0x00000000000000FF) << 56) | + ((val & 0x000000000000FF00) << 40) | + ((val & 0x0000000000FF0000) << 24) | + ((val & 0x00000000FF000000) << 8) | + ((val & 0x000000FF00000000) >> 8) | + ((val & 0x0000FF0000000000) >> 24) | + ((val & 0x00FF000000000000) >> 40) | + ((val & 0xFF00000000000000) >> 56); +} +#endif + +#define bswap16(x) __builtin_bswap16(x) +#define bswap32(x) __builtin_bswap32(x) +#define bswap64(x) __builtin_bswap64(x) + +#define bswap_ul(x) bswap##BITS_PER_LONG(x) + +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + +# ifndef __LITTLE_ENDIAN +# define __LITTLE_ENDIAN 1234 +# endif + +# ifndef __LITTLE_ENDIAN_BITFIELD +# define __LITTLE_ENDIAN_BITFIELD +# endif + +# define cpu_to_le64(x) (x) +# define le64_to_cpu(x) (x) +# define cpu_to_le32(x) (x) +# define le32_to_cpu(x) (x) +# define cpu_to_le16(x) (x) +# define le16_to_cpu(x) (x) +# define cpu_to_be64(x) bswap64(x) +# define be64_to_cpu(x) bswap64(x) +# define cpu_to_be32(x) bswap32(x) +# define be32_to_cpu(x) bswap32(x) +# define cpu_to_be16(x) bswap16(x) +# define be16_to_cpu(x) bswap16(x) + +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + +# ifndef __BIG_ENDIAN +# define __BIG_ENDIAN 4321 +# endif + +# ifndef __BIG_ENDIAN_BITFIELD +# define __BIG_ENDIAN_BITFIELD +# endif + +# define cpu_to_le64(x) bswap64(x) +# define le64_to_cpu(x) bswap64(x) +# define cpu_to_le32(x) bswap32(x) +# define le32_to_cpu(x) bswap32(x) +# define cpu_to_le16(x) bswap16(x) +# define le16_to_cpu(x) bswap16(x) +# define cpu_to_be64(x) (x) +# define be64_to_cpu(x) (x) +# define cpu_to_be32(x) (x) +# define be32_to_cpu(x) (x) +# define cpu_to_be16(x) (x) +# define be16_to_cpu(x) (x) + +#else +# error "Unknown Endianness" +#endif /* __BYTE_ORDER__ */ + +#endif /* _LINUX_BITOPS_H */ diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h index 696c7eb89e..68f28082a5 100644 --- a/xen/include/xen/compiler.h +++ b/xen/include/xen/compiler.h @@ -179,4 +179,16 @@ # define CLANG_DISABLE_WARN_GCC_COMPAT_END #endif +#if (!defined(__clang__) && (__GNUC__ < 10)) +/* + * Backwards compatibility for GCC < 10. + * All supported versions of Clang support __has_builtin + * */ +#define __has_builtin(x) GCC_has ## x + +#define GCC_has__builtin_bswap16 (CONFIG_GCC_VERSION >= 40800) +#define GCC_has__builtin_bswap32 (CONFIG_GCC_VERSION >= 40400) +#define GCC_has__builtin_bswap64 (CONFIG_GCC_VERSION >= 40400) +#endif + #endif /* __LINUX_COMPILER_H */ From patchwork Fri Oct 22 10:47:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TGluIExpdSDvvIjliJjmnpfvvIk=?= X-Patchwork-Id: 12577569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B00E9C433EF for ; Fri, 22 Oct 2021 10:48:31 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 650AD6120D for ; Fri, 22 Oct 2021 10:48:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 650AD6120D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.214954.373888 (Exim 4.92) (envelope-from ) id 1mds62-00080Q-Oj; Fri, 22 Oct 2021 10:48:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 214954.373888; Fri, 22 Oct 2021 10:48:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds62-0007zU-Ix; Fri, 22 Oct 2021 10:48:22 +0000 Received: by outflank-mailman (input) for mailman id 214954; Fri, 22 Oct 2021 10:48:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds61-00063m-Sc for xen-devel@lists.xenproject.org; Fri, 22 Oct 2021 10:48:21 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 21720d4b-1c5e-4ff2-abb1-670f19cdc7f6; Fri, 22 Oct 2021 10:48:07 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 21720d4b-1c5e-4ff2-abb1-670f19cdc7f6 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1634899687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bfisxychtO/D4CCkbsgtm3RJ+Fi6Cv0nOU8o5cia1XU=; b=BcJzWJPeRZQgwteUcwD8rFvKcckb+Gx5UYJSCD1P7/G5YoBea8xEvjWI L91EPz1G6pFi5YeF84PryIHSYN/Bp66ofrHcjZtZAAJ2cNkUlt1fVinnu mZQXUFUiZV3ZK+RXAEY6xv7dNaexbmvGtltR88UVezCk/ZXzLlSFf9yxi A=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: cE3i5g0JyT38eH7D6JiAjqPsCSe1+kOq1dm5/wDz28TF8TagMmd0W9E9YOUmGFQ3UKXIbCpIba gKCXuaIhx0x7XPoq/zDzvNsIuqzjWoDdBLnlUPrqf6vLHkro4f4QRNK/xmclcOKSknCYoE1a4K x3hzLZyenWSRW4JrhXVGbzmWVeKHcSKAjdTtayf5k1JsI5rbO6Pk9yOBSpwpSp7dWNZNbWO7+H 8oiB7JbhunwacKZiLP65PeTtxiViUAl27srwWVTGZwro6HqLPBQECu1Z1lbMFsvQxd2rkjLNks iZfvCyv0+LXCC4+Q2hptAIvr X-SBRS: 5.1 X-MesageID: 55807252 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:88jFLaO2xRsFxBrvrR0hkMFynXyQoLVcMsEvi/4bfWQNrUom0WcAy GEeXTqFM/2JM2X0ft1wb43n/EJSvJCAmt9mGgto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdpJYz/uUGuCJQUNUjMlkfZKhTr6bUsxNbVU8En540Ug5w7RRbrNA2rBVPSvc4 bsenOWHULOV82Yc3rU8sv/rRLtH5ZweiRtA1rAMTakjUGz2zhH5OKk3N6CpR0YUd6EPdgKMq 0Qv+5nilo/R109F5tpICd8XeGVSKlLZFVDmZna7x8FOK/WNz8A/+v9TCRYSVatYozvS3Ml19 c0Uj7qfECFwGqTKmfsSXTANRkmSPYUekFPGCX22sMjVxEzaaXr8hf5pCSnaP6VBpLwxWzsXs 6VFdnZdNXhvhMrvqF6/Yu1tgIInLdTDN4IDoHBwizreCJ7KRLieHvWSuoUFhl/cgOhEE6/8S epGcQZyRzKeTV4XfUY0GJYXybLAan7XLGQD9QP9SbAMy3PI0AV73bzpMdzUUt+HX8NYmgCfv G2u12bkBhAXMvSPxDzD9Wij7sfQmQvrVYRUE6e3ntZ6jVvWymENBRk+UVqgveL/mkO4Q8hYK UEf5mwpt6da3E20TPHtUhugunmGsxUAHd1KHIUS6guA167V6AaxHXUfQ3hKb9lOiSMtbWV0j BnTxYqvXGEx9u3OIZ6AyluKhT3pejEREHdbXwkrFC1cx9DloZ48gDuaG76PD5WJptHyHDjxx RWDoy4/m6gfgKY36kmrwbzUq2nz/saRH2bZ8i2SBzj/tlooO+ZJcqTxsQCDhcusOrp1WbVoU JIsoMOZ8PwVRa+EkCiAUY3h95n4uq7bblUwbbNpdqTNFghBGVb/Iui8AxkkfS+F1/ronxezP Cc/XisKvPdu0IOCN/MfXm5II51CIVLcPdrkTOvISdFFf4J8cgSKlAk3OxXMjzy0zxh0yvxuU Xt+TSpKJSxGYUiA5GHuL9rxLJdxnnxurY8tbcCTI+ubPUq2OyfOFOZt3KqmZeEl9qKUyDg5A P4EX/ZmPy53CbWkCgGOqNZ7BQlTcRATWMCnw+QKJ7XrClc3Rwkc5wr5nOpJl3pNxP8OyI8lP xiVBydl9bYIrSSWcFvQMik+MO+HsFQWhStTABHA9G2AgxALCbtDJo9GH3fuVbV4puFl09BuS PwJJ5eJDvhVE2yV8DUBd5jt6odlcU3z1w6JOiOkZhk5foJhGFOVqoO1IFO3+XlcFDezuOs/v 6akilHRT60cSlkwF83Rcv+ukQ+85CBPhOJoUkLUCdBPY0GwopNyIin8g6ZvccEBIBnO3BWA0 AOSDUtKrOXBudZtotLImbqFv8GiFO4nRhhWGGzS7LCXMyjG/zX8nd8cAbjQJT2EDTH64qSvY +lR3srQCvxfkQYYqZd4HpZq0bk6u4nlqYhFw1k2B37MdVmqVO9teyHUwclVu6RR7bZFog/qC FmX89xXNLjVasPoFFkdeFgsYuiZjKxGnzDT6bI+IVng5T8x972CCB0AMx6JgS1bDb10LIJ6n rtx5J9Is1Sy2kgwL9KLriFI7GDdfHUPXpIuuoweHIK22BEgzUtPYMCEByL7iH1Vhw6g7qX+z ueouZf/ IronPort-HdrOrdr: A9a23:YzSfE6ljPtNM2bxtlocEAke+QtfpDfIW3DAbv31ZSRFFG/Fxl6 iV/cjzsiWE8Qr5OUtQ4uxoV5PwIk80maQb3WBVB8bHYOCEghrPEGgB1/qB/9SIIUSXnYQxuZ uIMZIOb+EYZWIK9foSizPZLz9P+re6GdiT9ILj80s= X-IronPort-AV: E=Sophos;i="5.87,172,1631592000"; d="scan'208";a="55807252" From: Lin Liu To: CC: Lin Liu , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , "Stefano Stabellini" , Wei Liu Subject: [PATCH v2 2/7] crypto/vmac: Simplify code with byteswap.h Date: Fri, 22 Oct 2021 10:47:23 +0000 Message-ID: <97aca2e39ff1eefdab1e0b3440929958e4b99892.1634897942.git.lin.liu@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 This file has its own implementation of swap bytes. Clean up the code with xen/byteswap.h. No functional change. Signed-off-by: Lin Liu Acked-by: Jan Beulich --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Stefano Stabellini Cc: Wei Liu --- xen/crypto/vmac.c | 76 ++--------------------------------------------- 1 file changed, 3 insertions(+), 73 deletions(-) diff --git a/xen/crypto/vmac.c b/xen/crypto/vmac.c index 294dd16a52..acb4e015f5 100644 --- a/xen/crypto/vmac.c +++ b/xen/crypto/vmac.c @@ -8,6 +8,7 @@ /* start for Xen */ #include +#include #include #include #include @@ -50,7 +51,6 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ * MUL64: 64x64->128-bit multiplication * PMUL64: assumes top bits cleared on inputs * ADD128: 128x128->128-bit addition - * GET_REVERSED_64: load and byte-reverse 64-bit word * ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */ @@ -68,22 +68,6 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ #define PMUL64 MUL64 -#define GET_REVERSED_64(p) \ - ({uint64_t x; \ - asm ("bswapq %0" : "=r" (x) : "0"(*(uint64_t *)(p))); x;}) - -/* ----------------------------------------------------------------------- */ -#elif (__GNUC__ && __i386__) -/* ----------------------------------------------------------------------- */ - -#define GET_REVERSED_64(p) \ - ({ uint64_t x; \ - uint32_t *tp = (uint32_t *)(p); \ - asm ("bswap %%edx\n\t" \ - "bswap %%eax" \ - : "=A"(x) \ - : "a"(tp[1]), "d"(tp[0])); \ - x; }) /* ----------------------------------------------------------------------- */ #elif (__GNUC__ && __ppc64__) @@ -103,37 +87,6 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ #define PMUL64 MUL64 -#define GET_REVERSED_64(p) \ - ({ uint32_t hi, lo, *_p = (uint32_t *)(p); \ - asm volatile ("lwbrx %0, %1, %2" : "=r"(lo) : "b%"(0), "r"(_p) ); \ - asm volatile ("lwbrx %0, %1, %2" : "=r"(hi) : "b%"(4), "r"(_p) ); \ - ((uint64_t)hi << 32) | (uint64_t)lo; } ) - -/* ----------------------------------------------------------------------- */ -#elif (__GNUC__ && (__ppc__ || __PPC__)) -/* ----------------------------------------------------------------------- */ - -#define GET_REVERSED_64(p) \ - ({ uint32_t hi, lo, *_p = (uint32_t *)(p); \ - asm volatile ("lwbrx %0, %1, %2" : "=r"(lo) : "b%"(0), "r"(_p) ); \ - asm volatile ("lwbrx %0, %1, %2" : "=r"(hi) : "b%"(4), "r"(_p) ); \ - ((uint64_t)hi << 32) | (uint64_t)lo; } ) - -/* ----------------------------------------------------------------------- */ -#elif (__GNUC__ && (__ARMEL__ || __ARM__)) -/* ----------------------------------------------------------------------- */ - -#define bswap32(v) \ -({ uint32_t tmp,out; \ - asm volatile( \ - "eor %1, %2, %2, ror #16\n" \ - "bic %1, %1, #0x00ff0000\n" \ - "mov %0, %2, ror #8\n" \ - "eor %0, %0, %1, lsr #8" \ - : "=r" (out), "=&r" (tmp) \ - : "r" (v)); \ - out;}) - /* ----------------------------------------------------------------------- */ #elif _MSC_VER /* ----------------------------------------------------------------------- */ @@ -154,11 +107,6 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ (rh) += (ih) + ((rl) < (_il)); \ } -#if _MSC_VER >= 1300 -#define GET_REVERSED_64(p) _byteswap_uint64(*(uint64_t *)(p)) -#pragma intrinsic(_byteswap_uint64) -#endif - #if _MSC_VER >= 1400 && \ (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) #define MUL32(i1,i2) (__emulu((uint32_t)(i1),(uint32_t)(i2))) @@ -219,24 +167,6 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ } #endif -#ifndef GET_REVERSED_64 -#ifndef bswap64 -#ifndef bswap32 -#define bswap32(x) \ - ({ uint32_t bsx = (x); \ - ((((bsx) & 0xff000000u) >> 24) | (((bsx) & 0x00ff0000u) >> 8) | \ - (((bsx) & 0x0000ff00u) << 8) | (((bsx) & 0x000000ffu) << 24)); }) -#endif -#define bswap64(x) \ - ({ union { uint64_t ll; uint32_t l[2]; } w, r; \ - w.ll = (x); \ - r.l[0] = bswap32 (w.l[1]); \ - r.l[1] = bswap32 (w.l[0]); \ - r.ll; }) -#endif -#define GET_REVERSED_64(p) bswap64(*(uint64_t *)(p)) -#endif - /* ----------------------------------------------------------------------- */ #if (VMAC_PREFER_BIG_ENDIAN) @@ -247,9 +177,9 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ #if (VMAC_ARCH_BIG_ENDIAN) # define get64BE(ptr) (*(uint64_t *)(ptr)) -# define get64LE(ptr) GET_REVERSED_64(ptr) +# define get64LE(ptr) bswap64(*(uint64_t *)(ptr)) #else /* assume little-endian */ -# define get64BE(ptr) GET_REVERSED_64(ptr) +# define get64BE(ptr) bswap64(*(uint64_t *)(ptr)) # define get64LE(ptr) (*(uint64_t *)(ptr)) #endif From patchwork Fri Oct 22 10:47:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TGluIExpdSDvvIjliJjmnpfvvIk=?= X-Patchwork-Id: 12577565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63789C433F5 for ; Fri, 22 Oct 2021 10:48:26 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1948F61163 for ; Fri, 22 Oct 2021 10:48:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1948F61163 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.214952.373866 (Exim 4.92) (envelope-from ) id 1mds5x-0007Fx-UL; Fri, 22 Oct 2021 10:48:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 214952.373866; Fri, 22 Oct 2021 10:48:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds5x-0007Fh-Om; Fri, 22 Oct 2021 10:48:17 +0000 Received: by outflank-mailman (input) for mailman id 214952; Fri, 22 Oct 2021 10:48:16 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds5w-00063m-SN for xen-devel@lists.xenproject.org; Fri, 22 Oct 2021 10:48:16 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f06f55d9-7516-4143-8db2-48f17f8c1914; Fri, 22 Oct 2021 10:48:07 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f06f55d9-7516-4143-8db2-48f17f8c1914 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1634899687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=arMkqO0Q4MIEtmu8VJig4sN6edJ7nb/bgiFiX5lqa8c=; b=eTJv55e3Lp+uU2aC716fPVPYRjVGdtIWgf4iSwrf/a/5IjBbkEa4wsik U3R6csVQorfoMOpi+JUJldRqRojW28Xx5rvfavEAqestOQyFy1Dz5kwQx rIzZdAbeldEYLnYxAScMzJg0AFB9x9rtLCVxzpgtMrAsscuAX0R1rG2UX 0=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: gzgD0Aqt+8NJtKdFIeJMXLFKKycQr/Rx0IQcq1ZbxHWWR+jiKWE3ua5xfsK6L25JhTLomjrqig JRJJ0niuWCQYwy30tlVbiETg0H8vgG8BpmN6GIF9BKs+c5fw73K6Q2PVfgHCxl4oGJcCMaTmlN l9vrVLQBN8wIq4OsWIA3Iwz7IJSzkmRKYLyp7zAWsveEaJHUpl+cPcmt8ZJgQEuHkiv7kNZ6IN 96cY7gCrGao64wenrjjVTLZLInkfkfkYmm3Q7UHfSziKGKlqY16CgKRX7UtOiij7CdOk8Ol3yV X53l6uT4DECkXO/8qdRdwGvZ X-SBRS: 5.1 X-MesageID: 55376143 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:8FGM6K58AzjVO4ztE7kwegxRtNfAchMFZxGqfqrLsTDasY5as4F+v mUcWGCDafbZZ2L0c9kgbNni9hsOvpXcyd43TAZt/ithHi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuV3zyIQUBUjclkfJKlYAL/En03FVAMpBsJ00o5wrdh2NQw27BVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Zz PxGkYyRRyQQGYL+qe5NSwhKIX9+IvgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbL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QT5K1AwrhV5Vm/V k6Vo4QIPLyIPIXuEUILJRpjZeOGjKlGlj7X5PUzAUP7+C4oo+bXDRQMZ0GB2H5HMb94EII52 uNw6scZ5ju2hgcuLtvb3Dtf8H6BLyBYXqgq3n3A7FQHVub/Jol+XKHh IronPort-HdrOrdr: A9a23:+CjiXa7kuJroxuP+VwPXwPDXdLJyesId70hD6qhwISY6TiX+rb HJoB17726NtN9/YhEdcLy7VJVoBEmskKKdgrNhWotKPjOW21dARbsKheCJrgEIWReOktK1vZ 0QCpSWY+eQMbEVt6nHCXGDYrQd/OU= X-IronPort-AV: E=Sophos;i="5.87,172,1631592000"; d="scan'208";a="55376143" From: Lin Liu To: CC: Lin Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH v2 3/7] arm64/find_next_bit: Remove ext2_swab() Date: Fri, 22 Oct 2021 10:47:24 +0000 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 ext2 has nothing to do with this logic. Clean up the code with xen/byteswap.h which now has an unsigned long helper. No functional change. Signed-off-by: Lin Liu --- Cc: Stefano Stabellini Cc: Julien Grall Cc: Volodymyr Babchuk The patches are not well tested without running environment --- xen/arch/arm/arm64/lib/find_next_bit.c | 40 ++++++-------------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/xen/arch/arm/arm64/lib/find_next_bit.c b/xen/arch/arm/arm64/lib/find_next_bit.c index 8ebf8bfe97..8a7cfc0949 100644 --- a/xen/arch/arm/arm64/lib/find_next_bit.c +++ b/xen/arch/arm/arm64/lib/find_next_bit.c @@ -8,9 +8,9 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#include #include -#include +#include +#include #ifndef find_next_bit /* @@ -161,30 +161,6 @@ EXPORT_SYMBOL(find_first_zero_bit); #ifdef __BIG_ENDIAN -/* include/linux/byteorder does not support "unsigned long" type */ -static inline unsigned long ext2_swabp(const unsigned long * x) -{ -#if BITS_PER_LONG == 64 - return (unsigned long) __swab64p((u64 *) x); -#elif BITS_PER_LONG == 32 - return (unsigned long) __swab32p((u32 *) x); -#else -#error BITS_PER_LONG not defined -#endif -} - -/* include/linux/byteorder doesn't support "unsigned long" type */ -static inline unsigned long ext2_swab(const unsigned long y) -{ -#if BITS_PER_LONG == 64 - return (unsigned long) __swab64((u64) y); -#elif BITS_PER_LONG == 32 - return (unsigned long) __swab32((u32) y); -#else -#error BITS_PER_LONG not defined -#endif -} - #ifndef find_next_zero_bit_le unsigned long find_next_zero_bit_le(const void *addr, unsigned long size, unsigned long offset) @@ -199,7 +175,7 @@ unsigned long find_next_zero_bit_le(const void *addr, unsigned size -= result; offset &= (BITS_PER_LONG - 1UL); if (offset) { - tmp = ext2_swabp(p++); + tmp = bswap_ul(*p++); tmp |= (~0UL >> (BITS_PER_LONG - offset)); if (size < BITS_PER_LONG) goto found_first; @@ -217,7 +193,7 @@ unsigned long find_next_zero_bit_le(const void *addr, unsigned } if (!size) return result; - tmp = ext2_swabp(p); + tmp = bswap_ul(*p); found_first: tmp |= ~0UL << size; if (tmp == ~0UL) /* Are any bits zero? */ @@ -226,7 +202,7 @@ found_middle: return result + ffz(tmp); found_middle_swap: - return result + ffz(ext2_swab(tmp)); + return result + ffz(bswap_ul(tmp)); } EXPORT_SYMBOL(find_next_zero_bit_le); #endif @@ -245,7 +221,7 @@ unsigned long find_next_bit_le(const void *addr, unsigned size -= result; offset &= (BITS_PER_LONG - 1UL); if (offset) { - tmp = ext2_swabp(p++); + tmp = bswap_ul(*p++); tmp &= (~0UL << offset); if (size < BITS_PER_LONG) goto found_first; @@ -264,7 +240,7 @@ unsigned long find_next_bit_le(const void *addr, unsigned } if (!size) return result; - tmp = ext2_swabp(p); + tmp = bswap_ul(*p); found_first: tmp &= (~0UL >> (BITS_PER_LONG - size)); if (tmp == 0UL) /* Are any bits set? */ @@ -273,7 +249,7 @@ found_middle: return result + __ffs(tmp); found_middle_swap: - return result + __ffs(ext2_swab(tmp)); + return result + __ffs(bswap_ul(tmp)); } EXPORT_SYMBOL(find_next_bit_le); #endif From patchwork Fri Oct 22 10:47:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TGluIExpdSDvvIjliJjmnpfvvIk=?= X-Patchwork-Id: 12577561 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64B69C43217 for ; Fri, 22 Oct 2021 10:48:24 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D5E360560 for ; Fri, 22 Oct 2021 10:48:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1D5E360560 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.214950.373844 (Exim 4.92) (envelope-from ) id 1mds5u-0006d3-59; Fri, 22 Oct 2021 10:48:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 214950.373844; Fri, 22 Oct 2021 10:48:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds5u-0006cp-1Z; Fri, 22 Oct 2021 10:48:14 +0000 Received: by outflank-mailman (input) for mailman id 214950; Fri, 22 Oct 2021 10:48:11 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds5r-00063m-SC for xen-devel@lists.xenproject.org; Fri, 22 Oct 2021 10:48:11 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3dd4d950-1f2d-4743-9f3c-a27dcd40da0c; Fri, 22 Oct 2021 10:48:05 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3dd4d950-1f2d-4743-9f3c-a27dcd40da0c DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1634899685; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vWYcScFFcIQEVZP3kMCIm4XAsFx3uk4EAC/JiEqA390=; b=QGkYz30joJGyvg1l0BRFy0aI79YAFLix6L+giFTfhjG3RHjt2er4r8lc kMkgOQ/mjO5PxQFvzvXzT9djVIHme611uBuF1XlmWosPJHkXVE/AWaC0E +Ml8ku+hGiI4RdNP4b+XkwhXmKXnAzbK8a6WLBXX7blO6AuLvAGu7Sxe5 Q=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: MPfO+Wji9x93Dsji5f9qlta4Pv88cGaAAS+EM5FZXGK2iKhRqVvC1tjrQlIDzCZdwt7rEWuha8 VLZjVNlhz8R9lxhIlP6hHMcQJWAfBqjVG2H9qc2JXm6WuYzCPXoZ0jBkItPp6PdnRysJNaRXIO uY8+KsuQEhQXBzQZESCDFsSqNqoIy/1pRSXZL/wYAba0H/zII1tu7UlSxr8p4sG6I0MOg1dGEK DLweIuVPdpwxyXssPDPNpBtpQ/44BpyDpVSMysQjUwytKkZ79TYHXEatLB+dulc5XFifIfMm4M 6dfINCFFVd7YQzDPDREwpuse X-SBRS: 5.1 X-MesageID: 57733154 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221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g53KumMblisfLsTPT9+ NdDLcqaoyizo8WlChQ7BbU7dAhQRVBiXMieg5UOKoarf1o3cEl8WqS56e5wJORYc1F9y76gE oeVARQDljISRBTvdG23V5yUQOq+BMgl9StmZXBE0JTB8yFLXLtDJZw3L/MfFYTLPsQ6pRKtZ /VaKciGHNpVTTHLp2YUYZXn9dQwfxW3nwOeeSGiZWFnLZJnQgXI/P7ifxfuq3ZSXnbm65Nmr u3yzB7fTLoCWx9mUJTcZsWwwg7jpnMagu9zARfFe4EBZEX2/YF2ACXtlftrcdoUIBDOy2LCh QabCBsVv8fXpIox/IWbjKyItd7xQeB/AlBbDy/Q6rPvbXvW+W+qwIlhVueUfG+CCDOoqfv6P egMlqPyKvwKmlpOorFQKbczwPJs/cbrqp9b0h9gQCfBYWO0B+4yOXKBx8RO6PFAn+cLpQusV 0uT0dBGIrHVatj9GVscKQd5POSO0fYYxmvb4fgveRio4SZ2+PyMUFlIPgnKgytYdeMnPIQgy OYnmcgX9w3g1UZ6bofY1nhZpzaWM3gNc6Q7rZVLUobkhz0ixkxGfZGBWDT954uCaokUP0QnS tNOaHEuW1iIKpL+TkcO IronPort-HdrOrdr: A9a23:bcAep6sMtuPLYcOQ20HBTbLS7skDTtV00zEX/kB9WHVpmszxra 6TdZMgpHnJYVcqKQkdcL+7WJVoLUmxyXcx2/h1AV7AZniAhILLFvAA0WKK+VSJcEeSygce79 YFT0EXMqyIMbEQt6fHCWeDfOrIuOP3kpyVuQ== X-IronPort-AV: E=Sophos;i="5.87,172,1631592000"; d="scan'208";a="57733154" From: Lin Liu To: CC: Lin Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Konrad Rzeszutek Wilk , Ross Lagerwall Subject: [PATCH v2 4/7] arm: Switch to byteswap.h Date: Fri, 22 Oct 2021 10:47:25 +0000 Message-ID: <306bc005bc3786fcbccc0a0aca3c7b22e50d8c67.1634897942.git.lin.liu@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Update to use byteswap.h to swap bytes. No functional change. Signed-off-by: Lin Liu --- Cc: Stefano Stabellini Cc: Julien Grall Cc: Volodymyr Babchuk Cc: Konrad Rzeszutek Wilk Cc: Ross Lagerwall --- xen/arch/arm/alternative.c | 2 +- xen/arch/arm/arm64/livepatch.c | 2 +- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/vgic/vgic-mmio.c | 2 +- xen/include/asm-arm/arm32/io.h | 2 +- xen/include/asm-arm/arm64/io.h | 2 +- xen/include/xen/libfdt/libfdt_env.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c index 237c4e5642..0f84260ac9 100644 --- a/xen/arch/arm/alternative.c +++ b/xen/arch/arm/alternative.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -27,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c index 6ec8dc60f0..26b5729edf 100644 --- a/xen/arch/arm/arm64/livepatch.c +++ b/xen/arch/arm/arm64/livepatch.c @@ -3,6 +3,7 @@ */ #include +#include #include #include #include @@ -11,7 +12,6 @@ #include #include -#include #include #include diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index 8f43caa186..e89bb9cef8 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -3,6 +3,7 @@ * * Copyright (C) 2011 Citrix Systems, Inc. */ +#include #include #include #include @@ -14,7 +15,6 @@ #include #include -#include #include #include diff --git a/xen/arch/arm/vgic/vgic-mmio.c b/xen/arch/arm/vgic/vgic-mmio.c index 5d935a7301..d9c5066246 100644 --- a/xen/arch/arm/vgic/vgic-mmio.c +++ b/xen/arch/arm/vgic/vgic-mmio.c @@ -13,10 +13,10 @@ */ #include +#include #include #include #include -#include #include "vgic.h" #include "vgic-mmio.h" diff --git a/xen/include/asm-arm/arm32/io.h b/xen/include/asm-arm/arm32/io.h index 73a879e9fb..df8547403c 100644 --- a/xen/include/asm-arm/arm32/io.h +++ b/xen/include/asm-arm/arm32/io.h @@ -21,8 +21,8 @@ #ifndef _ARM_ARM32_IO_H #define _ARM_ARM32_IO_H +#include #include -#include static inline void __raw_writeb(u8 val, volatile void __iomem *addr) { diff --git a/xen/include/asm-arm/arm64/io.h b/xen/include/asm-arm/arm64/io.h index 30bfc78d9e..db328d9e3c 100644 --- a/xen/include/asm-arm/arm64/io.h +++ b/xen/include/asm-arm/arm64/io.h @@ -20,8 +20,8 @@ #ifndef _ARM_ARM64_IO_H #define _ARM_ARM64_IO_H +#include #include -#include #include /* diff --git a/xen/include/xen/libfdt/libfdt_env.h b/xen/include/xen/libfdt/libfdt_env.h index 035bf754d2..f8ea1ea07a 100644 --- a/xen/include/xen/libfdt/libfdt_env.h +++ b/xen/include/xen/libfdt/libfdt_env.h @@ -1,9 +1,9 @@ #ifndef _LIBFDT_ENV_H #define _LIBFDT_ENV_H +#include #include #include -#include typedef uint16_t fdt16_t; typedef uint32_t fdt32_t; From patchwork Fri Oct 22 10:47:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TGluIExpdSDvvIjliJjmnpfvvIk=?= X-Patchwork-Id: 12577563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81F8CC4332F for ; Fri, 22 Oct 2021 10:48:23 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 42F6261163 for ; Fri, 22 Oct 2021 10:48:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 42F6261163 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.214951.373848 (Exim 4.92) (envelope-from ) id 1mds5u-0006fn-Gm; Fri, 22 Oct 2021 10:48:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 214951.373848; Fri, 22 Oct 2021 10:48:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds5u-0006f7-As; Fri, 22 Oct 2021 10:48:14 +0000 Received: by outflank-mailman (input) for mailman id 214951; Fri, 22 Oct 2021 10:48:12 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds5s-00063s-J0 for xen-devel@lists.xenproject.org; Fri, 22 Oct 2021 10:48:12 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8aaffa20-3325-11ec-83b2-12813bfff9fa; Fri, 22 Oct 2021 10:48:07 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8aaffa20-3325-11ec-83b2-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1634899687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KXdMTUepQc/hWgrrZYpWXrp3b/8Yk5JMcrV/PHsyXk8=; b=CBOnxnnSZHoq9WMG/jcYbwpGgX6tWk25cLlIj3/ck1cM0TGe8RalBcQD 39GMHUm9YSp38uOllQXfB5yaFXHtpym8OCCy/KyPzTjuZhFdEpQRh8cGO DUuJDB7y33obkqD5N2xOF20ga0L5js2wSSxFBAomYBDX2qoXkAwFOcc9K A=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 5mV+QcJuMbU1xqtO+XxIArH03DeejP7wBDUKBvGVXkm3MZrcF9qzgOVv4yecmboHYycM1Vflk0 5i3hChc0YQ9YowmZezRDpSA32TSB8OCaxG+EHSxk9xZjxz5VlTa3M0Hw0XutKF0G1+hsnZVc+C 68ze2YdqIDFWFIItGHmjSV/FaZ7K30Mr751aZwc/YPLr3OF8bpzZtLbLa8mo5yx7jJ7DTlyE/V uZlNdYx3Q0Zu0Ul0quvuehcm2UHx55DlBQcIgiV4YiW4ZHr6/S15RDhUN7Wv8btxjVghqrHz1L X62c5dseILazvfIQRis2jK9r X-SBRS: 5.1 X-MesageID: 55807253 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:m7bC0qubxBSeGMlPh5sjBrMyKufnVIhZMUV32f8akzHdYApBsoF/q tZmKW3VOf/bYGvyeosnOY/j/EMG7cOGnN9qSFZo/yFkES8T+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZQP0VOZigHtIQMsadUsxKbVIiGHhJZS5LwbZj29cw24LhWWthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ Nplu8fzUAMUJvT2vstEdUB8Gid/IqJI0eqSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 aVGcnZXNEnF3r/ohuLgIgVvrp1LwM3DOIIZ/HVh0BnSDOo8QICFSKLPjTNd9Gpt1pgRR6uFD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SIYx8PJ4h3 ep86tUd7Bayi0ZyP9uL5syOG79g8pDUv30bi6wn IronPort-HdrOrdr: A9a23:Rx5Bgq8GbjfmWaIMfPxuk+DiI+orL9Y04lQ7vn2YSXRuE/Bw8P re5cjztCWE8wr5N0tQ+uxoVJPufZqYz+8Q3WBzB8bFYOCFghrLEGgK1+KLqFeMdxEWtNQtsp uIG5IOcOEYZmIbsS+V2meF+q4bsby6zJw= X-IronPort-AV: E=Sophos;i="5.87,172,1631592000"; d="scan'208";a="55807253" From: Lin Liu To: CC: Lin Liu , Daniel De Graaf , "Daniel P. Smith" Subject: [PATCH v2 5/7] xen/xsm: Switch to byteswap.h Date: Fri, 22 Oct 2021 10:47:26 +0000 Message-ID: <400efbc5c394140bb01664e5847046e8c4a38ea2.1634897942.git.lin.liu@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Update to use byteswap.h to swap bytes No functional change Signed-off-by: Lin Liu Acked-by: Jan Beulich --- Cc: Daniel De Graaf Cc: "Daniel P. Smith" --- xen/xsm/flask/ss/avtab.c | 2 +- xen/xsm/flask/ss/conditional.c | 2 +- xen/xsm/flask/ss/ebitmap.c | 2 +- xen/xsm/flask/ss/policydb.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/xsm/flask/ss/avtab.c b/xen/xsm/flask/ss/avtab.c index bfc91c8b0c..1fa796f625 100644 --- a/xen/xsm/flask/ss/avtab.c +++ b/xen/xsm/flask/ss/avtab.c @@ -19,8 +19,8 @@ /* Ported to Xen 3.0, George Coker, */ +#include #include -#include #include #include #include diff --git a/xen/xsm/flask/ss/conditional.c b/xen/xsm/flask/ss/conditional.c index 3e58aea551..059f6e07e5 100644 --- a/xen/xsm/flask/ss/conditional.c +++ b/xen/xsm/flask/ss/conditional.c @@ -9,7 +9,7 @@ /* Ported to Xen 3.0, George Coker, */ -#include +#include #include #include #include diff --git a/xen/xsm/flask/ss/ebitmap.c b/xen/xsm/flask/ss/ebitmap.c index e1d0a586a7..1550437c6f 100644 --- a/xen/xsm/flask/ss/ebitmap.c +++ b/xen/xsm/flask/ss/ebitmap.c @@ -10,7 +10,7 @@ /* Ported to Xen 3.0, George Coker, */ -#include +#include #include #include #include diff --git a/xen/xsm/flask/ss/policydb.c b/xen/xsm/flask/ss/policydb.c index 9426164353..595005c3b7 100644 --- a/xen/xsm/flask/ss/policydb.c +++ b/xen/xsm/flask/ss/policydb.c @@ -22,7 +22,7 @@ /* Ported to Xen 3.0, George Coker, */ -#include +#include #include #include #include From patchwork Fri Oct 22 10:47:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TGluIExpdSDvvIjliJjmnpfvvIk=?= X-Patchwork-Id: 12577571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9B06C433EF for ; Fri, 22 Oct 2021 10:48:37 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67C22611F2 for ; Fri, 22 Oct 2021 10:48:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 67C22611F2 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.214955.373899 (Exim 4.92) (envelope-from ) id 1mds68-0000EL-5l; Fri, 22 Oct 2021 10:48:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 214955.373899; Fri, 22 Oct 2021 10:48:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds68-0000D6-0z; Fri, 22 Oct 2021 10:48:28 +0000 Received: by outflank-mailman (input) for mailman id 214955; Fri, 22 Oct 2021 10:48:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds66-00063m-Sr for xen-devel@lists.xenproject.org; Fri, 22 Oct 2021 10:48:26 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 28c6be87-f6ea-42ef-9151-413cd568356b; Fri, 22 Oct 2021 10:48:08 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 28c6be87-f6ea-42ef-9151-413cd568356b DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1634899688; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=k/jOhLHPZRA8Ag0Zx9f8hcyG0uLCD9lIG9NbqTmotxQ=; b=P5LLaymYDDd7YPzHgw8VO//tiGscp2o2P63uah3hGxrvsMT55ARBFp/p 9vY++0HNE+WxlPloQuix8r0ZSKovztZH3SQURBpBSCitVnWMzF8/t5gji o5PNHYYJU8oLOkSz4/gkHNbReHFwYtR4FnEcJHreivFJ12K1q0Nu9die6 Q=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: FVYnoo/wTcjQj0Hr19f8bSUOfLUjj69j01RWR4xcgBFEKEIcjAhmQYdt6l3l+wjkD6bnW9NPSo RCKh2amD6+7hRLEkbwzHJgxBzhwDseJ7E0zbajPN+p73WzP9ErRyq8ztPTUa9rOajkNVLfTE51 OweUEt8q13ibX5emWvJ2XXWdP8ck9PQCqaX1C2+RwTdBEB/B9t7CQF8ESe24tWbpeluKD/QS3q jsBtQgykNf6n/q/n5xcvJlskC5/Rw8Jz2G5lWc+SB1kokBJVWhLrKC8EZolGDmtlbw/Aopu+nB lBxSz3aKH919eiSMYH/tCb+6 X-SBRS: 5.1 X-MesageID: 55807254 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:7ljUfaiBYtUcWl1AmEunBh4yX1615BcKZh0ujC45NGQN5FlHY01je htvWGyAPPzbZWuhf99xbdu1o08H6JSBmIc1QARv+XtkFyIb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oAMKRCQ7InQLlbGILes1htZGEk0F0/NtTo5w7Rg29Yy24Dja++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1D7t+pTToxZ5fqt707Cj1RFSBhMqNvreqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHvPYVZvnB95TrYEewnUdbIRKCiCdpwgWpg3p8UQKq2i 8wxWGssbAnGOExzGVoFJ88En+KlnVTSfGgNwL6SjfVuuDWCpOBr65D2K8bccNGOQcRTn26bq 3jA8mC/BQsVXPSd1D6E/3SEluLJ2yThV+o6C7mQ5vNsxlqJyQQ7GBAQEFe2v/S9okq/QM5Eb VwZ/DI0qqo//1DtScPyNzW5v3ysrhMaQ8BXEeAx9EeK0KW8ywSTC3UATzVBQMc7r8JwTjsvv mJlhPuwW2Yp6ufMDyvAqPHE9lteJBT5M0cMPmwdSTYduuPFj9gV1zbGSNd8H6Cc24id9S7L/ xiGqy03hrM2hMEN1rmm8V2vvw9AtqQlXSZuuV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To: CC: Lin Liu , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , "Stefano Stabellini" , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH v2 6/7] xen: Switch to byteswap.h Date: Fri, 22 Oct 2021 10:47:27 +0000 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Update to use byteswap.h to swap bytes. No functional chagne. Signed-off-by: Lin Liu --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Stefano Stabellini Cc: Wei Liu Cc: "Roger Pau Monné" --- xen/common/bitmap.c | 2 +- xen/common/gdbstub.c | 2 +- xen/common/libelf/libelf-private.h | 8 ++++---- xen/common/lz4/defs.h | 2 +- xen/common/lzo.c | 2 +- xen/common/unlzo.c | 2 +- xen/common/xz/private.h | 4 ++-- xen/drivers/char/ehci-dbgp.c | 2 +- xen/include/asm-x86/msi.h | 2 +- xen/include/xen/bitmap.h | 2 +- xen/include/xen/device_tree.h | 2 +- xen/include/xen/unaligned.h | 14 +++++++------- xen/lib/divmod.c | 2 +- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/xen/common/bitmap.c b/xen/common/bitmap.c index 7d4551f782..be274ca04a 100644 --- a/xen/common/bitmap.c +++ b/xen/common/bitmap.c @@ -9,10 +9,10 @@ #include #include #include +#include #include #include #include -#include /* * bitmaps provide an array of bits, implemented using an an diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c index 848c1f4327..3c8ed52d6b 100644 --- a/xen/common/gdbstub.c +++ b/xen/common/gdbstub.c @@ -33,6 +33,7 @@ /* Resuming after we've stopped used to work, but more through luck than any actual intention. It doesn't at the moment. */ +#include #include #include #include @@ -45,7 +46,6 @@ #include #include #include -#include /* Printk isn't particularly safe just after we've trapped to the debugger. so avoid it. */ diff --git a/xen/common/libelf/libelf-private.h b/xen/common/libelf/libelf-private.h index 47db679966..b7089cb31b 100644 --- a/xen/common/libelf/libelf-private.h +++ b/xen/common/libelf/libelf-private.h @@ -17,10 +17,10 @@ #ifdef __XEN__ +#include #include #include #include -#include #include /* we would like to use elf->log_callback but we can't because @@ -31,9 +31,9 @@ printk(fmt, ## args ) #define strtoull(str, end, base) simple_strtoull(str, end, base) -#define bswap_16(x) swab16(x) -#define bswap_32(x) swab32(x) -#define bswap_64(x) swab64(x) +#define bswap_16(x) bswap16(x) +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) #else /* !__XEN__ */ diff --git a/xen/common/lz4/defs.h b/xen/common/lz4/defs.h index 10609f5a53..1ce4476478 100644 --- a/xen/common/lz4/defs.h +++ b/xen/common/lz4/defs.h @@ -9,7 +9,7 @@ */ #ifdef __XEN__ -#include +#include #include #else diff --git a/xen/common/lzo.c b/xen/common/lzo.c index a87c76dded..17be9675f4 100644 --- a/xen/common/lzo.c +++ b/xen/common/lzo.c @@ -96,7 +96,7 @@ #ifdef __XEN__ #include -#include +#include #include #else #define get_unaligned_le16(_p) (*(u16 *)(_p)) diff --git a/xen/common/unlzo.c b/xen/common/unlzo.c index 74056778eb..f908d2a61f 100644 --- a/xen/common/unlzo.c +++ b/xen/common/unlzo.c @@ -33,7 +33,7 @@ #include #ifdef __XEN__ -#include +#include #include #else diff --git a/xen/common/xz/private.h b/xen/common/xz/private.h index 511343fcc2..647f9699a7 100644 --- a/xen/common/xz/private.h +++ b/xen/common/xz/private.h @@ -12,7 +12,7 @@ #ifdef __XEN__ #include -#include +#include #include #else @@ -28,7 +28,7 @@ static inline void put_unaligned_le32(u32 val, void *p) #endif -#define get_le32(p) le32_to_cpup((const uint32_t *)(p)) +#define get_le32(p) le32_to_cpu(*(const uint32_t *)(p)) #define false 0 #define true 1 diff --git a/xen/drivers/char/ehci-dbgp.c b/xen/drivers/char/ehci-dbgp.c index c893d246de..8412da1b11 100644 --- a/xen/drivers/char/ehci-dbgp.c +++ b/xen/drivers/char/ehci-dbgp.c @@ -5,13 +5,13 @@ * Linux; see the Linux source for authorship and copyrights. */ +#include #include #include #include #include #include #include -#include #include #include #include diff --git a/xen/include/asm-x86/msi.h b/xen/include/asm-x86/msi.h index e228b0f3f3..277375183c 100644 --- a/xen/include/asm-x86/msi.h +++ b/xen/include/asm-x86/msi.h @@ -1,9 +1,9 @@ #ifndef __ASM_MSI_H #define __ASM_MSI_H +#include #include #include -#include #include /* diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h index e9175ab54a..c44a1cb63c 100644 --- a/xen/include/xen/bitmap.h +++ b/xen/include/xen/bitmap.h @@ -229,7 +229,7 @@ static inline int bitmap_weight(const unsigned long *src, int nbits) return __bitmap_weight(src, nbits); } -#include +#include #ifdef __LITTLE_ENDIAN #define BITMAP_MEM_ALIGNMENT 8 diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index fd6cd00b43..4921e6b142 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -10,10 +10,10 @@ #ifndef __XEN_DEVICE_TREE_H__ #define __XEN_DEVICE_TREE_H__ -#include #include #include #include +#include #include #include #include diff --git a/xen/include/xen/unaligned.h b/xen/include/xen/unaligned.h index 0a2b16d05d..8a9ec8a0ac 100644 --- a/xen/include/xen/unaligned.h +++ b/xen/include/xen/unaligned.h @@ -11,8 +11,8 @@ #define __XEN_UNALIGNED_H__ #ifdef __XEN__ +#include #include -#include #endif #define get_unaligned(p) (*(p)) @@ -20,7 +20,7 @@ static inline uint16_t get_unaligned_be16(const void *p) { - return be16_to_cpup(p); + return be16_to_cpu(*(uint16_t*)p); } static inline void put_unaligned_be16(uint16_t val, void *p) @@ -30,7 +30,7 @@ static inline void put_unaligned_be16(uint16_t val, void *p) static inline uint32_t get_unaligned_be32(const void *p) { - return be32_to_cpup(p); + return be32_to_cpu(*(uint32_t*)p); } static inline void put_unaligned_be32(uint32_t val, void *p) @@ -40,7 +40,7 @@ static inline void put_unaligned_be32(uint32_t val, void *p) static inline uint64_t get_unaligned_be64(const void *p) { - return be64_to_cpup(p); + return be64_to_cpu(*(uint64_t*)p); } static inline void put_unaligned_be64(uint64_t val, void *p) @@ -50,7 +50,7 @@ static inline void put_unaligned_be64(uint64_t val, void *p) static inline uint16_t get_unaligned_le16(const void *p) { - return le16_to_cpup(p); + return le16_to_cpu(*(uint16_t*)p); } static inline void put_unaligned_le16(uint16_t val, void *p) @@ -60,7 +60,7 @@ static inline void put_unaligned_le16(uint16_t val, void *p) static inline uint32_t get_unaligned_le32(const void *p) { - return le32_to_cpup(p); + return le32_to_cpu(*(uint32_t*)p); } static inline void put_unaligned_le32(uint32_t val, void *p) @@ -70,7 +70,7 @@ static inline void put_unaligned_le32(uint32_t val, void *p) static inline uint64_t get_unaligned_le64(const void *p) { - return le64_to_cpup(p); + return le64_to_cpu(*(uint64_t*)p); } static inline void put_unaligned_le64(uint64_t val, void *p) diff --git a/xen/lib/divmod.c b/xen/lib/divmod.c index 0be6ccc700..dfc1129cfe 100644 --- a/xen/lib/divmod.c +++ b/xen/lib/divmod.c @@ -1,6 +1,6 @@ +#include #include #include -#include /* * A couple of 64 bit operations ported from FreeBSD. From patchwork Fri Oct 22 10:47:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TGluIExpdSDvvIjliJjmnpfvvIk=?= X-Patchwork-Id: 12577567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8B18C433EF for ; Fri, 22 Oct 2021 10:48:28 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8442B60560 for ; Fri, 22 Oct 2021 10:48:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8442B60560 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.214953.373877 (Exim 4.92) (envelope-from ) id 1mds5z-0007Wr-8P; Fri, 22 Oct 2021 10:48:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 214953.373877; Fri, 22 Oct 2021 10:48:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds5z-0007WM-4L; Fri, 22 Oct 2021 10:48:19 +0000 Received: by outflank-mailman (input) for mailman id 214953; Fri, 22 Oct 2021 10:48:17 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mds5x-00063s-JL for xen-devel@lists.xenproject.org; Fri, 22 Oct 2021 10:48:17 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 893393e9-3325-11ec-83b2-12813bfff9fa; Fri, 22 Oct 2021 10:48:07 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 893393e9-3325-11ec-83b2-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1634899687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1OHvsWzP7gE68vduDcWmR3YdlGbvcStDaG0K0LsI1tc=; b=GYz/yfZWbhjSvCAnUx9E97WF0o+SmPpCEHxK8NkA1mAEag1aNGSwEQT+ ri9lkLmfYEmqLVCZjh/i0046DGexy34UQJBcZdLyE7RHMa8txMb9OMqtW rddAzo3u+oDwAKxCIKmsMNnY34xoaRaTLzrVsu5AcGwBpcM+UTLJNV1Bi g=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: R21dHoDic8am31wi4NNutW4/f5v3voGJG2274lGVy8ycKKjz2xsmBV2dRbZ31drFKBDzkZOBef wCXCjGnVOVR3t9FQVsel/0Ef5cGwaBu/jNpJfs5czAYtzBJjEbBFKkC52xqQLXkYjzlM0IlR42 OA+zU9T3O97ZY1Gn1K/R04MikW+aEyH1W2N51b0R8PgNpH8aH+YLVVXCzyovSo5yJ+ENvcaxL0 Jm0S3l4LUT3KoghrX/nLs9E7r262w12h+1L7lBT+cKbLwcJMb/60L2EnUYLm0sOA/I3mT06F+d LNwyKb9pJIETzQMyRzLwGsfS X-SBRS: 5.1 X-MesageID: 55376145 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:m+n9pamtyPKDorFQ/6E8V3Po5gwZIURdPkR7XQ2eYbSJt1+Wr1Gzt xIZDGmAaKvbamGkKtAjb9/iox9Qv8ODzYAxSgU9rC09FCMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BClVlxJVF/fngqoDUUYYoAQgsA187IMsdoUg7wbdg2tQy2YLR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 JZvrLq/WxszB4vvg/kdCRkHIQAhOoQTrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ignBM3qOsUbu2xIxjDFF/c2B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8d88PF7+uH1s5LOCXEhfY0uMhShaIOcnOY8p2 7586ssf6gj5gRs2KNeWyCtT8j3UfHAHVqwmsLAcAZPq1VV3mg0TP8SEB3+k+oyLZvVNLlIuc 22di6f1jrhBwlbPLigoHn/X0OsB3ZkDtXimFrPZy4hlTjYdusIK4Q== IronPort-HdrOrdr: A9a23:gQTE5qxa3hXD79FMeZPpKrPwFL1zdoMgy1knxilNoRw8SKKlfq eV7Y0mPH7P+VAssR4b+exoVJPtfZqYz+8R3WBzB8bEYOCFghrKEGgK1+KLqFeMJ8S9zJ846U 4JSdkHNDSaNzlHZKjBjzVQa+xQouW6zA== X-IronPort-AV: E=Sophos;i="5.87,172,1631592000"; d="scan'208";a="55376145" From: Lin Liu To: CC: Lin Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Wei Liu , =?utf-8?q?Roger_Pau_?= =?utf-8?q?Monn=C3=A9?= Subject: [PATCH v2 7/7] byteorder: Remove byteorder Date: Fri, 22 Oct 2021 10:47:28 +0000 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 include/xen/byteswap.h has simplify the interface, just clean the old interface No functional change Signed-off-by: Lin Liu --- Cc: Stefano Stabellini Cc: Julien Grall Cc: Volodymyr Babchuk Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Wei Liu Cc: "Roger Pau Monné" --- xen/include/asm-arm/byteorder.h | 16 -- xen/include/asm-x86/byteorder.h | 36 ----- xen/include/xen/byteorder/big_endian.h | 102 ------------ xen/include/xen/byteorder/generic.h | 68 -------- xen/include/xen/byteorder/little_endian.h | 102 ------------ xen/include/xen/byteorder/swab.h | 183 ---------------------- 6 files changed, 507 deletions(-) delete mode 100644 xen/include/asm-arm/byteorder.h delete mode 100644 xen/include/asm-x86/byteorder.h delete mode 100644 xen/include/xen/byteorder/big_endian.h delete mode 100644 xen/include/xen/byteorder/generic.h delete mode 100644 xen/include/xen/byteorder/little_endian.h delete mode 100644 xen/include/xen/byteorder/swab.h diff --git a/xen/include/asm-arm/byteorder.h b/xen/include/asm-arm/byteorder.h deleted file mode 100644 index 9c712c4788..0000000000 --- a/xen/include/asm-arm/byteorder.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __ASM_ARM_BYTEORDER_H__ -#define __ASM_ARM_BYTEORDER_H__ - -#define __BYTEORDER_HAS_U64__ - -#include - -#endif /* __ASM_ARM_BYTEORDER_H__ */ -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/include/asm-x86/byteorder.h b/xen/include/asm-x86/byteorder.h deleted file mode 100644 index 1f77e502a5..0000000000 --- a/xen/include/asm-x86/byteorder.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef __ASM_X86_BYTEORDER_H__ -#define __ASM_X86_BYTEORDER_H__ - -#include -#include - -static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) -{ - asm("bswap %0" : "=r" (x) : "0" (x)); - return x; -} - -static inline __attribute_const__ __u64 ___arch__swab64(__u64 val) -{ - union { - struct { __u32 a,b; } s; - __u64 u; - } v; - v.u = val; - asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" - : "=r" (v.s.a), "=r" (v.s.b) - : "0" (v.s.a), "1" (v.s.b)); - return v.u; -} - -/* Do not define swab16. Gcc is smart enough to recognize "C" version and - convert it into rotation or exhange. */ - -#define __arch__swab64(x) ___arch__swab64(x) -#define __arch__swab32(x) ___arch__swab32(x) - -#define __BYTEORDER_HAS_U64__ - -#include - -#endif /* __ASM_X86_BYTEORDER_H__ */ diff --git a/xen/include/xen/byteorder/big_endian.h b/xen/include/xen/byteorder/big_endian.h deleted file mode 100644 index 40eb80a390..0000000000 --- a/xen/include/xen/byteorder/big_endian.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef __XEN_BYTEORDER_BIG_ENDIAN_H__ -#define __XEN_BYTEORDER_BIG_ENDIAN_H__ - -#ifndef __BIG_ENDIAN -#define __BIG_ENDIAN 4321 -#endif -#ifndef __BIG_ENDIAN_BITFIELD -#define __BIG_ENDIAN_BITFIELD -#endif - -#include -#include - -#define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x))) -#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x)) -#define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x))) -#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x)) -#define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x))) -#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x)) -#define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x)) -#define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x)) -#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x)) -#define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x)) -#define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x)) -#define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x)) -#define __cpu_to_le64(x) ((__force __le64)__swab64((x))) -#define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x)) -#define __cpu_to_le32(x) ((__force __le32)__swab32((x))) -#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x)) -#define __cpu_to_le16(x) ((__force __le16)__swab16((x))) -#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) -#define __cpu_to_be64(x) ((__force __be64)(__u64)(x)) -#define __be64_to_cpu(x) ((__force __u64)(__be64)(x)) -#define __cpu_to_be32(x) ((__force __be32)(__u32)(x)) -#define __be32_to_cpu(x) ((__force __u32)(__be32)(x)) -#define __cpu_to_be16(x) ((__force __be16)(__u16)(x)) -#define __be16_to_cpu(x) ((__force __u16)(__be16)(x)) - -static inline __le64 __cpu_to_le64p(const __u64 *p) -{ - return (__force __le64)__swab64p(p); -} -static inline __u64 __le64_to_cpup(const __le64 *p) -{ - return __swab64p((__u64 *)p); -} -static inline __le32 __cpu_to_le32p(const __u32 *p) -{ - return (__force __le32)__swab32p(p); -} -static inline __u32 __le32_to_cpup(const __le32 *p) -{ - return __swab32p((__u32 *)p); -} -static inline __le16 __cpu_to_le16p(const __u16 *p) -{ - return (__force __le16)__swab16p(p); -} -static inline __u16 __le16_to_cpup(const __le16 *p) -{ - return __swab16p((__u16 *)p); -} -static inline __be64 __cpu_to_be64p(const __u64 *p) -{ - return (__force __be64)*p; -} -static inline __u64 __be64_to_cpup(const __be64 *p) -{ - return (__force __u64)*p; -} -static inline __be32 __cpu_to_be32p(const __u32 *p) -{ - return (__force __be32)*p; -} -static inline __u32 __be32_to_cpup(const __be32 *p) -{ - return (__force __u32)*p; -} -static inline __be16 __cpu_to_be16p(const __u16 *p) -{ - return (__force __be16)*p; -} -static inline __u16 __be16_to_cpup(const __be16 *p) -{ - return (__force __u16)*p; -} -#define __cpu_to_le64s(x) __swab64s((x)) -#define __le64_to_cpus(x) __swab64s((x)) -#define __cpu_to_le32s(x) __swab32s((x)) -#define __le32_to_cpus(x) __swab32s((x)) -#define __cpu_to_le16s(x) __swab16s((x)) -#define __le16_to_cpus(x) __swab16s((x)) -#define __cpu_to_be64s(x) do {} while (0) -#define __be64_to_cpus(x) do {} while (0) -#define __cpu_to_be32s(x) do {} while (0) -#define __be32_to_cpus(x) do {} while (0) -#define __cpu_to_be16s(x) do {} while (0) -#define __be16_to_cpus(x) do {} while (0) - -#include - -#endif /* __XEN_BYTEORDER_BIG_ENDIAN_H__ */ diff --git a/xen/include/xen/byteorder/generic.h b/xen/include/xen/byteorder/generic.h deleted file mode 100644 index 8a0006b755..0000000000 --- a/xen/include/xen/byteorder/generic.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef __XEN_BYTEORDER_GENERIC_H__ -#define __XEN_BYTEORDER_GENERIC_H__ - -/* - * Generic Byte-reordering support - * - * The "... p" macros, like le64_to_cpup, can be used with pointers - * to unaligned data, but there will be a performance penalty on - * some architectures. Use get_unaligned for unaligned data. - * - * The following macros are to be defined by : - * - * Conversion of XX-bit integers (16- 32- or 64-) - * between native CPU format and little/big endian format - * 64-bit stuff only defined for proper architectures - * cpu_to_[bl]eXX(__uXX x) - * [bl]eXX_to_cpu(__uXX x) - * - * The same, but takes a pointer to the value to convert - * cpu_to_[bl]eXXp(__uXX x) - * [bl]eXX_to_cpup(__uXX x) - * - * The same, but change in situ - * cpu_to_[bl]eXXs(__uXX x) - * [bl]eXX_to_cpus(__uXX x) - * - * See asm-foo/byteorder.h for examples of how to provide - * architecture-optimized versions - */ - -#define cpu_to_le64 __cpu_to_le64 -#define le64_to_cpu __le64_to_cpu -#define cpu_to_le32 __cpu_to_le32 -#define le32_to_cpu __le32_to_cpu -#define cpu_to_le16 __cpu_to_le16 -#define le16_to_cpu __le16_to_cpu -#define cpu_to_be64 __cpu_to_be64 -#define be64_to_cpu __be64_to_cpu -#define cpu_to_be32 __cpu_to_be32 -#define be32_to_cpu __be32_to_cpu -#define cpu_to_be16 __cpu_to_be16 -#define be16_to_cpu __be16_to_cpu -#define cpu_to_le64p __cpu_to_le64p -#define le64_to_cpup __le64_to_cpup -#define cpu_to_le32p __cpu_to_le32p -#define le32_to_cpup __le32_to_cpup -#define cpu_to_le16p __cpu_to_le16p -#define le16_to_cpup __le16_to_cpup -#define cpu_to_be64p __cpu_to_be64p -#define be64_to_cpup __be64_to_cpup -#define cpu_to_be32p __cpu_to_be32p -#define be32_to_cpup __be32_to_cpup -#define cpu_to_be16p __cpu_to_be16p -#define be16_to_cpup __be16_to_cpup -#define cpu_to_le64s __cpu_to_le64s -#define le64_to_cpus __le64_to_cpus -#define cpu_to_le32s __cpu_to_le32s -#define le32_to_cpus __le32_to_cpus -#define cpu_to_le16s __cpu_to_le16s -#define le16_to_cpus __le16_to_cpus -#define cpu_to_be64s __cpu_to_be64s -#define be64_to_cpus __be64_to_cpus -#define cpu_to_be32s __cpu_to_be32s -#define be32_to_cpus __be32_to_cpus -#define cpu_to_be16s __cpu_to_be16s -#define be16_to_cpus __be16_to_cpus - -#endif /* __XEN_BYTEORDER_GENERIC_H__ */ diff --git a/xen/include/xen/byteorder/little_endian.h b/xen/include/xen/byteorder/little_endian.h deleted file mode 100644 index 4955632793..0000000000 --- a/xen/include/xen/byteorder/little_endian.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef __XEN_BYTEORDER_LITTLE_ENDIAN_H__ -#define __XEN_BYTEORDER_LITTLE_ENDIAN_H__ - -#ifndef __LITTLE_ENDIAN -#define __LITTLE_ENDIAN 1234 -#endif -#ifndef __LITTLE_ENDIAN_BITFIELD -#define __LITTLE_ENDIAN_BITFIELD -#endif - -#include -#include - -#define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x)) -#define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x)) -#define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x)) -#define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x)) -#define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x)) -#define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x)) -#define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x))) -#define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x)) -#define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x))) -#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x)) -#define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x))) -#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x)) -#define __cpu_to_le64(x) ((__force __le64)(__u64)(x)) -#define __le64_to_cpu(x) ((__force __u64)(__le64)(x)) -#define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) -#define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) -#define __cpu_to_le16(x) ((__force __le16)(__u16)(x)) -#define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) -#define __cpu_to_be64(x) ((__force __be64)__swab64((x))) -#define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x)) -#define __cpu_to_be32(x) ((__force __be32)__swab32((x))) -#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x)) -#define __cpu_to_be16(x) ((__force __be16)__swab16((x))) -#define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x)) - -static inline __le64 __cpu_to_le64p(const __u64 *p) -{ - return (__force __le64)*p; -} -static inline __u64 __le64_to_cpup(const __le64 *p) -{ - return (__force __u64)*p; -} -static inline __le32 __cpu_to_le32p(const __u32 *p) -{ - return (__force __le32)*p; -} -static inline __u32 __le32_to_cpup(const __le32 *p) -{ - return (__force __u32)*p; -} -static inline __le16 __cpu_to_le16p(const __u16 *p) -{ - return (__force __le16)*p; -} -static inline __u16 __le16_to_cpup(const __le16 *p) -{ - return (__force __u16)*p; -} -static inline __be64 __cpu_to_be64p(const __u64 *p) -{ - return (__force __be64)__swab64p(p); -} -static inline __u64 __be64_to_cpup(const __be64 *p) -{ - return __swab64p((__u64 *)p); -} -static inline __be32 __cpu_to_be32p(const __u32 *p) -{ - return (__force __be32)__swab32p(p); -} -static inline __u32 __be32_to_cpup(const __be32 *p) -{ - return __swab32p((__u32 *)p); -} -static inline __be16 __cpu_to_be16p(const __u16 *p) -{ - return (__force __be16)__swab16p(p); -} -static inline __u16 __be16_to_cpup(const __be16 *p) -{ - return __swab16p((__u16 *)p); -} -#define __cpu_to_le64s(x) do {} while (0) -#define __le64_to_cpus(x) do {} while (0) -#define __cpu_to_le32s(x) do {} while (0) -#define __le32_to_cpus(x) do {} while (0) -#define __cpu_to_le16s(x) do {} while (0) -#define __le16_to_cpus(x) do {} while (0) -#define __cpu_to_be64s(x) __swab64s((x)) -#define __be64_to_cpus(x) __swab64s((x)) -#define __cpu_to_be32s(x) __swab32s((x)) -#define __be32_to_cpus(x) __swab32s((x)) -#define __cpu_to_be16s(x) __swab16s((x)) -#define __be16_to_cpus(x) __swab16s((x)) - -#include - -#endif /* __XEN_BYTEORDER_LITTLE_ENDIAN_H__ */ diff --git a/xen/include/xen/byteorder/swab.h b/xen/include/xen/byteorder/swab.h deleted file mode 100644 index b7e30f0503..0000000000 --- a/xen/include/xen/byteorder/swab.h +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef __XEN_BYTEORDER_SWAB_H__ -#define __XEN_BYTEORDER_SWAB_H__ - -/* - * Byte-swapping, independently from CPU endianness - * swabXX[ps]?(foo) - * - * Francois-Rene Rideau 19971205 - * separated swab functions from cpu_to_XX, - * to clean up support for bizarre-endian architectures. - */ - -/* casts are necessary for constants, because we never know how for sure - * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. - */ -#define ___swab16(x) \ -({ \ - __u16 __x = (x); \ - ((__u16)( \ - (((__u16)(__x) & (__u16)0x00ffU) << 8) | \ - (((__u16)(__x) & (__u16)0xff00U) >> 8) )); \ -}) - -#define ___swab32(x) \ -({ \ - __u32 __x = (x); \ - ((__u32)( \ - (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | \ - (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | \ - (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | \ - (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); \ -}) - -#define ___swab64(x) \ -({ \ - __u64 __x = (x); \ - ((__u64)( \ - (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | \ - (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | \ - (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | \ - (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | \ - (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | \ - (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | \ - (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | \ - (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); \ -}) - -#define ___constant_swab16(x) \ - ((__u16)( \ - (((__u16)(x) & (__u16)0x00ffU) << 8) | \ - (((__u16)(x) & (__u16)0xff00U) >> 8) )) -#define ___constant_swab32(x) \ - ((__u32)( \ - (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ - (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ - (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ - (((__u32)(x) & (__u32)0xff000000UL) >> 24) )) -#define ___constant_swab64(x) \ - ((__u64)( \ - (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ - (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \ - (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \ - (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \ - (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \ - (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \ - (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \ - (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) )) - -/* - * provide defaults when no architecture-specific optimization is detected - */ -#ifndef __arch__swab16 -# define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); }) -#endif -#ifndef __arch__swab32 -# define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); }) -#endif -#ifndef __arch__swab64 -# define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); }) -#endif - -#ifndef __arch__swab16p -# define __arch__swab16p(x) __arch__swab16(*(x)) -#endif -#ifndef __arch__swab32p -# define __arch__swab32p(x) __arch__swab32(*(x)) -#endif -#ifndef __arch__swab64p -# define __arch__swab64p(x) __arch__swab64(*(x)) -#endif - -#ifndef __arch__swab16s -# define __arch__swab16s(x) do { *(x) = __arch__swab16p((x)); } while (0) -#endif -#ifndef __arch__swab32s -# define __arch__swab32s(x) do { *(x) = __arch__swab32p((x)); } while (0) -#endif -#ifndef __arch__swab64s -# define __arch__swab64s(x) do { *(x) = __arch__swab64p((x)); } while (0) -#endif - - -/* - * Allow constant folding - */ -#if defined(__GNUC__) && defined(__OPTIMIZE__) -# define __swab16(x) \ -(__builtin_constant_p((__u16)(x)) ? \ - ___swab16((x)) : \ - __fswab16((x))) -# define __swab32(x) \ -(__builtin_constant_p((__u32)(x)) ? \ - ___swab32((x)) : \ - __fswab32((x))) -# define __swab64(x) \ -(__builtin_constant_p((__u64)(x)) ? \ - ___swab64((x)) : \ - __fswab64((x))) -#else -# define __swab16(x) __fswab16(x) -# define __swab32(x) __fswab32(x) -# define __swab64(x) __fswab64(x) -#endif /* OPTIMIZE */ - - -static inline __attribute_const__ __u16 __fswab16(__u16 x) -{ - return __arch__swab16(x); -} -static inline __u16 __swab16p(const __u16 *x) -{ - return __arch__swab16p(x); -} -static inline void __swab16s(__u16 *addr) -{ - __arch__swab16s(addr); -} - -static inline __attribute_const__ __u32 __fswab32(__u32 x) -{ - return __arch__swab32(x); -} -static inline __u32 __swab32p(const __u32 *x) -{ - return __arch__swab32p(x); -} -static inline void __swab32s(__u32 *addr) -{ - __arch__swab32s(addr); -} - -#ifdef __BYTEORDER_HAS_U64__ -static inline __attribute_const__ __u64 __fswab64(__u64 x) -{ -# ifdef __SWAB_64_THRU_32__ - __u32 h = x >> 32; - __u32 l = x & ((1ULL<<32)-1); - return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h))); -# else - return __arch__swab64(x); -# endif -} -static inline __u64 __swab64p(const __u64 *x) -{ - return __arch__swab64p(x); -} -static inline void __swab64s(__u64 *addr) -{ - __arch__swab64s(addr); -} -#endif /* __BYTEORDER_HAS_U64__ */ - -#define swab16 __swab16 -#define swab32 __swab32 -#define swab64 __swab64 -#define swab16p __swab16p -#define swab32p __swab32p -#define swab64p __swab64p -#define swab16s __swab16s -#define swab32s __swab32s -#define swab64s __swab64s - -#endif /* __XEN_BYTEORDER_SWAB_H__ */