From patchwork Wed Oct 9 09:21:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13827972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9A85FCED63F for ; Wed, 9 Oct 2024 09:22:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.814022.1227095 (Exim 4.92) (envelope-from ) id 1syStG-0004Ip-Nt; Wed, 09 Oct 2024 09:21:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 814022.1227095; Wed, 09 Oct 2024 09:21: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 1syStG-0004Ii-KG; Wed, 09 Oct 2024 09:21:54 +0000 Received: by outflank-mailman (input) for mailman id 814022; Wed, 09 Oct 2024 09:21: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 1syStF-0004IZ-1d for xen-devel@lists.xenproject.org; Wed, 09 Oct 2024 09:21:53 +0000 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [2a00:1450:4864:20::52f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id eae4b11b-861f-11ef-a0bd-8be0dac302b0; Wed, 09 Oct 2024 11:21:51 +0200 (CEST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5c90333aaf1so1573264a12.0 for ; Wed, 09 Oct 2024 02:21:51 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8e05c13d2sm5254411a12.58.2024.10.09.02.21.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2024 02:21:50 -0700 (PDT) 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: eae4b11b-861f-11ef-a0bd-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1728465711; x=1729070511; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=SwJiQ5LRjRsB466O+oDjAIYFHy+oGvNSb3+tByj4BgU=; b=RaS2y0R1sU4c64svLQxjqDujQgdzxj8zge1BMfJet/l+tD6ipFfVjkll3mmxejzH9H JVqo2ywQQUaiGrmgJW8qr8mdwgau9S/XqsKSZ2dGAIoZ7ThcmxEsYkK6oejlixr/rMU/ Agan4HOzvJmEKrqq0lm9a6/yToOcTZ10xPVgYw1LUsAfITiPe9sYSau3/lNcwdcJuhk5 NiYOpV4aMAscadkxnHSRg50X2maM8G9klr3sAe7ev9X6x+CINVeT+QZ9TkiA3WGkBxMe Q3WWTbacdWfCPN6P4UgVFjIXMCEGLGakkcYdMYFDgcFtdWIgMUEfs/uQLQDoKrVIbYY9 5vJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728465711; x=1729070511; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SwJiQ5LRjRsB466O+oDjAIYFHy+oGvNSb3+tByj4BgU=; b=wf9+nWR3sfQt7kk8FtyA4joi7maI6nwya4nwO/t4iI8LZwVqGd5n8TzHrW3s6tgihi 1OSLy4JTrQZqk/8wpqoAmX48qkY0xus60t9kJkrO77tP9keI2xVK5R3Xh2GJcUKAOgJJ X/+ty4YaZPiIv4RT3XDFfiucOoNDv5EqKi6y0eN2ISsEp6btri7PboStn2KZ6ayb/zOr nfyoDgyI6cf/euNdaN6/XrLoN2P9xfuMIrrHYO2COYiZE6y4zD9XBIqHpgeKURYP4pp8 C4FnIcFiQi4pvgtEeVsnTW8Zo544ECYrz6OqtaZb7QhTSAkkOuNf9shNtPUY68u/xUul 8CQA== X-Gm-Message-State: AOJu0Yy79kOM5KRi0ss1XbRIX23celS61O0Qm4F/5TXigqtl7pd1znpB nCBYWm6CDSeAxxVHRRRxCphD1WRXrxoMWnDsvR/8ejeKQt98+5GrHzaCecf085R/gT5Slk3V+Z8 = X-Google-Smtp-Source: AGHT+IEFHgyD+96nHThn9bhtlHZFpzeg925t7VqO8Uu/o1tgfwGnnC4RJhMOZYDVngN7O+qp8oAdAA== X-Received: by 2002:a05:6402:5248:b0:5c8:9553:a1fb with SMTP id 4fb4d7f45d1cf-5c91d551f57mr1769075a12.9.1728465710920; Wed, 09 Oct 2024 02:21:50 -0700 (PDT) Message-ID: Date: Wed, 9 Oct 2024 11:21:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/7] byteorder: replace __u16 From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Julien Grall , Stefano Stabellini References: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway. In swab.h the casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab16()'s local variable is renamed, and __arch__swab16()'s is dropped as being redundant with ___swab16()'s. With that no uses of the type remain, so it moves to linux-compat.h. Signed-off-by: Jan Beulich --- I'm unconvinced of the need of the separate ___constant_swab16(). I'm also unconvinced of the need for said constants (that even had casts on them). --- a/xen/include/xen/byteorder/big_endian.h +++ b/xen/include/xen/byteorder/big_endian.h @@ -16,25 +16,25 @@ #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x))) #define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x))) -#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x)) +#define __constant_le16_to_cpu(x) ___constant_swab16((__force uint16_t)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x)) #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x)) #define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x)) -#define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x)) -#define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x)) +#define __constant_cpu_to_be16(x) ((__force __be16)(uint16_t)(x)) +#define __constant_be16_to_cpu(x) ((__force uint16_t)(__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 __le16_to_cpu(x) __swab16((__force uint16_t)(__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)) +#define __cpu_to_be16(x) ((__force __be16)(uint16_t)(x)) +#define __be16_to_cpu(x) ((__force uint16_t)(__be16)(x)) static inline __le64 __cpu_to_le64p(const __u64 *p) { @@ -52,13 +52,13 @@ static inline __u32 __le32_to_cpup(const { return __swab32p((__u32 *)p); } -static inline __le16 __cpu_to_le16p(const __u16 *p) +static inline __le16 __cpu_to_le16p(const uint16_t *p) { return (__force __le16)__swab16p(p); } -static inline __u16 __le16_to_cpup(const __le16 *p) +static inline uint16_t __le16_to_cpup(const __le16 *p) { - return __swab16p((__u16 *)p); + return __swab16p((const uint16_t *)p); } static inline __be64 __cpu_to_be64p(const __u64 *p) { @@ -76,13 +76,13 @@ static inline __u32 __be32_to_cpup(const { return (__force __u32)*p; } -static inline __be16 __cpu_to_be16p(const __u16 *p) +static inline __be16 __cpu_to_be16p(const uint16_t *p) { return (__force __be16)*p; } -static inline __u16 __be16_to_cpup(const __be16 *p) +static inline uint16_t __be16_to_cpup(const __be16 *p) { - return (__force __u16)*p; + return (__force uint16_t)*p; } #define __cpu_to_le64s(x) __swab64s((x)) #define __le64_to_cpus(x) __swab64s((x)) --- a/xen/include/xen/byteorder/little_endian.h +++ b/xen/include/xen/byteorder/little_endian.h @@ -15,26 +15,26 @@ #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_le16(x) ((__force __le16)(uint16_t)(x)) +#define __constant_le16_to_cpu(x) ((__force uint16_t)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x))) #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x))) #define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x))) -#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x)) +#define __constant_be16_to_cpu(x) ___constant_swab16((__force uint16_t)(__be16)(x)) #define __cpu_to_le64(x) ((__force __le64)(__u64)(x)) #define __le64_to_cpu(x) ((__force __u64)(__le64)(x)) #define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) -#define __cpu_to_le16(x) ((__force __le16)(__u16)(x)) -#define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) +#define __cpu_to_le16(x) ((__force __le16)(uint16_t)(x)) +#define __le16_to_cpu(x) ((__force uint16_t)(__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)) +#define __be16_to_cpu(x) __swab16((__force uint16_t)(__be16)(x)) static inline __le64 __cpu_to_le64p(const __u64 *p) { @@ -52,13 +52,13 @@ static inline __u32 __le32_to_cpup(const { return (__force __u32)*p; } -static inline __le16 __cpu_to_le16p(const __u16 *p) +static inline __le16 __cpu_to_le16p(const uint16_t *p) { return (__force __le16)*p; } -static inline __u16 __le16_to_cpup(const __le16 *p) +static inline uint16_t __le16_to_cpup(const __le16 *p) { - return (__force __u16)*p; + return (__force uint16_t)*p; } static inline __be64 __cpu_to_be64p(const __u64 *p) { @@ -76,13 +76,13 @@ static inline __u32 __be32_to_cpup(const { return __swab32p((__u32 *)p); } -static inline __be16 __cpu_to_be16p(const __u16 *p) +static inline __be16 __cpu_to_be16p(const uint16_t *p) { return (__force __be16)__swab16p(p); } -static inline __u16 __be16_to_cpup(const __be16 *p) +static inline uint16_t __be16_to_cpup(const __be16 *p) { - return __swab16p((__u16 *)p); + return __swab16p((const uint16_t *)p); } #define __cpu_to_le64s(x) do {} while (0) #define __le64_to_cpus(x) do {} while (0) --- a/xen/include/xen/byteorder/swab.h +++ b/xen/include/xen/byteorder/swab.h @@ -10,15 +10,16 @@ * 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. +/* + * Casts are necessary for constants, because we never know for sure how + * U/UL/ULL map to __u32, __u64. At least not in a portable way. */ #define ___swab16(x) \ ({ \ - __u16 __x = (x); \ - ((__u16)( \ - (((__u16)(__x) & (__u16)0x00ffU) << 8) | \ - (((__u16)(__x) & (__u16)0xff00U) >> 8) )); \ + uint16_t x_ = (x); \ + (uint16_t)( \ + (((uint16_t)(x_) & 0x00ffU) << 8) | \ + (((uint16_t)(x_) & 0xff00U) >> 8)); \ }) #define ___swab32(x) \ @@ -46,9 +47,9 @@ }) #define ___constant_swab16(x) \ - ((__u16)( \ - (((__u16)(x) & (__u16)0x00ffU) << 8) | \ - (((__u16)(x) & (__u16)0xff00U) >> 8) )) + ((uint16_t)( \ + (((uint16_t)(x) & 0x00ffU) << 8) | \ + (((uint16_t)(x) & 0xff00U) >> 8))) #define ___constant_swab32(x) \ ((__u32)( \ (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ @@ -70,7 +71,7 @@ * provide defaults when no architecture-specific optimization is detected */ #ifndef __arch__swab16 -# define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); }) +# define __arch__swab16(x) ___swab16(x) #endif #ifndef __arch__swab32 # define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); }) @@ -105,7 +106,7 @@ */ #if defined(__GNUC__) && defined(__OPTIMIZE__) # define __swab16(x) \ -(__builtin_constant_p((__u16)(x)) ? \ +(__builtin_constant_p((uint16_t)(x)) ? \ ___swab16((x)) : \ __fswab16((x))) # define __swab32(x) \ @@ -123,15 +124,15 @@ #endif /* OPTIMIZE */ -static inline attr_const __u16 __fswab16(__u16 x) +static inline attr_const uint16_t __fswab16(uint16_t x) { return __arch__swab16(x); } -static inline __u16 __swab16p(const __u16 *x) +static inline uint16_t __swab16p(const uint16_t *x) { return __arch__swab16p(x); } -static inline void __swab16s(__u16 *addr) +static inline void __swab16s(uint16_t *addr) { __arch__swab16s(addr); } --- a/xen/include/xen/linux-compat.h +++ b/xen/include/xen/linux-compat.h @@ -14,6 +14,7 @@ typedef int8_t s8, __s8; typedef uint8_t __u8; typedef int16_t s16, __s16; +typedef uint16_t __u16; typedef int32_t s32, __s32; typedef int64_t s64, __s64; --- a/xen/include/xen/types.h +++ b/xen/include/xen/types.h @@ -6,7 +6,7 @@ /* Linux inherited types which are being phased out */ typedef uint8_t u8; -typedef uint16_t u16, __u16; +typedef uint16_t u16; typedef uint32_t u32, __u32; typedef uint64_t u64, __u64; @@ -51,8 +51,8 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; #define LONG_MIN (-LONG_MAX - 1) #define ULONG_MAX (~0UL) -typedef __u16 __le16; -typedef __u16 __be16; +typedef uint16_t __le16; +typedef uint16_t __be16; typedef __u32 __le32; typedef __u32 __be32; typedef __u64 __le64; From patchwork Wed Oct 9 09:22:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13827973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A882CCED63E for ; Wed, 9 Oct 2024 09:22:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.814025.1227105 (Exim 4.92) (envelope-from ) id 1syStZ-0004ja-Vj; Wed, 09 Oct 2024 09:22:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 814025.1227105; Wed, 09 Oct 2024 09:22:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1syStZ-0004jS-Sa; Wed, 09 Oct 2024 09:22:13 +0000 Received: by outflank-mailman (input) for mailman id 814025; Wed, 09 Oct 2024 09:22:13 +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 1syStZ-0004i5-0m for xen-devel@lists.xenproject.org; Wed, 09 Oct 2024 09:22:13 +0000 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [2a00:1450:4864:20::62a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f6768ff0-861f-11ef-99a2-01e77a169b0f; Wed, 09 Oct 2024 11:22:11 +0200 (CEST) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a7aa086b077so764049466b.0 for ; Wed, 09 Oct 2024 02:22:11 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9944d35ae0sm516341966b.179.2024.10.09.02.22.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2024 02:22:10 -0700 (PDT) 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: f6768ff0-861f-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1728465730; x=1729070530; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=V8c2SNQ211TOqrrm1XFnwxCRfjvpxqWFiyYI1q9RatQ=; b=FLCL+zCS9rgtbiEcrw6aT7R+1c8za3nVuMGVvyRHBm+NPtDUJjdN8FF+qRro5QqJvm OpeKVeKRsKmHivEJF2xF6pE3FtmlOTC0J2NMkNq3sZ3KLpOTEAMSN8xE0ccc3h62U0ww z7H6DWr5MhmFzgSD5GN9hB8LDmD/7A+WT93nWbixviGL4C5N4PWJmkPUQAZKNgMg15GP Of64NUs4lsIDn6jafacBTytJMJyQiYbJInvCNYeJShsiskVC2NBiSbXiAehrrLLiQUw8 96KvsDlvGrbwymkUUNKcPetU59jmCoqN9nW5CbbQqNAJrXRPK+pqYzB5cG5I+u4n/H7Y kPOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728465730; x=1729070530; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V8c2SNQ211TOqrrm1XFnwxCRfjvpxqWFiyYI1q9RatQ=; b=WytvuwgTUAu4bu/y5m3WXSJYAIKRvMTjjOPnO8V2iHNXbk5NYjnT2DAKv16pO8ku82 s37IIU1kLYmdPTgVWuHGdkI+LtW4/08uye/jVB3xoPrSFzjXM5FCMOr/ud/raRAwZaK2 yGyqypCauuW7faIpD4iTJRUdViwZf2S0cTpjWPgXIEJcTVheYkbIBX2trDVkF2nZVpoI 2GSEnscraIgf1MEuS5qJtYkL0DArbPwhYtO9s6kKD5+uxR+VViYpScy2xBpDR0Nypb5a kQteNZPvcN8F8cio+XUOm1XNS3CgQ9zsLjpt8pM2hOvRMniZXMFLYT/7xF3/IXS0tBJv d7mQ== X-Gm-Message-State: AOJu0YwHErNLbAldJyOOASA3cIzs6KOFJumnaFbyN5G5V0XqZAoP6vFq fnqJ7evfzrFXoDxQEAEpvJIfPGCdXxnYE6pCwDOf4e2FslclgjNh0UGPqaMDFjQ40EqvA3b/QTE = X-Google-Smtp-Source: AGHT+IFxx9aAXs9K3UWLUkNoPTxnyQgFbFDiv6QuguA0fBJfC6nx4QcDbNYAPGOBVLbci3y7zpLYtg== X-Received: by 2002:a17:906:c105:b0:a99:403e:2578 with SMTP id a640c23a62f3a-a998d0ffcc4mr141469566b.5.1728465730378; Wed, 09 Oct 2024 02:22:10 -0700 (PDT) Message-ID: Date: Wed, 9 Oct 2024 11:22:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/7] byteorder: replace __u32 From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Julien Grall , Stefano Stabellini References: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway. In swab.h the casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab32()'s local variable is renamed, and __arch__swab32()'s is dropped as being redundant with ___swab32()'s. The masking operation is also dropped from __fswab64(). Signed-off-by: Jan Beulich --- I'm unconvinced of the need of the separate ___constant_swab32(). I'm also unconvinced of the need for some of said constants (that even had casts on them). --- a/xen/include/xen/byteorder/big_endian.h +++ b/xen/include/xen/byteorder/big_endian.h @@ -14,25 +14,25 @@ #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x))) #define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x)) #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x))) -#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x)) +#define __constant_le32_to_cpu(x) ___constant_swab32((__force uint32_t)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x))) #define __constant_le16_to_cpu(x) ___constant_swab16((__force uint16_t)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x)) #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x)) -#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x)) -#define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x)) +#define __constant_cpu_to_be32(x) ((__force __be32)(uint32_t)(x)) +#define __constant_be32_to_cpu(x) ((__force uint32_t)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__force __be16)(uint16_t)(x)) #define __constant_be16_to_cpu(x) ((__force uint16_t)(__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 __le32_to_cpu(x) __swab32((__force uint32_t)(__le32)(x)) #define __cpu_to_le16(x) ((__force __le16)__swab16((x))) #define __le16_to_cpu(x) __swab16((__force uint16_t)(__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_be32(x) ((__force __be32)(uint32_t)(x)) +#define __be32_to_cpu(x) ((__force uint32_t)(__be32)(x)) #define __cpu_to_be16(x) ((__force __be16)(uint16_t)(x)) #define __be16_to_cpu(x) ((__force uint16_t)(__be16)(x)) @@ -44,13 +44,13 @@ static inline __u64 __le64_to_cpup(const { return __swab64p((__u64 *)p); } -static inline __le32 __cpu_to_le32p(const __u32 *p) +static inline __le32 __cpu_to_le32p(const uint32_t *p) { return (__force __le32)__swab32p(p); } -static inline __u32 __le32_to_cpup(const __le32 *p) +static inline uint32_t __le32_to_cpup(const __le32 *p) { - return __swab32p((__u32 *)p); + return __swab32p((const uint32_t *)p); } static inline __le16 __cpu_to_le16p(const uint16_t *p) { @@ -68,13 +68,13 @@ static inline __u64 __be64_to_cpup(const { return (__force __u64)*p; } -static inline __be32 __cpu_to_be32p(const __u32 *p) +static inline __be32 __cpu_to_be32p(const uint32_t *p) { return (__force __be32)*p; } -static inline __u32 __be32_to_cpup(const __be32 *p) +static inline uint32_t __be32_to_cpup(const __be32 *p) { - return (__force __u32)*p; + return (__force uint32_t)*p; } static inline __be16 __cpu_to_be16p(const uint16_t *p) { --- a/xen/include/xen/byteorder/little_endian.h +++ b/xen/include/xen/byteorder/little_endian.h @@ -13,26 +13,26 @@ #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_le32(x) ((__force __le32)(uint32_t)(x)) +#define __constant_le32_to_cpu(x) ((__force uint32_t)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__force __le16)(uint16_t)(x)) #define __constant_le16_to_cpu(x) ((__force uint16_t)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x))) #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x))) -#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x)) +#define __constant_be32_to_cpu(x) ___constant_swab32((__force uint32_t)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x))) #define __constant_be16_to_cpu(x) ___constant_swab16((__force uint16_t)(__be16)(x)) #define __cpu_to_le64(x) ((__force __le64)(__u64)(x)) #define __le64_to_cpu(x) ((__force __u64)(__le64)(x)) -#define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) -#define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) +#define __cpu_to_le32(x) ((__force __le32)(uint32_t)(x)) +#define __le32_to_cpu(x) ((__force uint32_t)(__le32)(x)) #define __cpu_to_le16(x) ((__force __le16)(uint16_t)(x)) #define __le16_to_cpu(x) ((__force uint16_t)(__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 __be32_to_cpu(x) __swab32((__force uint32_t)(__be32)(x)) #define __cpu_to_be16(x) ((__force __be16)__swab16((x))) #define __be16_to_cpu(x) __swab16((__force uint16_t)(__be16)(x)) @@ -44,13 +44,13 @@ static inline __u64 __le64_to_cpup(const { return (__force __u64)*p; } -static inline __le32 __cpu_to_le32p(const __u32 *p) +static inline __le32 __cpu_to_le32p(const uint32_t *p) { return (__force __le32)*p; } -static inline __u32 __le32_to_cpup(const __le32 *p) +static inline uint32_t __le32_to_cpup(const __le32 *p) { - return (__force __u32)*p; + return (__force uint32_t)*p; } static inline __le16 __cpu_to_le16p(const uint16_t *p) { @@ -68,13 +68,13 @@ static inline __u64 __be64_to_cpup(const { return __swab64p((__u64 *)p); } -static inline __be32 __cpu_to_be32p(const __u32 *p) +static inline __be32 __cpu_to_be32p(const uint32_t *p) { return (__force __be32)__swab32p(p); } -static inline __u32 __be32_to_cpup(const __be32 *p) +static inline uint32_t __be32_to_cpup(const __be32 *p) { - return __swab32p((__u32 *)p); + return __swab32p((const uint32_t *)p); } static inline __be16 __cpu_to_be16p(const uint16_t *p) { --- a/xen/include/xen/byteorder/swab.h +++ b/xen/include/xen/byteorder/swab.h @@ -12,7 +12,7 @@ /* * Casts are necessary for constants, because we never know for sure how - * U/UL/ULL map to __u32, __u64. At least not in a portable way. + * UL/ULL map to __u64. At least not in a portable way. */ #define ___swab16(x) \ ({ \ @@ -24,12 +24,12 @@ #define ___swab32(x) \ ({ \ - __u32 __x = (x); \ - ((__u32)( \ - (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | \ - (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | \ - (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | \ - (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); \ + uint32_t x_ = (x); \ + (uint32_t)( \ + (((uint32_t)(x_) & 0x000000ffU) << 24) | \ + (((uint32_t)(x_) & 0x0000ff00U) << 8) | \ + (((uint32_t)(x_) & 0x00ff0000U) >> 8) | \ + (((uint32_t)(x_) & 0xff000000U) >> 24)); \ }) #define ___swab64(x) \ @@ -51,11 +51,11 @@ (((uint16_t)(x) & 0x00ffU) << 8) | \ (((uint16_t)(x) & 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) )) + ((uint32_t)( \ + (((uint32_t)(x) & 0x000000ffU) << 24) | \ + (((uint32_t)(x) & 0x0000ff00U) << 8) | \ + (((uint32_t)(x) & 0x00ff0000U) >> 8) | \ + (((uint32_t)(x) & 0xff000000U) >> 24))) #define ___constant_swab64(x) \ ((__u64)( \ (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ @@ -74,7 +74,7 @@ # define __arch__swab16(x) ___swab16(x) #endif #ifndef __arch__swab32 -# define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); }) +# define __arch__swab32(x) ___swab32(x) #endif #ifndef __arch__swab64 # define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); }) @@ -110,7 +110,7 @@ ___swab16((x)) : \ __fswab16((x))) # define __swab32(x) \ -(__builtin_constant_p((__u32)(x)) ? \ +(__builtin_constant_p((uint32_t)(x)) ? \ ___swab32((x)) : \ __fswab32((x))) # define __swab64(x) \ @@ -137,15 +137,15 @@ static inline void __swab16s(uint16_t *a __arch__swab16s(addr); } -static inline attr_const __u32 __fswab32(__u32 x) +static inline attr_const uint32_t __fswab32(uint32_t x) { return __arch__swab32(x); } -static inline __u32 __swab32p(const __u32 *x) +static inline uint32_t __swab32p(const uint32_t *x) { return __arch__swab32p(x); } -static inline void __swab32s(__u32 *addr) +static inline void __swab32s(uint32_t *addr) { __arch__swab32s(addr); } @@ -154,8 +154,7 @@ static inline void __swab32s(__u32 *addr static inline attr_const __u64 __fswab64(__u64 x) { # ifdef __SWAB_64_THRU_32__ - __u32 h = x >> 32; - __u32 l = x & ((1ULL<<32)-1); + uint32_t h = x >> 32, l = x; return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h))); # else return __arch__swab64(x); From patchwork Wed Oct 9 09:23:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13827974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA011CED63F for ; Wed, 9 Oct 2024 09:23:13 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.814035.1227114 (Exim 4.92) (envelope-from ) id 1sySuP-0005OI-Ck; Wed, 09 Oct 2024 09:23:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 814035.1227114; Wed, 09 Oct 2024 09:23:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sySuP-0005OB-9u; Wed, 09 Oct 2024 09:23:05 +0000 Received: by outflank-mailman (input) for mailman id 814035; Wed, 09 Oct 2024 09:23:04 +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 1sySuO-0004IZ-2Z for xen-devel@lists.xenproject.org; Wed, 09 Oct 2024 09:23:04 +0000 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [2a00:1450:4864:20::630]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 15ac6623-8620-11ef-a0bd-8be0dac302b0; Wed, 09 Oct 2024 11:23:03 +0200 (CEST) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a99543ab209so410363666b.2 for ; Wed, 09 Oct 2024 02:23:03 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a992e5bb23bsm631027366b.34.2024.10.09.02.23.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2024 02:23:02 -0700 (PDT) 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: 15ac6623-8620-11ef-a0bd-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1728465783; x=1729070583; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=ztKKNRdazt+hQvk49PZFem2qqn49Q1QaFTJERIwQniE=; b=JhlBX9b0+3aEHqobABZrthI3Ucq2eizf/btUWxmpR9FmwUbljjeZGY7fW0YY7OiTYR dv/maqxu0nxDA0gm1CSMYjRogSa4w3gRw73jHRabtNJbwdRqaUHDyqh7viifcS2beA5Q 2pnF0JWpks7l4hsIHr822715ZIn2+E5PhVBY1aTn7wU7tkvRto9nd1SDs4ncrOZHw5ol lZ9yL8nNyfKp6SsMmBKseqYFpURcLmB2P7/MY1LDs7J5Z6JxCfeAVSFTqOAC4SK2d+Dk dGxl5J3Ho1KSseVSkyMdPp3o1nonX0UGTJ05cyeLj3QMdqRRgD0G8dpJ2+lEcwuSVDgL D2qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728465783; x=1729070583; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ztKKNRdazt+hQvk49PZFem2qqn49Q1QaFTJERIwQniE=; b=gGPx9MVphwGN+hHhuMqtGjcD3JAZ1RSZF7WTL58AQOeXum6LOoqAdZ4IC8QIBdUkS6 1EiykwfbNFAhC2gr8HEhwx5Y6RdedwJMyOmjGZ3gijxKRubg9EQ/pG/KdVp5JUfG/Gvr X/rxRqxcasQnnyiWBFsxfydJHPSbKZu0ESyN/7I0FKjOKzC66N2TUXGgpEkMCHlCBaPK zNNsaO8P99ren44N+IxAyG+rd04rDHuCBZL1XxSLXgYYjgfRSarjLH2nM9nG/cMI1dy0 VZ5DjuQe70g1T2XqL8lqMzmAJSpUSBbM3sxnu0or2rX1z3QOfkD3+jS4yJU1L3XdahKL rd/Q== X-Gm-Message-State: AOJu0YzzQvMfUZIitRuzECXrJlleHp/yj71LVf0wkjuhctzqv33+kP63 NdQzzPpS4R5/nBy20VQpFOqO7S0T8b379XTA7e8mHnXXx/HJz5Velruy3IncjeH9Df+jStazgg8 = X-Google-Smtp-Source: AGHT+IGgfaHKwCHARGavcTVjouTGH6n2acn/einTMyTMQZCrnKjp1N13YFdE8PwP+JF5pNSqJoS4Jg== X-Received: by 2002:a17:907:9487:b0:a99:5c0e:e3ca with SMTP id a640c23a62f3a-a998d201507mr104814866b.34.1728465782814; Wed, 09 Oct 2024 02:23:02 -0700 (PDT) Message-ID: <868d803c-0a88-4080-99b1-68e6f8b92c25@suse.com> Date: Wed, 9 Oct 2024 11:23:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/7] Flask: replace uses of __u32 From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Daniel Smith References: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> ... by uint32_t. Signed-off-by: Jan Beulich Acked-by: Daniel P. Smith --- Uses of bool_val look suspicious; I looked at them because by its name I would have hoped I can switch it to bool instead. --- a/xen/xsm/flask/ss/conditional.h +++ b/xen/xsm/flask/ss/conditional.h @@ -29,8 +29,8 @@ struct cond_expr { #define COND_EQ 6 /* bool == bool */ #define COND_NEQ 7 /* bool != bool */ #define COND_LAST COND_NEQ - __u32 expr_type; - __u32 bool_val; + uint32_t expr_type; + uint32_t bool_val; struct cond_expr *next; }; --- a/xen/xsm/flask/ss/policydb.h +++ b/xen/xsm/flask/ss/policydb.h @@ -131,7 +131,7 @@ struct range_trans { /* Boolean data type */ struct cond_bool_datum { - __u32 value; /* internal type value */ + uint32_t value; /* internal type value */ int state; }; From patchwork Wed Oct 9 09:23:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13827975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C758CED63E for ; Wed, 9 Oct 2024 09:24:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.814042.1227125 (Exim 4.92) (envelope-from ) id 1sySv8-0005u1-LP; Wed, 09 Oct 2024 09:23:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 814042.1227125; Wed, 09 Oct 2024 09:23:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sySv8-0005tu-IQ; Wed, 09 Oct 2024 09:23:50 +0000 Received: by outflank-mailman (input) for mailman id 814042; Wed, 09 Oct 2024 09:23:49 +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 1sySv7-0005to-TY for xen-devel@lists.xenproject.org; Wed, 09 Oct 2024 09:23:49 +0000 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [2a00:1450:4864:20::632]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 30cf13b0-8620-11ef-a0bd-8be0dac302b0; Wed, 09 Oct 2024 11:23:49 +0200 (CEST) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a995f56ea2dso419663666b.1 for ; Wed, 09 Oct 2024 02:23:49 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9943ea4936sm528286466b.174.2024.10.09.02.23.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2024 02:23:48 -0700 (PDT) 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: 30cf13b0-8620-11ef-a0bd-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1728465828; x=1729070628; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=4/p9q6zzF3dEdrk0EDrk/Q8JWw7Bgak8AAujM54KwSo=; b=KocezMmJwmuWu9jemXbqvK6UqY1X2oMLBqa/2JedK3zZVgmHc0wT7QkfqkzuUzJzEx DoGs14IfQn/F0oxCrd1zXqLpS6M5VhyM/E3kQ9eZ55gQ4YmjfXPZgE1f1MbEbb2IYxbB r7V3CL7j5rCh97wbTADBmK6FgYRiHgswNx7om2WfMBcFsY1yMpVWHSS1F8J/IznDkeBm 4quQ8hA1X+kvsFUf/gEg+Bp11Xq4+n8K9FwQ4+Tdf7nDiOgv1U08u9ynb237DtcXtKvP XkB7w4PQ5kuWoCu+ehGhwXLPa4JEDMbuVAnLtSDwIKzDtm+/B9IHrlm0JnT18QzwcUyw nqcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728465828; x=1729070628; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4/p9q6zzF3dEdrk0EDrk/Q8JWw7Bgak8AAujM54KwSo=; b=D4clKHsosa8y4iASuZKqUWoMnkPhfo0jVfvAqw2QgdY8sZFg//E6QRvF/4G3Yf2oIS YJaKj6mHF73p96aSoeO0srpp8jS2IzDZRIEvl1guWLEkcaJ6uXTwiMgf37isDFqK244h nbxOGIpL7NISOebw3swh0NTUrKI8UUBCjnOdd5Q0Kn4UD7763/7VtogYZhdhKv/DERLJ gDQ2XvkxTn4ki57R573B8aSlB1HCuifCWfoqEhEzwsgz2+PcjKnK/mCoy4imtO1SaOFS pbgSOAhNkQC3K1X7g3KviCXzbC2igFPGaa6Gpg1cucH3yO/czyKAaZjEfRDatK1EdOyV UKIg== X-Gm-Message-State: AOJu0YwsT7F4ckU0XJmr8Wh7LlyYWgopRTUXPMya5kZeolBQJ96nekjb bEQtlJXTeZYSGlabVXSsYjnHnjItVsh1Qkfslb8h2o3/y2/1EFAclQ3x0vwg+DTswKrlkVEGetI = X-Google-Smtp-Source: AGHT+IHYUMA03wMgqdCv4B2ttcqDQw/CpkrylMiuFbcdYfLc2ADuFOei/2xd8o7eBKuwzt3vUdxTUA== X-Received: by 2002:a17:907:1c1a:b0:a99:2ab0:d973 with SMTP id a640c23a62f3a-a998d341895mr132202966b.55.1728465828372; Wed, 09 Oct 2024 02:23:48 -0700 (PDT) Message-ID: Date: Wed, 9 Oct 2024 11:23:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 4/7] x86: modernize swab64() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= References: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> For quite a while we didn't need to be concerned of 32-bit code generation anymore: Simply use the 64-bit form of BSWAP here. Signed-off-by: Jan Beulich --- a/xen/arch/x86/include/asm/byteorder.h +++ b/xen/arch/x86/include/asm/byteorder.h @@ -10,17 +10,10 @@ static inline attr_const __u32 ___arch__ return x; } -static inline attr_const __u64 ___arch__swab64(__u64 val) +static inline attr_const uint64_t ___arch__swab64(uint64_t x) { - union { - struct { __u32 a,b; } s; - __u64 u; - } v; - v.u = val; - asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" - : "=r" (v.s.a), "=r" (v.s.b) - : "0" (v.s.a), "1" (v.s.b)); - return v.u; + asm ( "bswap %0" : "+r" (x) ); + return x; } /* Do not define swab16. Gcc is smart enough to recognize "C" version and From patchwork Wed Oct 9 09:24:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13827986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A69ACED63E for ; Wed, 9 Oct 2024 09:25:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.814048.1227134 (Exim 4.92) (envelope-from ) id 1sySwC-0006Tr-TU; Wed, 09 Oct 2024 09:24:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 814048.1227134; Wed, 09 Oct 2024 09:24:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sySwC-0006Tk-R1; Wed, 09 Oct 2024 09:24:56 +0000 Received: by outflank-mailman (input) for mailman id 814048; Wed, 09 Oct 2024 09:24:56 +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 1sySwC-0006TZ-DF for xen-devel@lists.xenproject.org; Wed, 09 Oct 2024 09:24:56 +0000 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [2a00:1450:4864:20::62f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 588c9b09-8620-11ef-a0bd-8be0dac302b0; Wed, 09 Oct 2024 11:24:55 +0200 (CEST) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a9943897c07so560675466b.3 for ; Wed, 09 Oct 2024 02:24:55 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a992e623957sm627601766b.76.2024.10.09.02.24.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2024 02:24:54 -0700 (PDT) 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: 588c9b09-8620-11ef-a0bd-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1728465895; x=1729070695; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=dJN/oUOljW0y9dXzhI8yPyqKExVJQBlP+Fu4RB9uvL8=; b=aOlBlPvkIX3XtsJPGZiKi1LTqBx10V9xmMiLZ1HXWj4vQkrltjNgBRipgeV6y4Beu9 opAMWtnvO+/agjY4FiM6Yea8I4V/QKy1mPVNkl2ed+7DJr9ymjPL/Rhy1YS7T0+e5o1+ acvZkz8As6l0mul7dFZRVISp9oCHKjhGzf4OuE0w9QBxSJ+2M4klwKjhPPqPIpPxfTU0 1fKMyrvXni4/N7gJpKBJ2+8idHDcvEhXCL3VaDNjOqNV7r2EumyiN0D9F7tJtlnOrjfL CwJ90Y1NJ7bXLfACWQ9fxvIc5c/ua6JYT1awthPpaT7tcn8l8h+xXr3ITUHkIj/y1PAp d7ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728465895; x=1729070695; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dJN/oUOljW0y9dXzhI8yPyqKExVJQBlP+Fu4RB9uvL8=; b=TibmGkb1gYMLnZAsTpfVa9nxYNr9wy4GjGKLfTrzj/+6ubejrVMttahCe2v7Z4yt/u +bHIuZRyZHZ4X9VR4kXhWA2UkxSFUnbwCiffZMtm8q3Hujou1UlA99kDY5rj4y7OEsp4 ZYl+pBBXzPiY0vUJFUigSiplbAW9f75UbUXQnvTtKSP8E3BSjXCRZ3lyXvxJqmqtuaYY cE4sh8WpF93z/h7LegMVEFOKTfRJv4ETKYtySh5Izf8EtP7bsXlxOasi13TvsBFzPJ1g y9xNKtSZ0VBK2ezycDWm5Kvum1p814qPCzJM2hnxuTlBJlH4DV01x1mnVfyHTHHzPWci l/Ag== X-Gm-Message-State: AOJu0YwRuFbk6r7VwC+y9uY/Dxduc1Z84RgqoG6XsegBVcRFBjNNE5iL YyXbjUhLF92SuzlAiJFF3RxPc1k+ewtZ+2+Ww3JElKTNBLmyJX9hFEXzJg2xglJZmQmUkUBKvNQ = X-Google-Smtp-Source: AGHT+IEXt3/J4C+eyW5Yl0LniacQ1BLVl7nf5/vEeM1tXDNjGOnTPV2MdTrh6y1Z8liZKaLx5G2SEg== X-Received: by 2002:a17:906:7313:b0:a99:5957:b8f0 with SMTP id a640c23a62f3a-a998d31c11emr141654566b.49.1728465894981; Wed, 09 Oct 2024 02:24:54 -0700 (PDT) Message-ID: <832f8384-71b5-4872-92eb-8a81d7e1d50a@suse.com> Date: Wed, 9 Oct 2024 11:24:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 5/7] types: replace remaining uses of __u32 From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Julien Grall , Stefano Stabellini , =?utf-8?q?Roger_Pau_Monn=C3=A9?= References: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> ... and move the type itself to linux-compat.h. While doing so drop casts (instead of modiyfing them) from x86'es wrmsrl(). Signed-off-by: Jan Beulich --- a/xen/arch/x86/include/asm/byteorder.h +++ b/xen/arch/x86/include/asm/byteorder.h @@ -4,7 +4,7 @@ #include #include -static inline attr_const __u32 ___arch__swab32(__u32 x) +static inline attr_const uint32_t ___arch__swab32(uint32_t x) { asm("bswap %0" : "=r" (x) : "0" (x)); return x; --- a/xen/arch/x86/include/asm/msr.h +++ b/xen/arch/x86/include/asm/msr.h @@ -33,9 +33,8 @@ static inline void wrmsrl(unsigned int msr, __u64 val) { - __u32 lo, hi; - lo = (__u32)val; - hi = (__u32)(val >> 32); + uint32_t lo = val, hi = val >> 32; + wrmsr(msr, lo, hi); } --- a/xen/include/xen/bitops.h +++ b/xen/include/xen/bitops.h @@ -413,7 +413,7 @@ static inline int get_count_order(unsign * @word: value to rotate * @shift: bits to roll */ -static inline __u32 rol32(__u32 word, unsigned int shift) +static inline uint32_t rol32(uint32_t word, unsigned int shift) { return (word << shift) | (word >> (32 - shift)); } @@ -424,7 +424,7 @@ static inline __u32 rol32(__u32 word, un * @word: value to rotate * @shift: bits to roll */ -static inline __u32 ror32(__u32 word, unsigned int shift) +static inline uint32_t ror32(uint32_t word, unsigned int shift) { return (word >> shift) | (word << (32 - shift)); } --- a/xen/include/xen/linux-compat.h +++ b/xen/include/xen/linux-compat.h @@ -16,6 +16,7 @@ typedef uint8_t __u8; typedef int16_t s16, __s16; typedef uint16_t __u16; typedef int32_t s32, __s32; +typedef uint32_t __u32; typedef int64_t s64, __s64; typedef paddr_t phys_addr_t; --- a/xen/include/xen/types.h +++ b/xen/include/xen/types.h @@ -7,7 +7,7 @@ /* Linux inherited types which are being phased out */ typedef uint8_t u8; typedef uint16_t u16; -typedef uint32_t u32, __u32; +typedef uint32_t u32; typedef uint64_t u64, __u64; #include @@ -53,8 +53,8 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; typedef uint16_t __le16; typedef uint16_t __be16; -typedef __u32 __le32; -typedef __u32 __be32; +typedef uint32_t __le32; +typedef uint32_t __be32; typedef __u64 __le64; typedef __u64 __be64; From patchwork Wed Oct 9 09:25:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13827987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13F12CED25D for ; Wed, 9 Oct 2024 09:25:31 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.814052.1227145 (Exim 4.92) (envelope-from ) id 1sySwe-0006x0-6e; Wed, 09 Oct 2024 09:25:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 814052.1227145; Wed, 09 Oct 2024 09:25:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sySwe-0006wt-3V; Wed, 09 Oct 2024 09:25:24 +0000 Received: by outflank-mailman (input) for mailman id 814052; Wed, 09 Oct 2024 09:25:22 +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 1sySwc-0006TZ-HR for xen-devel@lists.xenproject.org; Wed, 09 Oct 2024 09:25:22 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 67f4a20d-8620-11ef-a0bd-8be0dac302b0; Wed, 09 Oct 2024 11:25:21 +0200 (CEST) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5c8967dd2c7so8154207a12.1 for ; Wed, 09 Oct 2024 02:25:21 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8e05bc56asm5212583a12.45.2024.10.09.02.25.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2024 02:25:20 -0700 (PDT) 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: 67f4a20d-8620-11ef-a0bd-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1728465921; x=1729070721; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=gP7lbN35wCGIUuM79IuL2uQrQmd6PPoQxchjzUNEOWM=; b=K0QUIxYxT9H87KdHsBOLjK6vf2zxRPx4D4ERibCwuWG2ICm3h9/0NMKJJ9QEaGlAsY 8qjYwRri5hezNeon1agu1V+BY6h/vXzu0MrGChnI6n7KuvaSnhPwbQrth647LZy1FXCl NosSbNT0rFIt2mFkSoymE7XtGrZOyvOf11wCKkNbaf/SQikKzTsdEGFdZ1S42v9yHqRn jf31t+7+/fhlgtaVvZENBe2RfBzYUBsRVoiLyAPVHryH1a+feK9v3UsoOR7dkv6gM4O9 tBrtXYB9E4nRufDAi5b/zCjP0LvTpjl6EVEM7xXhM9uLaEb1FlVJgo85+hMjQgtpHCcx 39xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728465921; x=1729070721; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gP7lbN35wCGIUuM79IuL2uQrQmd6PPoQxchjzUNEOWM=; b=JtQkjBHXhrdOlw/Rs0F3M8ohTcnaiXzRM67StoVASCvhWdje/12qgRGSjv72fCbNsl 3ZBI30MxKsz5h9aPFB8PifdsbxJ/apeTc6vv0BeHi4p41vUaLK4MkkHGDVmYHLeZGGIx kWABaGCrgo61zKGlWSHvvcF9cqUkzs+NaQz7lNMKYrxcjRX53/fiF4yxtaZHZiPk2eCq QE9yF5VVUGBbpe6ghuKEm81jh5nHd1Z3rQ1leseQTzL04e5EzBTUldqufGeybQ8TlTY0 Xpo6sgRvbGe+k6oy63PkzicobQFN9QxcTN5aWMabCozkZHq07NdwSp9nfNBQmIXrnIXQ tG6Q== X-Gm-Message-State: AOJu0YwfIgt3HDySmEmBMwNI9319ARuBl+0kdpzHIwtojL36w3X8vkPO UInGCg/hdVDQFCfXzOKvqI8PXlYYuoNoOd5/sh44DXt9FirgGY/p7wdlkf2cDT4QoZ52i0P4HQk = X-Google-Smtp-Source: AGHT+IGF+XuBUT0D8UHGLgMmKt+ASiWxSsAIdlF5aAfY98eLC1T/mVfHqaKXmMf+VDdE8uPgTY4B1A== X-Received: by 2002:a05:6402:3513:b0:5c8:bdbe:33a6 with SMTP id 4fb4d7f45d1cf-5c91d689226mr1347734a12.31.1728465920754; Wed, 09 Oct 2024 02:25:20 -0700 (PDT) Message-ID: <674bed79-1db6-4838-85a4-2dcba9655ebd@suse.com> Date: Wed, 9 Oct 2024 11:25:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 6/7] byteorder: replace __u64 From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Julien Grall , Stefano Stabellini References: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway. In swab.h the casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab64()'s local variable is renamed, and __arch__swab64()'s is dropped as being redundant with ___swab64()'s. Excessive casts compared to ___{,constant_}swab{16,32}() are also dropped. Much like excessive ones in __fswab64(). Signed-off-by: Jan Beulich --- I'm unconvinced of the need of the separate ___constant_swab64(). I'm also unconvinced of the need for some of said constants (that even had casts on them). --- a/xen/include/xen/byteorder/big_endian.h +++ b/xen/include/xen/byteorder/big_endian.h @@ -12,37 +12,37 @@ #include #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x))) -#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x)) +#define __constant_le64_to_cpu(x) ___constant_swab64((__force uint64_t)(__le64)(x)) #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x))) #define __constant_le32_to_cpu(x) ___constant_swab32((__force uint32_t)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x))) #define __constant_le16_to_cpu(x) ___constant_swab16((__force uint16_t)(__le16)(x)) -#define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x)) -#define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x)) +#define __constant_cpu_to_be64(x) ((__force __be64)(uint64_t)(x)) +#define __constant_be64_to_cpu(x) ((__force uint64_t)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__force __be32)(uint32_t)(x)) #define __constant_be32_to_cpu(x) ((__force uint32_t)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__force __be16)(uint16_t)(x)) #define __constant_be16_to_cpu(x) ((__force uint16_t)(__be16)(x)) #define __cpu_to_le64(x) ((__force __le64)__swab64((x))) -#define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x)) +#define __le64_to_cpu(x) __swab64((__force uint64_t)(__le64)(x)) #define __cpu_to_le32(x) ((__force __le32)__swab32((x))) #define __le32_to_cpu(x) __swab32((__force uint32_t)(__le32)(x)) #define __cpu_to_le16(x) ((__force __le16)__swab16((x))) #define __le16_to_cpu(x) __swab16((__force uint16_t)(__le16)(x)) -#define __cpu_to_be64(x) ((__force __be64)(__u64)(x)) -#define __be64_to_cpu(x) ((__force __u64)(__be64)(x)) +#define __cpu_to_be64(x) ((__force __be64)(uint64_t)(x)) +#define __be64_to_cpu(x) ((__force uint64_t)(__be64)(x)) #define __cpu_to_be32(x) ((__force __be32)(uint32_t)(x)) #define __be32_to_cpu(x) ((__force uint32_t)(__be32)(x)) #define __cpu_to_be16(x) ((__force __be16)(uint16_t)(x)) #define __be16_to_cpu(x) ((__force uint16_t)(__be16)(x)) -static inline __le64 __cpu_to_le64p(const __u64 *p) +static inline __le64 __cpu_to_le64p(const uint64_t *p) { return (__force __le64)__swab64p(p); } -static inline __u64 __le64_to_cpup(const __le64 *p) +static inline uint64_t __le64_to_cpup(const __le64 *p) { - return __swab64p((__u64 *)p); + return __swab64p((const uint64_t *)p); } static inline __le32 __cpu_to_le32p(const uint32_t *p) { @@ -60,13 +60,13 @@ static inline uint16_t __le16_to_cpup(co { return __swab16p((const uint16_t *)p); } -static inline __be64 __cpu_to_be64p(const __u64 *p) +static inline __be64 __cpu_to_be64p(const uint64_t *p) { return (__force __be64)*p; } -static inline __u64 __be64_to_cpup(const __be64 *p) +static inline uint64_t __be64_to_cpup(const __be64 *p) { - return (__force __u64)*p; + return (__force uint64_t)*p; } static inline __be32 __cpu_to_be32p(const uint32_t *p) { --- a/xen/include/xen/byteorder/little_endian.h +++ b/xen/include/xen/byteorder/little_endian.h @@ -11,38 +11,38 @@ #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_le64(x) ((__force __le64)(uint64_t)(x)) +#define __constant_le64_to_cpu(x) ((__force uint64_t)(__le64)(x)) #define __constant_cpu_to_le32(x) ((__force __le32)(uint32_t)(x)) #define __constant_le32_to_cpu(x) ((__force uint32_t)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__force __le16)(uint16_t)(x)) #define __constant_le16_to_cpu(x) ((__force uint16_t)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x))) -#define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x)) +#define __constant_be64_to_cpu(x) ___constant_swab64((__force uint64_t)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x))) #define __constant_be32_to_cpu(x) ___constant_swab32((__force uint32_t)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x))) #define __constant_be16_to_cpu(x) ___constant_swab16((__force uint16_t)(__be16)(x)) -#define __cpu_to_le64(x) ((__force __le64)(__u64)(x)) -#define __le64_to_cpu(x) ((__force __u64)(__le64)(x)) +#define __cpu_to_le64(x) ((__force __le64)(uint64_t)(x)) +#define __le64_to_cpu(x) ((__force uint64_t)(__le64)(x)) #define __cpu_to_le32(x) ((__force __le32)(uint32_t)(x)) #define __le32_to_cpu(x) ((__force uint32_t)(__le32)(x)) #define __cpu_to_le16(x) ((__force __le16)(uint16_t)(x)) #define __le16_to_cpu(x) ((__force uint16_t)(__le16)(x)) #define __cpu_to_be64(x) ((__force __be64)__swab64((x))) -#define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x)) +#define __be64_to_cpu(x) __swab64((__force uint64_t)(__be64)(x)) #define __cpu_to_be32(x) ((__force __be32)__swab32((x))) #define __be32_to_cpu(x) __swab32((__force uint32_t)(__be32)(x)) #define __cpu_to_be16(x) ((__force __be16)__swab16((x))) #define __be16_to_cpu(x) __swab16((__force uint16_t)(__be16)(x)) -static inline __le64 __cpu_to_le64p(const __u64 *p) +static inline __le64 __cpu_to_le64p(const uint64_t *p) { return (__force __le64)*p; } -static inline __u64 __le64_to_cpup(const __le64 *p) +static inline uint64_t __le64_to_cpup(const __le64 *p) { - return (__force __u64)*p; + return (__force uint64_t)*p; } static inline __le32 __cpu_to_le32p(const uint32_t *p) { @@ -60,13 +60,13 @@ static inline uint16_t __le16_to_cpup(co { return (__force uint16_t)*p; } -static inline __be64 __cpu_to_be64p(const __u64 *p) +static inline __be64 __cpu_to_be64p(const uint64_t *p) { return (__force __be64)__swab64p(p); } -static inline __u64 __be64_to_cpup(const __be64 *p) +static inline uint64_t __be64_to_cpup(const __be64 *p) { - return __swab64p((__u64 *)p); + return __swab64p((const uint64_t *)p); } static inline __be32 __cpu_to_be32p(const uint32_t *p) { --- a/xen/include/xen/byteorder/swab.h +++ b/xen/include/xen/byteorder/swab.h @@ -10,10 +10,6 @@ * to clean up support for bizarre-endian architectures. */ -/* - * Casts are necessary for constants, because we never know for sure how - * UL/ULL map to __u64. At least not in a portable way. - */ #define ___swab16(x) \ ({ \ uint16_t x_ = (x); \ @@ -34,16 +30,16 @@ #define ___swab64(x) \ ({ \ - __u64 __x = (x); \ - ((__u64)( \ - (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | \ - (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | \ - (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | \ - (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | \ - (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | \ - (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | \ - (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | \ - (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); \ + uint64_t x_ = (x); \ + (uint64_t)( \ + (((uint64_t)(x_) & 0x00000000000000ffULL) << 56) | \ + (((uint64_t)(x_) & 0x000000000000ff00ULL) << 40) | \ + (((uint64_t)(x_) & 0x0000000000ff0000ULL) << 24) | \ + (((uint64_t)(x_) & 0x00000000ff000000ULL) << 8) | \ + (((uint64_t)(x_) & 0x000000ff00000000ULL) >> 8) | \ + (((uint64_t)(x_) & 0x0000ff0000000000ULL) >> 24) | \ + (((uint64_t)(x_) & 0x00ff000000000000ULL) >> 40) | \ + (((uint64_t)(x_) & 0xff00000000000000ULL) >> 56)); \ }) #define ___constant_swab16(x) \ @@ -57,15 +53,15 @@ (((uint32_t)(x) & 0x00ff0000U) >> 8) | \ (((uint32_t)(x) & 0xff000000U) >> 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) )) + ((uint64_t)( \ + (((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \ + (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \ + (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \ + (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \ + (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \ + (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \ + (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \ + (((uint64_t)(x) & 0xff00000000000000ULL) >> 56))) /* * provide defaults when no architecture-specific optimization is detected @@ -77,7 +73,7 @@ # define __arch__swab32(x) ___swab32(x) #endif #ifndef __arch__swab64 -# define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); }) +# define __arch__swab64(x) ___swab64(x) #endif #ifndef __arch__swab16p @@ -114,7 +110,7 @@ ___swab32((x)) : \ __fswab32((x))) # define __swab64(x) \ -(__builtin_constant_p((__u64)(x)) ? \ +(__builtin_constant_p((uint64_t)(x)) ? \ ___swab64((x)) : \ __fswab64((x))) #else @@ -151,20 +147,20 @@ static inline void __swab32s(uint32_t *a } #ifdef __BYTEORDER_HAS_U64__ -static inline attr_const __u64 __fswab64(__u64 x) +static inline attr_const uint64_t __fswab64(uint64_t x) { # ifdef __SWAB_64_THRU_32__ uint32_t h = x >> 32, l = x; - return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h))); + return ((uint64_t)__swab32(l) << 32) | __swab32(h); # else return __arch__swab64(x); # endif } -static inline __u64 __swab64p(const __u64 *x) +static inline uint64_t __swab64p(const uint64_t *x) { return __arch__swab64p(x); } -static inline void __swab64s(__u64 *addr) +static inline void __swab64s(uint64_t *addr) { __arch__swab64s(addr); } From patchwork Wed Oct 9 09:25:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13827988 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 612CDCED25D for ; Wed, 9 Oct 2024 09:26:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.814060.1227155 (Exim 4.92) (envelope-from ) id 1sySx4-0007VU-IK; Wed, 09 Oct 2024 09:25:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 814060.1227155; Wed, 09 Oct 2024 09:25:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sySx4-0007VN-FC; Wed, 09 Oct 2024 09:25:50 +0000 Received: by outflank-mailman (input) for mailman id 814060; Wed, 09 Oct 2024 09:25:49 +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 1sySx3-0006qE-A4 for xen-devel@lists.xenproject.org; Wed, 09 Oct 2024 09:25:49 +0000 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [2a00:1450:4864:20::533]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 77a3e6c0-8620-11ef-99a2-01e77a169b0f; Wed, 09 Oct 2024 11:25:47 +0200 (CEST) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5c8784e3bc8so9009733a12.1 for ; Wed, 09 Oct 2024 02:25:47 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c920366ffbsm479657a12.73.2024.10.09.02.25.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2024 02:25:47 -0700 (PDT) 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: 77a3e6c0-8620-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1728465947; x=1729070747; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=lSt1UFZef/+6tCfhe9oUpk8XmMT2KJhBEjzS3rL8n6k=; b=MWHWkfcPM2BMRiB1lPl02FA36i12yKDwwKP84aHPb5XGW1rLfN3Wzax7h7ENy/6Wwv JPQSAEY9uDmI+r0JadMHT1tkQvbgQu6QyI2sepnzWQ3t8ob/fjyOEssMokVbATDmynPb U5jhicG2JhtYedvIPRuv4vrjN0/+VWuSy6H9ABDmbwPNehnIl+eAJeQNGWudPk/GXdRf 1acxB3fcEYLopEYC1vfn1DWq+vmyvL8F8slWOaig07TGNHCYmT71uwe27FPmJYXPeJAz CPoEvIPOXcaI0MC5M2m9T3mTdRcV0+AUC/B7A/Kptca9AiDdw1rkuxE6XIGyBCYTcpN7 S/Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728465947; x=1729070747; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lSt1UFZef/+6tCfhe9oUpk8XmMT2KJhBEjzS3rL8n6k=; b=EMB5IRMrteywyxtyGkO7SOuPX+iSU85cYDn0ZDOZ7x1LXLnsm4FFTjEEabTOpP3Rsg +NtUcThLr2EMDVSF3eurjkMlYAxIwSxvAAyzhI/lJ6Txa8VckEtabyKbra9nHa4Xyqy8 6xoT2DXmNUKg5QarTHZ2UMtU9KBeco5eADpGDjbKCTqhWF6He64qgMPCgFOp1fwOCVMc JoOqMQqKsGOeKvPoeJYLGEywL7Z0NWuD05Gz8csLgckmp0wORQiE5hgwjJQLUNnpXA7v 8gbdJvOVmPdOtPvKcdSd6xtItOvS88p5+9eWmAQhHeD/gV6keLXfkFQXfXoPBHRiNvCE lWtg== X-Gm-Message-State: AOJu0Yw5s+q2T8RODjgnAD2kbHMel6oqbdn7gTf+/STNjpYDILHVwaOF 25YlMvtA/DVLmlMgLPa8SfzNVYLLY0iPVM+T+beB9Jw39ss3DDYSBguzxrVjmtvJNrugMy76pns = X-Google-Smtp-Source: AGHT+IE9Ma2LvpqfTXUPLh4dG1TSxzztnL8Nx/XBTB6RGQ/Xdj3Z+eujl5DhjMFHvY1u/YRGrVrcDQ== X-Received: by 2002:a05:6402:278d:b0:5c8:9406:535b with SMTP id 4fb4d7f45d1cf-5c91d5c97b8mr1405593a12.18.1728465947227; Wed, 09 Oct 2024 02:25:47 -0700 (PDT) Message-ID: Date: Wed, 9 Oct 2024 11:25:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 7/7] types: replace remaining use of __u64 From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Julien Grall , Stefano Stabellini , =?utf-8?q?Roger_Pau_Monn=C3=A9?= References: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <17b6b894-9b41-4e8c-a3a9-ce837797eac3@suse.com> ... and move the type itself to linux-compat.h. Signed-off-by: Jan Beulich --- a/xen/arch/x86/include/asm/msr.h +++ b/xen/arch/x86/include/asm/msr.h @@ -31,7 +31,7 @@ : /* no outputs */ \ : "c" (msr), "a" (val1), "d" (val2)) -static inline void wrmsrl(unsigned int msr, __u64 val) +static inline void wrmsrl(unsigned int msr, uint64_t val) { uint32_t lo = val, hi = val >> 32; --- a/xen/include/xen/linux-compat.h +++ b/xen/include/xen/linux-compat.h @@ -18,6 +18,7 @@ typedef uint16_t __u16; typedef int32_t s32, __s32; typedef uint32_t __u32; typedef int64_t s64, __s64; +typedef uint64_t __u64; typedef paddr_t phys_addr_t; --- a/xen/include/xen/types.h +++ b/xen/include/xen/types.h @@ -8,7 +8,7 @@ typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; -typedef uint64_t u64, __u64; +typedef uint64_t u64; #include @@ -55,8 +55,8 @@ typedef uint16_t __le16; typedef uint16_t __be16; typedef uint32_t __le32; typedef uint32_t __be32; -typedef __u64 __le64; -typedef __u64 __be64; +typedef uint64_t __le64; +typedef uint64_t __be64; typedef unsigned int __attribute__((__mode__(__pointer__))) uintptr_t;