From nobody Mon Dec 15 11:23:48 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1752009763; cv=none; d=zohomail.com; s=zohoarc; b=JUrkXeqg1AYe0GCs8ByroBqqd3WiNuldDme8enEegiGMYY5SqDdk3ujeWpM2ygOluts+hjmqSO93a3AVciyjHOPjN91ZqhCBgBdjGSc+LOkC/Cz93nVEYORsWO5JOfXVZZehWXHSJWGdnICrMj7gZUn6RC6skmv/L+6sh8PHyx0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752009763; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rAL/ETRijy4/iQ3UXazRTb8RTZUYHHKVtD2BscpxpCQ=; b=KYa0DIixqwixJPhw9b1yKONOGvB9+lTrclKW3f86NQboSsL0znnMk0g+UJXBMA48o5W6GCN1Mk966cOpdiD3437LIO/yhsLeuwpoQNHqrI/JMslWi0VxCMdSs+wSkjpTAuAVkdNrSpN9mU+FPP+6aUCOv4R3eMjGZZskhjGWhps= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1752009763570915.6953374346124; Tue, 8 Jul 2025 14:22:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZFF4-0000vY-SO; Tue, 08 Jul 2025 16:48:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uZDrM-000870-Pk for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:20:14 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZDrI-0008O0-1C for qemu-devel@nongnu.org; Tue, 08 Jul 2025 15:20:06 -0400 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-32b5226e6beso43473791fa.2 for ; Tue, 08 Jul 2025 12:19:48 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-454cd38f092sm28331705e9.1.2025.07.08.10.20.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 10:21:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752002387; x=1752607187; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rAL/ETRijy4/iQ3UXazRTb8RTZUYHHKVtD2BscpxpCQ=; b=XuySZ14cHPOGQ5BmAbLds6Absx0GY8fEAvSF3+roiqZRGbitrU7Vc+e8obAbQSaQ0b xmn2BOldOaYmi7LwjHk61uMKq4LvgY5q0UwHdaIhmiir28fhBPEbInzc9ZH9YT3Yzkeg 2aeUvmkjeYFICMHuwL8bVn5Uk4x+4u6OKaIkVD4J12pm7/MUQsNGqj2GYnV5U9RqKx9H TVSv9tSrE6NkdA4WNRP6AZXPk3RqlYXqDdHTXaLhgzSatgiJxCOTq3TBzMOnxmjDjzaC xvEJJp9BeAZrg04im3/lFZpaJj6E4xNvyJFguFauQLelGU40CxoqRrWjsHDAFIRFkYs6 EkFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752002387; x=1752607187; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rAL/ETRijy4/iQ3UXazRTb8RTZUYHHKVtD2BscpxpCQ=; b=Fvtku7Ka8ojHAoW2fBpALMgltBQMbvMyCNwzGbHdzXQQUPigtSOvgSPmutQO0vOCfb C5ZeyTeEua5dBgcDfizyRS/qk5fHwU7TguRzoaPagG9JHCG4/rxHm9VW17xDoZ2Xz/i5 4BJlVZORMrG1Ir+7Uy4jGpFxc3TywQW+U6zjJ8uXnFiW4sSM7SmcTTGyp9MPlbpPSt2z dzQlMfnDP2UGZjz/OT8jUriby3bQ0PqgSNRHA9hJwCat3U6QtMZlovC0/9xAiqbOGxrB 8Sz3nUJ9C3btjqoWliXvt/65owHjki19W1GbvLFN7c3bDMkZXSp5IcXJu4LCRQFLp85q XfjA== X-Gm-Message-State: AOJu0YxtoDVISjc38itz/M8ogNV603r54hKhIaCL7X4LY9AcYDgf9eBt 2p2SaM1kGbgMiCWFNGvoKX/p17utZAlO4my+sKZy4xK8aJr2yVr6mY9QB4u941ySXnjlfC6xJiT 4V04x X-Gm-Gg: ASbGncswZuDKfL8epi5tpxbVErlbOGqnw5/9ljQBW9vQvROgXTMLXc8IxUfvRkefHTb LBRXA5tUQMhpwuY9zwBVRQ5J9utSg85dov9IPDXT5U8Sv/HdCTuTb/F3x5l7E+6u9cgTPfK3JgD p0biM3WkoKTserE3I9yYh226x9SSKAExvDM4EfaKe+PgNyOZtx6qlmfCa6+Qtg/gZijEesmPyrC 4WemMFiUux9tww8/07x1W41D9RD4lOh/pRwDoEg8lBUbef2LSZfM2MoO2JwxwKrek+/kcguBf/4 30Yk5HSzGLuEsf5q9RivyeEfdsn+bohCMnqwDia5Vt+Xn2w+O4o2kwkgoGJrbtgBW2wAeww30dT Zqt9Km/z86pMUopQ6FtO4slYS9ID1TEvOgz/b X-Google-Smtp-Source: AGHT+IHLZ/ykY7TZOQ2MzTMugvmnHDJCgJFHffcGRPTy37tNNZ378jls3SdJIi/LF+8ECz9D0Bqdzg== X-Received: by 2002:a05:600c:821b:b0:453:5c30:a1d0 with SMTP id 5b1f17b1804b1-454b4eadb5amr140127105e9.21.1751995268172; Tue, 08 Jul 2025 10:21:08 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Thomas Huth , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Pierrick Bouvier , "Michael S. Tsirkin" , qemu-riscv@nongnu.org, Richard Henderson , qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Zhao Liu Subject: [PATCH-for-10.1 v7 2/8] qemu/target-info: Factor target_arch() out Date: Tue, 8 Jul 2025 19:19:42 +0200 Message-ID: <20250708171949.62500-3-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250708171949.62500-1-philmd@linaro.org> References: <20250708171949.62500-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=philmd@linaro.org; helo=mail-lj1-x22c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752009770970116600 To keep "qemu/target-info.h" self-contained to native types, declare target_arch() -- which returns a QAPI type -- in "qemu/target-info-qapi.h". No logical change. Keeping native types in "qemu/target-info.h" is necessary to keep building tests such tests/tcg/plugins/mem.c, as per the comment added in commit ecbcc9ead2f ("tests/tcg: add a system test to check memory instrumentation"): /* * plugins should not include anything from QEMU aside from the * API header. However as this is a test plugin to exercise the * internals of QEMU and we want to avoid needless code duplication we * do so here. bswap.h is pretty self-contained although it needs a * few things provided by compiler.h. */ Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- include/qemu/target-info-qapi.h | 21 +++++++++++++++++++++ include/qemu/target-info.h | 2 +- hw/core/machine-qmp-cmds.c | 8 +++----- target-info.c | 8 ++++++++ 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 include/qemu/target-info-qapi.h diff --git a/include/qemu/target-info-qapi.h b/include/qemu/target-info-qap= i.h new file mode 100644 index 00000000000..dae92c47eb1 --- /dev/null +++ b/include/qemu/target-info-qapi.h @@ -0,0 +1,21 @@ +/* + * QEMU target info API (returning QAPI types) + * + * Copyright (c) Linaro + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef QEMU_TARGET_INFO_EXTRA_H +#define QEMU_TARGET_INFO_EXTRA_H + +#include "qapi/qapi-types-machine.h" + +/** + * target_arch: + * + * Returns: QAPI SysEmuTarget enum (i.e. SYS_EMU_TARGET_X86_64). + */ +SysEmuTarget target_arch(void); + +#endif diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h index 850a2958b9c..dde0e7d968a 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -1,5 +1,5 @@ /* - * QEMU target info API + * QEMU target info API (returning native types) * * Copyright (c) Linaro * diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index d82043e1c68..cd98daedd18 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -19,7 +19,7 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/type-helpers.h" #include "qemu/uuid.h" -#include "qemu/target-info.h" +#include "qemu/target-info-qapi.h" #include "qom/qom-qobject.h" #include "system/hostmem.h" #include "system/hw_accel.h" @@ -37,8 +37,7 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) MachineState *ms =3D MACHINE(qdev_get_machine()); MachineClass *mc =3D MACHINE_GET_CLASS(ms); CpuInfoFastList *head =3D NULL, **tail =3D &head; - SysEmuTarget target =3D qapi_enum_parse(&SysEmuTarget_lookup, target_n= ame(), - -1, &error_abort); + SysEmuTarget target =3D target_arch(); CPUState *cpu; =20 CPU_FOREACH(cpu) { @@ -139,8 +138,7 @@ QemuTargetInfo *qmp_query_target(Error **errp) { QemuTargetInfo *info =3D g_malloc0(sizeof(*info)); =20 - info->arch =3D qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1, - &error_abort); + info->arch =3D target_arch(); =20 return info; } diff --git a/target-info.c b/target-info.c index 16fdca7aaaf..9ebabec988f 100644 --- a/target-info.c +++ b/target-info.c @@ -8,7 +8,9 @@ =20 #include "qemu/osdep.h" #include "qemu/target-info.h" +#include "qemu/target-info-qapi.h" #include "qemu/target-info-impl.h" +#include "qapi/error.h" =20 const char *target_name(void) { @@ -20,6 +22,12 @@ unsigned target_long_bits(void) return target_info()->long_bits; } =20 +SysEmuTarget target_arch(void) +{ + return qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1, + &error_abort); +} + const char *target_cpu_type(void) { return target_info()->cpu_type; --=20 2.49.0