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

Re: [PATCH v4 1/6] xen: implement byteswap


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Lin Liu <lin.liu@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 23 May 2022 13:00:02 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=aQKzw+5fuPAhnUSaQnwi4psZFPcsGoT6Os08Bnau7og=; b=a7a3LQE9WHRDv3/B+atonFuDmjqFA92EUTonFZzNnCTcCwiF6Nl6jTb0dGX9XTM3wh6Pws144Wt3myH4J7/w4AGUJIvUttVxPJmxtevPHr+xCfkEEiCBvkiLHML4vryDnrfYJzNbAcqq/IkNpJL4HrfEIMK4SHZRp4hI/IRbN6tX7LjYuqzAcQfoGmGTNdbPvaiy/zjPy/juXcBSTti7StqYaKhcYhg4YEwR4N3kQ73+CWWuXDw3WjJ5t5gBsAzYSIxCHhGpjRMiLtE2OxrAihf2Ittvhu8YuTNYGDI+Iq0MRtoMY+R0GlqokBw7HW1yqAzvBAjmLFueuwVyPLibtg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lgDR1PhN+JvD/MfNdMhuHT9HmfWV6Pk3y4nMc2ZBGgRK1vPRA/PUftHjYYbOkOyuLCuc3P80njMPjOpYHOdOrlm95b70yqZ9bhK3YoBTKijZri5zPeyLmLUgG3SsMsBJXHJpux6QHiZuOYXbaMEjgGwAp7iaNf4qVgGbpOQsY80YkWwKj+aykpBKSHjQzTg9QfZCh93VX6iUvvFlSd27bZt9XAARjwz3zGrcM/8uGdxnPb0zdNWYpd9cqWii/5mgnvNE/RGtgva6OD7gfCqJsTVY9UFLBiB5kWfrWueetmSd/49UUfxAzK4DHws1CNDFtLKSCaXbPBoJ2V4YUUdkfg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.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>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 23 May 2022 11:00:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23.05.2022 12:07, Roger Pau Monné wrote:
> 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.

+1

> 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.

These need to live in per-arch headers, i.e. asm/byteorder.h.

Jan




 


Rackspace

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