From patchwork Mon Mar 17 18:34:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 14019854 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD7F519048F for ; Mon, 17 Mar 2025 18:34:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742236469; cv=none; b=e6ZBVuJ4uEElIaWbEguOAHj2BToDA8qTIz80YApKVoyhBz9kfzL1tx8F+pNKjxygoUqfSah0SLjVvPHL02t+BbRmBBW147To7WDKzXCt27PckMfGusRfY/YGbvKreinm9bqhR9ICUtKjj0dlhrbPeEnac73/Oques/0Gdpej3/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742236469; c=relaxed/simple; bh=D7kAKGSn4zAKkiSs1hQlq6vEceALs33too5mFmMr30Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XP62bak29y4StAKMB8cqY0tR+88bwGXHkAzCzpN9fBN5POeQrNpWJDYGf0Cf3ZboqvygmkFMvtElbRnZl+6RjZDrokfStHIcGdJfz/caZmkkAS5Pd+myO0WimNbXG4DGydmkyzCo4zK1ywQ6VnffAT79hfiHBpYNgjR9vJOinxE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lf7coFEG; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lf7coFEG" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-22423adf751so80101465ad.2 for ; Mon, 17 Mar 2025 11:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742236466; x=1742841266; darn=vger.kernel.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=949DeBQijWmgHqYCdDdupcSTn3rDdND8nLqwkILEwEI=; b=lf7coFEGzN80IA2TlDFDPqH+AH+ZksdfEB6AhFWXJUC7o+90sjl3/K8h0s3ic1aujx C1dlrecdXt55NiQcR3XQb5YcpdE0A3peW2gmP76i+lBKaLWTFQiXwYKBZomqQMajl+fh go2ekezYCGqSGdXNswr02fgr9MWurqWF2LGWuKGCmu1kHBcQ24bZjTIQyeIET48uYMwM xtA6ntMUztcZLUAwsNuOFQAtnNM0KfnGsCgNxBzhQaKvvbXPmada8aLEZGi4ZZMJZswO WULz3nQ/4UCzu/5cRtl3jlzgwImpSjZRRYnGtS2fOcOVQVquSEd8/CwPWDtaVhiVy9qP XZvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742236466; x=1742841266; 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=949DeBQijWmgHqYCdDdupcSTn3rDdND8nLqwkILEwEI=; b=ReRpYzFUaijfa0UDfLJ0dkJ5Lj1XiI6cEpAhE4FnM0bW4Un/khD1tdG2m6ioph3vSv RWWzYzd51sfRO6E2zvhEGdLZVNftCvth28ekLuYej3XcUBSJT5yuHoy2P0uhg/eWv46f 8Lflf5UfHfvHRmpFSViZaw9jOOETEhP2YSNvfAQ9HPjJ+PRr06AyzCHYwJnoEt/mB+kl hOEF/iYGRuTzwJsVQjeUI3trLmK5z+Y5xsVBdTvxBpPttoMJd4RQT+cWts0p0/HQ6SaI RvmbHIrFQzvw3F7s88JbqBqsn7d8PUGgz2+QQ3DSCgSiGsEaLtfi/lRN0gjxBYRSDkhQ 4rFA== X-Forwarded-Encrypted: i=1; AJvYcCXBpobe/ziR8vEltfO3NLpQxGBf9fMYaGiyIIUot+zFVVQqgEU8QzLP1EJGH9IE0fOnyzc=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4V5n/WrMAu+8Rt3blDW4hCJiJbywacbbPbbHuFDmuW8pMUjOQ hiX0n3acFzKEaZr2TQ0qBEnGGy6J9MJHfz6zXZXKAQmEiOitg2vIBcXaMlXp8Ko= X-Gm-Gg: ASbGncvddE3DqNd+mOf1SobAkJf6CAfsGbEMAB3GphntWHzLfj8dwjuJL6ppEctVas5 H6tbKraiIJ4CwXG1gUdBMkA7w1v5/rTVG4hLhreNFGh6yV/ERwDTvp+C5Rh4gNzcizm7irGrgrk Y9646V+JaBee9lQEf8VxRPLREFEpAzhedCwQlDzhZIQIiOL6Ve+xNKJpKpDjeVmiSCH6ee0dul/ 8I8NB9qegzGOEF3V+Ik4WZGx5kPwQ4Em+CHOH0AY4uqNg+IXZYhAjGDQub67jjWpsfwXDyauV4H Nqgnxi2JLpDVG8Kl0gteexe4Ng+QLU4naq5In7JMYqya X-Google-Smtp-Source: AGHT+IEMdkhHnCOZBQ+9EV0uYxPSw6/JcOSk+BrsDVDiw8khDcGewsFrIqa6c3AgQ8Es/TqwcULwNA== X-Received: by 2002:a05:6a00:139f:b0:736:9e40:13b1 with SMTP id d2e1a72fcca58-737224726e5mr14180634b3a.23.1742236465994; Mon, 17 Mar 2025 11:34:25 -0700 (PDT) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73711695a2esm8188770b3a.144.2025.03.17.11.34.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Mar 2025 11:34:25 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paul Durrant , xen-devel@lists.xenproject.org, David Hildenbrand , "Edgar E. Iglesias" , qemu-riscv@nongnu.org, Liu Zhiwei , Paolo Bonzini , Harsh Prateek Bora , alex.bennee@linaro.org, manos.pitsidianakis@linaro.org, Daniel Henrique Barboza , Richard Henderson , Alistair Francis , qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Weiwei Li , kvm@vger.kernel.org, Palmer Dabbelt , Peter Xu , Yoshinori Sato , Anthony PERARD , Stefano Stabellini , Nicholas Piggin , Pierrick Bouvier Subject: [PATCH v6 01/18] exec/tswap: target code can use TARGET_BIG_ENDIAN instead of target_words_bigendian() Date: Mon, 17 Mar 2025 11:34:00 -0700 Message-Id: <20250317183417.285700-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250317183417.285700-1-pierrick.bouvier@linaro.org> References: <20250317183417.285700-1-pierrick.bouvier@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- include/exec/tswap.h | 11 ++++++----- cpu-target.c | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/exec/tswap.h b/include/exec/tswap.h index ecd4faef015..2683da0adb7 100644 --- a/include/exec/tswap.h +++ b/include/exec/tswap.h @@ -13,13 +13,14 @@ /** * target_words_bigendian: * Returns true if the (default) endianness of the target is big endian, - * false otherwise. Note that in target-specific code, you can use - * TARGET_BIG_ENDIAN directly instead. On the other hand, common - * code should normally never need to know about the endianness of the - * target, so please do *not* use this function unless you know very well - * what you are doing! + * false otherwise. Common code should normally never need to know about the + * endianness of the target, so please do *not* use this function unless you + * know very well what you are doing! */ bool target_words_bigendian(void); +#ifdef COMPILING_PER_TARGET +#define target_words_bigendian() TARGET_BIG_ENDIAN +#endif /* * If we're in target-specific code, we can hard-code the swapping diff --git a/cpu-target.c b/cpu-target.c index cae77374b38..519b0f89005 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -155,6 +155,7 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...) abort(); } +#undef target_words_bigendian bool target_words_bigendian(void) { return TARGET_BIG_ENDIAN;