From nobody Tue Feb 10 05:27:37 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682352331; cv=none; d=zohomail.com; s=zohoarc; b=SToW0AQgk6uRCQrhGqEMHQzBe7wQ6MZQql0U+OtHUhkGo3rAFAcnqwaaZ/VtUqi6Hh7Rdo3uJRhFlsbSiBFCFu8GbTYMGZ8hWFSjzLfifAgKQmMjtILKwdL4UcdvdIPArChTLwvP7gj05bFBMRcYjoiAOwSaut6EBr6aPiNrdcU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682352331; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9g6gJwWMdnAMmlIfYYK+xwA48c7ix6bqNKJGWwWjRGU=; b=UlYne27499UK15i0wsczDNKPCr/5aRtrQy1BEQQ+MYrY2V7oyMTAhZAW5pLe7M7z1FXS2Zx1ZSMXA5qGZwmxRzA61bNpzH5mbT89VBpnO2NjzcIjYXtHG8ctlcxuGnKpJzP+AV4JeKzIxUjj57nY4LmDETwQUog8FwM1MpoYLhI= 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 168235233131697.1305638482039; Mon, 24 Apr 2023 09:05:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqygM-00018g-VC; Mon, 24 Apr 2023 12:04:51 -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 1pqygJ-000173-Mn for qemu-devel@nongnu.org; Mon, 24 Apr 2023 12:04:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqygH-0008LF-Jj for qemu-devel@nongnu.org; Mon, 24 Apr 2023 12:04:47 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-460-ZdC8Pf-2OwyM71Dz6r4QYw-1; Mon, 24 Apr 2023 12:04:40 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6265F101A54F; Mon, 24 Apr 2023 16:04:40 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id C286B492B03; Mon, 24 Apr 2023 16:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682352284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9g6gJwWMdnAMmlIfYYK+xwA48c7ix6bqNKJGWwWjRGU=; b=Erzr89jG3xCCOic8iheAXr4qxtAl/ZCuOX8QtkdytwatkKKNLL4wmASlRXQVGoPMWs5bov MGXK8ZtFwCkODcaQ8lxYlfHaSjr8JYPR5sATEVHujEj9ZSuWGDECYhkp1BzP8JweMcp8dW fc5+JZZjfQ+o7bROEcyyjGhL9k+sKdg= X-MC-Unique: ZdC8Pf-2OwyM71Dz6r4QYw-1 From: Thomas Huth To: qemu-devel@nongnu.org, Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Cc: qemu-s390x@nongnu.org, Yanan Wang , Richard Henderson , David Hildenbrand , Ilya Leoshkevich Subject: [PATCH 1/3] hw/core: Use a callback for target specific query-cpus-fast information Date: Mon, 24 Apr 2023 18:04:32 +0200 Message-Id: <20230424160434.331175-2-thuth@redhat.com> In-Reply-To: <20230424160434.331175-1-thuth@redhat.com> References: <20230424160434.331175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1682352353959100001 Content-Type: text/plain; charset="utf-8" For being able to create a universal QEMU binary one day, core files like machine-qmp-cmds.c must not contain any "#ifdef TARGET_..." parts. Thus let's provide the target specific function via a function pointer in CPUClass instead, as a first step towards making this file target independent. Signed-off-by: Thomas Huth --- include/hw/core/cpu.h | 4 ++++ include/qemu/typedefs.h | 1 + hw/core/machine-qmp-cmds.c | 16 ++-------------- target/s390x/cpu.c | 8 ++++++++ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 397fd3ac68..5a019a27bc 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -106,6 +106,9 @@ struct SysemuCPUOps; * @has_work: Callback for checking if there is work to do. * @memory_rw_debug: Callback for GDB memory access. * @dump_state: Callback for dumping state. + * @query_cpu_fast: + * Fill in target specific information for the "query-cpus-fast" + * QAPI call. * @get_arch_id: Callback for getting architecture-dependent CPU ID. * @set_pc: Callback for setting the Program Counter register. This * should have the semantics used by the target architecture when @@ -151,6 +154,7 @@ struct CPUClass { int (*memory_rw_debug)(CPUState *cpu, vaddr addr, uint8_t *buf, int len, bool is_write); void (*dump_state)(CPUState *cpu, FILE *, int flags); + void (*query_cpu_fast)(CPUState *cpu, CpuInfoFast *value); int64_t (*get_arch_id)(CPUState *cpu); void (*set_pc)(CPUState *cpu, vaddr value); vaddr (*get_pc)(CPUState *cpu); diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index df4b55ac65..8e9ef252f5 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -41,6 +41,7 @@ typedef struct CompatProperty CompatProperty; typedef struct ConfidentialGuestSupport ConfidentialGuestSupport; typedef struct CPUAddressSpace CPUAddressSpace; typedef struct CPUArchState CPUArchState; +typedef struct CpuInfoFast CpuInfoFast; typedef struct CPUJumpCache CPUJumpCache; typedef struct CPUState CPUState; typedef struct CPUTLBEntryFull CPUTLBEntryFull; diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index b98ff15089..c158c02aa3 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -28,18 +28,6 @@ #include "sysemu/runstate.h" #include "sysemu/sysemu.h" =20 -static void cpustate_to_cpuinfo_s390(CpuInfoS390 *info, const CPUState *cp= u) -{ -#ifdef TARGET_S390X - S390CPU *s390_cpu =3D S390_CPU(cpu); - CPUS390XState *env =3D &s390_cpu->env; - - info->cpu_state =3D env->cpu_state; -#else - abort(); -#endif -} - /* * fast means: we NEVER interrupt vCPU threads to retrieve * information from KVM. @@ -68,8 +56,8 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) } =20 value->target =3D target; - if (target =3D=3D SYS_EMU_TARGET_S390X) { - cpustate_to_cpuinfo_s390(&value->u.s390x, cpu); + if (cpu->cc->query_cpu_fast) { + cpu->cc->query_cpu_fast(cpu, value); } =20 QAPI_LIST_APPEND(tail, value); diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 40fdeaa905..df167493c3 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -140,6 +140,13 @@ static bool s390_cpu_has_work(CPUState *cs) return s390_cpu_has_int(cpu); } =20 +static void s390_query_cpu_fast(CPUState *cpu, CpuInfoFast *value) +{ + S390CPU *s390_cpu =3D S390_CPU(cpu); + + value->u.s390x.cpu_state =3D s390_cpu->env.cpu_state; +} + /* S390CPUClass::reset() */ static void s390_cpu_reset(CPUState *s, cpu_reset_type type) { @@ -332,6 +339,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *= data) cc->class_by_name =3D s390_cpu_class_by_name, cc->has_work =3D s390_cpu_has_work; cc->dump_state =3D s390_cpu_dump_state; + cc->query_cpu_fast =3D s390_query_cpu_fast; cc->set_pc =3D s390_cpu_set_pc; cc->get_pc =3D s390_cpu_get_pc; cc->gdb_read_register =3D s390_cpu_gdb_read_register; --=20 2.31.1 From nobody Tue Feb 10 05:27:37 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682352366; cv=none; d=zohomail.com; s=zohoarc; b=gspWJnVEt3OQreqMU04lLnC38frBu20XC0XAoqVG4RXAUgAGlIM3ABW0grjBmmfpbRFvYqwVKDBTKEKJEOBqOQn7m4kLfw+TVpnhIljgw8fy9IcUBEEVz+GfCGCMnr0tMlhZRwo5BOemykadmmjgozN/6Pe9w0mXXWs6LR3AeHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682352366; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qSmNA5+BbuZmTG8DgFkfnmAn466f15976BdLfdWzDeI=; b=n2PuP5fGj2oQG/T3DOhHgVTL1mUa6JS0UcMrSiKmDMBpBopWmSTlACkzQYaX/KZcYxKkjUC3b0eiXu5L4xrFBlNVP1XdQ5H3NyHjwZG+HOHUWjymDEBM4sq4KKUSVPIdpdme4XcsLfIR91KlVtWhaFGQyzLLQoejyN1ls+7WxoA= 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 1682352366838546.5862417533593; Mon, 24 Apr 2023 09:06:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqygP-0001B3-K9; Mon, 24 Apr 2023 12:04:53 -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 1pqygO-0001Al-77 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 12:04:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqygM-0008O7-QE for qemu-devel@nongnu.org; Mon, 24 Apr 2023 12:04:51 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-571-yWgoKZGFNAORfTizcZuzgg-1; Mon, 24 Apr 2023 12:04:43 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 400FC382C964; Mon, 24 Apr 2023 16:04:42 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1954492B03; Mon, 24 Apr 2023 16:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682352290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qSmNA5+BbuZmTG8DgFkfnmAn466f15976BdLfdWzDeI=; b=H0tzv+vD4xdtBlWZLfCiFF/Cs47mNUl5dmguds80qtPrWUbjl1K/OpRHsnQvEiuKIIsKwd oPTHdvAd838XIR60s/7gPB2WdiYmENhItGo17Yn99As4ntlC+MHEUurUqwFXND4fSF8ap7 8rKKnUnBIz4drDe2fYYS9SJ426Z2/0Q= X-MC-Unique: yWgoKZGFNAORfTizcZuzgg-1 From: Thomas Huth To: qemu-devel@nongnu.org, Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Cc: qemu-s390x@nongnu.org, Yanan Wang , Richard Henderson , David Hildenbrand , Ilya Leoshkevich Subject: [PATCH 2/3] cpu: Introduce a wrapper for being able to use TARGET_NAME in common code Date: Mon, 24 Apr 2023 18:04:33 +0200 Message-Id: <20230424160434.331175-3-thuth@redhat.com> In-Reply-To: <20230424160434.331175-1-thuth@redhat.com> References: <20230424160434.331175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1682352368351100001 Content-Type: text/plain; charset="utf-8" In some spots, it would be helpful to be able to use TARGET_NAME in common (target independent) code, too. Thus introduce a wrapper that can be called from common code, too, just like we already have one for target_words_bigendian(). Signed-off-by: Thomas Huth --- include/hw/core/cpu.h | 2 ++ cpu.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 5a019a27bc..39150cf8f8 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1013,6 +1013,8 @@ void cpu_exec_unrealizefn(CPUState *cpu); */ bool target_words_bigendian(void); =20 +const char *target_name(void); + void page_size_init(void); =20 #ifdef NEED_CPU_H diff --git a/cpu.c b/cpu.c index 9105c85404..65ebaf8159 100644 --- a/cpu.c +++ b/cpu.c @@ -427,6 +427,11 @@ bool target_words_bigendian(void) #endif } =20 +const char *target_name(void) +{ + return TARGET_NAME; +} + void page_size_init(void) { /* NOTE: we can always suppose that qemu_host_page_size >=3D --=20 2.31.1 From nobody Tue Feb 10 05:27:37 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682352335; cv=none; d=zohomail.com; s=zohoarc; b=geTh7Bf6ltaUhNYLo0YGQhUwzx0F5PrcbwpGYb8G7hGY2azXmRqQxv0IGEDKmfBD/nau/oxHASJ/fyyutiEdL6XF2Is6UlpasMbEX6n/WFotP6EOqIAAZoYt34a2L71w6/KDh5tFnkIKDkA2PC4Z94TN2OKKyYUA7vu6jq1J+3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682352335; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PxtSIVuHb7gtaD/y/MKGISw7YNPZgYIfmHDicVZ8Wik=; b=RJvT7cvHbuLasOdPwuT/RlID3yxmgLntj598i4lJZPfjPBAns3sv+LuiexxnAEfYuW/i3RTTHqssqhS3Yaq/2HAxnnhX4Lm/IuKnGttjb5er95bij3YLcUy58rN+GE4yhDAoiIcYPo1wYhPSF6F5PqTrmb8oOdOOh/qY8GEEdI0= 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 16823523351591.6793170514545182; Mon, 24 Apr 2023 09:05:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqygQ-0001Bp-Sa; Mon, 24 Apr 2023 12:04:54 -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 1pqygP-0001B1-49 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 12:04:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqygN-0008OD-CW for qemu-devel@nongnu.org; Mon, 24 Apr 2023 12:04:52 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-113-0J8ALhdAOZ6-Ri3d3lUD4w-1; Mon, 24 Apr 2023 12:04:44 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1F691185A78B; Mon, 24 Apr 2023 16:04:44 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 839B4492B03; Mon, 24 Apr 2023 16:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682352290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PxtSIVuHb7gtaD/y/MKGISw7YNPZgYIfmHDicVZ8Wik=; b=iFZZu00xjWqUE3LQt7NefiifJaIyWixZPPfFVKs4Rv0d9+jwWh3+XG32lZ52n1QFB7rjGJ UhaX55Fq2ciSYMoUKghhIX8DNNt2dXKXW6shorNCPnZ6xLQOlfbJ0RMvbZb+0YpgkSQil/ zZNdWZ48Y3NtTza2eH90t4U0hbT/UvA= X-MC-Unique: 0J8ALhdAOZ6-Ri3d3lUD4w-1 From: Thomas Huth To: qemu-devel@nongnu.org, Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Cc: qemu-s390x@nongnu.org, Yanan Wang , Richard Henderson , David Hildenbrand , Ilya Leoshkevich Subject: [PATCH 3/3] hw/core: Move machine-qmp-cmds.c into the target independent source set Date: Mon, 24 Apr 2023 18:04:34 +0200 Message-Id: <20230424160434.331175-4-thuth@redhat.com> In-Reply-To: <20230424160434.331175-1-thuth@redhat.com> References: <20230424160434.331175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1682352336439100001 Content-Type: text/plain; charset="utf-8" The only target specific code that is left in here are two spots that use TARGET_NAME. Change them to use the new target_name() wrapper function instead, so we can move the file into the common softmmu_ss source set. That way we only have to compile this file once, and not for each target anymore. Signed-off-by: Thomas Huth --- hw/core/machine-qmp-cmds.c | 4 ++-- hw/core/meson.build | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index c158c02aa3..3860a50c3b 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -37,7 +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, + SysEmuTarget target =3D qapi_enum_parse(&SysEmuTarget_lookup, target_n= ame(), -1, &error_abort); CPUState *cpu; =20 @@ -117,7 +117,7 @@ TargetInfo *qmp_query_target(Error **errp) { TargetInfo *info =3D g_malloc0(sizeof(*info)); =20 - info->arch =3D qapi_enum_parse(&SysEmuTarget_lookup, TARGET_NAME, -1, + info->arch =3D qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1, &error_abort); =20 return info; diff --git a/hw/core/meson.build b/hw/core/meson.build index ae977c9396..959bc924d4 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -41,6 +41,7 @@ softmmu_ss.add(files( 'gpio.c', 'loader.c', 'machine-hmp-cmds.c', + 'machine-qmp-cmds.c', 'machine.c', 'nmi.c', 'null-machine.c', @@ -51,7 +52,3 @@ softmmu_ss.add(files( 'vm-change-state-handler.c', 'clock-vmstate.c', )) - -specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files( - 'machine-qmp-cmds.c', -)) --=20 2.31.1