From nobody Sun Dec 14 01:39:50 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=1752012769; cv=none; d=zohomail.com; s=zohoarc; b=WSOxMK74I1HqDZRgKdlfLz9UqD7B/j7loKfMX+5IwTWYZRGe+TYb/MyjVCZmL23SxAN7puEK8wRWf3TXoX797RtO7dt6AbqtLt2KT/wbHdHy5BVlX2grGjFC5zttM4MWxeQrSEG0WXD6iMPROXMDHr9zdjoc8BH2IDyhDJDCzrM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752012769; 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=91kh8gM7bE1DvG8K9EhiXTHWKL7JzNJQDQuB0S1EOTc=; b=ghRSoY6viuUbtk6vVJIZmyUWA4H+9cYO9j/wS1R0UOLJK9YXz26Okqq7m7HUjyb6Tl5TnP47ZgPGpkkYjzI+AtJSFNmIF4TPMNDvBKdWN1n0YOw2rIG7allxKe/hsk8//gpv0USRzKQ9YZbzJw+wZU6VC/mweo6kN4Y8m2biOiw= 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 1752012769848143.23881449557757; Tue, 8 Jul 2025 15:12:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZGY1-0003Hc-9m; Tue, 08 Jul 2025 18:12:21 -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 1uZGFn-0000UF-RX for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:31 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZGFk-0003I3-Q1 for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:31 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-451d7b50815so41094315e9.2 for ; Tue, 08 Jul 2025 14:53:28 -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-454d5070691sm732755e9.29.2025.07.08.14.53.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 14:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752011607; x=1752616407; 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=91kh8gM7bE1DvG8K9EhiXTHWKL7JzNJQDQuB0S1EOTc=; b=IHUFDqXCfKJXgCFnMt7oJMBpvCNJJomYd7DKtkg1/6h9DVjgKHlmbKaoyIrcDi/8O7 RIbBlK3xbDzhbCMPfKG9Q+EPI+Em/jme5e0UqLd+G9u1t32l92jZ1ar47d+irypcNgX7 PlcMv78vFoN18+5hif4gBLRq0USuUe8ZXvtdcr4ocqaJLqMmLcBiHbGXEFRbvV6EFocO BaOU99A4iNqmvxDTDmCLsZ1CeAmooecPnS0V63H7oCUdKLtY5sY6MG6pdQyzetywYUp8 iaguY5kllyuX6HB1MnhkNLl85w1YubTGv9NyYWPo3e4Whty03Us7mf37jXAW0gzz87jC +Txg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752011607; x=1752616407; 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=91kh8gM7bE1DvG8K9EhiXTHWKL7JzNJQDQuB0S1EOTc=; b=lKeY7PrsDrAy76rTdL8LUedl/aEs8wGAOcQF91v9gFonW32GQBA/QLSSsvL4kh6IgW zJH4mV3JKoAFFvIWsBtGnY6m75amOvobeqqR9JQ0YYBOKdmTPAJY06rAwaMeBIm5H2H0 5RWD9gI/oCBFE3/jdgBOPVK5JB/eUwzg9oMlsbL/ufO9ZtPunxQeKRYUx2SxenFAuWJm VBxMehieGdQNLX3pMVCPiP47tA3uFkpYhBjG1//oZk822eZNCoEBXZH8SP42zaejfuig 8OS58MBec+9pSe4h2uLiKvBgsfF8yIcoPrvSxSpiG+kua9QWCHnbfG+3FJnBmzxTKfiz L1VQ== X-Gm-Message-State: AOJu0YzCNxhf7ySpPkhuBik28bm99cWxigyExHsevRQl7f7UT8u6H6Ib 7xSoqFtuQ/PRxeK0QOF2dHOOMAAF8w9tWemi37fLIbwfv5SxFb0t2RcRI1PfedGG7fADG5NkWsa 9ssWW X-Gm-Gg: ASbGnctM1gYw9GKm199KIglqq9tJbrftvf5UxfoXZYRS4U/KwiPg3Jmt3I0g4sk41Id WUj6uQmpy2+EcCW1ioEM4CVswTuBveXBwvB+RdNWhyth+L8M2fdE2x6EiKSI+J7UDjLGoA4vAhe HyzQyO1EwGtqRx/ZUnf9AdO9u8+k2PyWwLiPDnA9Qf+ZRMnTpzqK5LiSqCh6zX0dZpu+FLmmiJM PSScrf3bK84u3Mpl6ECKHG+7Aln7NmuqYAuvL2wBpmQFDwWGan7SFvEbiceBjVIv0kP2q/AGLXe ZSwyE/fgdywK+93xsTf7l5jEa9YtvbSnPslrsNv4L/IrAzmFnBApz1FSiZXg1Dokux6hbBDha7G KNiGD18i7eADjOlRllqdGp6Mqc7SjyN/2twqwUbGlhg== X-Google-Smtp-Source: AGHT+IEKeaIf8ydwFxaC7CzcMoJiykZ7tpJY4NEy7E6eR7UMiSfrgE10xDZswu4cPQ2P+J+t+Kl90Q== X-Received: by 2002:a05:600c:4452:b0:450:d012:df85 with SMTP id 5b1f17b1804b1-454b5d08af0mr194483995e9.18.1752011607002; Tue, 08 Jul 2025 14:53:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Pierrick Bouvier , Thomas Huth , qemu-riscv@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , "Michael S. Tsirkin" , qemu-block@nongnu.org, qemu-arm@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 RESEND v8 1/8] target/qmp: Use target_cpu_type() Date: Tue, 8 Jul 2025 23:53:12 +0200 Message-ID: <20250708215320.70426-2-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708215320.70426-1-philmd@linaro.org> References: <20250708215320.70426-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::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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: 1752012772079116600 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 Sun Dec 14 01:39:50 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=1752012578; cv=none; d=zohomail.com; s=zohoarc; b=bLTAUkaxibL2gfRemBHH9D1cfPIakG51PI4mZRnF/uJV8s1cMTuj4bWzgTGEkH3aQn0/Mqz1o0SkV+MPB+t8xC08untnTckrd5LTumIRKbuHSnaKjpjAyy5aHqHlr0QrX8l0Cp+kBN9G5zzph21ht+qRezicrJAB5lk1JLIvMXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752012578; 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=ulkx3Q5KroTiu66enU0LDbqVfAkkR9CFQ9rrQaIZwyo=; b=YBDAl5ERJKxm2+yeBPCyXtXWDCmz+PvCF6mqJ7Iq0dxChzmIG6Nz2O+d9LyT4Z7bKeTKBd+d1jK4Vf9dVe/l5jd1GRj9qjJBOpt45us6ULpMEn0kPfQOPIHJK6PweRSQ4dMn5WmBrgk3RzOBz3/sGfUMbex+DHX2mwaIlsVS6Qo= 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 1752012578233565.7047305088402; Tue, 8 Jul 2025 15:09:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZGVC-0002LG-Ot; Tue, 08 Jul 2025 18:09:27 -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 1uZGFs-0000fE-Jt for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:36 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZGFp-0003JS-LO for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:36 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-45363645a8eso34453145e9.1 for ; Tue, 08 Jul 2025 14:53:33 -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-3b47285c9f9sm14231973f8f.93.2025.07.08.14.53.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 14:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752011612; x=1752616412; 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=ulkx3Q5KroTiu66enU0LDbqVfAkkR9CFQ9rrQaIZwyo=; b=YXUFZUu4eXxSK9LTaUhjcuu+zooO9X12Z/TUDK4IDR5EmuYL+PPACDDhOSnkxovAsb 7mjcZODQDjlMuX1CJcMS9QPSznB7K9YjlwqsMP0WyJ0nP5yLgzMwVpGr5t8RocfR+kCf nlsNAfmGr/BErm5SmfXcEXmO61zPuj0fOGOZXB29z5g15a9X7Ip7x5ru/W5v4QCLbAHv 85DiF/Ial/gEGs8iQf/GKYhzX+vMxGBUXd6X8y9Xu5s3yA3kTq+gtpTj3tHK4/6fV02w zK3qC/hVVLRzAiquB2uUHWDurDSx9SudGdFE1NWrw5eJSCavd2WFDjOHpRD/taAfkjzq ciTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752011612; x=1752616412; 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=ulkx3Q5KroTiu66enU0LDbqVfAkkR9CFQ9rrQaIZwyo=; b=YUQkKesfGAPnUyWe5v/x7ch3klWMQ0s/C8NgLb4N6rA22+hImTnBbMrzxEp1Dy4uDW w3+fSDn7I3ySu5CavhWgvCwQ6bNih3mb3IhJ9M5u0qoOYGgY20twcOUD0oUMZlVx2vHL +MZj136032OWe10mtZEVKr4Mp7vqXOJO77q5AS6KagYPArg95exD1WM8fhI/3KLJ5ARH DUdXAzMcgf5hcPdRhxklzP9cMVWdN1+yNR/HXEdMQbD0Cz7Del4BEZWvVQzb713xULHA WL/P8lecKD0iG6xAQ/0d1paUDjpaAgx23fyKfQk2DAzPW6EqeushksZk7dViiVDqZ5yk v4TA== X-Gm-Message-State: AOJu0YwG/lXCHJHXUVqKaSQaWAK5WVkZtoxE5KaTbayNjWRoipdZSNf7 BqPmoZ6VkH5F5Ri5OyZYh+oBUsEPAyGb+PTdftZTZqxMGmk9xwfS1Fx+VO9E/RyEhpOOKSoTWZ/ uRZNs X-Gm-Gg: ASbGncvd4DPc/TIjE1mr05JivQzY4OZPnrukGXbRVexifhQ5I0DcyQXJ63PmJJ0FSkm OgNbmI9Ag4YCrRMz7hemAnEoaOfwFzNBMd5jDYE6uGhO7wmMlIQTFuyfvdCQ1dh4GFnxVrVfKAw DY9JeNAZR65FpeVOtQOevCuVNFvbEl/kcoxUqaUW5iCOSQDS6Skb5Nm9COtErT+5ObWhExHFNSu mH9DGEenjae3VhMA2g3rv2Vt1IYH5re6DreLOIVFvB02YCWMyWp4260Jq8TrdAo+ePTOeLHjKAc 2j2TXUtRpvFRPKa5yhazsWXXySlwdPRlmCLyIIpii1i08kYJ/rqx9otYE5Ye1n74oX7GLJ4hX+r 0bttGD/lGmlFAXumyMBI7c7WE1JFn0ARX/Jscl4wH9w== X-Google-Smtp-Source: AGHT+IH8OH7XAiQSqNzM/QS/p5Dh4S9WqsdBq0wqNadTp3JEBu2Z/Zy2qBF4g9jMlLss+j+3c8l1Jg== X-Received: by 2002:a05:600c:8b57:b0:450:cfcb:5c9b with SMTP id 5b1f17b1804b1-454d52f4e4fmr26845e9.1.1752011611852; Tue, 08 Jul 2025 14:53:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Pierrick Bouvier , Thomas Huth , qemu-riscv@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , "Michael S. Tsirkin" , qemu-block@nongnu.org, qemu-arm@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 RESEND v8 2/8] qemu/target-info: Factor target_arch() out Date: Tue, 8 Jul 2025 23:53:13 +0200 Message-ID: <20250708215320.70426-3-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708215320.70426-1-philmd@linaro.org> References: <20250708215320.70426-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::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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: 1752012579668116600 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..a337c867bfb --- /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 (e.g. 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 Sun Dec 14 01:39:50 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=1752012716; cv=none; d=zohomail.com; s=zohoarc; b=G1hcSQdUfgtYEx8E5Qk1x16ISyniGGQUsRZyj9P/22aCE5ZfKHph4Lk38xYXAUt8z5zI9idWv6tTJVbzrVWT6QQF8k5NoJCYHUeAg6dq2xBQb8rz9HgFiSVDSkg5aVYwZGfl4hwVgMrzNyhsA569y6pp5pNOK8VDs7xuhk0Oyc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752012716; 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=KQ7EZXT9CO2OHBTy9GyeX1UKDvNPuq/+5ZdKjXTN/Ns=; b=CvLwjgqRjebcRywB+Tdo97dNlW0plZxHns+lcdRZdNpmiFR95EPOqkoAxl0a+iYuP7awfxd7N57un4fC8o2GHGC2J1Usto6KJRHpwZrJ7vNQBtFircQI4ySy4nS3VAtGDKigJqejxTZTSkDrzFaIddlJVxYRhQiBEDsjsVPY16k= 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 1752012716674101.95182827491521; Tue, 8 Jul 2025 15:11:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZGW5-0005aS-BU; Tue, 08 Jul 2025 18:10:21 -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 1uZGFx-0000mE-SJ for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:42 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZGFv-0003L6-Ee for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:41 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-451d7b50815so41094995e9.2 for ; Tue, 08 Jul 2025 14:53:38 -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-454d508cbdesm703125e9.33.2025.07.08.14.53.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 14:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752011618; x=1752616418; 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=KQ7EZXT9CO2OHBTy9GyeX1UKDvNPuq/+5ZdKjXTN/Ns=; b=HSXBeo3GXKywL9wHq8Gvq4pNAxGuN2TnNHjsSfc9DzuCxfDCG/QGYvUp3oL60jQa7y U2wqewjsE83aA3q9w/oeEp1h4gQ82gzKr5SRby80FiEDuKYlNMRQyLx2Od01qPDvzuPx bcSu4aGlpmIkxx7T7rzYgcvppXqUSPMvaa8TyjSVdxENPQdEHBQ7WNv/8OzTO+pnzOuA 7HN7oX4DZL76j9xhX41DULjARL+F/N3XbEgDLvyhCQpRrlIP+H/GGOXaid9/+6I6QnUk 4TbsvzAQu3RQWvRNH6MlkXbEPOpb7IGs9a3pGQgXn6eGJyEXp2PwuchIHyHf4dBMte+P hw8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752011618; x=1752616418; 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=KQ7EZXT9CO2OHBTy9GyeX1UKDvNPuq/+5ZdKjXTN/Ns=; b=R4BR9HSiGtu1IYFXoIcTPqWgMp/lopn2HokWO5JMGiU3djz1f5mL1x9aHH2Dj1TpKf gJoBV3S/T54HJiYyb3gY7sHL3iJ4Di2pNjHNeERjs1S3qvuSGupe0fw3WAhBrs3DoDCx wmw/ftf7oLZiMdy2LYau3CAIrCZ1DiVXblBuseAp+HrLEgmDST6yD9ulTQAzI+50W84i Run9sxgjtIDTzkTjc/DNYv2IX6+6NbasYSFCVI5jLle3tVBmZyxdA2r0R6Kzo1U7QOIJ MG+1kLdgeMvRR7x7rfTZhrQrRj7zdTo8PYS+keWQcAWcBNCS1uya2Itw3SsPlC+LYLUN qK0Q== X-Gm-Message-State: AOJu0YzYIbJyyA1wi7Fjom4ulEd+q3I+/qkjacfdxF9RPSCKnmXVpCmV /doJWisQsAdFSU8KbjTBb6r/BzP6+k+TU/ChiKAavAX2nz0k57GIwBu5ZVkUmaX0ygFjFUD/KNh f0AR8 X-Gm-Gg: ASbGncsk/7g0xyvRyTKutU3gQ+jPZBx3ZMw3oaXuxD153xO/TMvB+dBcc/QQLc6HRxj P+OJzj8zXCs1yoBIRzc0qpaJMQiCruaOikJVpqgYd6xq4TNAoxahN+mzqnZvgEWnid7eLgrXSH8 KY8IVwD8Sg8RVPaufqQ5EvPmG+hMqoTkZOtYxKtGF2UetwhKLCk5TeuxDwHWpGHj1kVfj3O0WR4 8Y9Z1NLHVWGOxWBFcB/92h2gqLCP5bDL/H48dyhv1ZRw+UiZKIH6rvb02BMUeA/po6l1pgED0F5 y+a9z1bWU3cVce2y0FHWR3aiOJ4efkzilK5NptzAYFK9D7YvRnjN2wt5BmZEIwtFak3+f8BYHpc wMIDsPWAiDdM45KAmXnlCk4dA9RgMZ7mWc1sLKqhtxw== X-Google-Smtp-Source: AGHT+IH6LgiCiKP3S4x7k4EEXqGXeCKB1z+Qt1OoQC51l1ga4Ds5cTR1QEfJT4eN5CJVshZ3/iSHSw== X-Received: by 2002:a5d:64e7:0:b0:3a4:ddde:13e4 with SMTP id ffacd0b85a97d-3b4964ee263mr14146877f8f.58.1752011617528; Tue, 08 Jul 2025 14:53:37 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Pierrick Bouvier , Thomas Huth , qemu-riscv@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , "Michael S. Tsirkin" , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 RESEND v8 3/8] qemu/target-info: Add %target_arch field to TargetInfo Date: Tue, 8 Jul 2025 23:53:14 +0200 Message-ID: <20250708215320.70426-4-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708215320.70426-1-philmd@linaro.org> References: <20250708215320.70426-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::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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: 1752012717085116600 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 Sun Dec 14 01:39:50 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=1752012619; cv=none; d=zohomail.com; s=zohoarc; b=NNMMIxIGGFZqJNgndO9XcP/SJkcc68ZTMJ913/isHrzvk2WdjulbGPdc/uFWKZzpZPkdjK8NvC7yCIbnOY8pgP+XXJc0U6rb4WY5/8XB1Cs1kowwt+U11FRZeEYwKZfBPKB4SKMMHwRkqwR8Z8QJ+8fJEGhDuatiKEvusfMEASw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752012619; 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=raEYFujrRvjmCyFkmc4EZhoAqBaaMKjzPeGsgftBG6Y=; b=Xek7cl6nbbTnglZXiCbulcBBbiNMfsZ+3Kv2/rfgNTBTlvJ3PugCB+JTLp2FtX1cSINndQygftXhie26i/xL8sC2daHghF9NlK7s2SXUa3aam/5Mlfb7nHhunhdT1QMI1OFFbAwxJ7nNtfY9qnJR/t8t4ifAtgsi2pE2u13VuQ4= 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 175201261978699.06892719764039; Tue, 8 Jul 2025 15:10:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZGVn-0003xG-S0; Tue, 08 Jul 2025 18:10: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 1uZGG2-0000wg-Mc for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:47 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZGG0-0003ML-EH for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:46 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3a528243636so2886569f8f.3 for ; Tue, 08 Jul 2025 14:53:44 -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-454cdb31d21sm27771445e9.1.2025.07.08.14.53.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 14:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752011622; x=1752616422; 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=raEYFujrRvjmCyFkmc4EZhoAqBaaMKjzPeGsgftBG6Y=; b=BFfGfX3ZWjDUFrIk+h3877VYZUTuQrOsq3/kGhLG5IBPZErPkM9etSMvPavyeHO3Uv bYqg80cZRothckLbAo4AiUOohTNrUY01HKU/R+EpU1HlrzXIuvBsCeYDwCDrhi3vn6r/ x3BXuU1twALuSzDCNFnzUPbBRxReZx2pS5bsGK6QCHZUrHUkcvu85kVcoLGp6OcxM5ar yoGIw/RzvYEs4zrizuYaGrsCKIplke5OFoJZiZvWFjqRrl4qt4Y6Wzzi9SNVNc3+3SiW 5TPDAivX1vHoknCXElEVmYIZNbx5OUegE0LcWYlo2Guq217JMfDph+I5nKse9xxj4AGo csCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752011622; x=1752616422; 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=raEYFujrRvjmCyFkmc4EZhoAqBaaMKjzPeGsgftBG6Y=; b=vzsMdwPDVT7lojclnUf433bzvW0GeN0qGrOmiWuPKkImzHFyBWviO4xBnuqpGmq5Lg 99pAU4UT5oPCeSrQ4eOPC+GjBUx9odQwaUtBFzsgFP4oCop+SajI6OvGgGJTatAXkYo3 2/D74HVkEuzhH2qcib1ETYirkLdZBDQBLoI/Dk5kDM0C0E0FBlWuUFKNvS9VTO65+HZe 2a3dZDRbLmCf4D/xDH1DolNI8hlk/xlVYshnEM9P9ORpf7chZzcKzufcHXd2zjiEGWTK +uUB+Pzi8UOHlyzjJhtylMkg8zXtkRoAgboWK/ApvX4udINPh4gWeSv9uVpgJibenDlD N/+Q== X-Gm-Message-State: AOJu0Yzr76j5SWOtcINeQbEI6yER75tAlzWavpw59nUKW7q6PfiREuGz coKm1J2Ucu/E90Xs1/sYWZaixejubeCcf2/9wnMcStM2O+eeguajGd2M+5QO6MB3GKtJU+uWB2a OiCMi X-Gm-Gg: ASbGnctAr+YFOBUcQS6m2RVLfMIVP9HrbwVqZ4rF32YCb4suZy4dBD/rB2XEahn/ouV k6zu8yx6LR3nsiPjP8PXsVcUjWZM3InuCbLtAH4+7CzkMbRzCNIGH2jQnUl6+kb7JRTQtsfdMHt vmTtMx/ipU0bwVPcBDmg58JRjalqnZzI7Twxu0X3Bu6fpxCBBlQbbCrb4QK57JEIdeS0zp1Owq/ 5DJFteY4i4XT4a9E6/nSVtW7tpFywjxcWzpbz9wXmbEVO1XVML9PALkPSZgV0990/IALwmD4U3o gymaSq+ubDB3Ml81oBBPa8HDMjHoRFGk994CqMZW25l8cd8duIxo+uYiC+Sak6fU0vesUYlOpzZ xC2TWFavpt+KgBgjYmX1XWyrYAyD/BA5y6+pUV/k9XQ== X-Google-Smtp-Source: AGHT+IFBICwrTOKSAv/BrN5Pi3NIZ3nfqRGD8Pm3OdP4WVs03v47EGoWPVWm0JWrOshnYIlBJQIV4w== X-Received: by 2002:a05:6000:4716:b0:3a8:38b3:1aa1 with SMTP id ffacd0b85a97d-3b5ddecd002mr4301575f8f.27.1752011622408; Tue, 08 Jul 2025 14:53:42 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Pierrick Bouvier , Thomas Huth , qemu-riscv@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , "Michael S. Tsirkin" , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 RESEND v8 4/8] qemu/target-info: Add target_endian_mode() Date: Tue, 8 Jul 2025 23:53:15 +0200 Message-ID: <20250708215320.70426-5-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708215320.70426-1-philmd@linaro.org> References: <20250708215320.70426-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::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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: 1752012622195116600 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 a337c867bfb..d5ce0523238 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 (e.g. 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 Sun Dec 14 01:39:50 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=1752012812; cv=none; d=zohomail.com; s=zohoarc; b=GcNiQnEpBobwpvso/yQDR6iKV+7umEJsV6FAW1BRZqHoiVtYp9xYHD2KcDUFcgioG6xApsbsv+Qxd3XufjCmHEW0jfYKK24Pp25FHROmX7EBTx2aIXj1+4huTZsxmROY70hwXQf1DOTRLDvUdFMxtmi0LmsD9Igcn8U4goAHI4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752012812; 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=7IgGHEeRKsG0dre7n+N4g7EyPm5kGW3Qo9EDGG86lSM=; b=jD7mKl/EH0BzXQKOSyUOKceHE3N/XUr3A9FAoda0aq0y2CMZZ/H6o3B37Bjh4Maqir7ylK9cNDQf9mfRaimxjXFluDw3ESa6o6+AaGs86qMJZ0ZBiEnXV7ZWV1X07otFncnfRrgybKUFZOZDeheYNnOkJcNWzeH0KWtxXohYVqw= 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 1752012812179169.84229449792622; Tue, 8 Jul 2025 15:13:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZGYA-00041F-27; Tue, 08 Jul 2025 18:12:30 -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 1uZGG8-0001Ig-NC for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:52 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZGG6-0003Nx-06 for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:52 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-453647147c6so46495755e9.2 for ; Tue, 08 Jul 2025 14:53: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 5b1f17b1804b1-454d50503c4sm799795e9.11.2025.07.08.14.53.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 14:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752011628; x=1752616428; 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=7IgGHEeRKsG0dre7n+N4g7EyPm5kGW3Qo9EDGG86lSM=; b=vKdxD2lX7jUT9PuFe8dTvhnxcm5/i2F5FeRcLAu2IGEst5XqkIGROInKsB6wZX+6g0 zWPkN5sGhuEZGaJXgFAj+coSGGgH/YFt+rDhLrWR5VhS+ht+KsUEjt3iGPqrBkecVw+U cWwqNTNxaRlYTAORUbB4SM4+zSkVGFNyjBpUKzEJMM7MB0u5clhU175KrS+Y48ZlivFb IPI+yyF6a+oiP+jRpG8ecSbWOogDL6C8Bbq+N0eM0K3wwm3fZbmyGM+uaa6LAYVlhHzz xur9qM7aZepRgS3+YuTpIEOAGEzLyxq+F4QOxURDLh5lAMNPxsKEdsyYj8TEYOTim9Ua IOTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752011628; x=1752616428; 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=7IgGHEeRKsG0dre7n+N4g7EyPm5kGW3Qo9EDGG86lSM=; b=Hs7DKkd00epWZTE+zuPicsFlEKGMcedDuMhgp0V3o0qUFqkfMnMViI2oxDHSzIaTyu a5peQ+o6dtUvU0dCal5DYzqRS9SPApetWA4w7ndSAUrtn9CGTBlM0SpVZJRmQM+BbKN/ IS7oP3Qd6T3+DUF9tulTlX5As342hTzkgB8YxB4icUkHFr+Ds4mPot9gyWzfSr86t1pS nJEDBD5k7G7OoVYIJeyxgE0aQh1ahGgbctalyF6aAHaAXLzVQnVGIU0A9KNTSuSI3JeJ quXCVOHuU7XoIRjZ3c71oSC5O7sCfGGTYZub36j70Iw+iF6apjkzwlBE2jqQdYd0ti6R XLcg== X-Gm-Message-State: AOJu0YyhT7qnsxaw7Mf6DdH4+mHNIxlZf2oW9HUFCfAjlFXlj0s4025N 4XmoglRJKDH7sOM8UYKty6WESRS4oKIGuG+2VbyQ5o/Fki9fw/YjDzlv9HSPrjRSZA2xjaqhVZG 9mkRw X-Gm-Gg: ASbGncu938xae155ljKmIyFpCS+UydLluk1ir6E/CVsVsf8iv53u0ZJ6Y1eKGKjHdIH HQ9XiGWKEYJOlbGQPLGE5c+HkJVeGL9PJZR9ppxHqnMk/QWaPuMOadCtN7ZppE4L6JJXjeR+3S7 Mn8VAOZi8WhiUUquMMmKEUC67LY7ERdd9NpdvMq05SR727RqagrivQ2CI476+ZoqeXyy2oauSoi HpDxSHFzh9qMtgsqjk/a1x1CwiykZRoH608/X5xTTx6DgzTRUaitJUu87QciT2tIp/tYAo14dof 9L5fhSrehZpA9T1M4HzIG7YeHcjVgTwb3IL5AUQbnAJGu6fNYrBmxFizAL//JJtgI085w1j0swR czV/KHw6w7BtvpYFF0QTo9KOxnEfcOUe+Zb+IeJFhvQ== X-Google-Smtp-Source: AGHT+IFeaWgOKj7t5yQFnUIXH0oo7NKnJrFXSy/62Kfs+U7jSOYUVIQsEOfGc3tdvvFn67udLJCFFw== X-Received: by 2002:a05:600c:5020:b0:43d:300f:fa1d with SMTP id 5b1f17b1804b1-454d3695a62mr14601115e9.31.1752011627689; Tue, 08 Jul 2025 14:53:47 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Pierrick Bouvier , Thomas Huth , qemu-riscv@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , "Michael S. Tsirkin" , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Gerd Hoffmann , Peter Xu , David Hildenbrand , Fabiano Rosas , Laurent Vivier Subject: [PATCH-for-10.1 RESEND v8 5/8] qemu: Convert target_words_bigendian() to TargetInfo API Date: Tue, 8 Jul 2025 23:53:16 +0200 Message-ID: <20250708215320.70426-6-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708215320.70426-1-philmd@linaro.org> References: <20250708215320.70426-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::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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=ham 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: 1752012814287116600 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 | 12 ++++++++++++ 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, 23 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..abcf25db6fa 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -38,4 +38,16 @@ 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. + * + * 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_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 Sun Dec 14 01:39:50 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=1752012655; cv=none; d=zohomail.com; s=zohoarc; b=B997Ly2BCEsDUhmh8FwjU7Es+tXdTiwGbH5H4rUJdnWRdzV88dIC+WlYmByoSnAuPx3yLEGxAY1va5dO83CltRdS12t8sn9w23OF2BVDIwYH09bB06f+UsSZGk//e05OhaTfizOhII0ELQUCC6iVa5B8AYMPTXfxrrd9H/fTjUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752012655; 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=oxnjh/X694j9j3b/2Ng5oDJDQQ9fFb9s5F3xkMYnYD8=; b=JiewxH1JcpkVw+ihHVl6YXMyQhO2KVUkzsyjYHJy9SM/9ZsnJfEpDpgIv15yXHRlT5B+ABQwtgqfHOEGewzHFN+01HJlpeu8LBZwE34qnkd1kiIm6Wp89hzRDUOX+dyZ9maBO+ZS3gvPa4MRPotBWRnNjmr/gDQHddoFgikV8Ag= 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 175201265503080.39276565427531; Tue, 8 Jul 2025 15:10:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZGVs-0004Nn-UN; Tue, 08 Jul 2025 18:10:09 -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 1uZGGE-0001Of-EL for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:54:04 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZGGB-0003P9-MB for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:53:58 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3a6cdc27438so4040181f8f.2 for ; Tue, 08 Jul 2025 14:53: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 ffacd0b85a97d-3b47285e236sm13995248f8f.100.2025.07.08.14.53.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 14:53:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752011633; x=1752616433; 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=oxnjh/X694j9j3b/2Ng5oDJDQQ9fFb9s5F3xkMYnYD8=; b=kbBL8baaGGM4NxXJwIGFnxya5NLWrmu7GtfEfZ1np4GY/I4uxkhc7LMZbfwCDF2Z6k sXeevAlgqEdQmUO/q7wjIYpGChI5fGsFV4N7MtSAC/n+VEfhs2eFk5ztzv5VSkJ4oxwV 4mnHPw/EOseCEjGA7mj90WcBaPOQBdTR8pF7PD3M4pJR/mlQjw2L8ICNJQcWcBa7QBgi zzPFIh+lMVQTSaMbcDzlEWfDs0HGH4ShK3HwogZkRT7dKS9uhrMv5Wb4hg3dXwcKHsHg qx92zUH7mXdD5vLDUVGY/g6MOdKGoPhVCb9R3esyBV1ELF0GbbJJWGGBb6EX3seqUmsh Xp/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752011633; x=1752616433; 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=oxnjh/X694j9j3b/2Ng5oDJDQQ9fFb9s5F3xkMYnYD8=; b=Cxql2oZMTPsOVEACn0Q3Wz0Kau+bcdBqTi0uy/MQkMxox6M8jNZJLNRWc3SdB/Oexm WKBZq4h7PsEiEEUZF5zIqW8QNRbhLKDYmhSQT2BDSt7hgVdB3vzaq1vVCka0+U9s/e66 WWxSOjHsgNrOQGdQk3sR1eNcvqGTPTmGZBhcVca98F2ka46A+Ad6C4ORBz3RnmEW/I07 gUA7cJibugIlpGZFH+VQphx2iVYiW0yk9qN8e7PGpAP32NE6R4ZBm7WcqjAsak2Lw8R5 2WtPU7C21D8HUk7LT593tgih+/+0F2epyyJsAWWaeybH5SRk1MyWXtSmu0u7bnAXiwBb 5tJQ== X-Gm-Message-State: AOJu0YyJXJNyNXXXKqgD0k12v8Xm8+zy/cxljmcZjm/0zeOTFxwd19VY RC9alWu8Dv2pcYvajE0NALrSsUQDUtfqLInhfyGgF74HZMM/E3ix7IJ8Cj14yXmqWRC+nJGcr/h lueyn X-Gm-Gg: ASbGncsm9jhFeLU68wNCB343GXw7djMs3LoSyHnPd53iRFILIv64IVxnWfaOHIPr9/m dk5QaGpe4wUXEUg4zhacHJ/pE1nJvRpUoTpZHrZ4kvA2rVWfIuqWIGbMbBMlxFTAK4drbKb9+c7 /tUt/H6ObSswx2LAfyCJmjtNd1OWrjRk5MXfaB8vIZ+mTrhdydmddaktZOKbX7o7HxNFzzayK+d 8prRCW/L1iXZ606APN9+L0vg/zCqZ9nxm/bGJjPPTjBe6iUofp0KmpB/5M5+tsqtwEdXNKG6p1E Q/E3zL4DxaMyeMq/U/Tnyv0UVK+BmK2zdRRG6SdBt1DDLB38+ZVbkCHTMgfEwCKpzOuWURj2TEn 1btItsBSSZ2B4eoDBWeg4sxRYWQIO/hVMxbm+1+1Kbg== X-Google-Smtp-Source: AGHT+IEapKHkl/MIZsyavswhrJ0kmSudvREE1nrzhAoKhLSRwgepxYWrQlZ4ctFcBcxub+n1tWqevw== X-Received: by 2002:a05:6000:1788:b0:3a4:f379:65bc with SMTP id ffacd0b85a97d-3b497038e7emr15382058f8f.40.1752011633355; Tue, 08 Jul 2025 14:53:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Pierrick Bouvier , Thomas Huth , qemu-riscv@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , "Michael S. Tsirkin" , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 RESEND v8 6/8] gdbstub/helpers: Replace TARGET_BIG_ENDIAN -> target_big_endian() Date: Tue, 8 Jul 2025 23:53:17 +0200 Message-ID: <20250708215320.70426-7-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708215320.70426-1-philmd@linaro.org> References: <20250708215320.70426-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::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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: 1752012656390116600 Check endianness at runtime to remove the target-specific TARGET_BIG_ENDIAN definition. Use cpu_to_[be,le]XX() from "qemu/bswap.h" instead of tswapXX() from "exec/tswap.h". Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Manos Pitsidianakis --- include/gdbstub/helpers.h | 48 +++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h index 6f7cc48adcb..b685afac436 100644 --- a/include/gdbstub/helpers.h +++ b/include/gdbstub/helpers.h @@ -16,7 +16,8 @@ #error "gdbstub helpers should only be included by target specific code" #endif =20 -#include "exec/tswap.h" +#include "qemu/bswap.h" +#include "qemu/target-info.h" #include "cpu-param.h" =20 /* @@ -33,40 +34,49 @@ static inline int gdb_get_reg8(GByteArray *buf, uint8_t= val) =20 static inline int gdb_get_reg16(GByteArray *buf, uint16_t val) { - uint16_t to_word =3D tswap16(val); - g_byte_array_append(buf, (uint8_t *) &to_word, 2); + if (target_big_endian()) { + cpu_to_be16s(&val); + } else { + cpu_to_le16s(&val); + } + g_byte_array_append(buf, (uint8_t *) &val, 2); return 2; } =20 static inline int gdb_get_reg32(GByteArray *buf, uint32_t val) { - uint32_t to_long =3D tswap32(val); - g_byte_array_append(buf, (uint8_t *) &to_long, 4); + if (target_big_endian()) { + cpu_to_be32s(&val); + } else { + cpu_to_le32s(&val); + } + g_byte_array_append(buf, (uint8_t *) &val, 4); return 4; } =20 static inline int gdb_get_reg64(GByteArray *buf, uint64_t val) { - uint64_t to_quad =3D tswap64(val); - g_byte_array_append(buf, (uint8_t *) &to_quad, 8); + if (target_big_endian()) { + cpu_to_be64s(&val); + } else { + cpu_to_le64s(&val); + } + g_byte_array_append(buf, (uint8_t *) &val, 8); return 8; } =20 static inline int gdb_get_reg128(GByteArray *buf, uint64_t val_hi, uint64_t val_lo) { - uint64_t to_quad; -#if TARGET_BIG_ENDIAN - to_quad =3D tswap64(val_hi); - g_byte_array_append(buf, (uint8_t *) &to_quad, 8); - to_quad =3D tswap64(val_lo); - 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 + uint64_t tmp[2]; + if (target_big_endian()) { + tmp[0] =3D cpu_to_be64(val_hi); + tmp[1] =3D cpu_to_be64(val_lo); + } else { + tmp[0] =3D cpu_to_le64(val_lo); + tmp[1] =3D cpu_to_le64(val_hi); + } + g_byte_array_append(buf, (uint8_t *)&tmp, 16); return 16; } =20 --=20 2.49.0 From nobody Sun Dec 14 01:39:50 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=1752012714; cv=none; d=zohomail.com; s=zohoarc; b=mezf0xQjqw3hvMOPO9h39zg7N4izRippFQXV1sl09n9qKdv1ggU3eOVOY6pzMcODFh8JxUhVSUu5H3iUYTQtTSjgVa0Cg+VaS1aTcRkEuLLLEh/2x+G7DfQlnIGAU9otsm/qe965MFIE4frcYt/29seSj/cJACFGCF+MO1Kiwus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752012714; 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=+TDbQ3dDocdF9uvZc+EJHH3djZkz8cTLzLtC46celL0=; b=M9oaymhEvyYmb7Jrrjdhski2uhh+Fj19x45uXmdf05f5cwZR30E15QVpDe6ZoHJPlL1RTBzZYpUkbBjNcoWu8yt4n7pOjxDDzGFvCGzgaOc/pdhZQh1kalafbJM26d6y0zrD7I4H2TKKNf/bKoyIaha4/JRCoPFc2/q1tL+z320= 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 1752012714984625.7979107534991; Tue, 8 Jul 2025 15:11:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZGX9-0007a7-6T; Tue, 08 Jul 2025 18:11:27 -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 1uZGGM-0001QR-7u for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:54:12 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZGGH-0003Qb-KL for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:54:05 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4537fdec33bso30717175e9.1 for ; Tue, 08 Jul 2025 14:54:01 -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-454d511bd6dsm582985e9.38.2025.07.08.14.53.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 14:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752011640; x=1752616440; 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=+TDbQ3dDocdF9uvZc+EJHH3djZkz8cTLzLtC46celL0=; b=PvqsDLkvLXfDr/j8EVt1ACr5NLbMTUU4laQN7oWWsu/NGIjp3wpBzMik17YyAuPSHV uT/XEsfQ45aGrWbOuzPGUzlNmC9L2ylfDmTkatmYiuQuKhdN3cJHd1nXuX0hzMl+EKHI oiOMGqnmO1Q1ndAwOSkWyeawvew3asjHKcrmNFJrG95u6zHvZvQUsx1xsE+XJZsd2nEF V3/SgvRPt6eNxLPWhzDO2ZdSAtfCWeZUirYdLA0Qu3Dr9ma7F/MY1DMuo4ILyQnt31NO mpFLsoXsYH6N13LkhPJbr4qRFBAiU9Dv6+6nEKK1XG0PvguNePTWiTolLiloGLF3/EQV 3Pyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752011640; x=1752616440; 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=+TDbQ3dDocdF9uvZc+EJHH3djZkz8cTLzLtC46celL0=; b=j8kMhg54ZpW45gZ5hd7Xa9qGh3FhserjCe3T46xUkjLbQgTbjb+Xm/fp8XEpjUt+se p03tHKjjk9cNuyxjhOMTcBM2TXubBXcnD4LEvC69jwUyFwINffuhnSsT++mdi470H9Cx RvKZckBo/HLShw897Kv/cwnrF/YtGWPLYP679XZ4ILAlTeTxARNVZXbSWurYZc3xKc0j WBHC4qXOMJJRSxFdZxJlVwK572FHccnc/u957idLqS+ZXWwWsMprHwViz7c5aYeF41EK 4KSFtJH+O6pmjqLYJh8Z9KUcURWmpV6GgL2uRkeEiZiJwLkzLNjA+LtPMk79PXs/KN/U Gq8A== X-Gm-Message-State: AOJu0YxLxcUx6FUeUoy3mbImNjxqddoikDe4Y2xsLyuivLU8vGra8Jy+ plcNCOspRVJyaPxGd6AnJkc0u8voc+HDUe2X4TVf2yiRD6Vdjdrywx7IONDYeDwXD61jQifetxb fB5pj X-Gm-Gg: ASbGncvV9QpEEUTC+KEqWtYXuG3paxhEpZBvHWf4o6E2KQ8hh8N026IKmYafULJxnug aLa+G+9Z7BAgkidM4vLKWCg8in+OTIY9esFH6jpWD4SDgPBN8kiVUzDyjwXl3SOpnpSnh6yja4D OGSCerEx8kgjf/s1CWYvWDPFVQq92I7BLSNN+3M4WCJYuA4DQY0vJ8l7QcxBjfKix0/TzT0XZrG +YgOixUf6U4m6dh+++cdu01MRVWASlrRKztmGwPGHujq3tAOxpJHOpqw3v5rXfXFVHHwMv38ROZ dtNBTOfPrsmxUpLa5NDKztbWZwMkI5CFp+MbZnODMexNWkc2KjvSGf3431V9MplfmaIIm9niX/l TVSd1yuMzOqNVwhEPDNw6ibj0WHYYE+bvodJq4QlqtA== X-Google-Smtp-Source: AGHT+IG7bJbY8/SLhN1clMLZhVmgKF+wqcz5dR9tV23hRDc8E0fR1ue+PEwwB8R2Tc0k0YMSUYSiuw== X-Received: by 2002:a05:600c:8b6c:b0:453:745:8534 with SMTP id 5b1f17b1804b1-454d5311814mr20025e9.12.1752011639718; Tue, 08 Jul 2025 14:53:59 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Pierrick Bouvier , Thomas Huth , qemu-riscv@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , "Michael S. Tsirkin" , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Igor Mammedov , Ani Sinha , Beniamino Galvani , Peter Maydell , 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?= , Paolo Bonzini , 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 , David Hildenbrand , Ilya Leoshkevich , Halil Pasic , Christian Borntraeger , 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 RESEND v8 7/8] qemu: Declare all load/store helper in 'qemu/bswap.h' Date: Tue, 8 Jul 2025 23:53:18 +0200 Message-ID: <20250708215320.70426-8-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708215320.70426-1-philmd@linaro.org> References: <20250708215320.70426-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::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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: 1752012718646116600 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 Sun Dec 14 01:39:50 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=1752012714; cv=none; d=zohomail.com; s=zohoarc; b=Q0LXQzN8FdFSlJtJVnVUrFxQrw1NZj9BW8Ol8itEqGldzLXCqnJGy57r47Jm0iW6UWU7csdClvi2JKJbyC7mjWDVs1FBzT4HRKNhzqmd6BvDofH4rgSxpxbmy1ga8L7u4SZXqWWiIH9jyfeYX3i8+IJSHkSoHvEjwSLY8fj4vu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752012714; 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=Qoh+8dqxlT0ZYBwoM39/O4GOENzlLmIR6TyBNNrriVw=; b=T6NSjfuf0vf0slpw5X3KOIwSBc/pcGW7KdXde6IF4BnXLTDmSsDcE72EmVlvkZIvBgZTz59Bd3/KH4DXL8xHmxZmylsxHr1gqoRO7i0Dlx+8YzfddUQN7iKDFqfN4vT6VUAU7ehVfckXexLkPsuMJparRoPfXaQwEYK5UcGN/BY= 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 1752012714516739.9003865095694; Tue, 8 Jul 2025 15:11:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZGW5-0005Zk-6z; Tue, 08 Jul 2025 18:10:21 -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 1uZGGR-0001St-9C for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:54:12 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZGGM-0003RT-Qn for qemu-devel@nongnu.org; Tue, 08 Jul 2025 17:54:09 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3a50fc7ac4dso2155248f8f.0 for ; Tue, 08 Jul 2025 14:54:06 -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-3b4708d0a5csm13783800f8f.29.2025.07.08.14.54.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 14:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752011645; x=1752616445; 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=Qoh+8dqxlT0ZYBwoM39/O4GOENzlLmIR6TyBNNrriVw=; b=uaat15DjDZz+jroBYOJIJ64ftvjAuK/f2zwdIYR4lWgk6yV4D8SgtuKM8pB7PnBIh0 gdy2zefcKjwGzTQbZSYoqpwX7Bg0wukjLtIpLKEEXtEyMqqfJH/nP76Tc628WcrbSdue kI1SSStOyMAkv+be0hZUYTyOYNaJ1WaIkQ+zUoOpiofj7Wvp9KEsLVIC1PHTiKGHsN5T /lTxHSkqloIfKENF/mIYaCBf24ubaLcv4Yci2FmQHjuq61/95wB21efCduWXWdu1X4lf kAN5Jhgea7p2rxCKjMq70NOX8jN0Ie9ZFJIWgN4B/Sc7HCFY4bxkwngnrG/teFKyZBv7 iZ6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752011645; x=1752616445; 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=Qoh+8dqxlT0ZYBwoM39/O4GOENzlLmIR6TyBNNrriVw=; b=LhyADdLfybPWe8iat3iZSF+++j97i7SiUPwtrw3KP/2GhCw5tEwpvsR86SWhrtohqe vB2TkZAFmJbyQ7ZG5y6Hwnyifyv6GZXNxTk8BZ6mv4YR30+18HZmSxmzNrdVC4ILFvAw 4VSSCNu/j3aQwQTNBUs4vpHWStgCoZeSsZV5BrVjj1KY9BouMGWFjPpCLb97lUgS4wIW fa5zg7wk4JllpDxyw7zdDrobPXiG3gYlRVaVKKgMabX01kL27EOy6BY9s4TGgXFj6zq9 4Wj01dgd4K0LvzKW938ndLvoplImmALnypZpFf4DK5BOnE7jaCkJELE39Fv7wGIai0rs JO6w== X-Gm-Message-State: AOJu0Yyv2hKQA7n6mVxLxke8CP/xOyI44H9Y6nP+F9P0kSyy/d3urmOZ PmC62GmJX90I5PtM+XE5AuPiLStoypGJ0wrKRZpE7XVI8D6tl7lZKfrVzbgfG56M0pD312ODe0H 7YXea X-Gm-Gg: ASbGncvGhvgcLPo8I7dVZPgPaNECzM/MIM8GSL22bN/JGl1OKjMEEhXx9vPN91ZpqIg Edv1UqI15icagFa0l7KUkGlA+7ruaCra2rb0izCfvhp81nBCrsOF3mtmrHoSeUTmQqRw5CsYONk 8qMnEifZ92aZooQ+cHz8P5vmgGTOzzqlKw7Dbyb9fIA+8m5ysEovMc2n4/aW3qHxELG533JDB6p AQwswwcKls0BD8gh2n7XXZCPXIt5wRVSCFWEANO0zX1umgnK1/kgVGiKjNNHXCU0VIMuPPSfiZx Z3camwEZDwJqXex6zzaIWzcAqymY4VgejUGO6e5kL6pI9w8hGXcZ2w+sXFv4XjS64wXz3j2DkX9 9hPYLrlNDMAeVoJA83YlbzV7N+rVCtotMBNftRo3ynA== X-Google-Smtp-Source: AGHT+IFa1+vUgnBYCiG3UCfP9XSLXt3QlGLqHgRmPXtuSBhGY4XE1sm2P52+dh4vRQ4ucCsO4KZKhw== X-Received: by 2002:a05:6000:2c0f:b0:3a6:c923:bc5f with SMTP id ffacd0b85a97d-3b5e2fec609mr1003608f8f.17.1752011644784; Tue, 08 Jul 2025 14:54:04 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Pierrick Bouvier , Thomas Huth , qemu-riscv@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , "Michael S. Tsirkin" , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Hanna Reitz Subject: [PATCH-for-10.1 RESEND v8 8/8] hw/virtio: Build various files once Date: Tue, 8 Jul 2025 23:53:19 +0200 Message-ID: <20250708215320.70426-9-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708215320.70426-1-philmd@linaro.org> References: <20250708215320.70426-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::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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: 1752012715243116600 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 --- 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