From nobody Sun Oct 5 07:45:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.50 as permitted sender) client-ip=209.85.128.50; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f50.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.50 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1619088474; cv=none; d=zohomail.com; s=zohoarc; b=JEvacP77+jTtFqMvoCUzBA434myEQGVMJHA1Kdvtmx9+GKojx4Kor6huLBO1FJp1u5R4leWLizVmilFDrvWqdQ1nk5DISSXYF0/khMdGC/wK2SXmAfUQ8vVxCTfKgbn59ca/qZBm1rH0dLax1ePc/yGsOS+kysHU6blFr5SH7Fg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619088474; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tP2J+wCmSfixgkbUO0OS9j1xOz4RXS1xTWip+OxPRIE=; b=WTucaMDUIbFYt10a5/a6cygrDoiBBvDlacVXfxLRdmsKHKjSQ2IEDGx6dsLs86n3LHTqmlTRH4kX/ewHhsLkWKYucea0/lWJk+/FxOfah40NwY0gBv1Ig70NWIwLI+7PA2stLwfyoYm5dn+YAe+trAm/WBIhUWB9kRdFG17qCR0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.50 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.zohomail.com with SMTPS id 1619088474694243.19852838547183; Thu, 22 Apr 2021 03:47:54 -0700 (PDT) Received: by mail-wm1-f50.google.com with SMTP id z6so6039987wmg.1 for ; Thu, 22 Apr 2021 03:47:54 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (39.red-81-40-121.staticip.rima-tde.net. [81.40.121.39]) by smtp.gmail.com with ESMTPSA id i4sm3002746wrx.56.2021.04.22.03.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 03:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tP2J+wCmSfixgkbUO0OS9j1xOz4RXS1xTWip+OxPRIE=; b=nqlgUw5wBnL4GCJe/3bzAWYmKr20OCo60bg7OuF4yKfsI14YIYr4fE07FCb8ZiHPgK v+Yi+jD9MCFIo0Z1XABbiSVix/GD3S9isn8LVLDipUBDYDA36SiAuRSbmOJoHENx0sNa DifpMGHR+5E53ANUHJNgOHCyQKr7hUdwrqPkntg08upCxGTwAOEULJc7ZLHlEy5VtJS8 bDsq6ejLYbgCTqpZ8J/wcjqTz1QGBmPYEV/WWisrbW3laraIZ2WMqbYEDw46s+HqTFRU JS0wJbVIR/6ubWcf4Id19IbyPZdmNva81cYQ1/D+qHuTF83MM2HjN+Ph/xxlspjpRMSp CLPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=tP2J+wCmSfixgkbUO0OS9j1xOz4RXS1xTWip+OxPRIE=; b=TaBai114IVcSs5dfhmf2wq229WLDCbhmva3SXrBwaOpmZGL9ncQjKhHH5hMMVEUaLq xaUp3lBBb44Pc1LvaljRatyHUnjp6sW1tcBaxZHKHqV91vp2DxySUrk6qdPvVX1Cl87P Lp9N1o/a4W+NkPM5S3ZE4MqVgEICBkdMrI0adpM9KXibYZ1NpvgGnuhBW8iSp+WlDqQv T96IzjtG8/VDxRejdrICTiq1r6Ul/TvinfhuutTbqJETWqfHQG/DjKQzr4kyTGTtz1SV VlwS3Kac4OLqgFPY3Isyx5gAosUVNyH7mh6ZiOEGHCEugDnWRF5/Mv/fdQZgo/t/NjBp IXHQ== X-Gm-Message-State: AOAM530Nw3mNTHPhfez7jqyZIP6zQchXnlqvPrXOB856Wt/wLvwXKUbO NBseP/7VYAV+gHtb54fSa5s= X-Google-Smtp-Source: ABdhPJwf2KUOcN4rfcqd4xZAzNqlCGTmwdOudbp+f2BJG/rbHG9p2bX+R//Y/C+ck98SpAqhB/3qGA== X-Received: by 2002:a7b:cd85:: with SMTP id y5mr14783816wmj.93.1619088472900; Thu, 22 Apr 2021 03:47:52 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Claudio Fontana , Juan Quintela , Greg Kurz , Laurent Vivier , qemu-riscv@nongnu.org, "Michael S. Tsirkin" , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Peter Maydell , qemu-arm@nongnu.org, Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Marcel Apfelbaum , David Gibson Subject: [PATCH v5 08/15] cpu: Move CPUClass::virtio_is_big_endian to SysemuCPUOps Date: Thu, 22 Apr 2021 12:46:57 +0200 Message-Id: <20210422104705.2454166-9-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210422104705.2454166-1-f4bug@amsat.org> References: <20210422104705.2454166-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) VirtIO devices are only meaningful with system emulation. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/cpu.h | 5 ----- include/hw/core/sysemu-cpu-ops.h | 8 ++++++++ hw/core/cpu.c | 4 ++-- target/arm/cpu.c | 2 +- target/ppc/translate_init.c.inc | 4 +--- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index bdc702894bf..e3c702b8b74 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -89,10 +89,6 @@ struct AccelCPUClass; * @parse_features: Callback to parse command line arguments. * @reset_dump_flags: #CPUDumpFlags to use for reset logging. * @has_work: Callback for checking if there is work to do. - * @virtio_is_big_endian: Callback to return %true if a CPU which supports - * runtime configurable endianness is currently big-endian. Non-configurab= le - * CPUs can use the default implementation of this method. This method sho= uld - * not be used by any callers other than the pre-1.0 virtio devices. * @memory_rw_debug: Callback for GDB memory access. * @dump_state: Callback for dumping state. * @dump_statistics: Callback for dumping statistics. @@ -151,7 +147,6 @@ struct CPUClass { =20 int reset_dump_flags; bool (*has_work)(CPUState *cpu); - bool (*virtio_is_big_endian)(CPUState *cpu); int (*memory_rw_debug)(CPUState *cpu, vaddr addr, uint8_t *buf, int len, bool is_write); void (*dump_state)(CPUState *cpu, FILE *, int flags); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index 05f19b22070..9c3ac4f2280 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -16,6 +16,14 @@ * struct SysemuCPUOps: System operations specific to a CPU class */ typedef struct SysemuCPUOps { + /** + * @virtio_is_big_endian: Callback to return %true if a CPU which supp= orts + * runtime configurable endianness is currently big-endian. + * Non-configurable CPUs can use the default implementation of this me= thod. + * This method should not be used by any callers other than the pre-1.0 + * virtio devices. + */ + bool (*virtio_is_big_endian)(CPUState *cpu); /** * @vmsd: State description for migration. */ diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 5abf8bed2e4..09eaa3fa49f 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -204,8 +204,8 @@ bool cpu_virtio_is_big_endian(CPUState *cpu) { CPUClass *cc =3D CPU_GET_CLASS(cpu); =20 - if (cc->virtio_is_big_endian) { - return cc->virtio_is_big_endian(cpu); + if (cc->sysemu_ops->virtio_is_big_endian) { + return cc->sysemu_ops->virtio_is_big_endian(cpu); } return target_words_bigendian(); } diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 6421877c978..edefcc340af 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1945,6 +1945,7 @@ static gchar *arm_gdb_arch_name(CPUState *cs) =20 #ifndef CONFIG_USER_ONLY static const struct SysemuCPUOps arm_sysemu_ops =3D { + .virtio_is_big_endian =3D arm_cpu_virtio_is_big_endian, .vmsd =3D &vmstate_arm_cpu, }; #endif @@ -1988,7 +1989,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void = *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_attrs_debug =3D arm_cpu_get_phys_page_attrs_debug; cc->asidx_from_attrs =3D arm_asidx_from_attrs; - cc->virtio_is_big_endian =3D arm_cpu_virtio_is_big_endian; cc->write_elf64_note =3D arm_cpu_write_elf64_note; cc->write_elf32_note =3D arm_cpu_write_elf32_note; cc->sysemu_ops =3D &arm_sysemu_ops; diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.= inc index 32fa62aded0..b8a095d3f3a 100644 --- a/target/ppc/translate_init.c.inc +++ b/target/ppc/translate_init.c.inc @@ -10880,6 +10880,7 @@ static Property ppc_cpu_properties[] =3D { =20 #ifndef CONFIG_USER_ONLY static const struct SysemuCPUOps ppc_sysemu_ops =3D { + .virtio_is_big_endian =3D ppc_cpu_is_big_endian, .vmsd =3D &vmstate_ppc_cpu, }; #endif @@ -10948,9 +10949,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, voi= d *data) cc->gdb_core_xml_file =3D "power64-core.xml"; #else cc->gdb_core_xml_file =3D "power-core.xml"; -#endif -#ifndef CONFIG_USER_ONLY - cc->virtio_is_big_endian =3D ppc_cpu_is_big_endian; #endif cc->disas_set_info =3D ppc_disas_set_info; =20 --=20 2.26.3