From nobody Sat Dec 13 22:49:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1752007452; cv=none; d=zohomail.com; s=zohoarc; b=MqXybqT4sFx7SHt2AY1+kosEV+rLjSXPUDY8oHpIMYFWp6ITiEMQjsCrzHVMpyNLmcZsDqiBUmZoAMMRpv5Js7MwhkD9vMDjgN1X6/6pnr0oj/FFmSMOxmruRH1/1PS56yr3q3ypI6Gc5gPUNQ5GAIPHArfhmhFGF7X8dOMpuLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752007452; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NHSfU1hw2z+9jkIM4IPD8mN1I4YQgc2MZothfwYUUn4=; b=dPu2G5tuaHFEUPHZJAv6VjEWCUXwOR6FzCq47uiGkvn6JRbuFkVWPLQmGG0IRnUfVFicSfB+tIU5Zi4yALaFYYMquJXDKHJo94CX0XsMP39D7U1mE7tSYKMqhnuwqp88wNh7POuA7qRse2jKpR9srtk03ARUieC8oZwh7OTlGNY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1752007452003881.0397328715698; Tue, 8 Jul 2025 13:44:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZFA8-0001yW-QT; Tue, 08 Jul 2025 16:43:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uZDeb-0005HR-SF for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:07:03 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZDeW-0004Xl-6c for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:06:54 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-ae0bc7aa21bso1016525666b.2 for ; Tue, 08 Jul 2025 12:06:51 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b471b97353sm13744377f8f.51.2025.07.08.10.20.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 10:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752001610; x=1752606410; darn=nongnu.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=NHSfU1hw2z+9jkIM4IPD8mN1I4YQgc2MZothfwYUUn4=; b=t4KnuV3Vr88rAy4zwRWx6jrB1MTPLwCV7FaKR09iVvdrYhEntXlZFpI/sa3JB6ujtP jGxLSgA8N9tV/tT7m/TupY6dNz6ooMAMdg+KAsr+9h60c6e9SwOEiZ2L0cZkABPU4AB5 bbb6sGbw5QJTD1Jm0VZDswoinHVxVj+Qtcek0nlYb/N2aeXKRy4M+b/Jn2hmc9MD87Sn aacE/7rmTQyeUqPg6o60J+7I5qMn4zlMfsrS60djtw3DMrbteFrZR0McQWxgHsZ9Uyxn 9ayboBkm7XYwNYYj+9UD69Ppd3TP5TaX1gKIHGAbx1uUQTHpzXAxMWGk9lYKdN9huJQz bd3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752001610; x=1752606410; 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=NHSfU1hw2z+9jkIM4IPD8mN1I4YQgc2MZothfwYUUn4=; b=RGsMMLz91sEGHZPKtcaOdCfSA2rjDkwPbDYpGPmYOyMbRK6v0yRFvih+suFNbMs5QY MFlvILHPPgyz3EdhGoHayb06nZk/+QZeWvsLdqWbskedZt71uEnyO3WoPHSnlMi/Prbw /LoCv3RiB6COoxV79Z92cY+ihOmirqCtFXxbdFoGo/yS35rNhncYcDkYK0a21RYAJ2Kk 5rUip2LwuFhf5yWGSe+9Ed0gcCdx8IW0Y3s7AaxE2J1xU9ixjezxE8X7lTBg3pV94R8P 6EMHbMGfQa4qpJmZQUkcjdFiJPhbSyghe2nGmAYKW2/TD4LvaA0aC9jNsdUkqvfBxOW4 Cz/Q== X-Gm-Message-State: AOJu0YxsImbK2Ps9eWl3VMmbDahWWgnxWgHowaEIHN4sUMRb1BtteVZe G7PR2cHzXzp7iH08J+MSYvT5Im20PYbmLbKHK7aJNRTiHpdJb5evc0MrsgLCnFTIORh7G/C/9EH 7iJAs X-Gm-Gg: ASbGncuuonY8hRE17ZnRryGXvR7/GiWwhU6YB2p+NL1Ra4WWAX80WX7G5lKaeTJMXbT mihufh9A/I6UQMZNnLtcqnnB9Pm0NfFxGkAk1tiaxX4IUO3XWl+KInuOlXiCkTFgI9nDWzFpmj7 yX7uPcBVYQyGvhpTEjzNvonTcx7xFDj2Ahy2+6AaLXyvwEAQvbMbuSlPLNeg9T0L7Ec47zp9mua 7Mt7jAoXUqmTQJ1WyIDvPJGl5lHCufIUJBBlu28tTw+1wiNulJKpNb4XhTa5/cW/ueAQvkzNlyT JNBvuEcO0RUE4QwwguxkNqKHOWWvXyrbS8BkQGVMXxY1zk8MKdZ4Vtwhe4ud18u3ivlTmYByX4t 12ya+h6VYQWv5FcD2Bphyl23E2DBkyy6BfS1H X-Google-Smtp-Source: AGHT+IFsmodWCOsSIAzcPTk6dkh6F8N2/9PUPUtepWvho3NU70iaiwVVCG+G9Q36XUWaJ/6q1u8LHw== X-Received: by 2002:a5d:6f1a:0:b0:3a6:d255:7eda with SMTP id ffacd0b85a97d-3b497038ed2mr14264397f8f.28.1751995228021; Tue, 08 Jul 2025 10:20:28 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Thomas Huth , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Pierrick Bouvier , "Michael S. Tsirkin" , qemu-riscv@nongnu.org, Richard Henderson , qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Song Gao , Huacai Chen , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo Subject: [PATCH-for-10.1 v7 1/8] target/qmp: Use target_cpu_type() Date: Tue, 8 Jul 2025 19:19:41 +0200 Message-ID: <20250708171949.62500-2-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708171949.62500-1-philmd@linaro.org> References: <20250708171949.62500-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752007453846116600 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- target/arm/arm-qmp-cmds.c | 3 ++- target/loongarch/loongarch-qmp-cmds.c | 3 ++- target/mips/system/mips-qmp-cmds.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c index cefd2352638..d292c974c44 100644 --- a/target/arm/arm-qmp-cmds.c +++ b/target/arm/arm-qmp-cmds.c @@ -21,6 +21,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/target-info.h" #include "hw/boards.h" #include "kvm_arm.h" #include "qapi/error.h" @@ -241,7 +242,7 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error = **errp) CpuDefinitionInfoList *cpu_list =3D NULL; GSList *list; =20 - list =3D object_class_get_list(TYPE_ARM_CPU, false); + list =3D object_class_get_list(target_cpu_type(), false); g_slist_foreach(list, arm_cpu_add_definition, &cpu_list); g_slist_free(list); =20 diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loong= arch-qmp-cmds.c index f5f1cd0009d..1d8cd32f5fc 100644 --- a/target/loongarch/loongarch-qmp-cmds.c +++ b/target/loongarch/loongarch-qmp-cmds.c @@ -7,6 +7,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/target-info.h" #include "qapi/error.h" #include "qapi/qapi-commands-machine.h" #include "cpu.h" @@ -32,7 +33,7 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **= errp) CpuDefinitionInfoList *cpu_list =3D NULL; GSList *list; =20 - list =3D object_class_get_list(TYPE_LOONGARCH_CPU, false); + list =3D object_class_get_list(target_cpu_type(), false); g_slist_foreach(list, loongarch_cpu_add_definition, &cpu_list); g_slist_free(list); =20 diff --git a/target/mips/system/mips-qmp-cmds.c b/target/mips/system/mips-q= mp-cmds.c index d98d6623f2f..b6a2874f2dd 100644 --- a/target/mips/system/mips-qmp-cmds.c +++ b/target/mips/system/mips-qmp-cmds.c @@ -7,6 +7,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/target-info.h" #include "qapi/error.h" #include "qapi/qapi-commands-machine.h" #include "cpu.h" @@ -40,7 +41,7 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **= errp) CpuDefinitionInfoList *cpu_list =3D NULL; GSList *list; =20 - list =3D object_class_get_list(TYPE_MIPS_CPU, false); + list =3D object_class_get_list(target_cpu_type(), false); g_slist_foreach(list, mips_cpu_add_definition, &cpu_list); g_slist_free(list); =20 --=20 2.49.0 From nobody Sat Dec 13 22:49:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1752009763; cv=none; d=zohomail.com; s=zohoarc; b=JUrkXeqg1AYe0GCs8ByroBqqd3WiNuldDme8enEegiGMYY5SqDdk3ujeWpM2ygOluts+hjmqSO93a3AVciyjHOPjN91ZqhCBgBdjGSc+LOkC/Cz93nVEYORsWO5JOfXVZZehWXHSJWGdnICrMj7gZUn6RC6skmv/L+6sh8PHyx0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752009763; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rAL/ETRijy4/iQ3UXazRTb8RTZUYHHKVtD2BscpxpCQ=; b=KYa0DIixqwixJPhw9b1yKONOGvB9+lTrclKW3f86NQboSsL0znnMk0g+UJXBMA48o5W6GCN1Mk966cOpdiD3437LIO/yhsLeuwpoQNHqrI/JMslWi0VxCMdSs+wSkjpTAuAVkdNrSpN9mU+FPP+6aUCOv4R3eMjGZZskhjGWhps= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1752009763570915.6953374346124; Tue, 8 Jul 2025 14:22:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZFF4-0000vY-SO; Tue, 08 Jul 2025 16:48:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uZDrM-000870-Pk for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:20:14 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZDrI-0008O0-1C for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:20:06 -0400 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-32b5226e6beso43473791fa.2 for ; Tue, 08 Jul 2025 12:19:48 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-454cd38f092sm28331705e9.1.2025.07.08.10.20.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 10:21:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752002387; x=1752607187; darn=nongnu.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=rAL/ETRijy4/iQ3UXazRTb8RTZUYHHKVtD2BscpxpCQ=; b=XuySZ14cHPOGQ5BmAbLds6Absx0GY8fEAvSF3+roiqZRGbitrU7Vc+e8obAbQSaQ0b xmn2BOldOaYmi7LwjHk61uMKq4LvgY5q0UwHdaIhmiir28fhBPEbInzc9ZH9YT3Yzkeg 2aeUvmkjeYFICMHuwL8bVn5Uk4x+4u6OKaIkVD4J12pm7/MUQsNGqj2GYnV5U9RqKx9H TVSv9tSrE6NkdA4WNRP6AZXPk3RqlYXqDdHTXaLhgzSatgiJxCOTq3TBzMOnxmjDjzaC xvEJJp9BeAZrg04im3/lFZpaJj6E4xNvyJFguFauQLelGU40CxoqRrWjsHDAFIRFkYs6 EkFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752002387; x=1752607187; 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=rAL/ETRijy4/iQ3UXazRTb8RTZUYHHKVtD2BscpxpCQ=; b=Fvtku7Ka8ojHAoW2fBpALMgltBQMbvMyCNwzGbHdzXQQUPigtSOvgSPmutQO0vOCfb C5ZeyTeEua5dBgcDfizyRS/qk5fHwU7TguRzoaPagG9JHCG4/rxHm9VW17xDoZ2Xz/i5 4BJlVZORMrG1Ir+7Uy4jGpFxc3TywQW+U6zjJ8uXnFiW4sSM7SmcTTGyp9MPlbpPSt2z dzQlMfnDP2UGZjz/OT8jUriby3bQ0PqgSNRHA9hJwCat3U6QtMZlovC0/9xAiqbOGxrB 8Sz3nUJ9C3btjqoWliXvt/65owHjki19W1GbvLFN7c3bDMkZXSp5IcXJu4LCRQFLp85q XfjA== X-Gm-Message-State: AOJu0YxtoDVISjc38itz/M8ogNV603r54hKhIaCL7X4LY9AcYDgf9eBt 2p2SaM1kGbgMiCWFNGvoKX/p17utZAlO4my+sKZy4xK8aJr2yVr6mY9QB4u941ySXnjlfC6xJiT 4V04x X-Gm-Gg: ASbGncswZuDKfL8epi5tpxbVErlbOGqnw5/9ljQBW9vQvROgXTMLXc8IxUfvRkefHTb LBRXA5tUQMhpwuY9zwBVRQ5J9utSg85dov9IPDXT5U8Sv/HdCTuTb/F3x5l7E+6u9cgTPfK3JgD p0biM3WkoKTserE3I9yYh226x9SSKAExvDM4EfaKe+PgNyOZtx6qlmfCa6+Qtg/gZijEesmPyrC 4WemMFiUux9tww8/07x1W41D9RD4lOh/pRwDoEg8lBUbef2LSZfM2MoO2JwxwKrek+/kcguBf/4 30Yk5HSzGLuEsf5q9RivyeEfdsn+bohCMnqwDia5Vt+Xn2w+O4o2kwkgoGJrbtgBW2wAeww30dT Zqt9Km/z86pMUopQ6FtO4slYS9ID1TEvOgz/b X-Google-Smtp-Source: AGHT+IHLZ/ykY7TZOQ2MzTMugvmnHDJCgJFHffcGRPTy37tNNZ378jls3SdJIi/LF+8ECz9D0Bqdzg== X-Received: by 2002:a05:600c:821b:b0:453:5c30:a1d0 with SMTP id 5b1f17b1804b1-454b4eadb5amr140127105e9.21.1751995268172; Tue, 08 Jul 2025 10:21:08 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Thomas Huth , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Pierrick Bouvier , "Michael S. Tsirkin" , qemu-riscv@nongnu.org, Richard Henderson , qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Zhao Liu Subject: [PATCH-for-10.1 v7 2/8] qemu/target-info: Factor target_arch() out Date: Tue, 8 Jul 2025 19:19:42 +0200 Message-ID: <20250708171949.62500-3-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708171949.62500-1-philmd@linaro.org> References: <20250708171949.62500-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=philmd@linaro.org; helo=mail-lj1-x22c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752009770970116600 To keep "qemu/target-info.h" self-contained to native types, declare target_arch() -- which returns a QAPI type -- in "qemu/target-info-qapi.h". No logical change. Keeping native types in "qemu/target-info.h" is necessary to keep building tests such tests/tcg/plugins/mem.c, as per the comment added in commit ecbcc9ead2f ("tests/tcg: add a system test to check memory instrumentation"): /* * plugins should not include anything from QEMU aside from the * API header. However as this is a test plugin to exercise the * internals of QEMU and we want to avoid needless code duplication we * do so here. bswap.h is pretty self-contained although it needs a * few things provided by compiler.h. */ Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- include/qemu/target-info-qapi.h | 21 +++++++++++++++++++++ include/qemu/target-info.h | 2 +- hw/core/machine-qmp-cmds.c | 8 +++----- target-info.c | 8 ++++++++ 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 include/qemu/target-info-qapi.h diff --git a/include/qemu/target-info-qapi.h b/include/qemu/target-info-qap= i.h new file mode 100644 index 00000000000..dae92c47eb1 --- /dev/null +++ b/include/qemu/target-info-qapi.h @@ -0,0 +1,21 @@ +/* + * QEMU target info API (returning QAPI types) + * + * Copyright (c) Linaro + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef QEMU_TARGET_INFO_EXTRA_H +#define QEMU_TARGET_INFO_EXTRA_H + +#include "qapi/qapi-types-machine.h" + +/** + * target_arch: + * + * Returns: QAPI SysEmuTarget enum (i.e. SYS_EMU_TARGET_X86_64). + */ +SysEmuTarget target_arch(void); + +#endif diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h index 850a2958b9c..dde0e7d968a 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -1,5 +1,5 @@ /* - * QEMU target info API + * QEMU target info API (returning native types) * * Copyright (c) Linaro * diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index d82043e1c68..cd98daedd18 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -19,7 +19,7 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/type-helpers.h" #include "qemu/uuid.h" -#include "qemu/target-info.h" +#include "qemu/target-info-qapi.h" #include "qom/qom-qobject.h" #include "system/hostmem.h" #include "system/hw_accel.h" @@ -37,8 +37,7 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) MachineState *ms =3D MACHINE(qdev_get_machine()); MachineClass *mc =3D MACHINE_GET_CLASS(ms); CpuInfoFastList *head =3D NULL, **tail =3D &head; - SysEmuTarget target =3D qapi_enum_parse(&SysEmuTarget_lookup, target_n= ame(), - -1, &error_abort); + SysEmuTarget target =3D target_arch(); CPUState *cpu; =20 CPU_FOREACH(cpu) { @@ -139,8 +138,7 @@ QemuTargetInfo *qmp_query_target(Error **errp) { QemuTargetInfo *info =3D g_malloc0(sizeof(*info)); =20 - info->arch =3D qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1, - &error_abort); + info->arch =3D target_arch(); =20 return info; } diff --git a/target-info.c b/target-info.c index 16fdca7aaaf..9ebabec988f 100644 --- a/target-info.c +++ b/target-info.c @@ -8,7 +8,9 @@ =20 #include "qemu/osdep.h" #include "qemu/target-info.h" +#include "qemu/target-info-qapi.h" #include "qemu/target-info-impl.h" +#include "qapi/error.h" =20 const char *target_name(void) { @@ -20,6 +22,12 @@ unsigned target_long_bits(void) return target_info()->long_bits; } =20 +SysEmuTarget target_arch(void) +{ + return qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1, + &error_abort); +} + const char *target_cpu_type(void) { return target_info()->cpu_type; --=20 2.49.0 From nobody Sat Dec 13 22:49:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1752007634; cv=none; d=zohomail.com; s=zohoarc; b=aEShod/OCjUrR9isBa4dW2Bjsvau8PCeAwxG3NR+vjBwIEBCO4nsxOd7QXuxLxI6m0W+8JjvJMv4tBtuvpkcc06/CzuRbXbWiHWd/t0Vyt9uIYl/ZGBjz+RpMKT4ZP83O1Paou2zZgDfT1P4WzUTVHGzqrEl4Zyygsw9MeOWc+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752007634; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MdQhcbrWCDw+stGMxabzY7NAeBH4tymx5hVA3eT0Fq4=; b=M9zTSpzCcK2eLmGoRLCNKUCZMEsN3sUp1s2EdMduWNL18O3cldbVwmYSYMfBhr6P77THpsd0PX64tzcqhjU/yPByEuKR82c5kyPl51r7swHuUgb032185mV9SPUIYznA6n4qSnjlMPjCJ6hwOQ2zlhzG4aeGaIgEWSEFWWHYadc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1752007634681304.77058408810774; Tue, 8 Jul 2025 13:47:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZFAG-0002Sm-3U; Tue, 08 Jul 2025 16:43:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uZDha-000840-Ic for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:10:24 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZDhX-0005UB-Ck for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:10:02 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-6099d89a19cso8480753a12.2 for ; Tue, 08 Jul 2025 12:09:54 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-454cd38eee8sm27951465e9.6.2025.07.08.10.21.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 10:21:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752001793; x=1752606593; darn=nongnu.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=MdQhcbrWCDw+stGMxabzY7NAeBH4tymx5hVA3eT0Fq4=; b=dP5ZNyxa4qwPKz+9hDD9T6ijFwrQ4Ihz+9qpAQ1/qMfunUtcWWboyAeUwrEiTbCd1/ tonj+Xolb6WcFKbVsRB+ysmZE5tp4N22DOsMy4cQv7LeS83r4N6VURdidvKDRlWoNIkS ppHKxpJhWtHeb+EOcfdDgF3NcXwTlDGYPAtP9YRdx2OhXUSQeR0YxWsJMWhKGaBch7V7 0N6gCE9VPaSTNeOaoOq+Pn8LeIaecTKQuygeneMD5n9IbuxgkPgevMMc/gsUClqefIEW 1vBwAkDUu0lSyAQ+MfSH1SmnGH84Kn91FCIXEurBMqhMsKC+CroPtT6PSyTqU90uxsMz gc4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752001793; x=1752606593; 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=MdQhcbrWCDw+stGMxabzY7NAeBH4tymx5hVA3eT0Fq4=; b=uLcq6h5lAL2EnkhwnIEoLnmZpBEqowmI36Romti2Ae+ydsuQWUcUVB/eK+JP1Z9Sfg EA4JJkcUg9k/FkyHM6aRkXyM/Ed7yT143PJoHLqlLJ7tA3D7mC6T1F89Eo0Qrgg1LQd3 vMQ/FsWoxil9xlTfJxQ9RCNrNp7ITnBk/f7+N6onDuLFhBbwxnyHQKPn9stWkXXidSO8 fYe8Pfc1bio3BHkdgYIHVoJE0KqEv1UG2gMTlvoPA2kwCR6Ar1tXVoASeLXux0VLrnfY tNR3lf/Cel5gbYAF6xfhOLWV3D0lyROE2Lk/0Dycghs1qmqWaQL6f0/abTDPsevYVb2V gFXw== X-Gm-Message-State: AOJu0YxkVy3LHzbFmXZNLoWv6FG/0/NwuWBFyxaIgYD2R0UvwRnAIlwz ReSaDLVqSPJ8cMADeL+xWGRXbehKpVhT0h1okvyWYEJoGbzP7DogWcmPLxOgA7wnR3IizirF1+S ZSigU X-Gm-Gg: ASbGnct3E4OiyBAFMPX3GI0ioeO6UC/qtQVZpWtnjNU7vdiIoBGy8RbHQS/ivct8ehf QRJ4M0CVd+TIxkP6WKlT7rxpIg7bEvMjIto3okExoz6KMStlIO59deDLv02x6mDtvxFXe2AGK8o J1WPe45XTUlFsgS+rqa7rpVeFPLMHeydt6+SBybCSGF9jmSXXWo4xx9yrJzTlzIK2jsLDk99KIo vMOga5DU98qryiteogm0x6z5Hp+Dpgzn4z4z6wb367rmsTS3UHa5RM25VeaNLGE6v98g9QD1c47 0V6xncIbWr3rqSVHb31ZzHGSvy9jD0iNT6lDpM9BN1m27fVGgfYIfH/Yi3kK8y9ztVDMfBtUHvQ DBCzir5vBfYbmhyS3zC7bwzn0piCs4SyTeRKs X-Google-Smtp-Source: AGHT+IFxP3b5N6vxU6EpIbRwS7wH6KJLvPs4GzEpfkT+XKcIdQ581Ja1R1yt6JsGcJHJpBkNjt+5HA== X-Received: by 2002:a05:600c:5247:b0:453:b1c:442a with SMTP id 5b1f17b1804b1-454c0fc516bmr100411325e9.27.1751995282887; Tue, 08 Jul 2025 10:21:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Thomas Huth , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Pierrick Bouvier , "Michael S. Tsirkin" , qemu-riscv@nongnu.org, Richard Henderson , qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v7 3/8] qemu/target-info: Add %target_arch field to TargetInfo Date: Tue, 8 Jul 2025 19:19:43 +0200 Message-ID: <20250708171949.62500-4-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708171949.62500-1-philmd@linaro.org> References: <20250708171949.62500-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=philmd@linaro.org; helo=mail-ed1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752007635739116600 Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier --- include/qemu/target-info-impl.h | 4 +++- target-info-stub.c | 1 + target-info.c | 9 +++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/qemu/target-info-impl.h b/include/qemu/target-info-imp= l.h index 1b51cbcfe1b..a8b34d150ab 100644 --- a/include/qemu/target-info-impl.h +++ b/include/qemu/target-info-impl.h @@ -9,11 +9,13 @@ #ifndef QEMU_TARGET_INFO_IMPL_H #define QEMU_TARGET_INFO_IMPL_H =20 -#include "qemu/target-info.h" +#include "qapi/qapi-types-machine.h" =20 typedef struct TargetInfo { /* runtime equivalent of TARGET_NAME definition */ const char *target_name; + /* related to TARGET_ARCH definition */ + SysEmuTarget target_arch; /* runtime equivalent of TARGET_LONG_BITS definition */ unsigned long_bits; /* runtime equivalent of CPU_RESOLVING_TYPE definition */ diff --git a/target-info-stub.c b/target-info-stub.c index fecc0e71286..2e4407ff04b 100644 --- a/target-info-stub.c +++ b/target-info-stub.c @@ -14,6 +14,7 @@ =20 static const TargetInfo target_info_stub =3D { .target_name =3D TARGET_NAME, + .target_arch =3D SYS_EMU_TARGET__MAX, .long_bits =3D TARGET_LONG_BITS, .cpu_type =3D CPU_RESOLVING_TYPE, .machine_typename =3D TYPE_MACHINE, diff --git a/target-info.c b/target-info.c index 9ebabec988f..8e29553b4ef 100644 --- a/target-info.c +++ b/target-info.c @@ -24,8 +24,13 @@ unsigned target_long_bits(void) =20 SysEmuTarget target_arch(void) { - return qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1, - &error_abort); + SysEmuTarget arch =3D target_info()->target_arch; + + if (arch =3D=3D SYS_EMU_TARGET__MAX) { + arch =3D qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1, + &error_abort); + } + return arch; } =20 const char *target_cpu_type(void) --=20 2.49.0 From nobody Sat Dec 13 22:49:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1752008871; cv=none; d=zohomail.com; s=zohoarc; b=JFvlaeNcsEE3NuMA39lT1ZMtJVw8CiSF+8kwuL7+vDIfHwUecToa44FMmIAGVt5x8bqUGC3vw9dzsAy9FCGkf2iPMP8vhhIsTFlAdE8bNSobqKvGjy2OVh8LnSjXX76ba6HYKpv7pN4VtoevyyTVBw3/6cd4Gt7JDkPOcsmZ9/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752008871; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=K9MeYWno9//WEkluE3Tl/0Oq7GlgozTz3zFV14cG8Q8=; b=AMBxZmxzt2loNfacYYCCgp7+jHHSkk5kG/jmUa+W3WvyeQePVm4NclEenheiyjCnntdjsjzHA/I9HcwqtIW40av0a+X56f8RfSvuJpl/wW6BquuO+joktkCCXuH6I+jL4cBwHI/rbt43ouMP/708t9cqHr0Gf+lXdfmQx8twQzA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175200887125281.98457551231513; Tue, 8 Jul 2025 14:07:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZFAR-00033p-AZ; Tue, 08 Jul 2025 16:43:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uZDai-0000UJ-3B for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:03:06 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZDab-0003KU-Vh for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:02:54 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-ae223591067so790638166b.3 for ; Tue, 08 Jul 2025 12:02:49 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b4722597f0sm13733424f8f.68.2025.07.08.10.21.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 10:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752001368; x=1752606168; darn=nongnu.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=K9MeYWno9//WEkluE3Tl/0Oq7GlgozTz3zFV14cG8Q8=; b=fOcKVDs9SnFgbWGw7hLHFBsq9weFLss095UC214ppxvvmhPhEn/iRnLCTVkv7k3g1r SD61Xn4OL/v6YD8MUyNCp/Y85d6sdaAzHYEyQu0vx6zjN9OmXKE4Wly/wQIat4QpvrsG k2T5CL8s5NKQd1jfbjrk4+aB2pJAtusXQnSAFDxMt4nlyO/T5fn1Przf7O3YojEHrV4Z BnobxuwXB1CwIhJztVn2bq5CltEo6Q1N48hgmjlD67VYk0ChyHdBVl3/hxGHC694dZsQ 5CPD8ObUGc01vk5knRjisDZIR8VEyeQcJKwRwFqh40sR03rc0S9ggTwLmSwBCbyjmQJM 9BUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752001368; x=1752606168; 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=K9MeYWno9//WEkluE3Tl/0Oq7GlgozTz3zFV14cG8Q8=; b=BzUiBpsCNiQYoV18m9Eir9SQPS7frq36NYKXoU//AFi19do+/ekCEUlTcbtDimVCqm vNVBqzQiYNB2V0b9sJRv25vrUxo4A/9TVufbq38uNuZCXvEpGZUyGpTTc/DYX37Q5HYE Yf8MWj/SFY9XW3XkpPrOAHAQ6qhGmf3L+TCZrciwv1Gy6qkZPh4/d3va+crtsgQsNx2U agI0B70Y3y4kbS28dueN0A0adtLkJjbnVQMBvv1RlqGi2R7fg+3b90TTU+/HJKUV/Cj2 Yikpyu9ZjqbNIozVUApGi5cQiMqqdcYKw+vsV0cgCpazGkyA1jfAwbO/zACUw2EMzzgq r2sQ== X-Gm-Message-State: AOJu0YwVwAzrY+xi888TCRTLZyXq0CJOL5VlaaY/orGZMGK8x/rpZmd1 p5BmNqqMllUv7FYi6K01IH08B3ScGdnmKeul5Bl5knWWug2wcE5ncJe9YIb0czvrw5IMq2KZNkP 52R9K X-Gm-Gg: ASbGnctS9yQdZ23/6SUkk0fCSg5gA/fC0B2kMofyoAqqBVieYb3PJHs6i9iVBvbg6JG npE5GVcpN1ZpiZCrjQ8YxbbCp+wlc1uJbYdyR9dZdSW6E//LDbUI+pIMZsk2XH/NrBVYp9dKpKc lgrs0z8pUTmIiJk4/TwBv/kJs9ZHULR7u1au4l877U2En8CipNq5HgvRsuHYhNJulucq/V82SZY Pq0CwWpM/Ea+BgWeE6o+NULNozJG/xg9PfogOKdTtDY+IpWWN9nlqypocbhJgphhUigXMCI622n anf335wxKzvSaWbdUcpL+rLFvHpijBT/94HBnmiyT2volOYUQpVnI4//j5GFFJ2nPhZLtyXxj1l S7Rsg0zKKyRCwM0IBqdcR+hyigWhmL3ixSjq9 X-Google-Smtp-Source: AGHT+IHUfown0RCeaPbaYi6Ti0Qx48c6i6HY1oN1sTkXfdLePbkDffIiRX1FBTDGzWBceusNHNsWwA== X-Received: by 2002:a05:6000:41d5:b0:3a4:e5bc:9892 with SMTP id ffacd0b85a97d-3b4964c3dc3mr13388695f8f.21.1751995343022; Tue, 08 Jul 2025 10:22:23 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Thomas Huth , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Pierrick Bouvier , "Michael S. Tsirkin" , qemu-riscv@nongnu.org, Richard Henderson , qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v7 4/8] qemu/target-info: Add target_endian_mode() Date: Tue, 8 Jul 2025 19:19:44 +0200 Message-ID: <20250708171949.62500-5-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708171949.62500-1-philmd@linaro.org> References: <20250708171949.62500-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=philmd@linaro.org; helo=mail-ej1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752008872865116600 target_endian_mode() returns the default endianness (QAPI type) of a target. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier Reviewed-by: Richard Henderson --- include/qemu/target-info-impl.h | 2 ++ include/qemu/target-info-qapi.h | 8 ++++++++ target-info-stub.c | 1 + target-info.c | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/include/qemu/target-info-impl.h b/include/qemu/target-info-imp= l.h index a8b34d150ab..17887f64e26 100644 --- a/include/qemu/target-info-impl.h +++ b/include/qemu/target-info-impl.h @@ -22,6 +22,8 @@ typedef struct TargetInfo { const char *cpu_type; /* QOM typename machines for this binary must implement */ const char *machine_typename; + /* related to TARGET_BIG_ENDIAN definition */ + EndianMode endianness; } TargetInfo; =20 /** diff --git a/include/qemu/target-info-qapi.h b/include/qemu/target-info-qap= i.h index dae92c47eb1..bdf207e6a3e 100644 --- a/include/qemu/target-info-qapi.h +++ b/include/qemu/target-info-qapi.h @@ -9,6 +9,7 @@ #ifndef QEMU_TARGET_INFO_EXTRA_H #define QEMU_TARGET_INFO_EXTRA_H =20 +#include "qapi/qapi-types-common.h" #include "qapi/qapi-types-machine.h" =20 /** @@ -18,4 +19,11 @@ */ SysEmuTarget target_arch(void); =20 +/** + * target_endian_mode: + * + * Returns: QAPI EndianMode enum (i.e. ENDIAN_MODE_LITTLE). + */ +EndianMode target_endian_mode(void); + #endif diff --git a/target-info-stub.c b/target-info-stub.c index 2e4407ff04b..ca0caa3686c 100644 --- a/target-info-stub.c +++ b/target-info-stub.c @@ -18,6 +18,7 @@ static const TargetInfo target_info_stub =3D { .long_bits =3D TARGET_LONG_BITS, .cpu_type =3D CPU_RESOLVING_TYPE, .machine_typename =3D TYPE_MACHINE, + .endianness =3D TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITT= LE, }; =20 const TargetInfo *target_info(void) diff --git a/target-info.c b/target-info.c index 8e29553b4ef..a756c0714c4 100644 --- a/target-info.c +++ b/target-info.c @@ -42,3 +42,8 @@ const char *target_machine_typename(void) { return target_info()->machine_typename; } + +EndianMode target_endian_mode(void) +{ + return target_info()->endianness; +} --=20 2.49.0 From nobody Sat Dec 13 22:49:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1752007576; cv=none; d=zohomail.com; s=zohoarc; b=FnJhb9DL8wfW9V+psRkDI+t73bpzfYO64efzGsVI8WaU+pSNYrp4Z1i4/URyedbKWEhc3b+/zp2PyzpYDhjHedqEyyBFF1Bu7wq6V/35clnmpBGkdb/J9BKVTqKHwSxuAvg0Sk/jDoxG3sWFawZD3gcOZFstIB7Zi/IEcbHG/vg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752007576; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hg2dyL7tW3tL/dDdSwNEK/JVBUdUtkDstPfeG3qxYtE=; b=d7W1NEJjIxvIN08HsGNO4iiNrJknq+yXuJWPhpkWzj/uCEwvqgWnl8tSidNNi6vsoNhN+EKLN2ExFPW9qezL8P/rwD38Tk06eKEBGKso8dziXbgBospUVBW17P3nLlYeQvRFbKJTOGXqoPxBxBA7HbeNHHSaUAp/hGKQ9UPLDNw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1752007576401444.30813052245105; Tue, 8 Jul 2025 13:46:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZFAT-0003G4-Ob; Tue, 08 Jul 2025 16:43:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uZDXl-0005XO-9Z for qemu-devel@nongnu.org; Tue, 08 Jul 2025 14:59:57 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZDXY-00027D-AV for qemu-devel@nongnu.org; Tue, 08 Jul 2025 14:59:49 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-60c51860bf5so7726923a12.1 for ; Tue, 08 Jul 2025 11:59:04 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b471b975efsm13281509f8f.46.2025.07.08.10.22.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 10:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752001143; x=1752605943; darn=nongnu.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=hg2dyL7tW3tL/dDdSwNEK/JVBUdUtkDstPfeG3qxYtE=; b=wEsKloeiQsjYQZdTYGkDHPDjHFKt/8p5TwlH4raKwcZsz3hvPfYjbgI/fz6MncJDKg HOPEkI9tBkeqtLjbH9uJKUZzvfLRRQjP8SVI6BOKBvPHr22cxj/OgqO5/fBreS8imQsV RTpXCmngMVNxYnmBfi1Hqu+9kk7kOAtMg6srloOEN/Vzukv1ba2X9Ehc3yXun+HC1H0Y 9VYzWyR5by+wOm1PFXMEI8r59xknwFg1hBc4qpxn5k51DptuI0Wu5kDJNPRjscEvPcBi qRyrO3c/ol/F+zFK07kMFUS8x2wq8rBfX4PRRYlzh9FrnqKWVv1VU1ep5+xaDuOOyopw rruw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752001143; x=1752605943; 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=hg2dyL7tW3tL/dDdSwNEK/JVBUdUtkDstPfeG3qxYtE=; b=nvcmexEU/x+cze1PC5fLsqT6oTlf4teuZTRGYeE6eGuqeJArvMk9J9GzwRj+Lkx32W BQNsEzR2wk/WzAs6nEgG+PU6neU2dzveHObjZsd81xbDfoz9t0ZBNClGzoQvmfbx1W6d fWH49SBjTwbJAXmqocMk9k2qvqqAKkhujU5ItasTHLRi4uHGgWvQ8BEtYyMleoEqBXLd k2blCVEoBanqnTicGk5QpGkYhfYqBLsdgyjEw+zX0+7T0Wn235bTHjb66Y7SYrnuNFAJ j2WGZzySIw3Rt3k1K2HgO+v77eG+jceXUalHWw0YAq8rTRQM3TmWYr5faft7eASYh6+r qidA== X-Gm-Message-State: AOJu0YxZqkIVladgrt4gwjiwCZXM8a6nHQYKcxpfdQEpteTNMIhRHgiO PYsCqsZaBcTa19ESTA8dubqVZPXtY2cKhV7aKRtW7ofruvyZk7doC5MwAoh9Vwws5Nj2rwrAIcE Q0dHV X-Gm-Gg: ASbGncteMzXKNk8k28W792Z0A16BrWCHLKfJHO24i2GQ32Qn9SkUflzHU7JOR4/D/Y2 n6QafESeGgJ8rsCmcreBN1wZzRpoy9n5HIK/BimKkWDJsUZHqdYIa7Mr1Hb9C/u75dVdlMcj+RF vMt0OrJw6yooJwhi6fvPSXnDhCzabs1OwARRLtsbV1dk81ipcwLXinWMfuq2oEXdNB5tKCprGQd yZ1Dyzj8SFcfCn2rxuNr6uYdBclBvXufDJkBVZD1yFGOH7HJM393bAaUNxhHrjdTvBr4ipsLGxi XOPbddXp4mhfgAYKAkdmxY4FdJPe5I/sOZqDVGqk65NcdziwV+1jpxu/vUxbjKGKgeWwahP78Lq M/Rhi8TxNyiWbZOu3d27ggPPv13iqACZiPzqV X-Google-Smtp-Source: AGHT+IEl3xAFgAOmbbj7qgMvicNw9rf+A5S0u5RVkXBNEJvLMdLB/qGhc6bLcFco17sXFzqEy1AtOw== X-Received: by 2002:adf:9c81:0:b0:3a4:cbc6:9db0 with SMTP id ffacd0b85a97d-3b5ddea1b98mr3138124f8f.51.1751995365618; Tue, 08 Jul 2025 10:22:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Thomas Huth , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Pierrick Bouvier , "Michael S. Tsirkin" , qemu-riscv@nongnu.org, Richard Henderson , qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Gerd Hoffmann , Peter Xu , David Hildenbrand , Fabiano Rosas , Laurent Vivier Subject: [PATCH-for-10.1 v7 5/8] qemu: Convert target_words_bigendian() to TargetInfo API Date: Tue, 8 Jul 2025 19:19:45 +0200 Message-ID: <20250708171949.62500-6-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708171949.62500-1-philmd@linaro.org> References: <20250708171949.62500-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752007578831116600 Reviewed-by: Pierrick Bouvier Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/exec/tswap.h | 13 +------------ include/qemu/target-info.h | 8 ++++++++ cpu-target.c | 7 ------- hw/core/cpu-system.c | 2 +- hw/display/vga.c | 2 +- hw/virtio/virtio.c | 2 +- system/memory.c | 1 + system/qtest.c | 1 + target-info.c | 5 +++++ 9 files changed, 19 insertions(+), 22 deletions(-) diff --git a/include/exec/tswap.h b/include/exec/tswap.h index 49511f26117..55ffa633598 100644 --- a/include/exec/tswap.h +++ b/include/exec/tswap.h @@ -9,18 +9,7 @@ #define TSWAP_H =20 #include "qemu/bswap.h" - -/** - * target_big_endian: - * Returns true if the (default) endianness of the target is big endian, - * false otherwise. Common code should normally never need to know about t= he - * endianness of the target, so please do *not* use this function unless y= ou - * know very well what you are doing! - */ -bool target_big_endian(void); -#ifdef COMPILING_PER_TARGET -#define target_big_endian() TARGET_BIG_ENDIAN -#endif +#include "qemu/target-info.h" =20 /* * If we're in target-specific code, we can hard-code the swapping diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h index dde0e7d968a..18a8c4ff6e8 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -38,4 +38,12 @@ const char *target_machine_typename(void); */ const char *target_cpu_type(void); =20 +/** + * target_big_endian: + * + * Returns: %true if the (default) endianness of the target is big endian, + * %false otherwise. + */ +bool target_big_endian(void); + #endif diff --git a/cpu-target.c b/cpu-target.c index 1c90a307593..20db5ff3108 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -22,7 +22,6 @@ #include "system/accel-ops.h" #include "system/cpus.h" #include "exec/cpu-common.h" -#include "exec/tswap.h" #include "exec/replay-core.h" #include "exec/log.h" #include "hw/core/cpu.h" @@ -85,9 +84,3 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...) #endif abort(); } - -#undef target_big_endian -bool target_big_endian(void) -{ - return TARGET_BIG_ENDIAN; -} diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 3c84176a0c5..a975405d3a0 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -24,7 +24,7 @@ #include "exec/cputlb.h" #include "system/memory.h" #include "exec/tb-flush.h" -#include "exec/tswap.h" +#include "qemu/target-info.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" #include "hw/core/sysemu-cpu-ops.h" diff --git a/hw/display/vga.c b/hw/display/vga.c index 20475ebbd31..90b89cf4044 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -26,7 +26,7 @@ #include "qemu/units.h" #include "system/reset.h" #include "qapi/error.h" -#include "exec/tswap.h" +#include "qemu/target-info.h" #include "hw/display/vga.h" #include "hw/i386/x86.h" #include "hw/pci/pci.h" diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 82a285a31d1..0f4d28033d7 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -20,7 +20,7 @@ #include "qemu/log.h" #include "qemu/main-loop.h" #include "qemu/module.h" -#include "exec/tswap.h" +#include "qemu/target-info.h" #include "qom/object_interfaces.h" #include "hw/core/cpu.h" #include "hw/virtio/virtio.h" diff --git a/system/memory.c b/system/memory.c index e8d9b15b28f..38da62f5052 100644 --- a/system/memory.c +++ b/system/memory.c @@ -22,6 +22,7 @@ #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/qemu-print.h" +#include "qemu/target-info.h" #include "qom/object.h" #include "trace.h" #include "system/ram_addr.h" diff --git a/system/qtest.c b/system/qtest.c index 301b03be2d3..fa42c9f9215 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -29,6 +29,7 @@ #include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/cutils.h" +#include "qemu/target-info.h" #include "qom/object_interfaces.h" =20 #define MAX_IRQ 256 diff --git a/target-info.c b/target-info.c index a756c0714c4..3110ab32f75 100644 --- a/target-info.c +++ b/target-info.c @@ -47,3 +47,8 @@ EndianMode target_endian_mode(void) { return target_info()->endianness; } + +bool target_big_endian(void) +{ + return target_endian_mode() =3D=3D ENDIAN_MODE_BIG; +} --=20 2.49.0 From nobody Sat Dec 13 22:49:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1752007822; cv=none; d=zohomail.com; s=zohoarc; b=RsxRcAuvCtlgiJkEZ+baTBQlITzUDqJLV/CRLVAuM52mIHwASc+su3/ji3ee328BJ51XKZmvSDtnZCaRbkiX+hOUR7Ru0DOGNh913dKYc4kQKYQaxoVqhJSwrR4TpXmdnzqjGYLH5YVWaT8nDV6tZM70LBmnMQCsRfVmhZGMO8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752007822; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RFonhSB51r1m9DRDPq3gxW3IKaSRsXZYDkC267ansE0=; b=P8mCcQ2FoAKZe8xmiZpIp7bW1Ogkdv6hP5/BiCQ5xLbNtxRuV4t6EFwIyu5XTjlBh7O+8eyOaDY4PsJ2v8BVOaWgp3awb/LinCg9H47/DR/6EkOQTgNCRkgjhYBcJ/ft9cZwFPCvCX7l5S6sN6O9l+ZBPrb5PEYXE23YeqGonkY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1752007822442144.80184496511094; Tue, 8 Jul 2025 13:50:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZFAc-0003jM-He; Tue, 08 Jul 2025 16:44:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uZDcz-0002x7-8N for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:06:00 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZDcv-00042K-0S for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:05:14 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-60bfcada295so7717927a12.1 for ; Tue, 08 Jul 2025 12:05:10 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-454cd44ffb9sm28311905e9.14.2025.07.08.10.22.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 10:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752001509; x=1752606309; darn=nongnu.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=RFonhSB51r1m9DRDPq3gxW3IKaSRsXZYDkC267ansE0=; b=yXG9H428JSmZWcNHQxA2a6A4b2mp0YutzM7BMh1DCKoV2z5eQzfA6fFbzOI81ZVoHN o7F0jw0QEb0Q/KrDLdoy+uom/YOqIf/L/d+MW3H1y52bw7dZG0+4UkklvZgo0gmlkuPS qgG9m/3Zvd2DW6jG2AlVn9vq8TgH3MKLdBC0mMxRzGTxnDT1Gx1+4mNCJwuyVPHVxyML XTDpuS2t5m3Y3XVq+hvfYbun5kYJkU/uzb828uj4p+KsithwZKxkZf2wEVxaxdRpnM2i QHcW8/9qsUz9PSXPluwJeKv6+IOgjPH1mcWY7EG6+1yu/qF9/8Z9hWDPnawPb5dk049e iTZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752001509; x=1752606309; 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=RFonhSB51r1m9DRDPq3gxW3IKaSRsXZYDkC267ansE0=; b=IDTaiHUT9hKINacUow96+UOPFIPx82B9HshN+FEqHn0F3LkY8cswjPtNfYCPMaCDDf NOsj+0F7N50aeNar8DtSvB2eKwq3pFD/nlGtAIRJUN+WJpuOLdr6wps/Qt9eK6J4K7Ep 9GxKIaQ3e1Rdrw5ak6PM/B/pf6BR8Z4cyGlmdVMmNvyWGPMNx/ADn4+eBS2LVtB+/EE+ uuQ9CnG/Pwa+Os+BxVH0atEt8qs2QV2qXXGjV+3qALnbfMu2nBuDrsWeOIxw+alnnpye G3tf7y1sVqQ9FRrvPVaRQ3cDJahe9O0yPrCmavfDf3MKn8gZF2dXZYzEBv+WhFdls4n5 N3Fw== X-Gm-Message-State: AOJu0YyOEanXt9B71RRFKarkJPYsRfJtfBvNJ57+XnHJ0FOOKjFaoZq+ xIIjFdp4KYyrv70lG4slLj25ALuhIHR8sDssVyh19WyTbkzfUelQ4uJ6v/TJQZkdwv1/fr6tgb/ OW/iy X-Gm-Gg: ASbGncuTsI0H2Ljy66WcmrNgERAYeW9DJDZTP80E3Z3mz5BUyAQOXX/8ctTxAFrDEHD jcZJWNLAFYwYE2PDdOnOT7nCkhHPFP/hdJmoNALbL28yc8q7JdOboS28SLdzqXGuCkapyf7gqfj jATKH+VBdwhdqdmBKAt6YRQlI8OjQy2ExHs6Wrq+v5mqo+tZ0Qbea5xYWbRyqp8V64RVcB174qy tIqP13GbVy63et6zw+LhX+0COf47TNgFb7eHUS41XCYsreau5m2Opm1j5mNzF4Ua5FjEvQReEyl A7a29eUCdTuhJKxICCwyN8kfJwvjoCs4YSJM3vxC60okFRLujLRti59No77WibvwoQXHW8etmQK fx+D1bSME3gHOlGRfAHpCJt2LmINyJFuC1jc7 X-Google-Smtp-Source: AGHT+IFEQ+Grn2rKXvnzGJpvoE1KkuW74qXxlvK4ke3uCqnSbhamEV2TgSUSqn/9QolpXsBttWVTuA== X-Received: by 2002:a05:6000:713:b0:3a4:f66a:9d31 with SMTP id ffacd0b85a97d-3b49701abf5mr13082687f8f.16.1751995380379; Tue, 08 Jul 2025 10:23:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Thomas Huth , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Pierrick Bouvier , "Michael S. Tsirkin" , qemu-riscv@nongnu.org, Richard Henderson , qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v7 6/8] gdbstub/helpers: Replace TARGET_BIG_ENDIAN -> target_big_endian() Date: Tue, 8 Jul 2025 19:19:46 +0200 Message-ID: <20250708171949.62500-7-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708171949.62500-1-philmd@linaro.org> References: <20250708171949.62500-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=philmd@linaro.org; helo=mail-ed1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752007823342116600 Check endianness at runtime to remove the target-specific TARGET_BIG_ENDIAN definition. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier --- include/gdbstub/helpers.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h index 6f7cc48adcb..1411b136d5c 100644 --- a/include/gdbstub/helpers.h +++ b/include/gdbstub/helpers.h @@ -16,6 +16,7 @@ #error "gdbstub helpers should only be included by target specific code" #endif =20 +#include "qemu/target-info.h" #include "exec/tswap.h" #include "cpu-param.h" =20 @@ -55,18 +56,14 @@ static inline int gdb_get_reg64(GByteArray *buf, uint64= _t val) static inline int gdb_get_reg128(GByteArray *buf, uint64_t val_hi, uint64_t val_lo) { + bool be =3D target_big_endian(); uint64_t to_quad; -#if TARGET_BIG_ENDIAN - to_quad =3D tswap64(val_hi); + + to_quad =3D tswap64(be ? val_hi : val_lo); g_byte_array_append(buf, (uint8_t *) &to_quad, 8); - to_quad =3D tswap64(val_lo); + to_quad =3D tswap64(be ? val_lo : val_hi); g_byte_array_append(buf, (uint8_t *) &to_quad, 8); -#else - to_quad =3D tswap64(val_lo); - g_byte_array_append(buf, (uint8_t *) &to_quad, 8); - to_quad =3D tswap64(val_hi); - g_byte_array_append(buf, (uint8_t *) &to_quad, 8); -#endif + return 16; } =20 --=20 2.49.0 From nobody Sat Dec 13 22:49:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1752010012; cv=none; d=zohomail.com; s=zohoarc; b=OqU0zvhzhcmGfwwlYmr8GmiokDSthJyWDRKQ64yqMOtJNcAdGWb4QSbs/5UQRZYs2mnDXC9qdJeXKEDBd800K3s2fNVN9coGbuG+kVcIb2OtfSllZSNWiKNL2XGYmSJxznnG8EZiwlD49r3xxQsJUUIW3b7hMg7eWECP39GJQYQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752010012; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rdBIXTavtg6pNFCK5VZLNyddFa1VV1Q1VDfkVeBkEjg=; b=A/I14PfZ8cVrKHgo/9fWIWScSnQIhFhXbEZF0CnSzYv0sjrupRqUPCwUi2KJ6slFjBn9BGe5n3wyAU5b3sLJhhT+uEORbTtpxNeOdfb9n+f2rXJ/A15V14ykmGCDEEgfVxN/KOjWDOWdn3v66ZnwldUxKQfg/7fHEd9l5XwffXk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1752010012752271.28098641713314; Tue, 8 Jul 2025 14:26:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZFDj-0003w9-20; Tue, 08 Jul 2025 16:47:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uZDnh-0004iu-Gn for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:16:25 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZDnd-0007Mk-6k for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:16:21 -0400 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-60c79bedc19so7421791a12.3 for ; Tue, 08 Jul 2025 12:16:16 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-454cd49379fsm27387165e9.25.2025.07.08.10.23.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 10:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752002175; x=1752606975; darn=nongnu.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=rdBIXTavtg6pNFCK5VZLNyddFa1VV1Q1VDfkVeBkEjg=; b=dzacxMQdeqGnAIOHtZcALSF6bW9SxQmWMdlfxoTFU7PyZbxhI59PVxKGbvzcBVGniw hEyhDO8+rQP21v6NMvAePYU2nbkCleUGxghIbhdMzJ8xApqhjEs6zyXRUh333H/dOatN OKFQhSaerBXC04z2I7+kbqrdMa3kojCCS7IAvLJoWx2fLkd/shgBy1WG4v2uUtUsfUvQ mYfTNOfNKzSCsN68sG+RZMI93lwDL/wz9dP/KEfotV1BhRjdSRpMOycMn2pUuA57x8fX F8z1l0WsoWSWYWJ07IOnwvPfs0LVeUHszVg0cjdVY200Vt3Q+zPYLfId/+YaKeBJ3U5j idRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752002175; x=1752606975; 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=rdBIXTavtg6pNFCK5VZLNyddFa1VV1Q1VDfkVeBkEjg=; b=ivqHesuX8M9vg+LTxZsIjpKPG7wOLsxiXqmj1b0kMy2vO3wC/Vlgalp68PjEQ/mIH/ XpH99c33N+xju+0S+LT809TBZMrlolPvxSbh+pEsOHtXbUNt5uak+UR3bbj0sHvkhMX0 vtMnmrZHxfpaD7AGuCIQB6YI9w3QHw4fjvxnvHUf5Y7bzVuCIho0f5aGKuMi7UuEOep5 WzDORejfPS0oXaVyeaaXD3f85fJYVHq/z+AnERyI7rVF9n4chwaEomQdWbCrAMQqk34y 2I3T1RkMepWopBQlQQdDQkJpW6aCGshU0aW2aKKkCMu8wTa+4OGGYe4mtlccwJU7h2sY Vlvw== X-Gm-Message-State: AOJu0YyFtkuhYfSbSBZvNtjbr6UEDXtYRcrMm/3kBCtXBHRrWxX+HYU/ BuSjGJI7bvwgJpifv1xaAOs8KjmEOwcOtsZ5cxnC9VRC+ZdmQaPq1HBaf0Bca40VtqarK6YcpVg slMzG X-Gm-Gg: ASbGncv/BXlefMrhYmqgZSzq8rg8PtR4ARuUThG++/ZSW89ycof8bRPAOFNRT+MBIol Bjus6QpYOBTanRlv3RvmemCRCtRPOVrYkIeCVFsmdn84yVlyBDdCV7NHN1AtEfU2sHyF3YEi6Ex MrAtlW0lEiO5X4I8Q5DUKtiYNDYuamghsvcJvudDnOzHssHg8mldbk9slsILPUDKqh09HCY73nL 3JZMIlBv2clzJqerjQgFGPSkHdsc+hDDaVMAIqDy8S9vIAMRTPPtHU01MWGSbDdscrVXgInpmkY 6aU6W9Q9x6ZTQRUMDqL86Hl5iXhYHXJx5nTH1vsPUG+eLPbF0U1t9ZuLpVeMzna5kh+zVldxdaN 9C5mEaeeU0eecCWLtkv88KM/KjVxsMu5xpmNCBxGPYyWnMDc= X-Google-Smtp-Source: AGHT+IFV+g34WvWk4fFmJMfbidxBMeG+bOyMg6P21RXF1+TrS4p4+WPGBBxZ3CcOWTROJtkYGu1rsw== X-Received: by 2002:a05:600c:8b6b:b0:454:ac20:d157 with SMTP id 5b1f17b1804b1-454b311616fmr201532255e9.30.1751995429336; Tue, 08 Jul 2025 10:23:49 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Thomas Huth , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Pierrick Bouvier , "Michael S. Tsirkin" , qemu-riscv@nongnu.org, Richard Henderson , qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Igor Mammedov , Ani Sinha , Peter Maydell , Beniamino Galvani , Strahinja Jankovic , Tyrone Ting , Hao Wu , John Snow , Kevin Wolf , Hanna Reitz , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Jonathan Cameron , Fan Ni , Helge Deller , Pavel Pisa , Francisco Iglesias , Vikram Garhwal , Jason Wang , Dmitry Fleytman , Aurelien Jarno , Nicholas Piggin , =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Barrat?= , Bernhard Beschow , Yoshinori Sato , Magnus Damm , Matthew Rosato , Eric Farman , Halil Pasic , Christian Borntraeger , David Hildenbrand , Ilya Leoshkevich , Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Alexander Graf , Phil Dennis-Jordan , Peter Xu , Riku Voipio , Eduardo Habkost , Zhao Liu , Alexandre Iooss , Mahmoud Mandour Subject: [PATCH-for-10.1 v7 7/8] qemu: Declare all load/store helper in 'qemu/bswap.h' Date: Tue, 8 Jul 2025 19:19:47 +0200 Message-ID: <20250708171949.62500-8-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708171949.62500-1-philmd@linaro.org> References: <20250708171949.62500-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=philmd@linaro.org; helo=mail-ed1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752010015846116600 Restrict "exec/tswap.h" to the tswap*() methods, move the load/store helpers with the other ones declared in "qemu/bswap.h". Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier --- include/exec/tswap.h | 70 -------------------------- include/qemu/bswap.h | 73 ++++++++++++++++++++++++++++ include/system/memory.h | 1 - include/user/abitypes.h | 1 - target/ppc/mmu-hash64.h | 2 - hw/acpi/bios-linker-loader.c | 2 - hw/arm/allwinner-r40.c | 1 - hw/arm/boot.c | 2 + hw/arm/npcm7xx.c | 2 +- hw/block/hd-geometry.c | 1 - hw/char/riscv_htif.c | 1 - hw/cxl/cxl-events.c | 2 - hw/display/artist.c | 1 + hw/display/ati.c | 1 + hw/net/can/ctucan_core.c | 1 - hw/net/lan9118.c | 1 + hw/net/rtl8139.c | 1 + hw/net/vmxnet3.c | 1 - hw/pci-host/gt64120.c | 1 + hw/pci-host/pnv_phb3.c | 1 + hw/pci-host/pnv_phb4.c | 1 + hw/pci-host/ppce500.c | 1 - hw/pci-host/sh_pci.c | 1 - hw/s390x/s390-pci-inst.c | 1 + hw/sensor/lsm303dlhc_mag.c | 1 - hw/smbios/smbios.c | 1 + hw/vfio/migration-multifd.c | 1 - hw/virtio/virtio-pci.c | 1 + hw/vmapple/virtio-blk.c | 1 - target/arm/cpu.c | 1 - target/i386/tcg/system/excp_helper.c | 1 - target/i386/xsave_helper.c | 1 - target/riscv/vector_helper.c | 1 - tests/tcg/plugins/mem.c | 1 + 34 files changed, 87 insertions(+), 93 deletions(-) diff --git a/include/exec/tswap.h b/include/exec/tswap.h index 55ffa633598..72219e2c431 100644 --- a/include/exec/tswap.h +++ b/include/exec/tswap.h @@ -69,74 +69,4 @@ static inline void tswap64s(uint64_t *s) } } =20 -/* Return ld{word}_{le,be}_p following target endianness. */ -#define LOAD_IMPL(word, args...) \ -do { \ - if (target_big_endian()) { \ - return glue(glue(ld, word), _be_p)(args); \ - } else { \ - return glue(glue(ld, word), _le_p)(args); \ - } \ -} while (0) - -static inline int lduw_p(const void *ptr) -{ - LOAD_IMPL(uw, ptr); -} - -static inline int ldsw_p(const void *ptr) -{ - LOAD_IMPL(sw, ptr); -} - -static inline int ldl_p(const void *ptr) -{ - LOAD_IMPL(l, ptr); -} - -static inline uint64_t ldq_p(const void *ptr) -{ - LOAD_IMPL(q, ptr); -} - -static inline uint64_t ldn_p(const void *ptr, int sz) -{ - LOAD_IMPL(n, ptr, sz); -} - -#undef LOAD_IMPL - -/* Call st{word}_{le,be}_p following target endianness. */ -#define STORE_IMPL(word, args...) \ -do { \ - if (target_big_endian()) { \ - glue(glue(st, word), _be_p)(args); \ - } else { \ - glue(glue(st, word), _le_p)(args); \ - } \ -} while (0) - - -static inline void stw_p(void *ptr, uint16_t v) -{ - STORE_IMPL(w, ptr, v); -} - -static inline void stl_p(void *ptr, uint32_t v) -{ - STORE_IMPL(l, ptr, v); -} - -static inline void stq_p(void *ptr, uint64_t v) -{ - STORE_IMPL(q, ptr, v); -} - -static inline void stn_p(void *ptr, int sz, uint64_t v) -{ - STORE_IMPL(n, ptr, sz, v); -} - -#undef STORE_IMPL - #endif /* TSWAP_H */ diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 9a117645360..39ba64046a6 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -1,6 +1,8 @@ #ifndef BSWAP_H #define BSWAP_H =20 +#include "qemu/target-info.h" + #undef bswap16 #define bswap16(_x) __builtin_bswap16(_x) #undef bswap32 @@ -432,4 +434,75 @@ DO_STN_LDN_P(be) #undef le_bswaps #undef be_bswaps =20 + +/* Return ld{word}_{le,be}_p following target endianness. */ +#define LOAD_IMPL(word, args...) \ +do { \ + if (target_big_endian()) { \ + return glue(glue(ld, word), _be_p)(args); \ + } else { \ + return glue(glue(ld, word), _le_p)(args); \ + } \ +} while (0) + +static inline int lduw_p(const void *ptr) +{ + LOAD_IMPL(uw, ptr); +} + +static inline int ldsw_p(const void *ptr) +{ + LOAD_IMPL(sw, ptr); +} + +static inline int ldl_p(const void *ptr) +{ + LOAD_IMPL(l, ptr); +} + +static inline uint64_t ldq_p(const void *ptr) +{ + LOAD_IMPL(q, ptr); +} + +static inline uint64_t ldn_p(const void *ptr, int sz) +{ + LOAD_IMPL(n, ptr, sz); +} + +#undef LOAD_IMPL + +/* Call st{word}_{le,be}_p following target endianness. */ +#define STORE_IMPL(word, args...) \ +do { \ + if (target_big_endian()) { \ + glue(glue(st, word), _be_p)(args); \ + } else { \ + glue(glue(st, word), _le_p)(args); \ + } \ +} while (0) + + +static inline void stw_p(void *ptr, uint16_t v) +{ + STORE_IMPL(w, ptr, v); +} + +static inline void stl_p(void *ptr, uint32_t v) +{ + STORE_IMPL(l, ptr, v); +} + +static inline void stq_p(void *ptr, uint64_t v) +{ + STORE_IMPL(q, ptr, v); +} + +static inline void stn_p(void *ptr, int sz, uint64_t v) +{ + STORE_IMPL(n, ptr, sz, v); +} + +#undef STORE_IMPL + #endif /* BSWAP_H */ diff --git a/include/system/memory.h b/include/system/memory.h index 46248d4a52c..3ba34d49ba3 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -19,7 +19,6 @@ #include "exec/memattrs.h" #include "exec/memop.h" #include "exec/ramlist.h" -#include "exec/tswap.h" #include "qemu/bswap.h" #include "qemu/queue.h" #include "qemu/int128.h" diff --git a/include/user/abitypes.h b/include/user/abitypes.h index 7528124b62f..be7a8765238 100644 --- a/include/user/abitypes.h +++ b/include/user/abitypes.h @@ -6,7 +6,6 @@ #endif =20 #include "exec/cpu-defs.h" -#include "exec/tswap.h" #include "user/tswap-target.h" =20 #ifdef TARGET_ABI32 diff --git a/target/ppc/mmu-hash64.h b/target/ppc/mmu-hash64.h index b8fb12a9705..ae8d4b37aed 100644 --- a/target/ppc/mmu-hash64.h +++ b/target/ppc/mmu-hash64.h @@ -1,8 +1,6 @@ #ifndef MMU_HASH64_H #define MMU_HASH64_H =20 -#include "exec/tswap.h" - #ifndef CONFIG_USER_ONLY =20 #ifdef TARGET_PPC64 diff --git a/hw/acpi/bios-linker-loader.c b/hw/acpi/bios-linker-loader.c index 108061828b1..c9ffe449aac 100644 --- a/hw/acpi/bios-linker-loader.c +++ b/hw/acpi/bios-linker-loader.c @@ -22,8 +22,6 @@ #include "hw/acpi/bios-linker-loader.h" #include "hw/nvram/fw_cfg.h" =20 -#include "qemu/bswap.h" - /* * Linker/loader is a paravirtualized interface that passes commands to gu= est. * The commands can be used to request guest to diff --git a/hw/arm/allwinner-r40.c b/hw/arm/allwinner-r40.c index 0bf700865c2..c8eda39957c 100644 --- a/hw/arm/allwinner-r40.c +++ b/hw/arm/allwinner-r40.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "qemu/bswap.h" #include "qemu/module.h" #include "qemu/units.h" #include "hw/boards.h" diff --git a/hw/arm/boot.c b/hw/arm/boot.c index becd827af13..d391cd01bb1 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -15,6 +15,7 @@ #include "hw/arm/boot.h" #include "hw/arm/linux-boot-if.h" #include "cpu.h" +#include "exec/tswap.h" #include "exec/target_page.h" #include "system/kvm.h" #include "system/tcg.h" @@ -29,6 +30,7 @@ #include "qemu/config-file.h" #include "qemu/option.h" #include "qemu/units.h" +#include "qemu/bswap.h" =20 /* Kernel boot protocol is specified in the kernel docs * Documentation/arm/Booting and Documentation/arm64/booting.txt diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c index 2f30c49df55..ecfae328a96 100644 --- a/hw/arm/npcm7xx.c +++ b/hw/arm/npcm7xx.c @@ -24,7 +24,7 @@ #include "hw/qdev-clock.h" #include "hw/qdev-properties.h" #include "qapi/error.h" -#include "qemu/bswap.h" +#include "exec/tswap.h" #include "qemu/units.h" #include "system/system.h" #include "target/arm/cpu-qom.h" diff --git a/hw/block/hd-geometry.c b/hw/block/hd-geometry.c index f3939e73f42..db221901cf4 100644 --- a/hw/block/hd-geometry.c +++ b/hw/block/hd-geometry.c @@ -33,7 +33,6 @@ #include "qemu/osdep.h" #include "system/block-backend.h" #include "qapi/qapi-types-block.h" -#include "qemu/bswap.h" #include "hw/block/block.h" #include "trace.h" =20 diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c index c884be5d757..a78ea9b01c0 100644 --- a/hw/char/riscv_htif.c +++ b/hw/char/riscv_htif.c @@ -29,7 +29,6 @@ #include "qemu/timer.h" #include "qemu/error-report.h" #include "system/address-spaces.h" -#include "exec/tswap.h" #include "system/dma.h" #include "system/runstate.h" #include "trace.h" diff --git a/hw/cxl/cxl-events.c b/hw/cxl/cxl-events.c index 12dee2e4675..f90470930d6 100644 --- a/hw/cxl/cxl-events.c +++ b/hw/cxl/cxl-events.c @@ -8,8 +8,6 @@ */ =20 #include "qemu/osdep.h" - -#include "qemu/bswap.h" #include "qemu/error-report.h" #include "hw/pci/msi.h" #include "hw/pci/msix.h" diff --git a/hw/display/artist.c b/hw/display/artist.c index 3fafc8a222b..3c884c92437 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -12,6 +12,7 @@ #include "qemu/log.h" #include "qemu/module.h" #include "qemu/units.h" +#include "qemu/bswap.h" #include "qapi/error.h" #include "hw/sysbus.h" #include "hw/loader.h" diff --git a/hw/display/ati.c b/hw/display/ati.c index 7de27732cdc..f7c0006a879 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -22,6 +22,7 @@ #include "vga-access.h" #include "hw/qdev-properties.h" #include "vga_regs.h" +#include "qemu/bswap.h" #include "qemu/log.h" #include "qemu/module.h" #include "qemu/error-report.h" diff --git a/hw/net/can/ctucan_core.c b/hw/net/can/ctucan_core.c index 17131a4e18f..6bd99c477b2 100644 --- a/hw/net/can/ctucan_core.c +++ b/hw/net/can/ctucan_core.c @@ -28,7 +28,6 @@ =20 #include "qemu/osdep.h" #include "qemu/log.h" -#include "qemu/bswap.h" #include "qemu/bitops.h" #include "hw/irq.h" #include "migration/vmstate.h" diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 6dda1e5c940..3017e129710 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -21,6 +21,7 @@ #include "hw/ptimer.h" #include "hw/qdev-properties.h" #include "qapi/error.h" +#include "qemu/bswap.h" #include "qemu/log.h" #include "qemu/module.h" #include /* for crc32 */ diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index 654a087d80a..324fb932aac 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -57,6 +57,7 @@ #include "system/dma.h" #include "qemu/module.h" #include "qemu/timer.h" +#include "qemu/bswap.h" #include "net/net.h" #include "net/eth.h" #include "system/system.h" diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 7c0ca56b7c0..af73aa8ef28 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -22,7 +22,6 @@ #include "net/tap.h" #include "net/checksum.h" #include "system/system.h" -#include "qemu/bswap.h" #include "qemu/log.h" #include "qemu/module.h" #include "hw/pci/msix.h" diff --git a/hw/pci-host/gt64120.c b/hw/pci-host/gt64120.c index b12a25696c4..b1d96f62fe9 100644 --- a/hw/pci-host/gt64120.c +++ b/hw/pci-host/gt64120.c @@ -28,6 +28,7 @@ #include "qapi/error.h" #include "qemu/units.h" #include "qemu/log.h" +#include "qemu/bswap.h" #include "hw/qdev-properties.h" #include "hw/registerfields.h" #include "hw/pci/pci_device.h" diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index a4335f44f22..5d8383fac30 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" #include "qemu/log.h" +#include "qemu/bswap.h" #include "qapi/visitor.h" #include "qapi/error.h" #include "hw/pci-host/pnv_phb3_regs.h" diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 77ea35299d3..18992054e83 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" #include "qemu/log.h" +#include "qemu/bswap.h" #include "qapi/visitor.h" #include "qapi/error.h" #include "target/ppc/cpu.h" diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c index 52269b05bb1..975d191ccb8 100644 --- a/hw/pci-host/ppce500.c +++ b/hw/pci-host/ppce500.c @@ -20,7 +20,6 @@ #include "migration/vmstate.h" #include "hw/pci/pci_device.h" #include "hw/pci/pci_host.h" -#include "qemu/bswap.h" #include "hw/pci-host/ppce500.h" #include "qom/object.h" =20 diff --git a/hw/pci-host/sh_pci.c b/hw/pci-host/sh_pci.c index de8f6a84aab..62fb945075f 100644 --- a/hw/pci-host/sh_pci.c +++ b/hw/pci-host/sh_pci.c @@ -28,7 +28,6 @@ #include "hw/irq.h" #include "hw/pci/pci_device.h" #include "hw/pci/pci_host.h" -#include "qemu/bswap.h" #include "qemu/module.h" #include "qom/object.h" =20 diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index b5dddb22b84..a3bb5aa2216 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -16,6 +16,7 @@ #include "exec/target_page.h" #include "system/memory.h" #include "qemu/error-report.h" +#include "qemu/bswap.h" #include "system/hw_accel.h" #include "hw/boards.h" #include "hw/pci/pci_device.h" diff --git a/hw/sensor/lsm303dlhc_mag.c b/hw/sensor/lsm303dlhc_mag.c index f9e501da840..cd5773ae64e 100644 --- a/hw/sensor/lsm303dlhc_mag.c +++ b/hw/sensor/lsm303dlhc_mag.c @@ -28,7 +28,6 @@ #include "qapi/visitor.h" #include "qemu/module.h" #include "qemu/log.h" -#include "qemu/bswap.h" =20 enum LSM303DLHCMagReg { LSM303DLHC_MAG_REG_CRA =3D 0x00, diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index ad4cd6721e6..1ac063cfb4b 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -17,6 +17,7 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/bswap.h" #include "qapi/error.h" #include "qemu/config-file.h" #include "qemu/module.h" diff --git a/hw/vfio/migration-multifd.c b/hw/vfio/migration-multifd.c index 850a3194887..69e57833dbd 100644 --- a/hw/vfio/migration-multifd.c +++ b/hw/vfio/migration-multifd.c @@ -13,7 +13,6 @@ #include "hw/vfio/vfio-device.h" #include "migration/misc.h" #include "qapi/error.h" -#include "qemu/bswap.h" #include "qemu/error-report.h" #include "qemu/lockable.h" #include "qemu/main-loop.h" diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index fba2372c93b..767216d7959 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -30,6 +30,7 @@ #include "qemu/error-report.h" #include "qemu/log.h" #include "qemu/module.h" +#include "qemu/bswap.h" #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "hw/loader.h" diff --git a/hw/vmapple/virtio-blk.c b/hw/vmapple/virtio-blk.c index 532b5649ab7..9de9aaae0bf 100644 --- a/hw/vmapple/virtio-blk.c +++ b/hw/vmapple/virtio-blk.c @@ -19,7 +19,6 @@ #include "hw/vmapple/vmapple.h" #include "hw/virtio/virtio-blk.h" #include "hw/virtio/virtio-pci.h" -#include "qemu/bswap.h" #include "qemu/log.h" #include "qemu/module.h" #include "qapi/error.h" diff --git a/target/arm/cpu.c b/target/arm/cpu.c index ebac86f70d3..baaa13aed6d 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -23,7 +23,6 @@ #include "qemu/timer.h" #include "qemu/log.h" #include "exec/page-vary.h" -#include "exec/tswap.h" #include "target/arm/idau.h" #include "qemu/module.h" #include "qapi/error.h" diff --git a/target/i386/tcg/system/excp_helper.c b/target/i386/tcg/system/= excp_helper.c index c1626215877..50040f6fcaf 100644 --- a/target/i386/tcg/system/excp_helper.c +++ b/target/i386/tcg/system/excp_helper.c @@ -25,7 +25,6 @@ #include "exec/page-protection.h" #include "exec/target_page.h" #include "exec/tlb-flags.h" -#include "exec/tswap.h" #include "tcg/helper-tcg.h" =20 typedef struct TranslateParams { diff --git a/target/i386/xsave_helper.c b/target/i386/xsave_helper.c index 24ab7be8e9a..996e9f3bfef 100644 --- a/target/i386/xsave_helper.c +++ b/target/i386/xsave_helper.c @@ -5,7 +5,6 @@ #include "qemu/osdep.h" =20 #include "cpu.h" -#include "exec/tswap.h" =20 void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen) { diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index b41c29da0be..7c67d67a13f 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -27,7 +27,6 @@ #include "exec/helper-proto.h" #include "exec/tlb-flags.h" #include "exec/target_page.h" -#include "exec/tswap.h" #include "fpu/softfloat.h" #include "tcg/tcg-gvec-desc.h" #include "internals.h" diff --git a/tests/tcg/plugins/mem.c b/tests/tcg/plugins/mem.c index ca4e8883dd2..9649bce99ca 100644 --- a/tests/tcg/plugins/mem.c +++ b/tests/tcg/plugins/mem.c @@ -20,6 +20,7 @@ * few things provided by compiler.h. */ #include +#include #include #include =20 --=20 2.49.0 From nobody Sat Dec 13 22:49:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1752008014; cv=none; d=zohomail.com; s=zohoarc; b=dW5Yc8AhNv+KeLtaox1eNBTRzzjErNxrUGWUAonkvOwquQ2BjXfk1NyS8xit1l0OXNfYn8AzgeYECKJWQqktQKbHaWqt+sAVUy4uxVzpfXdymuyD9orrAPndIjKECmS195ATaj3QwOP9ZYWJJwuscUv8RTphkbP3HcCNBmBUt/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752008014; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bEOImi2VO3DZu8PRd+W9Z97+V53/R1U1vvMpOETczLE=; b=G50VNzyGpn5dYmh+JNri7JbXCMyrr9/jQ2vTTpDLqO2GGt3tak+IUL/snLK9nd82Hpr6jtSLAeLTOTD/G1wXUUHoVBHEx3MY+t/m67S/Y7ORDZFI7lKo1Awehqvr7QQZUlwLiZZ+Q1xrBNyW1TTsj0mEeKFgdRBrNTYBKStQ8l0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175200801417892.37926044373182; Tue, 8 Jul 2025 13:53:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZFAa-0003eD-Td; Tue, 08 Jul 2025 16:44:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uZDcq-0002pK-VE for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:06:00 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZDcm-0003zK-WE for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:05:08 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-450ce3a2dd5so44277575e9.3 for ; Tue, 08 Jul 2025 12:05:04 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b471b966c0sm13781596f8f.52.2025.07.08.10.23.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 10:24:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752001503; x=1752606303; darn=nongnu.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=bEOImi2VO3DZu8PRd+W9Z97+V53/R1U1vvMpOETczLE=; b=Q8uYeK59UYKbSkk/ovK4Q7WRJi//1Q5thWcvPH3Hywf0LPt3Ts2zHgK2IJe+7nsT3H oXlltmS4lLuzg3ghXFVZ8tGTYG2RWZsoINrrc7rBHsUHQf+b5I9mQ6RjHb2pHfhb0GnI w0fSYTyuwfFiiQpxi48XT99zs0yDnr0bmVkb+ZCANYeAtru+xy8prpIQ+olh3aKCCIa7 CFafuL5/Vk6XXmpwY06nt0JOaMfH/PbrZ7Pu9zSRUGupDQhfbpXcCbs00RdsIzMMNMQe LqePtlffqwcPCSx/tAWaA4mI0CejkR6ek2ukEt/9lFep8HITLhpmBgXQfpRfA/MMXiD8 6m0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752001503; x=1752606303; 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=bEOImi2VO3DZu8PRd+W9Z97+V53/R1U1vvMpOETczLE=; b=d3yv82V86r6FnWBXLNx8o2iVcX1o6Jo8SEmSJYlRt0gfvZIvwM7RdUDRa4v1H9cumh 2iDuZWYZgisf6SIWhBn8Q5ppa0WUGQuYCrYxM2owZ9zSm1MIKrD/yhSEpS3uOZyuvLE3 Wx+2marwlMX2Rq5xLtUPZJShgV32S4rYhFkifbesL82fUkDMXzFPZfzlvSmD8uINLMj4 BIxSgtaOnxVen07SzVefWkhN/pdSTUgcFpSNq4E0BPFDaQM1Dc+YsaObIX2HiknYYuNv n1hmkRTFWHtQGiM2p2A9aBFOINvt4fDN/0wNwvDsOwHW+qDd84988VzTbecdduiwtsob vVZw== X-Gm-Message-State: AOJu0YzsyXRfF5WlSBpaMXQAJY5TaErFQWSEwwPfFrzZcOA4ugQIbtNa f9i+nrrS6lmAgVWlJer6FXCGXs5iF3iOiypyaTwsxuRHTRIHPJIzmM0hE+meSRrZg3LmHE1Ickm FsdW0 X-Gm-Gg: ASbGncspw6GeU3GWmMStSXlEZOkv+ZutPrzgwnLgxzD4l/qliCWFTZR/yrMApppIWdC c1FULHF0r5cj3T+A1pWNkme7MFn2lZ6qk60C+BYPODZApZwLsYWhKLZiyGBBnCJo66roh1zVlEd UfBaUnLp4F+9lQyec2NpUP24z0Hf0P/sfx6dBAx1tWSJi1bYR9Ni+Z8XpkeoyzZPvZkuiNji+qd fvMdiYgdEwGEOQR6p+pRX9UPCki1NqgzufSsk8GkW/59EV6Aw1KENScMWA2dvBfUsDSxcnWEtdZ JGSbrcIamGMfM6ChhLaxZLJw/hW6mR6lkh8u2rO68Ona7vbKjUi4f7xW0C08WaFu1EeQk9UFeBj M+po8IrTIYwIGhK4xwg3jYmRunoxsPnrDP+nV X-Google-Smtp-Source: AGHT+IG2E4JIlXfdQQvRjce8IXIvZNIOOF5rgjcL1X02SY3IwGdbbfoCXCdaMg6vCkSGBjZ9LVYmXg== X-Received: by 2002:a05:6000:2c06:b0:3a4:f2ed:217e with SMTP id ffacd0b85a97d-3b49702e79emr12971492f8f.42.1751995451388; Tue, 08 Jul 2025 10:24:11 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Thomas Huth , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Pierrick Bouvier , "Michael S. Tsirkin" , qemu-riscv@nongnu.org, Richard Henderson , qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Hanna Reitz Subject: [PATCH-for-10.1? v7 8/8] hw/virtio: Build various files once Date: Tue, 8 Jul 2025 19:19:48 +0200 Message-ID: <20250708171949.62500-9-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708171949.62500-1-philmd@linaro.org> References: <20250708171949.62500-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752008015533116600 Now that various VirtIO files don't use target specific API anymore, we can move them to the system_ss[] source set to build them once. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Manos Pitsidianakis Reviewed-by: Pierrick Bouvier --- MST prefers to defer this one to 10.2. hw/virtio/virtio-config-io.c | 1 - hw/block/meson.build | 6 ++++-- hw/virtio/meson.build | 20 +++++++++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/hw/virtio/virtio-config-io.c b/hw/virtio/virtio-config-io.c index ad78e0b9bc5..f58d90b6e31 100644 --- a/hw/virtio/virtio-config-io.c +++ b/hw/virtio/virtio-config-io.c @@ -11,7 +11,6 @@ =20 #include "qemu/osdep.h" #include "hw/virtio/virtio.h" -#include "cpu.h" =20 uint32_t virtio_config_readb(VirtIODevice *vdev, uint32_t addr) { diff --git a/hw/block/meson.build b/hw/block/meson.build index 655704471a5..43ed296cf47 100644 --- a/hw/block/meson.build +++ b/hw/block/meson.build @@ -13,7 +13,9 @@ system_ss.add(when: 'CONFIG_SSI_M25P80', if_true: files('= m25p80_sfdp.c')) system_ss.add(when: 'CONFIG_SWIM', if_true: files('swim.c')) system_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xen-block.c')) =20 -specific_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk.c', = 'virtio-blk-common.c')) -specific_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-= blk.c', 'virtio-blk-common.c')) +specific_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk.c')) +system_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk-common= .c')) +specific_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-= blk.c')) +system_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('virtio-blk-co= mmon.c')) =20 subdir('dataplane') diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 164f6fd995a..3ea7b3cec83 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -1,6 +1,7 @@ system_virtio_ss =3D ss.source_set() system_virtio_ss.add(files('virtio-bus.c')) system_virtio_ss.add(files('iothread-vq-mapping.c')) +system_virtio_ss.add(files('virtio-config-io.c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('virtio-pci= .c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mm= io.c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-= crypto.c')) @@ -10,11 +11,11 @@ system_virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_= true: files('vdpa-dev.c') =20 specific_virtio_ss =3D ss.source_set() specific_virtio_ss.add(files('virtio.c')) -specific_virtio_ss.add(files('virtio-config-io.c', 'virtio-qmp.c')) +specific_virtio_ss.add(files('virtio-qmp.c')) =20 if have_vhost system_virtio_ss.add(files('vhost.c')) - specific_virtio_ss.add(files('vhost-backend.c', 'vhost-iova-tree.c')) + system_virtio_ss.add(files('vhost-backend.c', 'vhost-iova-tree.c')) if have_vhost_user # fixme - this really should be generic specific_virtio_ss.add(files('vhost-user.c')) @@ -43,22 +44,22 @@ if have_vhost endif if have_vhost_vdpa system_virtio_ss.add(files('vhost-vdpa.c')) - specific_virtio_ss.add(files('vhost-shadow-virtqueue.c')) + system_virtio_ss.add(files('vhost-shadow-virtqueue.c')) endif else system_virtio_ss.add(files('vhost-stub.c')) endif +system_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhos= t-user-vsock.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng= .c')) =20 specific_virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virt= io-balloon.c')) specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost= -user-fs.c')) specific_virtio_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-= pmem.c')) specific_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-v= sock.c')) -specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vh= ost-user-vsock.c')) -specific_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-r= ng.c')) -specific_virtio_ss.add(when: 'CONFIG_VIRTIO_NSM', if_true: [files('virtio-= nsm.c', 'cbor-helpers.c'), libcbor]) specific_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-m= em.c')) -specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_SCMI', if_true: files('vho= st-user-scmi.c')) -specific_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SCMI= '], if_true: files('vhost-user-scmi-pci.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_NSM', if_true: files('virtio-nsm= .c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_NSM', if_true: [files('cbor-help= ers.c'), libcbor]) +system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SCMI', if_true: files('vhost= -user-scmi.c')) =20 virtio_pci_ss =3D ss.source_set() virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-= pci.c')) @@ -67,6 +68,7 @@ virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true:= files('vhost-user-blk- virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_SCSI', if_true: files('vhost-us= er-scsi-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_SCSI', if_true: files('vhost-scsi-pc= i.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user= -fs-pci.c')) +virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_SCMI', if_true: files('vhost-us= er-scmi-pci.c')) =20 virtio_pci_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-cry= pto-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_INPUT_HOST', if_true: files('virtio= -input-host-pci.c')) @@ -85,7 +87,7 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: fil= es('virtio-mem-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev-= pci.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MD', if_true: files('virtio-md-pci.= c')) =20 -specific_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_= ss) +system_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss) =20 system_ss.add_all(when: 'CONFIG_VIRTIO', if_true: system_virtio_ss) system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c')) --=20 2.49.0