[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 1/6] xen: implement byteswap
- To: Lin Liu <lin.liu@xxxxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Mon, 23 May 2022 12:07:02 +0200
- 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=26E/DV1roI2sAcBvSS0wmnSdKy704aSFtfjk3zOs2Ms=; b=ZStdpMKPAS+/mBxO+lHXPKYE//1msPbS1FKIb3rc44pJb3jBxViN/an3knV1BldkMtR8OY4ZCBLnLjZAEsB96mBn43zH3UJfO48+yIVv+fVyRby1+iyTvIXkVSQ1IA5vBeTpDTvGvvKWmvTQKqaP3iwC+YCY14TZQfvEcYeo32IXXxBPzXnhJMqBmZd+A5d+/ty4h8KcROEvJ9KU/vMYHDDeud1+whurufSPr7Qq7U4nv8NqBE+a8Kpx2lH7oCetZBHhHL8auIdOQc+EepVHaMkMVIx6hU9pvaDO9xyuqeTorvCJ5HW+CmLku+uwCN587PA30Qmpo7OIfFAZgiK4ig==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E/v7u2ANbge2TsrpE/qhQvwSAWRhSTZkEgrxGQOISq+hbUUOOGhua+N/pmFHKhr9RcfK7b+x+gr3NtuyjPqMPob5HxdwGGCwcZiIwRdVagHusWkPDB+blsiztN/14QFrDJ/c7PbaumYY0bN5nyU1UbXgA9tHOQ3luDbS3MDK+noyKxjcWdsNoIk/y2h3F3g4WKq0HAj/IYbtjnsJnvB+rbhWMxE++H05PhSv7pM6SYUzFtmtU4YpyFEVA5xgwb9wmf7eqheX5/ShQRq7yADHk05VxuP3kZDtrQF7EBGQqqovfjV6C9aWjg6NJPXTzTU+nfiXVJTk+M6ke1GkYw3nGw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Mon, 23 May 2022 10:07:16 +0000
- Ironport-data: A9a23:OTQ33qBON9cGARVW/+Piw5YqxClBgxIJ4kV8jS/XYbTApD1w1DAFz mZOWmvVa6nbZ2X8edlza4y18xsDvMfUm9c2QQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMZiaA4E/raNANlFEkvU2ybuOU5NXsZ2YgHGeIdA970Ug5w7Nj2dYx6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhPy /VCtYyraD13faqVyeQ2YUkGPHBHaPguFL/veRBTsOS15mifKz7A5qsrC0s7e4oF5uxwHGdCs +QCLywAZQyCgOTwx6+nTu5rhYIoK8yD0IE34yk8i22GS6t2B8mbHM0m5vcBtNs0rtpJEvvEI dIQdBJkbQjaYg0JMVASYH47tLjx1yOhImEIwL6TjfQU+lWP3CZz6aLKCfzUdPKJS913x1nN8 woq+Ey8WHn2Lue32TeDt36hmOLLtSf6Q54JUq218OZwh1+ezXBVDwcZPXOguuWwgEO6X9NZK mQX9zAooKx081akJvH/Qhm5rXisrhMaHd1KHIUS4gyX1rDd5QrfA2EeVyNAc/QvrspwTjsvv ne3mNfuCS1qoaeiY3uX/beJrhu/ISEQa2QFYEcsTwEI/t3iq4EblQ/UQ5BoF6vdpsLxMSH9x XaNtidWulkIpcsC1qH+8VWZhTup/8DNVlRsvlqRWX+55ARkYoLjf5av9VXQ8fdHKsCeU0WFu 38H3cOZ6YjiEK2wqcBEe81VdJnB2hpPGGe0bYJHd3X5ywmQxg==
- Ironport-hdrordr: A9a23:IKs4c63rAxr9nF6klEAwFgqjBS5yeYIsimQD101hICG9Lfb0qy n+pp4mPEHP4wr5OEtOpTlPAtjkfZr5z+8M3WBxB8baYOCCggeVxe5ZjbcKrweQeBEWs9Qtrp uIEJIOdOEYb2IK6voSiTPQe7hA/DDEytHPuQ639QYRcegAUdAF0+4WMHf4LqUgLzM2f6bRWa DskPZvln6FQzA6f867Dn4KU6zqoMDKrovvZVojCwQ84AeDoDu04PqieiLolis2Yndq+/MP4G LFmwv26uGKtOy68AbV0yv2445NkNXs59NfDIini9QTKB/rlgG0Db4REoGqjXQQmqWC+VwqmN 7Dr1MJONly0WrYeiWPrR7ky2DboUMTwk6n7WXdrWrooMT/Sj5/IdFGn5hlfhzQ7FdllM1g0Y pQtljp+6Z/PFflpmDQ9tLIXxZlmg6funw5i9MeiHRZTM83dKJRl4oC50lYea1wUR4S0LpXXt WGMfuspcq/KTihHjDkVyhUsZaRt00Ib1i7qhNogL3X79BU9EoJvXfwivZv3Evoz6hNNaWs19 60TZiAq4s+P/P+TZgNcNvpEvHHfVAkf3r3QRKvCGWiMp07EFTwjLOyyIkJxYiRCe81Jd0J6d /8bG8=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Mon, May 23, 2022 at 05:52:17AM -0400, Lin Liu wrote:
> diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
> index 933aec09a9..ae029afa14 100644
> --- a/xen/include/xen/compiler.h
> +++ b/xen/include/xen/compiler.h
> @@ -185,4 +185,28 @@
> # define CLANG_DISABLE_WARN_GCC_COMPAT_END
> #endif
>
> +#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 >= 40800)
> +#define GCC_has__builtin_bswap32 (CONFIG_GCC_VERSION >= 40400)
> +#define GCC_has__builtin_bswap64 (CONFIG_GCC_VERSION >= 40400)
> +#endif
> +
> +#ifndef __ORDER_LITTLE_ENDIAN__
> +# define __ORDER_LITTLE_ENDIAN__ 1234
> +#endif
> +
> +#ifndef __ORDER_BIG_ENDIAN__
> +# define __ORDER_BIG_ENDIAN__ 4321
> +#endif
> +
> +/* Indirect macros required for expanded argument pasting. */
> +#define PASTE_(a, b) a ## b
> +#define PASTE(a, b) PASTE_(a, b)
I think it would be better if byteswap.h included lib.h, rather than
moving the PASTE define into compiler.h.
Likewise the __ORDER_{BIG,LITTLE}_ENDIAN__ defines would be better
placed in byteswap.h itself if possible IMO, since it's not strictly
related to the compiler.
Thanks, Roger.
|