From nobody Thu May 2 02:33:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1652177786; cv=none; d=zohomail.com; s=zohoarc; b=fdriOvpcvIyBN5yNbn9JuXROGovgdv1WgIxIX/+8xwIOa/mKGCxD4mLPDQeHhknSHKgIf1WPIUhAr5mEZYfu/mUVO5t5sqVnrVaBJD8QFsHvJBBJ3FNX04fSkfHmfElSV2WPLSjekMsrdO9gPoWlxpzW4qstoHmxiasuGYe4BoM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652177786; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RIVy/wJu1LqKv9TQrQaXXyG1YBHUAxJxfwilSy8Zfqg=; b=e4cnJ1fHhVaESjZVQM+vYBBMJ4Axyhxq1zLTalU3lkZirSiWi3KiTv3nnF23kRWQ7NoTLzJc+/+hEHSaU1p1pnZpkuTpILOyqePsme2N01+J1Qzp82R6b/0G2QpImtoaN2dGpAo0THVORnaXkbgrouX5ZEUOHXPDzwvBPv/ISWg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1652177786682116.81652331812563; Tue, 10 May 2022 03:16:26 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.325339.547909 (Exim 4.92) (envelope-from ) id 1noMuQ-0006Ut-O2; Tue, 10 May 2022 10:16:02 +0000 Received: by outflank-mailman (output) from mailman id 325339.547909; Tue, 10 May 2022 10:16:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuQ-0006Tt-Ga; Tue, 10 May 2022 10:16:02 +0000 Received: by outflank-mailman (input) for mailman id 325339; Tue, 10 May 2022 10:16:00 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuO-000561-Ih for xen-devel@lists.xenproject.org; Tue, 10 May 2022 10:16:00 +0000 Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2ed209b0-d04a-11ec-a406-831a346695d4; Tue, 10 May 2022 12:15:59 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 2ed209b0-d04a-11ec-a406-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1652177758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FBx5VXViH2N+eGGpOUcQCz2z12c6GtTDSfMwDmCLLRQ=; b=gwBvgm3VJ/R45JGo/aVGhZ+ohl1fRCfMbZioevIqAhmV6lrU0x3jws5a BpIyc7tpz+LNkyyS7zZ0WfQcQVQ6qg3hPa8EfokGissi649zJzNQgYwQc FqL5FvFSwKuqq7Iw3/RJzoZ/PEDPhMdgJp0i2AwZ6HXLWYJI5VWYtIUqI o=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 70351037 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:KqtWoK58/i/gMmkLaNnoBAxRtPjHchMFZxGqfqrLsTDasY5as4F+v jMXCmiDbKyDazf1f4sibti19xkOvZWEx4I2Sgc+rCE9Hi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuVGuG96yE6j8lkf5KkYAL+EnkZqTRMFWFw0HqPp8Zj2tQy2YXgW1vX0 T/Pi5a31GGNimYc3l08s8pvmDs31BglkGpF1rCWTakjUG72zxH5PrpGTU2CByKQrr1vNvy7X 47+IISRpQs1yfuP5uSNyd4XemVSKlLb0JPnZnB+A8BOiTAazsA+PzpS2FPxpi67hh3Q9+2dx umhurS8Thx1P7HQoN4fUgRhA2J7J51gxZLIdC3XXcy7lyUqclPpyvRqSko3IZcZ6qB8BmQmG f4wcW5XKErZ3qTvnez9GrIEascLdaEHOKsbu3cmyTDEJf0nXYrCU+PB4towMDIY2ZgVQK+GP JVxhTxHZkXgYT5iKn0uNcgjpb2Ull/neRFCtwfAzUYwyzeKl1EguFT3C/LXcNGXQcRenm6Du 3nLuW/+B3kyNsGbyDeD2mKhgKnIhyyTcJ0WPK218LhtmlL77lIUDBoaRF6qu86Tg0S1W89cA 0EM8y9opq83nGS7Q9+4UxCmrXqsuh8HR8EWA+A88BuKyKff/0CeHGdsZiVadNUsucsyRDor/ lyEhdXkAXpoqrL9YXiQ7KuOpDW+fy0cN3YfZDQsRBEApdLkpekOYgnnF4g5VvTv15usRG+2k 2viQDUCa6s7gckQi6Sn4Wj9gTOxn4iKSxQFwDj6UTfwhu9mX7KNa4ut4FndyP9PKoeFU1WM1 EQ5d9iiAPMmVs/UynHUKAkZNPTwvqvebmWA6bJ6N8N5nwlB7UJPamy5DNtWAE5yevgJdjbyC KM4kVMAvcQDVJdGgEIeXm5QNyjI5fW5fTgGfqqNBjarXnSWXFXelByCnWbKgwjQfLEEyMnTw 6uzf8e2Fmo9Aq961jewTOp1+eZ1m3pnnzqMFcCnl0nPPV+iiJm9E+xtDbdzRrphsPPsTPv9r b6zyPdmOz0ACbajM0E7AKYYLEwQLGhTOHwFg5c/SwJ3GSI/QDtJI6aImdsJItU594wIx7yg1 izsBSdlJK/X2CSvxfOiMSgzNtsCnP9X8BoGAMDbFQz2hCJ/Md3/vM/ytfIfJNEayQCq9tYsJ 9FtRilKKq0npujvk9jFUaTAkQ== IronPort-HdrOrdr: A9a23:GBFz3K8Uk8EIMM93lWFuk+DgI+orL9Y04lQ7vn2YSXRuHPBw8P re5cjztCWE7gr5N0tBpTntAsW9qDbnhPtICOoqTNCftWvdyQiVxehZhOOIqVDd8m/Fh4pgPM 9bAtBD4bbLbGSS4/yU3ODBKadD/OW6 X-IronPort-AV: E=Sophos;i="5.91,214,1647316800"; d="scan'208";a="70351037" From: Lin Liu To: CC: Lin Liu , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , "Jan Beulich" , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v3 1/6] xen: implement byteswap Date: Tue, 10 May 2022 06:15:19 -0400 Message-ID: <2699787cd4ba1d71448bbcdf190d927e180e80b9.1652170719.git.lin.liu@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1652177788467100007 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: Stefano Stabellini Cc: Julien Grall Cc: Bertrand Marquis Cc: Volodymyr Babchuk Cc: Andrew Cooper Cc: George Dunlap Cc: Jan Beulich Cc: Wei Liu Cc: "Roger Pau Monn=C3=A9" Changes in v3: - Check __has_builtin instead of GNUC version=20 Changes in v2: - Add fallback for compilers without __builtin_bswap - Implement with plain C instead of macros --- xen/arch/arm/include/asm/byteorder.h | 14 ++----- xen/arch/x86/include/asm/byteorder.h | 34 ++--------------- xen/include/xen/byteorder.h | 56 ++++++++++++++++++++++++++++ xen/include/xen/byteswap.h | 44 ++++++++++++++++++++++ xen/include/xen/compiler.h | 12 ++++++ 5 files changed, 120 insertions(+), 40 deletions(-) create mode 100644 xen/include/xen/byteorder.h create mode 100644 xen/include/xen/byteswap.h diff --git a/xen/arch/arm/include/asm/byteorder.h b/xen/arch/arm/include/as= m/byteorder.h index 9c712c4788..622eeaba07 100644 --- a/xen/arch/arm/include/asm/byteorder.h +++ b/xen/arch/arm/include/asm/byteorder.h @@ -1,16 +1,10 @@ #ifndef __ASM_ARM_BYTEORDER_H__ #define __ASM_ARM_BYTEORDER_H__ =20 -#define __BYTEORDER_HAS_U64__ +#ifndef __BYTE_ORDER__ + #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#endif =20 -#include +#include =20 #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/arch/x86/include/asm/byteorder.h b/xen/arch/x86/include/as= m/byteorder.h index 1f77e502a5..82aadee7bd 100644 --- a/xen/arch/x86/include/asm/byteorder.h +++ b/xen/arch/x86/include/asm/byteorder.h @@ -1,36 +1,10 @@ #ifndef __ASM_X86_BYTEORDER_H__ #define __ASM_X86_BYTEORDER_H__ =20 -#include -#include +#ifndef __BYTE_ORDER__ + #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#endif =20 -static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) -{ - asm("bswap %0" : "=3Dr" (x) : "0" (x)); - return x; -} - -static inline __attribute_const__ __u64 ___arch__swab64(__u64 val) -{=20 - union {=20 - struct { __u32 a,b; } s; - __u64 u; - } v; - v.u =3D val; - asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1"=20 - : "=3Dr" (v.s.a), "=3Dr" (v.s.b)=20 - : "0" (v.s.a), "1" (v.s.b));=20 - return v.u; -}=20 - -/* 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 +#include =20 #endif /* __ASM_X86_BYTEORDER_H__ */ diff --git a/xen/include/xen/byteorder.h b/xen/include/xen/byteorder.h new file mode 100644 index 0000000000..2ec434e6a6 --- /dev/null +++ b/xen/include/xen/byteorder.h @@ -0,0 +1,56 @@ +#ifndef __XEN_BYTEORDER_H__ +#define __XEN_BYTEORDER_H__ + +#include + +#if __BYTE_ORDER__ =3D=3D __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__ =3D=3D __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 /* __XEN_BYTEORDER_H__ */ diff --git a/xen/include/xen/byteswap.h b/xen/include/xen/byteswap.h new file mode 100644 index 0000000000..0dd5567557 --- /dev/null +++ b/xen/include/xen/byteswap.h @@ -0,0 +1,44 @@ +#ifndef __XEN_BYTESWAP_H__ +#define __XEN_BYTESWAP_H__ + +#include +#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) PASTE(bswap,BITS_PER_LONG)(x) + +#endif /* __XEN_BYTESWAP_H__ */ diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h index 933aec09a9..05b1b8b24d 100644 --- a/xen/include/xen/compiler.h +++ b/xen/include/xen/compiler.h @@ -185,4 +185,16 @@ # define CLANG_DISABLE_WARN_GCC_COMPAT_END #endif =20 +#ifndef __has_builtin +/* + * 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 >=3D 40800) +#define GCC_has__builtin_bswap32 (CONFIG_GCC_VERSION >=3D 40400) +#define GCC_has__builtin_bswap64 (CONFIG_GCC_VERSION >=3D 40400) +#endif + #endif /* __LINUX_COMPILER_H */ --=20 2.27.0 From nobody Thu May 2 02:33:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1652177787; cv=none; d=zohomail.com; s=zohoarc; b=AbVt1uF83+PD9evZz9h7V7MoDY5OD3pZehlRzllobUc6INx2uMiLSZyFp0FQ1iTj8ALaEWOFXAwmcSZDmdPtlGsoJQ9ljj1HmrCvrdLdj0b2iq60n3BEbnMvJUfyShtLXZYzv9XkmKTOD90xiBCy5KHrNJPApGgJdIDJCXa0SWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652177787; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nN8ogNFj5BK1qq0XahAlIfaXt7lHj4+hFZGQa/tGUVE=; b=kHC+YL10iagVNSdcDm5OGb3q2TuSFuyHAkMoIEjw/DOZkxulAyZgFoEM1P5vAC18Iv/+U/ivunUEWPoPiNajmWCF8KIZqgW96y/hpYRhNlrnCVfpVd5U3v8tQqN4o/c2jxy2/S7khWjEMa/nAjNWOPly0L665wfyLAc0sbGhUTk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1652177787109171.1644682410025; Tue, 10 May 2022 03:16:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.325340.547920 (Exim 4.92) (envelope-from ) id 1noMuV-0006wd-7U; Tue, 10 May 2022 10:16:07 +0000 Received: by outflank-mailman (output) from mailman id 325340.547920; Tue, 10 May 2022 10:16:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuV-0006wQ-1w; Tue, 10 May 2022 10:16:07 +0000 Received: by outflank-mailman (input) for mailman id 325340; Tue, 10 May 2022 10:16:05 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuT-00055w-Hu for xen-devel@lists.xenproject.org; Tue, 10 May 2022 10:16:05 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 320097b6-d04a-11ec-8fc4-03012f2f19d4; Tue, 10 May 2022 12:16:04 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 320097b6-d04a-11ec-8fc4-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1652177763; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pihspNLolWNcndSwdSRcONnMwvkmXayMv7dBXhsK0NA=; b=OGNl9bp7B0VLuVwxx+tmiSBE3iV49cnZrVlJ5RuxIrtLbcS+/IzIODcD 1q1kgsIbn3JyDLhtmAcCw/M+bj9h9qjWtF2pBOYgnPMDGcMqQ7og7mMiI C+fO8viY7KwKDGAh+tBO99bMZk59i3rVP8XAT2egAoGi5fylTBIEleGu+ g=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 70954436 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:/nf4JajtdGeUrUHiFT/tVwvMX161ahAKZh0ujC45NGQN5FlHY01je htvXGGBbPfcN2L9ed1/bI+19xwE65DTxoQyHFFt+SpgEi0b9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oDJ9CU6jefSLlbFILas1hpZHGeIcw98z0M68wIFqtQw24LhXlrV4 YmaT/D3YzdJ5RYlagr41IrbwP9flKyaVOQw5wFWiVhj5TcyplFNZH4tDfjZw0jQG+G4KtWSV efbpIxVy0uCl/sb5nFJpZ6gGqECaua60QFjERO6UYD66vRJjnRaPqrWqJPwwKqY4tmEt4kZ9 TlDiXC/YQR3IpKUiOM/akljGTBUeupt4eTVPHfq5KR/z2WeG5ft6/BnDUVwNowE4OdnR2pJ8 JT0KhhUMErF3bjvhuvmFK883azPL+GyVG8bknVhy3fdDOsOSpHfWaTao9Rf2V/cg+gRRaeDO 5ZCN1KDajzaQURNJlUeLagEu9zxpHnTSRla91288P9fD2/7k1UqjemF3MDuUt6XQcRYmG6Iq 2SA+H72ajkFMPSPxDzD9Wij7sfUhj/yUo8WELy+99ZpjUeVy2hVDwcZPXOrrP/8hkOgVtZ3L 00P5jFovaU07FasTNT2Q1u/unHslhwWVsdUEuY6wBqQ0aeS6AGcblXoVRYYNoZg7pVvA2V3i BnZxLsFGACDrpWWF26irqeTjwriAiIEByhFTjZfXxYKtoyLTJ4IsjrDSdNqEaiQh9LzGC3tz z3ikBXSl4n/nuZQifzloAmvbyaE48GQE1Vrvlm/sneNtFsRWWKzW2C/BbE3B95kJZ3RcFSOt WNsdyO2vLFXVsHleMBgrYww8FCVCxStbWS0bb1HRcBJG9GRF5mLJ9k43d2GDB01WvvogBewC KMphStf5YVIIFyhZrJtboS6BqwClPa9T42/D6+EPoYWP/CdkTNrGwk0PiatM53FyhBwwcnTx 7/FGSpTMZrqIfs+l2fnLwvs+bQq2jo/1QvuqWPTlHyaPU6lTCfNE98taQLWBshgtf/siFiEq L53aprVoyizpcWjO0E7B6ZIdQBURZX6bLirw/FqmhmreFQ5Qj1xUK+BqV7jEqQ895loei7z1 inVcidlJJDX3hUr9S3ihqhfVY7S IronPort-HdrOrdr: A9a23:ygCE/auHafWTU2F1XNJ3+MoA7skDTtV00zEX/kB9WHVpmszxra 6TdZMgpHnJYVcqKQkdcL+7WJVoLUmxyXcx2/h1AV7AZniAhILLFvAA0WKK+VSJcEeSygce79 YFT0EXMqyIMbEQt6fHCWeDfOrIuOP3kpyVuQ== X-IronPort-AV: E=Sophos;i="5.91,214,1647316800"; d="scan'208";a="70954436" From: Lin Liu To: CC: Lin Liu , Jan Beulich , "Andrew Cooper" , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v3 2/6] crypto/vmac: Simplify code with byteswap Date: Tue, 10 May 2022 06:15:20 -0400 Message-ID: <4bf9200cfbd798130d2ef68c9b0f5373f72a1b95.1652170719.git.lin.liu@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1652177788297100002 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Andrew Cooper --- Cc: Andrew Cooper Cc: George Dunlap 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 @@ =20 /* start for Xen */ #include +#include #include #include #include @@ -50,7 +51,6 @@ const uint64_t mpoly =3D 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 =20 * -----------------------------------------------------------------------= */ =20 /* -----------------------------------------------------------------------= */ @@ -68,22 +68,6 @@ const uint64_t mpoly =3D UINT64_C(0x1fffffff1fffffff); = /* Poly key mask */ =20 #define PMUL64 MUL64 =20 -#define GET_REVERSED_64(p) \ - ({uint64_t x; \ - asm ("bswapq %0" : "=3Dr" (x) : "0"(*(uint64_t *)(p))); x;}) - -/* -----------------------------------------------------------------------= */ -#elif (__GNUC__ && __i386__) -/* -----------------------------------------------------------------------= */ - -#define GET_REVERSED_64(p) \ - ({ uint64_t x; \ - uint32_t *tp =3D (uint32_t *)(p); = \ - asm ("bswap %%edx\n\t" \ - "bswap %%eax" \ - : "=3DA"(x) = \ - : "a"(tp[1]), "d"(tp[0])); \ - x; }) =20 /* -----------------------------------------------------------------------= */ #elif (__GNUC__ && __ppc64__) @@ -103,37 +87,6 @@ const uint64_t mpoly =3D UINT64_C(0x1fffffff1fffffff); = /* Poly key mask */ =20 #define PMUL64 MUL64 =20 -#define GET_REVERSED_64(p) \ - ({ uint32_t hi, lo, *_p =3D (uint32_t *)(p); = \ - asm volatile ("lwbrx %0, %1, %2" : "=3Dr"(lo) : "b%"(0), "r"(_p) );= \ - asm volatile ("lwbrx %0, %1, %2" : "=3Dr"(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 =3D (uint32_t *)(p); = \ - asm volatile ("lwbrx %0, %1, %2" : "=3Dr"(lo) : "b%"(0), "r"(_p) );= \ - asm volatile ("lwbrx %0, %1, %2" : "=3Dr"(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" \ - : "=3Dr" (out), "=3D&r" (tmp) = \ - : "r" (v)); \ - out;}) - /* -----------------------------------------------------------------------= */ #elif _MSC_VER /* -----------------------------------------------------------------------= */ @@ -154,11 +107,6 @@ const uint64_t mpoly =3D UINT64_C(0x1fffffff1fffffff);= /* Poly key mask */ (rh) +=3D (ih) + ((rl) < (_il)); \ } =20 -#if _MSC_VER >=3D 1300 -#define GET_REVERSED_64(p) _byteswap_uint64(*(uint64_t *)(p)) -#pragma intrinsic(_byteswap_uint64) -#endif - #if _MSC_VER >=3D 1400 && \ (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >=3D 1000) #define MUL32(i1,i2) (__emulu((uint32_t)(i1),(uint32_t)(i2))) @@ -219,24 +167,6 @@ const uint64_t mpoly =3D UINT64_C(0x1fffffff1fffffff);= /* Poly key mask */ } #endif =20 -#ifndef GET_REVERSED_64 -#ifndef bswap64 -#ifndef bswap32 -#define bswap32(x) \ - ({ uint32_t bsx =3D (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 =3D (x); = \ - r.l[0] =3D bswap32 (w.l[1]); = \ - r.l[1] =3D bswap32 (w.l[0]); = \ - r.ll; }) -#endif -#define GET_REVERSED_64(p) bswap64(*(uint64_t *)(p))=20 -#endif - /* -----------------------------------------------------------------------= */ =20 #if (VMAC_PREFER_BIG_ENDIAN) @@ -247,9 +177,9 @@ const uint64_t mpoly =3D UINT64_C(0x1fffffff1fffffff); = /* Poly key mask */ =20 #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 =20 --=20 2.27.0 From nobody Thu May 2 02:33:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1652177788; cv=none; d=zohomail.com; s=zohoarc; b=i77jrfZUNZyrBd65ALTdc8cKQDzGKc0zsA6XjjLAd1nS7c04zeZb4X0ZlGB9RKM+BdVkBQcp6JvhnTCXEfG8hkwbfG2Oa3gUKtP7Dl75L7NFtzquOfia783pTL6HKXJ/hgdfn4oOuJsHwwuXiCFMbh4dcqoFzzxumIKGLYs2G4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652177788; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+CwbZzLe0OpR8gi7fhTrLbznVlicKyfbIsH7+26Xm0E=; b=DUpFR351zmhaC6T74PBm05CtfMqLhCKNwdrt+wHmgEaA0HtSXKoqja6G/Vrx96HHCYKOQ3j8ThHITYSdHe7y1F+YOaA0QSP7nzkd7TcWD5k4KE4O5YX1ZiJJLAJEtIjs11vBGDQ/8Ceezs7VthH/Fvd4K/z70tUci+cIRLR0hvE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1652177788501295.72235892503284; Tue, 10 May 2022 03:16:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.325338.547898 (Exim 4.92) (envelope-from ) id 1noMuP-0006C4-15; Tue, 10 May 2022 10:16:01 +0000 Received: by outflank-mailman (output) from mailman id 325338.547898; Tue, 10 May 2022 10:16:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuO-0006Bu-TG; Tue, 10 May 2022 10:16:00 +0000 Received: by outflank-mailman (input) for mailman id 325338; Tue, 10 May 2022 10:15:59 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuN-000561-Cd for xen-devel@lists.xenproject.org; Tue, 10 May 2022 10:15:59 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2f292f68-d04a-11ec-a406-831a346695d4; Tue, 10 May 2022 12:15:58 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 2f292f68-d04a-11ec-a406-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1652177758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tSkw06p+M7uP7rlqOhJWwx1pKczcdXCgiRbYRyRDoo0=; b=YITwRWslsgDcRp/wyUTVR+IdD1LIxVUSgmx6s5C/nfy/ODUz9SnQuhQg WkwyV1ecEZAv9jntZfi//147gwBM2gBE41nY7Yq5wd3cxGlNFKmz662ZJ cLt+46ozJ5Rc/wrhecirW14R0Eykvyq2idsQ7yW5miXOOt9uw9rpt8XdE s=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 73450899 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:tPyCraw07xLtcff5x7V6t+cUxirEfRIJ4+MujC+fZmUNrF6WrkUFx 2QWD2qGP/3eYWX3e9EjbY7k/BtU65HRnYBlQAo5pCAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnj/0bv656yMUOZigHtIQMsadUsxKbVIiGX5JZS5LwbZj2NY12IDhWWthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ Nplv7fuGSN0IfD3vuUMCAVSAisvA6hcweqSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 aVGcnZXNEnF3r/ohuLgIgVvrp1LwM3DOIIZ/HVh0BnSDOo8QICFSKLPjTNd9Ghr2p0WTaePD yYfQWI/UhODaUZIAGZJVZEzsqSzgVLVcCIN/Tp5ooJoujOOnWSdyoPFOtfPZsaDQ8kTm0+Cv 3/H5EzwGBRcP9uaoRK79Xariv7KjDnMcosYH72l9dZnmFSWgGcUDXU+V0a/oPS/ol6zXZRYM UN80jojq+0++VKmSvH5XgakuziUsxgEQd1SHuYmrgaXxcL8+B2FD2IJSjpAbt0Ot8IsQzEuk FiTkLvU6SdH6ePPDyjHr/HN8G30aXN9wXI+iTEsRyBbs/2+v9wIqBPeFcppAaTksNjvIGSlq 9yVlxQWi7IWhM8N8qy0+1Hbnj6hzqT0oh4JChb/BTz8sF4gDGKxT8nxsAWAs64cRGqMZgPZ1 EXojfRy+wzn4XulsCWWCNsAE7iyjxpuGG2N2AU/d3XNGtnExpJCQWyyyGwnTKuKGpxdEdMMX KM0kVkIjKK/xFPwMcdKj3uZUqzGN5TIG9X/TezzZdFTeJV3fwLv1HgwOBTJhTmywBhwyfxX1 XKnnSGEVy1yNEia5GDuG7d1PUEDmEjSOl8/tbiklk/6gNJylVaeSKsfMUvmUwzKxPjsnekhy P4Gb5Hi40wGCIXWO3CLmaZOfAtiBSVqWvjLRzl/K7frzvxOQzlxVZc8ANoJJuRYokiivr2Wo SvhChQImDISRxTvcG23V5yqU5u3Nb4XkJ7xFXVE0YqAs5T7XbuS0Q== IronPort-HdrOrdr: A9a23:tzgFw6P4s74yIMBcTvujsMiBIKoaSvp037Eqv3oRdfUzSL3gqy nOpoVh6faaskdzZJhNo7+90ey7MBfhHP1OkO8s1NWZLWvbUQKTRekIh+aP/9SjIVyYygc079 YZT0EUMr3N5DZB4/oSmDPIduod/A== X-IronPort-AV: E=Sophos;i="5.91,214,1647316800"; d="scan'208";a="73450899" From: Lin Liu To: CC: Lin Liu , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH v3 3/6] arm64/find_next_bit: Remove ext2_swab() Date: Tue, 10 May 2022 06:15:21 -0400 Message-ID: <48bdc1be03a77bcc405e327b8022fcd937186e9e.1652170719.git.lin.liu@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1652177789955100010 Content-Type: text/plain; charset="utf-8" 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 Acked-by: Julien Grall Reviewed-by: Andrew Cooper --- Cc: Stefano Stabellini Cc: Julien Grall Cc: Bertrand Marquis Cc: Volodymyr Babchuk This patche is not well tested without running environment for arm --- xen/arch/arm/arm64/lib/find_next_bit.c | 36 +++++--------------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/xen/arch/arm/arm64/lib/find_next_bit.c b/xen/arch/arm/arm64/li= b/find_next_bit.c index 8ebf8bfe97..e3b3720ff4 100644 --- a/xen/arch/arm/arm64/lib/find_next_bit.c +++ b/xen/arch/arm/arm64/lib/find_next_bit.c @@ -161,30 +161,6 @@ EXPORT_SYMBOL(find_first_zero_bit); =20 #ifdef __BIG_ENDIAN =20 -/* include/linux/byteorder does not support "unsigned long" type */ -static inline unsigned long ext2_swabp(const unsigned long * x) -{ -#if BITS_PER_LONG =3D=3D 64 - return (unsigned long) __swab64p((u64 *) x); -#elif BITS_PER_LONG =3D=3D 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 =3D=3D 64 - return (unsigned long) __swab64((u64) y); -#elif BITS_PER_LONG =3D=3D 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, u= nsigned size -=3D result; offset &=3D (BITS_PER_LONG - 1UL); if (offset) { - tmp =3D ext2_swabp(p++); + tmp =3D bswap_ul(*p++); tmp |=3D (~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, u= nsigned } if (!size) return result; - tmp =3D ext2_swabp(p); + tmp =3D bswap_ul(*p); found_first: tmp |=3D ~0UL << size; if (tmp =3D=3D ~0UL) /* Are any bits zero? */ @@ -226,7 +202,7 @@ found_middle: return result + ffz(tmp); =20 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, unsign= ed size -=3D result; offset &=3D (BITS_PER_LONG - 1UL); if (offset) { - tmp =3D ext2_swabp(p++); + tmp =3D bswap_ul(*p++); tmp &=3D (~0UL << offset); if (size < BITS_PER_LONG) goto found_first; @@ -264,7 +240,7 @@ unsigned long find_next_bit_le(const void *addr, unsign= ed } if (!size) return result; - tmp =3D ext2_swabp(p); + tmp =3D bswap_ul(*p); found_first: tmp &=3D (~0UL >> (BITS_PER_LONG - size)); if (tmp =3D=3D 0UL) /* Are any bits set? */ @@ -273,7 +249,7 @@ found_middle: return result + __ffs(tmp); =20 found_middle_swap: - return result + __ffs(ext2_swab(tmp)); + return result + __ffs(bswap_ul(tmp)); } EXPORT_SYMBOL(find_next_bit_le); #endif --=20 2.27.0 From nobody Thu May 2 02:33:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1652177787; cv=none; d=zohomail.com; s=zohoarc; b=aMzngELrQNFV1wMy4UBZx6fLdRkEGj+ln0k2VIyDBnV/VJlbcOSo15AsaFN72Gnpk6nyLs0E9FuBRncPaYpyihYJVz0Pls+u+3Or0UGCRJMmJM9pz6hqoRxaMTH3ybJUEnC4iKXQ/jqLiNqvDiu69Snl+Tenpo6fOu2cGrZFJNw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652177787; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VQ8sCH1ajnU0QHCWlieMi0A3fSL8n3FVGpUos7bzCxI=; b=InN1iFpzfqBfr9VEdxu2RHgeSwD2cSQrqHEWwN4vVuMtw5PWNB0m3EzPGNg+v9v+nMyEymnW/pYLdPAe/nFvG3Qu8Kfoy20Wu1rFKk+A20v3jXfEBCUWcDdbeLvh11dEBVqt8ghpcY7sQg+EcCjOoEmzfnrK7+8bq4+6AMjHo24= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16521777870381010.8771992356786; Tue, 10 May 2022 03:16:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.325335.547861 (Exim 4.92) (envelope-from ) id 1noMuJ-0005EX-2F; Tue, 10 May 2022 10:15:55 +0000 Received: by outflank-mailman (output) from mailman id 325335.547861; Tue, 10 May 2022 10:15:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuI-0005D6-T2; Tue, 10 May 2022 10:15:54 +0000 Received: by outflank-mailman (input) for mailman id 325335; Tue, 10 May 2022 10:15:53 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuH-000561-Gr for xen-devel@lists.xenproject.org; Tue, 10 May 2022 10:15:53 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 29c50bdf-d04a-11ec-a406-831a346695d4; Tue, 10 May 2022 12:15:51 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 29c50bdf-d04a-11ec-a406-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1652177751; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0T/JNn3Dww3wHscmgvdIRfZs4Ekns00pQ2CWndQ/ZWk=; b=EEmsDdzTkk3Q8tscErIHkq4n3sRwpWEHI/InD3TnzKClI7uVBOATLtNn 1BZ53g0S3DKWFLJCiNIIHrU9YP9Xq9iIx2XPE2hFrWAxSV8QPSVm68EGY tu/7NijKfS0Hb4zpbLJiKHuPrR91Y6ikMliSlmHRAHHWIU/dBiNGSJZ6k U=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 70954409 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:bve7HqOmaevnueDvrR2vl8FynXyQoLVcMsEvi/4bfWQNrUok3jxUx 2cbWmzTOvePZTSkfN5zPtvkpk4FupSEn942Gwto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdleF+lH1dOKJQUBUjclkfJKlYAL/En03FFYMpBsJ00o5wbZk29Yw27BVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Zw sRwqqKtCj8SAI7Kk8gZagVoMAZjBPgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbLtqF64YrAEasALKMjteocep1lrzC3DDOZgSpfGK0nPzYAAjWps2pgfdRrYT 8MpKgI+dw3qXxRKAFMnVs4Yrd6CoUCqJlW0r3rK/PFqsgA/1jdZ0qXpMdfTUsyHQ4NShEnwj n3C13T0BFcdLtP34TiP/2+oh+TPtTjmQ49UH7q9ntZ6jVvWymENBRk+UVqgveL/mkO4Q8hYK UEf5mwpt6da3FewUtD3Uhm8oXiFlh0RQdxdF6s98g7l90bPy1/HXC5eFGcHMYF48p9tLdA36 rOXt9n4OCNRrf6tcky+8Ly4qQquCQsyMFZXMEfoUjA5y9XkpYgyiDfGQdBiDLO5g7XJJN3g/ 9yZhHNg3utO1Kbnw43+pAma2Gz0+vAlWyZvvm3qsnSZAhSVjWJPT6ih8hDl4PlJN+51pXHR7 SFfy6ByAA3jZKxhdRBhos1QRdlFBN7faVUwZGKD+LF7rlyQF4aLJ9w43d2HDB4B3jw4UTHoe lTPngha+YVeOnCnBYcuPd/rUp5zkviwSYy4PhwxUjapSsIqHDJrAQk0PRLAt4wTuBZEfV4D1 WezLp/3UCdy5VVPxzuqXeYNuYLHNQhlrV4/savTlkz9uZLHPSb9Ye5cbDOmM7FihIvZ8Vq9z jqqH5bTo/mpeLamMne/HE96BQ1iEEXX8ris9ZMNKr7YcloO9aNII6a5/I7NsrdNx8x9/tokN FnnMqOE4DITXUH6FDg= IronPort-HdrOrdr: A9a23:zPaLjKAGn+9BzZPlHemU55DYdb4zR+YMi2TC1yhKJyC9Ffbo8f xG/c5rrSMc5wxwZJhNo7y90ey7MBbhHP1OkO4s1NWZLWrbUQKTRekIh+bfKn/baknDH4ZmpN 5dmsNFaeEYY2IUsS+D2njbL+od X-IronPort-AV: E=Sophos;i="5.91,214,1647316800"; d="scan'208";a="70954409" From: Lin Liu To: CC: Lin Liu , Stefano Stabellini , Julien Grall , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu Subject: [PATCH v3 4/6] xen: Switch to byteswap Date: Tue, 10 May 2022 06:15:22 -0400 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1652177788317100003 Content-Type: text/plain; charset="utf-8" Update to use byteswap to swap bytes. No functional change. Signed-off-by: Lin Liu --- Cc: Stefano Stabellini Cc: Julien Grall Cc: Andrew Cooper Cc: George Dunlap Cc: Jan Beulich Cc: Wei Liu Changes in v3: - Update xen/common/device_tree.c to use be32_to_cpu - Keep const in type cast in unaligned.h --- xen/common/device_tree.c | 44 +++++++++++++++--------------- xen/common/libelf/libelf-private.h | 6 ++-- xen/common/xz/private.h | 2 +- xen/include/xen/unaligned.h | 24 ++++++++-------- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 4aae281e89..70d3be3be6 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -171,7 +171,7 @@ bool_t dt_property_read_u32(const struct dt_device_node= *np, if ( !val || len < sizeof(*out_value) ) return 0; =20 - *out_value =3D be32_to_cpup(val); + *out_value =3D be32_to_cpu(*val); =20 return 1; } @@ -264,7 +264,7 @@ int dt_property_read_variable_u32_array(const struct dt= _device_node *np, =20 count =3D sz; while ( count-- ) - *out_values++ =3D be32_to_cpup(val++); + *out_values++ =3D be32_to_cpu(*val++); =20 return sz; } @@ -490,7 +490,7 @@ static int __dt_n_addr_cells(const struct dt_device_nod= e *np, bool_t parent) =20 ip =3D dt_get_property(np, "#address-cells", NULL); if ( ip ) - return be32_to_cpup(ip); + return be32_to_cpu(*ip); } while ( np->parent ); /* No #address-cells property for the root node */ return DT_ROOT_NODE_ADDR_CELLS_DEFAULT; @@ -507,7 +507,7 @@ int __dt_n_size_cells(const struct dt_device_node *np, = bool_t parent) =20 ip =3D dt_get_property(np, "#size-cells", NULL); if ( ip ) - return be32_to_cpup(ip); + return be32_to_cpu(*ip); } while ( np->parent ); /* No #address-cells property for the root node */ return DT_ROOT_NODE_SIZE_CELLS_DEFAULT; @@ -660,7 +660,7 @@ static void dt_bus_pci_count_cells(const struct dt_devi= ce_node *np, static unsigned int dt_bus_pci_get_flags(const __be32 *addr) { unsigned int flags =3D 0; - u32 w =3D be32_to_cpup(addr); + u32 w =3D be32_to_cpu(*addr); =20 switch((w >> 24) & 0x03) { case 0x01: @@ -1077,7 +1077,7 @@ dt_irq_find_parent(const struct dt_device_node *child) if ( parp =3D=3D NULL ) p =3D dt_get_parent(child); else - p =3D dt_find_node_by_phandle(be32_to_cpup(parp)); + p =3D dt_find_node_by_phandle(be32_to_cpu(*parp)); child =3D p; } while ( p && dt_get_property(p, "#interrupt-cells", NULL) =3D=3D NUL= L ); =20 @@ -1110,7 +1110,7 @@ unsigned int dt_number_of_irq(const struct dt_device_= node *device) intlen /=3D sizeof(*intspec); =20 dt_dprintk(" using 'interrupts' property\n"); - dt_dprintk(" intspec=3D%d intlen=3D%d\n", be32_to_cpup(intspec), intle= n); + dt_dprintk(" intspec=3D%d intlen=3D%d\n", be32_to_cpu(*intspec), intle= n); =20 /* Look for the interrupt parent. */ p =3D dt_irq_find_parent(device); @@ -1241,7 +1241,7 @@ int dt_for_each_irq_map(const struct dt_device_node *= dev, imaplen -=3D addrsize + intsize; =20 /* Get the interrupt parent */ - ipar =3D dt_find_node_by_phandle(be32_to_cpup(imap)); + ipar =3D dt_find_node_by_phandle(be32_to_cpu(*imap)); imap++; --imaplen; =20 @@ -1358,8 +1358,8 @@ static int dt_irq_map_raw(const struct dt_device_node= *parent, int match, i; =20 dt_dprintk("dt_irq_map_raw: par=3D%s,intspec=3D[0x%08x 0x%08x...],oint= size=3D%d\n", - parent->full_name, be32_to_cpup(intspec), - be32_to_cpup(intspec + 1), ointsize); + parent->full_name, be32_to_cpu(*intspec), + be32_to_cpu(*(intspec+1)), ointsize); =20 ipar =3D parent; =20 @@ -1471,7 +1471,7 @@ static int dt_irq_map_raw(const struct dt_device_node= *parent, dt_dprintk(" -> match=3D%d (imaplen=3D%d)\n", match, imaplen); =20 /* Get the interrupt parent */ - newpar =3D dt_find_node_by_phandle(be32_to_cpup(imap)); + newpar =3D dt_find_node_by_phandle(be32_to_cpu(*imap)); imap++; --imaplen; =20 @@ -1565,7 +1565,7 @@ int dt_device_get_raw_irq(const struct dt_device_node= *device, intlen /=3D sizeof(*intspec); =20 dt_dprintk(" using 'interrupts' property\n"); - dt_dprintk(" intspec=3D%d intlen=3D%d\n", be32_to_cpup(intspec), intle= n); + dt_dprintk(" intspec=3D%d intlen=3D%d\n", be32_to_cpu(*intspec), intle= n); =20 /* Look for the interrupt parent. */ p =3D dt_irq_find_parent(device); @@ -1676,7 +1676,7 @@ static int __dt_parse_phandle_with_args(const struct = dt_device_node *np, * If phandle is 0, then it is an empty entry with no * arguments. Skip forward to the next entry. * */ - phandle =3D be32_to_cpup(list++); + phandle =3D be32_to_cpu(*list++); if ( phandle ) { /* @@ -1745,7 +1745,7 @@ static int __dt_parse_phandle_with_args(const struct = dt_device_node *np, out_args->np =3D node; out_args->args_count =3D count; for ( i =3D 0; i < count; i++ ) - out_args->args[i] =3D be32_to_cpup(list++); + out_args->args[i] =3D be32_to_cpu(*list++); } =20 /* Found it! return success */ @@ -1826,7 +1826,7 @@ static unsigned long __init unflatten_dt_node(const v= oid *fdt, int has_name =3D 0; int new_format =3D 0; =20 - tag =3D be32_to_cpup((__be32 *)(*p)); + tag =3D be32_to_cpu(*(__be32 *)(*p)); if ( tag !=3D FDT_BEGIN_NODE ) { printk(XENLOG_WARNING "Weird tag at start of node: %x\n", tag); @@ -1919,7 +1919,7 @@ static unsigned long __init unflatten_dt_node(const v= oid *fdt, u32 sz, noff; const char *pname; =20 - tag =3D be32_to_cpup((__be32 *)(*p)); + tag =3D be32_to_cpu(*(__be32 *)(*p)); if ( tag =3D=3D FDT_NOP ) { *p +=3D 4; @@ -1928,8 +1928,8 @@ static unsigned long __init unflatten_dt_node(const v= oid *fdt, if ( tag !=3D FDT_PROP ) break; *p +=3D 4; - sz =3D be32_to_cpup((__be32 *)(*p)); - noff =3D be32_to_cpup((__be32 *)((*p) + 4)); + sz =3D be32_to_cpu(*(__be32 *)(*p)); + noff =3D be32_to_cpu(*(__be32 *)((*p) + 4)); *p +=3D 8; if ( fdt_version(fdt) < 0x10 ) *p =3D ROUNDUP(*p, sz >=3D 8 ? 8 : 4); @@ -1956,13 +1956,13 @@ static unsigned long __init unflatten_dt_node(const= void *fdt, (strcmp(pname, "linux,phandle") =3D=3D 0) ) { if ( np->phandle =3D=3D 0 ) - np->phandle =3D be32_to_cpup((__be32*)*p); + np->phandle =3D be32_to_cpu(*(__be32*)*p); } /* And we process the "ibm,phandle" property * used in pSeries dynamic device tree * stuff */ if ( strcmp(pname, "ibm,phandle") =3D=3D 0 ) - np->phandle =3D be32_to_cpup((__be32 *)*p); + np->phandle =3D be32_to_cpu(*(__be32 *)*p); pp->name =3D pname; pp->length =3D sz; pp->value =3D (void *)*p; @@ -2034,7 +2034,7 @@ static unsigned long __init unflatten_dt_node(const v= oid *fdt, *p +=3D 4; else mem =3D unflatten_dt_node(fdt, mem, p, np, allnextpp, fpsize); - tag =3D be32_to_cpup((__be32 *)(*p)); + tag =3D be32_to_cpu(*(__be32 *)(*p)); } if ( tag !=3D FDT_END_NODE ) { @@ -2086,7 +2086,7 @@ static void __init __unflatten_device_tree(const void= *fdt, /* Second pass, do actual unflattening */ start =3D ((unsigned long)fdt) + fdt_off_dt_struct(fdt); unflatten_dt_node(fdt, mem, &start, NULL, &allnextp, 0); - if ( be32_to_cpup((__be32 *)start) !=3D FDT_END ) + if ( be32_to_cpu(*(__be32 *)start) !=3D FDT_END ) printk(XENLOG_WARNING "Weird tag at end of tree: %08x\n", *((u32 *)start)); if ( be32_to_cpu(((__be32 *)mem)[size / 4]) !=3D 0xdeadbeef ) diff --git a/xen/common/libelf/libelf-private.h b/xen/common/libelf/libelf-= private.h index 47db679966..6062598fb8 100644 --- a/xen/common/libelf/libelf-private.h +++ b/xen/common/libelf/libelf-private.h @@ -31,9 +31,9 @@ printk(fmt, ## args ) =20 #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) =20 #else /* !__XEN__ */ =20 diff --git a/xen/common/xz/private.h b/xen/common/xz/private.h index 511343fcc2..97131fa714 100644 --- a/xen/common/xz/private.h +++ b/xen/common/xz/private.h @@ -28,7 +28,7 @@ static inline void put_unaligned_le32(u32 val, void *p) =20 #endif =20 -#define get_le32(p) le32_to_cpup((const uint32_t *)(p)) +#define get_le32(p) le32_to_cpu(*(const uint32_t *)(p)) =20 #define false 0 #define true 1 diff --git a/xen/include/xen/unaligned.h b/xen/include/xen/unaligned.h index 0a2b16d05d..16b2e6f5f0 100644 --- a/xen/include/xen/unaligned.h +++ b/xen/include/xen/unaligned.h @@ -20,62 +20,62 @@ =20 static inline uint16_t get_unaligned_be16(const void *p) { - return be16_to_cpup(p); + return be16_to_cpu(*(const uint16_t *)p); } =20 static inline void put_unaligned_be16(uint16_t val, void *p) { - *(__force __be16*)p =3D cpu_to_be16(val); + *(__be16 *)p =3D cpu_to_be16(val); } =20 static inline uint32_t get_unaligned_be32(const void *p) { - return be32_to_cpup(p); + return be32_to_cpu(*(const uint32_t *)p); } =20 static inline void put_unaligned_be32(uint32_t val, void *p) { - *(__force __be32*)p =3D cpu_to_be32(val); + *(__be32 *)p =3D cpu_to_be32(val); } =20 static inline uint64_t get_unaligned_be64(const void *p) { - return be64_to_cpup(p); + return be64_to_cpu(*(const uint64_t *)p); } =20 static inline void put_unaligned_be64(uint64_t val, void *p) { - *(__force __be64*)p =3D cpu_to_be64(val); + *(__be64 *)p =3D cpu_to_be64(val); } =20 static inline uint16_t get_unaligned_le16(const void *p) { - return le16_to_cpup(p); + return le16_to_cpu(*(const uint16_t *)p); } =20 static inline void put_unaligned_le16(uint16_t val, void *p) { - *(__force __le16*)p =3D cpu_to_le16(val); + *(__le16 *)p =3D cpu_to_le16(val); } =20 static inline uint32_t get_unaligned_le32(const void *p) { - return le32_to_cpup(p); + return le32_to_cpu(*(const uint32_t *)p); } =20 static inline void put_unaligned_le32(uint32_t val, void *p) { - *(__force __le32*)p =3D cpu_to_le32(val); + *(__le32 *)p =3D cpu_to_le32(val); } =20 static inline uint64_t get_unaligned_le64(const void *p) { - return le64_to_cpup(p); + return le64_to_cpu(*(const uint64_t *)p); } =20 static inline void put_unaligned_le64(uint64_t val, void *p) { - *(__force __le64*)p =3D cpu_to_le64(val); + *(__le64 *)p =3D cpu_to_le64(val); } =20 #endif /* __XEN_UNALIGNED_H__ */ --=20 2.27.0 From nobody Thu May 2 02:33:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1652177791; cv=none; d=zohomail.com; s=zohoarc; b=hmGFMSRbvAhiLKv6vVkxOlxsplQ6gKNZ56lRnlIUsiJH+FS2+9UoFXOqEYDorWNr0H8/2HuSzPRDzUaobyC8qKn++wbJV2e/HrX1U4e6BeSiOM+zuSBmeUfYMAmmIxuwfQeuM4vFFtOOdsosFkuR3btFvbvf8QQl2UiNXReFdpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652177791; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g1S+Hn2o4cvLAwERtGowJd9aOHh7B44e0wBAyt/5QdY=; b=PgGoQoPNRMWBN8ha8m6s+X5rn4xmDHfUdjW3LZ9Dbl6avhZWflFV5+i2SzCFv+N5ZH5P3Z3FwdJLBJZMi9uFHjEGdM/UG4pts6vLw+2kjUNzsKe0xgmjCIT/JkFEL/nDrSCUNNJLHEwOMlStynBB+lRBJ77vGlBjHw+WtNrOdiI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1652177791195507.6350373418496; Tue, 10 May 2022 03:16:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.325334.547854 (Exim 4.92) (envelope-from ) id 1noMuI-00056K-Hi; Tue, 10 May 2022 10:15:54 +0000 Received: by outflank-mailman (output) from mailman id 325334.547854; Tue, 10 May 2022 10:15:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuI-00056C-EM; Tue, 10 May 2022 10:15:54 +0000 Received: by outflank-mailman (input) for mailman id 325334; Tue, 10 May 2022 10:15:53 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuG-00055w-Ox for xen-devel@lists.xenproject.org; Tue, 10 May 2022 10:15:53 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 29d0fca6-d04a-11ec-8fc4-03012f2f19d4; Tue, 10 May 2022 12:15:50 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 29d0fca6-d04a-11ec-8fc4-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1652177750; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9/53ScNxOaKweIeaPofc3f9ymrzpAqLfKE0Re3kkOsI=; b=VIxZQP+zdIqR6muP76aWIn3qTsYyBdublT7hKHgiFZktfB0vxk/1a/sI g2Gw14URNMnKMScAMEe6AGCj6B89npI/R17eHgQsYCW1prKMCJciHcr3e 4LuBj4Q5lOS2RMypJgnYsBPSTEpwe7y9jfl+5uu5B38TkupAy1iEv1k5R g=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 70977058 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:FTEYOKOMemRM5WnvrR2vl8FynXyQoLVcMsEvi/4bfWQNrUoh0DADz 2BJDWCHP66NM2rxeY11b9/n9xwDuJTTyNJmGwto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdleF+lH1dOKJQUBUjclkfJKlYAL/En03FFYMpBsJ00o5wbZk29Yw27BVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Z+ tJSjJmvSAsSJ/eWuM8jD0hUIyphIvgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbLtqF64YrAEasALKMjteocep1lrzC3DDOZgSpfGK0nPzYAAjWhv3p0edRrYT 5syampBfBPCXzARJFUQJZsXjeiTgnaqJlW0r3rK/PFqsgA/1jdZ0qXpMdfTUsyHQ4NShEnwj n3C13T0BFcdLtP34SGe7numi+vLnCX6cIEfDru18rhtmlL77nweDlgaWEW2pdG9i1WiQJRPJ koM4C0soKMuskuxQbHVXRe1vXqFtR40QMdLHqsx7wTl90bPy1/HXC5eFGcHMYF48p9tLdA36 rOXt+HuGgVqr7yZcmvHrJe/k2/jNRgeMnBXMEfoUjA5y9XkpYgyiDfGQdBiDLO5g7XJJN3g/ 9yZhHNg3utO1Kbnw43+pAma2Gz0+vAlWyZvvm3qsnSZAhSVjWJPT6ih8hDl4PlJN+51pXHR7 SFfy6ByAA3jZKxhdRBhos1QRdlFBN7faVUwZGKD+LF7rlyQF4aLJ9w43d2HDB4B3jw4UTHoe lTPngha+YVeOnCnBYcuPd/rUp5zkviwSYy4PhwxUjapSsIqHDJrAQk0PRLAt4wTuBZEfV4D1 WezLp/3UCdy5VVPxzuqXeYNuYLHNQhlrV4/savTlkz9uZLHPSb9Ye5cbDOmM7FihIvZ8Vq9z jqqH5bTo/mpeLamMne/HE96BQ1iEEXX8ris9ZMNKr7YcloO9aNII6a5/I7NsrdNx8x9/tokN FnkMqOE4DITXUH6FDg= IronPort-HdrOrdr: A9a23:YlRGr6A5DbBvFI7lHemU55DYdb4zR+YMi2TC1yhKJyC9Ffbo8f xG/c5rrSMc5wxwZJhNo7y90ey7MBbhHP1OkO4s1NWZLWrbUQKTRekIh+bfKn/baknDH4ZmpN 5dmsNFaeEYY2IUsS+D2njbL+od X-IronPort-AV: E=Sophos;i="5.91,214,1647316800"; d="scan'208";a="70977058" From: Lin Liu To: CC: Lin Liu , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v3 5/6] byteorder: Remove byteorder Date: Tue, 10 May 2022 06:15:23 -0400 Message-ID: <97e346648d356f621170bcb89fd7d86c120aca70.1652170719.git.lin.liu@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1652177792036100001 Content-Type: text/plain; charset="utf-8" include/xen/byteswap.h has simplify the interface, just clean the old interface No functional change Signed-off-by: Lin Liu Reviewed-by: Andrew Cooper --- Cc: Andrew Cooper Cc: George Dunlap Cc: Jan Beulich Cc: Julien Grall Cc: Stefano Stabellini Cc: Wei Liu --- 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 ---------------------- 4 files changed, 455 deletions(-) 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/xen/byteorder/big_endian.h b/xen/include/xen/byteo= rder/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)(__le6= 4)(x)) -#define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x))) -#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le3= 2)(x)) -#define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x))) -#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le1= 6)(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/byteorde= r/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=20 - * 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/by= teorder/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)(__be6= 4)(x)) -#define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x))) -#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be3= 2)(x)) -#define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x))) -#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be1= 6)(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/s= wab.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 =3D (x); \ - ((__u16)( \ - (((__u16)(__x) & (__u16)0x00ffU) << 8) | \ - (((__u16)(__x) & (__u16)0xff00U) >> 8) )); \ -}) - -#define ___swab32(x) \ -({ \ - __u32 __x =3D (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 =3D (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 =3D (x) ; ___swab16(__tmp); }) -#endif -#ifndef __arch__swab32 -# define __arch__swab32(x) ({ __u32 __tmp =3D (x) ; ___swab32(__tmp); }) -#endif -#ifndef __arch__swab64 -# define __arch__swab64(x) ({ __u64 __tmp =3D (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) =3D __arch__swab16p((x)); } while (= 0) -#endif -#ifndef __arch__swab32s -# define __arch__swab32s(x) do { *(x) =3D __arch__swab32p((x)); } while (= 0) -#endif -#ifndef __arch__swab64s -# define __arch__swab64s(x) do { *(x) =3D __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 =3D x >> 32; - __u32 l =3D 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__ */ --=20 2.27.0 From nobody Thu May 2 02:33:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1652177788; cv=none; d=zohomail.com; s=zohoarc; b=XHZg1Kk8Nr+S8Mv0bJoU4q/6fLkz5i3qpUduYFWNB2VxnSBdQKX5OQVXnyw3Nj6Em9Ky7vIC17o9XieEkbGc47F6Z0wScp1ElJCh475UduT/a7ziBcH8KZ7Ynd4TOIA/7no2ptkKpTiMSUKtK4i0X8ssGIzFf1cYg29wJ2AWG6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652177788; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ek+S8cKNCYAwayAYoEAtKCYN95ZbSII2fT/2sxYBrhA=; b=VJE4992Gd88MAzJWtjxoleWZ6xQ7B7PLFnixOc+FVCsfFtm+nDNVr8l5EAHohud1UN8OCvLo71R+oyhTwuWHVWu7NAdw3OdQHGSD47jnhlZuXPasIdjA0N7x0VEOaXnwf0uix65e2dm5JUjVyxoKyDUpycahC8GSk72hpxlF9w8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1652177788542649.0940504214567; Tue, 10 May 2022 03:16:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.325336.547868 (Exim 4.92) (envelope-from ) id 1noMuJ-0005KU-Ex; Tue, 10 May 2022 10:15:55 +0000 Received: by outflank-mailman (output) from mailman id 325336.547868; Tue, 10 May 2022 10:15:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuJ-0005Iy-6v; Tue, 10 May 2022 10:15:55 +0000 Received: by outflank-mailman (input) for mailman id 325336; Tue, 10 May 2022 10:15:54 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1noMuI-000561-9M for xen-devel@lists.xenproject.org; Tue, 10 May 2022 10:15:54 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2c2a401e-d04a-11ec-a406-831a346695d4; Tue, 10 May 2022 12:15:53 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 2c2a401e-d04a-11ec-a406-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1652177753; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vAwEG8ep7queso8cVxSz5fAnFQyJV9WnYmQA5HibJZQ=; b=gqC1vIksuqG7vDX2TFXtryrua+qX9mYL2qQFyS9HhyZW1G8ZHx0KoOZE 4AjuGs8QsC+1Rfe8zDuFaBrU4UT5NEHWaqnKXPBGRqCp2snc/ZXQid5pD HbCLJpJbKI8qLBLbFPFSg7FtRWOSOnHE4SuZDU1gVbezkO8nK6qGpzYcj 0=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 70954410 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:97wGWqkTf3tYqL35HcatMPHo5gzhJkRdPkR7XQ2eYbSJt1+Wr1Gzt xIdXDiAafaJMGLwLo8nad61oUIPvpWHyNRqHVNtqHpgQyMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BCpC48T8kk/vgqoPUUIYoAAgoLeNfYHpn2EsLd9IR2NYy24DkWlvV4 7senuWEULOb828sWo4rw/rrRCNH5JwebxtB4zTSzdgS1LPvvyF94KA3fMldHFOhKmVgJcaoR v6r8V2M1jixEyHBqD+Suu2TnkUiGtY+NOUV45Zcc/DKbhNq/kTe3kunXRa1hIg+ZzihxrhMJ NtxWZOYYhp1EKGQm/Ukb0d7HAclOZ1KpeHLCC3q2SCT5xWun3rExvxvCAc9PJEC+/YxCmZLn RAaAGlTNFbZ3bvwme/lDLk37iggBJCD0Ic3vnBmizXYEN4tQIzZQrWM7thdtNs1rp8WTKuCO 5NBAdZpRBDPRyxxCl4RNKkvsuiNgnX1IgF68XvA8MLb5ECMlVcsgdABKuH9eNOQQt5Otl2Fv W+A9GP8ajkFMPSPxDzD9Wij7sffkCW+VI8MGbmQ8v9xnEbV1mEVEAcRV1awvb++kEHWZj5EA xVKoGx09/F0rRH1CImmN/GlnJKaljUBB/RcT+4r0T3T6aXyuAKpCjVaQhcUPbTKq/QKbTAt0 1aImfbgCjpurKCZRBqhy1uEkd+hEXNLdDFfPEfoWSNAuoC++99r0nojW/45SMaIYsvJ9SYcK txghAw3nP0tgMECzM1XFniX0mv39vAlouPYjzg7v15JDCskPeZJhKTysDA3CMqsy67DFzG8U IAswZT20Qz3JcjleNaxaOsMBqq1wP2OLSfRh1Vid7F4qWn3oiT6ItAAvGkjTKuMDirjUWWyC HI/RCsLvMMDVJdURfEfj32N5zQCkvG7SIWNugH8ZdtSeJlhHDJrDwk1DXN8K1vFyRB2+YlmY M/zWZ/1UR4yVPU8pBLrFrh17FPe7n1nrY8lbcujn0rPPHv3TCP9dIrpx3PUML9jsPPf8FW9H hQ2H5Li9iizmdbWOkH/mbP/53hQRZTnLfgac/BqS9M= IronPort-HdrOrdr: A9a23:7Iquia4cpNTL9TfGrAPXwPDXdLJyesId70hD6qhwISY6TiX+rb HJoB17726NtN9/YhEdcLy7VJVoBEmskKKdgrNhWotKPjOW21dARbsKheCJrgEIWReOktK1vZ 0QCpSWY+eQMbEVt6nHCXGDYrQd/OU= X-IronPort-AV: E=Sophos;i="5.91,214,1647316800"; d="scan'208";a="70954410" From: Lin Liu To: CC: Lin Liu , Wei Liu , Anthony PERARD , Juergen Gross Subject: [PATCH v3 6/6] tools: Remove unnecessary header Date: Tue, 10 May 2022 06:15:24 -0400 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1652177789950100009 Content-Type: text/plain; charset="utf-8" xen/byteorder/little_endian.h is included but not used, Remove it. No functional change. Signed-off-by: Lin Liu --- Cc: Wei Liu Cc: Anthony PERARD Cc: Juergen Gross --- tools/libs/guest/xg_dom_decompress_unsafe_zstd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c b/tools/libs/= guest/xg_dom_decompress_unsafe_zstd.c index 01eafaaaa6..47e071574d 100644 --- a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c +++ b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c @@ -31,7 +31,6 @@ typedef uint64_t __be64; =20 #define __BYTEORDER_HAS_U64__ #define __TYPES_H__ /* xen/types.h guard */ -#include "../../xen/include/xen/byteorder/little_endian.h" #define __ASM_UNALIGNED_H__ /* asm/unaligned.h guard */ #include "../../xen/include/xen/unaligned.h" #include "../../xen/include/xen/xxhash.h" --=20 2.27.0