From patchwork Thu Mar 13 16:38:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 14015439 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (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 683CB1FBEA8 for ; Thu, 13 Mar 2025 16:39:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741883956; cv=none; b=nj8odf5QNxgN1CirI1l7/+HVXu0eMIW9KBOVRCOiiik+VFnHw8ATnAlnUqrvW6VKbNxhc0t22jJ9OKBhrbFCatsmsnvt8Y0IZf5c6pt5gJLK6GurcgAOdq9zgY6aa6zHPWkLlRuLEA+L2S/a22qWY+RGsAxpXX76H+scappgVWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741883956; c=relaxed/simple; bh=D7kAKGSn4zAKkiSs1hQlq6vEceALs33too5mFmMr30Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Oy9NIZjXPa4whvzMLpX/0qpRAi63ftY42MkdXf9wq64yXkKgdnERpPaOuXoiLzgmwSe5mQPfuInZxjO+iUeY99CTLAWaJS1nticWmA49IC8CTa1YWgVklq/Ojdkur6pqkU1kiyRRuepak1rPLpZk84nob3jGYsVWHtceRyD5yhA= 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=os0AdLfp; arc=none smtp.client-ip=209.85.216.54 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="os0AdLfp" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2ff65d88103so2115514a91.2 for ; Thu, 13 Mar 2025 09:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741883952; x=1742488752; 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=os0AdLfpbmE1IPXGe2iz9R0NgEj4pTBFdZmHErvcvlX81Z0RN33b+piz/BsbE6/auT eqsCNnj3MBT9J+21AO4xLjeqO+wAaP9md9KZe891zmI8qw8AHr32kQihcNA8DKGFvDb3 k3OKULE/aXJPsQ8tWMEwBlwprUj6PLu0UIB0Oi0g+hRiYAYhO3Ugxx5FEMkSbIDCanHy bF39skCvNcusNwpNYy/iwQ8n9yiB0zSbXnzVZMwNmPzgOkaF6/7n9Km5oPiL5tJptz8v 76lffw8j7QWxzhOM7vqRtqER5smOmzUeICY5id5WJEKYhu3HEMsXMgii9oshlZcBMa1r UlCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741883952; x=1742488752; 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=Yc1e9uTqtw+B4diZKqAwguvnap/J0A7JE9Vm+3oeMdeGxER+AfOS4X1F4DRuIdw32i nVDKepsTMv2vew//+NfG/tiXvfLUC83B5wyT6obPMdKldhmgpMS3NqSCzpwCfLSq7et7 eQtnLxkhNSFqSOs079MU30LYsaEiHKncPf/9gKM898AQh5jYCL8aRZoy5fbU7oh870L3 kbtwJsL+I0GG5GuWfOoCm7zGe/UjQROqSomNhSG2bSFO4ClywFdC30sMUB3cGIev8vYs uZ1+r1wp5gznxDDVRGpL1lPugHuherc9PFieCgLM6XQQhJs+IxzeKwPckvi+EfYkkJT8 MgdA== X-Forwarded-Encrypted: i=1; AJvYcCVdZ5FMekObl2z/yDhhW5Vl/lOyzjVG5EzBFO1okxJRZHuzzEqU+Z6wQJ/Ck/FvyeNdZBM=@vger.kernel.org X-Gm-Message-State: AOJu0YxXv3/BYC7eKC08u29zVqBA2nwgvmA5ZO0oOGlpPI0w9zzFXiuo gAk3t1JaDBe6L+EMSuvT5FuFKdlAtW/J9zlpR7difZUPGHhiIC29lSVSYyv2ZnM= X-Gm-Gg: ASbGncuK855Quvi6ucwkNUxe4zKWjdOq/IHpZTEBkRrSn1gABQJWR2JX7XRI/ZPNYlG vHrx03GrP6o1XVN7x6TFhIX30bz0ZUx7qn+MXaSgFmktd5Ab58w2wJgCuNHnGBVA90bFo33D71p lWFan+9CpmcNYgmGkit1qHpizYZoksxzqfTIo4NEsWiBgoM5JiReBz7HHvB2NfY+yciE4t6meuB lf+2xkH8Rsn1EQ7IhFQR6zTHT/J9/h9w7zX1IePm3IZXxbeXRxERQHKEfnqpKMxXKn1Dxp7fo3l HdOD2O7yFkba0r9GuuPezTf7XVaiwSMklNtatGI+DXvg X-Google-Smtp-Source: AGHT+IGev37PyaCRPVTSAXm6sa8QmcuQfkCR4AEqF/Tkfr+Zh7Bhff2KfoPULWlCloRr8rbLF7MLgw== X-Received: by 2002:a17:90b:3850:b0:2ff:7b15:813b with SMTP id 98e67ed59e1d1-3014e855f52mr302864a91.17.1741883952691; Thu, 13 Mar 2025 09:39:12 -0700 (PDT) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-30119265938sm4020084a91.39.2025.03.13.09.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Mar 2025 09:39:12 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paul Durrant , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Harsh Prateek Bora , Liu Zhiwei , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Peter Xu , alex.bennee@linaro.org, manos.pitsidianakis@linaro.org, Stefano Stabellini , Paolo Bonzini , qemu-ppc@nongnu.org, Richard Henderson , kvm@vger.kernel.org, David Hildenbrand , Palmer Dabbelt , Weiwei Li , qemu-riscv@nongnu.org, Alistair Francis , Anthony PERARD , Yoshinori Sato , Daniel Henrique Barboza , Nicholas Piggin , Pierrick Bouvier Subject: [PATCH v4 01/17] exec/tswap: target code can use TARGET_BIG_ENDIAN instead of target_words_bigendian() Date: Thu, 13 Mar 2025 09:38:47 -0700 Message-Id: <20250313163903.1738581-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250313163903.1738581-1-pierrick.bouvier@linaro.org> References: <20250313163903.1738581-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;