[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 6/7] xen: Switch to byteswap.h


  • To: Lin Liu <lin.liu@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 22 Oct 2021 12:25:52 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jtw8hog5odKGwwLZXc8eLTsw5rnuoGxyp3I0UIwMhwI=; b=fGzSham7QhFjuFmijHKzC8slVckMTIGMRqLskjQgTL2FUm0mkTiasrtohPsUIikIE1yEKEl1o84EnxaUO+jK7kijgtXSAbD/b17CAoirTN23ft9Nq+5qs1fcLnLzLNlKkGS/9PGXZiPAxgBZj2PK9Qh8lXQysgYQk8GnvqJnfjO+XH6cOFjaYjXR5iBaNkAlFTyYmOYKeEIK6Xm/fMLikYTYoY6/rkywtJgd5s6KjmwCEkbbxaINZ72hpa2HrU217EHNz7QAN1GynheHbdPUoqE1ISbb4kBNcZ/k1d5P/pDDO+D/RL0Kdyiopf71ztq85LnrdnW9MP7DuJUutu8Wuw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SFFGfUzVVNhSplFmtHsomSoR6yiOSCDinn5mZ6n2uBQWFIADi3WsioMp7ZD3Dnc7PxuUogrZfC8JZ2X7tmr9MGNaH7wVUENZNlbxPg/4BEHANB+zSJj55gMoZzg/JRkwpRVrSZ9E/5FqmcW0F3Jc4e5ltyQA+PXBNwJen3byEprpt9a2ZKj5sL60BLSRJLbJ0gQVGz8UXauosGhKXteAnauWZQcaJo97ZGwr/XGq5bYsb8R+kziPfJHLZFXPKQvXLBBmSJ6t+tDbt/s30G7GHWZ2AMGTliMQZhj4CVeZbGdOWy9/1ipLid/Li9xEhYOwduHRb+nG5mhcmmXL3L6n9A==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 22 Oct 2021 11:26:27 +0000
  • Ironport-data: A9a23:0l0I7Klc4lvZhidZVkN/C1/o5gwbIURdPkR7XQ2eYbSJt1+Wr1Gzt xIaWGqEbvqKMWL1L9gkbty38RkHscfWn9BnSwBqpH9hRCMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BClVlxJVF/fngqoDUUYYoAQgsA187IMsdoUg7wbdg2tQy2YLR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 ItdsZbsezwkAoP3t8gTYiZ5CAp5NrITrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ignBODtMJkSpTdLyjbBAOx9aZvCX7/L9ZlT2zJYasVmQKmBP JdANWoHgBLoRRFOO0k0B4MFvOaYuUnkS2129WLPqv9ii4TU5FMoi+W8WDbPQfSIT8hImkeTp krd4n/0RBodMbS3yCWH2mKhgPfVmiH2U55UE6e3ntZ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BQhMhWtR1HpLPYy49lRjYRaicL4SBs
  • Ironport-hdrordr: A9a23:B+dYxaMTcWctBcBcT1H155DYdb4zR+YMi2TDiHofdfUFSKClfp 6V8cjztSWUtN4QMEtQ/exoS5PwPk80kqQFnbX5XI3SITUO3VHHEGgM1/qb/9SNIVyZygcZ79 YbT0EcMqyBMbEZt7eC3ODQKb9Jq7PmgcPY9ts2jU0dKj2CA5sQnjuRYTzrcHGeKjM2YKbRWK Dsnfau8FGbCAoqh4mAdzQ4dtmGg+eOuIPtYBYACRJiwA6SjQmw4Lq/NxSDxB8RXx5G3L9nqA H+4kPEz5Tml8v+5g7X1mfV4ZgTsNz9yuFbDMjJrsQOMD3jhiuheYwkcbyfuzIepv2p9T8R4Z XxiiZlG/42x2Laf2mzrxeo8w780Aw243un8lOciWuLm72weBsKT+56wa5JeBrQ7EQt+Ptm1r hQ4m6fv51LSTvdgSXU/bHzJlFXv3vxhUBnvf8YjnRZX4dbQqRWt5Yj8ERcF4pFND7m6bogDP JlAKjnlbdrmGuhHjLkV1RUsZmRtixZJGbDfqFCgL3a79FupgE786NCr/Zv2Uvp9/oGOtB5Dq r/Q+JVfYp1P7orhJRGdZE8qPuMex7wqC33QRavyHTcZeo60iH22tTKCItc3pDcRHVP9upqpK j8
  • Ironport-sdr: DW9A3j3vcSOHlS8ptH3kp97QhuS52lX3yuuxgzsXRm4/HtnBEv7g3AtG/oLmENFIBhw9QM04pQ ymT9PRXb/SVrMiGRoDUJhHjiuwcb4RKNLDEPl1hz0Os+E8YhW3gxhPG30WoWJxDp3pF7wxJcQp Gr8FKW51SC8mcNRvYejvQ+1Z/u1faKT9q6O1cUAPEFVKCdi9Z1GdjLI4CVhcle0xC3ZlKP5/84 qM1vfjGFW44gc9WD1/3W8UdWdCgrZ1voPIxcwyLtztrOJvF1F9KZ9glZcaqouQvZr5dB2SBzry yZzDGhyAvJQHW0mcCJNT+oFo
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22/10/2021 11:47, Lin Liu wrote:
> Update to use byteswap.h to swap bytes.
>
> No functional chagne.
>
> Signed-off-by: Lin Liu <lin.liu@xxxxxxxxxx>
> ---
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: George Dunlap <george.dunlap@xxxxxxxxxx>
> Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Julien Grall <julien@xxxxxxx>
> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Cc: Wei Liu <wl@xxxxxxx>
> Cc: "Roger Pau Monné" <roger.pau@xxxxxxxxxx>
> ---
>  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 <xen/errno.h>
>  #include <xen/bitmap.h>
>  #include <xen/bitops.h>
> +#include <xen/byteswap.h>
>  #include <xen/cpumask.h>
>  #include <xen/guest_access.h>
>  #include <xen/lib.h>
> -#include <asm/byteorder.h>
>  
>  /*
>   * 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 <xen/byteswap.h>
>  #include <xen/lib.h>
>  #include <xen/spinlock.h>
>  #include <xen/serial.h>
> @@ -45,7 +46,6 @@
>  #include <xen/console.h>
>  #include <xen/errno.h>
>  #include <xen/delay.h>
> -#include <asm/byteorder.h>
>  
>  /* 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 <xen/byteswap.h>
>  #include <xen/lib.h>
>  #include <xen/libelf.h>
>  #include <xen/softirq.h>
> -#include <asm/byteorder.h>
>  #include <public/elfnote.h>
>  
>  /* 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 <asm/byteorder.h>
> +#include <xen/byteswap.h>
>  #include <asm/unaligned.h>
>  #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 <xen/lib.h>
> -#include <asm/byteorder.h>
> +#include <xen/byteswap.h>
>  #include <asm/unaligned.h>
>  #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 <xen/lzo.h>
>  
>  #ifdef __XEN__
> -#include <asm/byteorder.h>
> +#include <xen/byteswap.h>
>  #include <asm/unaligned.h>
>  #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 <xen/kernel.h>
> -#include <asm/byteorder.h>
> +#include <xen/byteswap.h>
>  #include <asm/unaligned.h>
>  #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 <xen/byteswap.h>
>  #include <xen/console.h>
>  #include <xen/delay.h>
>  #include <xen/errno.h>
>  #include <xen/param.h>
>  #include <xen/pci.h>
>  #include <xen/serial.h>
> -#include <asm/byteorder.h>
>  #include <asm/io.h>
>  #include <asm/fixmap.h>
>  #include <public/physdev.h>
> 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 <xen/byteswap.h>
>  #include <xen/cpumask.h>
>  #include <xen/pci.h>
> -#include <asm/byteorder.h>
>  #include <asm/hvm/vmx/vmcs.h>
>  
>  /*
> 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 <asm/byteorder.h>
> +#include <xen/byteswap.h>
>  
>  #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 <asm/byteorder.h>
>  #include <asm/device.h>
>  #include <public/xen.h>
>  #include <public/device_tree_defs.h>
> +#include <xen/byteswap.h>
>  #include <xen/kernel.h>
>  #include <xen/string.h>
>  #include <xen/types.h>
> 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 <xen/byteswap.h>
>  #include <xen/types.h>
> -#include <asm/byteorder.h>
>  #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);

Hmm - this missed one of my pieces of internal feedback.

*(const uint16_t *)p

to get correct style and avoid casting away const.

Also, the put functions what to drop the __force and use typecasting
like this.

I can fix up on commit if there are no other concerns with the series.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.