From nobody Fri Oct 31 23:15:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1744804771; cv=none; d=zohomail.com; s=zohoarc; b=MW+ITBkP+feSA+lgWJKm0+kdBegHTG+R9qv/X5cU4WCMqitDI71yNau1CRbt94Vxh+MiWChKK8qoylYbYFznE1TCsO90jea6yD67ZBHw41+XugBH4B4tRwT7xsDE0nD6giGe+tXm9Byt7VFNxiCh4frH4n7Yf366YNIYEhSGYBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744804771; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1daQrbWI9UKwuEhY3SZBXcJke4ogYtrZfiRlr7lZLK8=; b=GkIDqveLApR9OzH0lWNxojfFIq0y3w72dqBE8hLvL9afkJH+HoXS6RpcONGC5XLG4O31A5RXpmB21AEyWsraxM2xPveCnOVFsNneQ6LLK9KYFXoDIsF2cqCyjNwR8ZGgm2aq2mDA0Z2QXPTSXxtWFzvhWFhkOiUxNxia7gYoZKM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1744804771330829.6507169758532; Wed, 16 Apr 2025 04:59:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.955720.1349360 (Exim 4.92) (envelope-from ) id 1u51Q7-0007AN-QL; Wed, 16 Apr 2025 11:59:11 +0000 Received: by outflank-mailman (output) from mailman id 955720.1349360; Wed, 16 Apr 2025 11:59:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u51Q7-00078t-I4; Wed, 16 Apr 2025 11:59:11 +0000 Received: by outflank-mailman (input) for mailman id 955720; Wed, 16 Apr 2025 11:59:09 +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 1u51Q5-0006At-GP for xen-devel@lists.xenproject.org; Wed, 16 Apr 2025 11:59:09 +0000 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [2a00:1450:4864:20::335]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 343109fa-1aba-11f0-9eaf-5ba50f476ded; Wed, 16 Apr 2025 13:59:09 +0200 (CEST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43cfe63c592so72078725e9.2 for ; Wed, 16 Apr 2025 04:59:09 -0700 (PDT) Received: from localhost.localdomain (host-92-26-98-202.as13285.net. [92.26.98.202]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4405b5a9846sm18761905e9.35.2025.04.16.04.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Apr 2025 04:59:07 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 343109fa-1aba-11f0-9eaf-5ba50f476ded DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1744804748; x=1745409548; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1daQrbWI9UKwuEhY3SZBXcJke4ogYtrZfiRlr7lZLK8=; b=QB1m3j6aJ0qa30+P6+dyHHCNS8MMeJvmIRD0OzSt3C3KMjRCDmqmL4QWbPFRntR1vK XZVoihQj/yUYZT9O78kfFKeJGbkGRdYkefwKp53AOPA5StPkZS3XRy3IxPulCU0H80Jd O3lwpdykuKBD9vNs8bOP+RTxa3+V3izGK7zhE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744804748; x=1745409548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1daQrbWI9UKwuEhY3SZBXcJke4ogYtrZfiRlr7lZLK8=; b=DE7v0aITNHUM9DSVdjexNnlOaScaYWDyo4vYEjuyMIQjRfRvGWCEH3gEXnPp2KN/lE /1dmWnZHrJPWr/toMdsA3nj+BK+g1jE0iH3kAsf/RTeZmFEIHO34S7FwdotBZLz51HRN /nZUjdxukcovCvOk+72UPmcgfc1cY8pn13iM0ibFscNjHRvWO8CJX5H4r+N9bQ+EVOff Qv9pAZIncK8YUKOszc4vRCo/aEfrCoyzSiLa8t9Y0BY8GsoFUHYIvwa1FYiyz62vn0+6 USRd9fFLB5ge5giOYYcRVdidLON5jLbXWUk6fX5WI8iUyjlb2dm7XBWGIkutVS1aWRzD K9uA== X-Gm-Message-State: AOJu0YwnrU9PKvkfacbBWSfBG+IOHMV1YZHaWL0STAxkLx9AWTfP4l21 ye5v7smUpIemKMo1VPQn7qO5Ywl7iM9FnTUnk6lMUdoviTr/Yhi0NPCodcGaoA4RV8TRVuh3tBm MpkA= X-Gm-Gg: ASbGncujSKvuBKa3QlU0p8cJ/hJV3JnO+dH735QafY+o7uSgDoe3PoJyEgBZLmip7FP sYvANKAU3sX3uk0UljJtaaD2055u3oaQuYyj7deS/5GjBXBL9s3tX49YShK0JyU47dyaoFtO3kV 5RtZtnLfvsPPglJ2THvNY8WrStDonTWirEufS08y6mMxyoDWT9Oey+Qfrh4tCtKz+TyyTdw7egL QGcrgNPvuEu0VGFkQJBmOPrrOFvayns8ShvTBSqi4KZHuwWR9KaiJOKjNzdG5NijjsX9PtTfOj+ ebyBd0/TL87ubjd6AGQ6PFIukTam5FAAr/5u/3WUD7y7SYD/zxzKG5PY+xD7cq/8CKuWV5REwK6 xRwtRUlADiWGttg== X-Google-Smtp-Source: AGHT+IFgpfcqBIvlugUUmrvz/YH5fAtZyyY+frKoounRJDMbxOfMjexVXjUUxjtZ+ntbvBpdiGHb+A== X-Received: by 2002:a05:600c:1c1c:b0:43d:82c:2b23 with SMTP id 5b1f17b1804b1-4405d6ad1a1mr14089215e9.23.1744804748260; Wed, 16 Apr 2025 04:59:08 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Lin Liu , Andrew Cooper , Jan Beulich , Anthony PERARD , Michal Orzel , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Volodymyr Babchuk , Bertrand Marquis , Shawn Anastasio , Oleksii Kurochko , "Daniel P . Smith" Subject: [PATCH v6 06/15] xen/arch: Switch to new byteorder infrastructure Date: Wed, 16 Apr 2025 12:58:51 +0100 Message-Id: <20250416115900.2491661-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250416115900.2491661-1-andrew.cooper3@citrix.com> References: <20250416115900.2491661-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1744804773728019100 From: Lin Liu This needs to be done in several steps, because of common vs arch issues. Start by using the new common infastructure inside the arch infrastructure. libelf-private.h is awkward, and the only thing in Xen using swab??() directly. It needs updating at the same time. Signed-off-by: Lin Liu Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Anthony PERARD CC: Michal Orzel CC: Jan Beulich CC: Julien Grall CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Shawn Anastasio CC: Oleksii Kurochko CC: Daniel P. Smith CC: Lin Liu v5: * Rebase * Rearange from other patches to maintain bisectability --- xen/arch/arm/include/asm/byteorder.h | 4 +--- xen/arch/ppc/include/asm/byteorder.h | 8 +------- xen/arch/riscv/include/asm/byteorder.h | 4 +--- xen/arch/x86/include/asm/byteorder.h | 25 +------------------------ xen/common/libelf/libelf-private.h | 6 +++--- 5 files changed, 7 insertions(+), 40 deletions(-) diff --git a/xen/arch/arm/include/asm/byteorder.h b/xen/arch/arm/include/as= m/byteorder.h index 9c712c47884a..7f1419c45a16 100644 --- a/xen/arch/arm/include/asm/byteorder.h +++ b/xen/arch/arm/include/asm/byteorder.h @@ -1,9 +1,7 @@ #ifndef __ASM_ARM_BYTEORDER_H__ #define __ASM_ARM_BYTEORDER_H__ =20 -#define __BYTEORDER_HAS_U64__ - -#include +#include =20 #endif /* __ASM_ARM_BYTEORDER_H__ */ /* diff --git a/xen/arch/ppc/include/asm/byteorder.h b/xen/arch/ppc/include/as= m/byteorder.h index 2b5f6b9f6321..8df6adbf0d7d 100644 --- a/xen/arch/ppc/include/asm/byteorder.h +++ b/xen/arch/ppc/include/asm/byteorder.h @@ -1,12 +1,6 @@ #ifndef _ASM_PPC_BYTEORDER_H #define _ASM_PPC_BYTEORDER_H =20 -#define __arch__swab16 __builtin_bswap16 -#define __arch__swab32 __builtin_bswap32 -#define __arch__swab64 __builtin_bswap64 - -#define __BYTEORDER_HAS_U64__ - -#include +#include =20 #endif /* _ASM_PPC_BYTEORDER_H */ diff --git a/xen/arch/riscv/include/asm/byteorder.h b/xen/arch/riscv/includ= e/asm/byteorder.h index 8ca65e1b330e..a32bca02df38 100644 --- a/xen/arch/riscv/include/asm/byteorder.h +++ b/xen/arch/riscv/include/asm/byteorder.h @@ -1,9 +1,7 @@ #ifndef ASM__RISCV__BYTEORDER_H #define ASM__RISCV__BYTEORDER_H =20 -#define __BYTEORDER_HAS_U64__ - -#include +#include =20 #endif /* ASM__RISCV__BYTEORDER_H */ /* diff --git a/xen/arch/x86/include/asm/byteorder.h b/xen/arch/x86/include/as= m/byteorder.h index 44c240376d3a..3524a6cee741 100644 --- a/xen/arch/x86/include/asm/byteorder.h +++ b/xen/arch/x86/include/asm/byteorder.h @@ -1,29 +1,6 @@ #ifndef __ASM_X86_BYTEORDER_H__ #define __ASM_X86_BYTEORDER_H__ =20 -#include -#include - -static inline attr_const uint32_t ___arch__swab32(uint32_t x) -{ - asm("bswap %0" : "=3Dr" (x) : "0" (x)); - return x; -} - -static inline attr_const uint64_t ___arch__swab64(uint64_t x) -{=20 - asm ( "bswap %0" : "+r" (x) ); - return x; -}=20 - -/* Do not define swab16. Gcc is smart enough to recognize "C" version and - convert it into rotation or exhange. */ - -#define __arch__swab64(x) ___arch__swab64(x) -#define __arch__swab32(x) ___arch__swab32(x) - -#define __BYTEORDER_HAS_U64__ - -#include +#include =20 #endif /* __ASM_X86_BYTEORDER_H__ */ diff --git a/xen/common/libelf/libelf-private.h b/xen/common/libelf/libelf-= private.h index 197d7a7623a3..65417dffc8a0 100644 --- a/xen/common/libelf/libelf-private.h +++ b/xen/common/libelf/libelf-private.h @@ -31,9 +31,9 @@ printk(fmt, ## args ) =20 #define strtoull(str, end, base) simple_strtoull(str, end, base) -#define bswap_16(x) swab16(x) -#define bswap_32(x) swab32(x) -#define bswap_64(x) swab64(x) +#define bswap_16(x) bswap16(x) +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) =20 #else /* !__XEN__ */ =20 --=20 2.39.5