From nobody Wed Nov 5 23:19:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.42 as permitted sender) client-ip=209.85.221.42; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f42.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1619120405; cv=none; d=zohomail.com; s=zohoarc; b=O9hBjJwdi0TtCGtaxY2pPoRT2hw9EQ4JqlJEsM5+J3UqI4zT/FAGTE/Ihk3yuGiJxdZKylNcPNruwW/SSmAKYN1sBK/AUBQx7+Vi19il27FMSi7f6qEv+Oh0lvbYNoTxZduVbarZpufFs3c9l3J90yLK/3dsRBUw/bSZNj1sdaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619120405; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=A7inHjxFSKegRWGQqqs5t49oYCgVN7h+qmqFdyyUm4Q=; b=Rl5Dju1H88bViX/JmikihFu7qmlBG5DuxtCSit3GQfS9TyFSeURfK/p/LMDyUKHdZ6FGCjiYxlU7HKpkLglsS5uAVOjPHEWzsKQVdaLyylrv0qF46jgEeJHdGRemCOFkhgqV3PKKsymFLgdEjffTxKEi86t1FSv65+7R10ZEcFQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mx.zohomail.com with SMTPS id 1619120405499400.803014807315; Thu, 22 Apr 2021 12:40:05 -0700 (PDT) Received: by mail-wr1-f42.google.com with SMTP id e5so17282496wrg.7 for ; Thu, 22 Apr 2021 12:40:04 -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 t20sm7400937wmi.35.2021.04.22.12.40.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 12:40:03 -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=A7inHjxFSKegRWGQqqs5t49oYCgVN7h+qmqFdyyUm4Q=; b=QM8MVmniMaHl+Smm4+9C6OMCS1gKU8GkwU7VJFvD5hxpjWTyMbyrrKuCOkOtAaSw1l qiSw0qkbSs9cyshkROaR54VRAkCdd9gd2dtde29XeksJEGTtEStk95K8P8ZGPSTnVQJ8 l1iWlSb4StayRAoSKy1hRCAe/6ZXoI9XxrV3tjPOvKbLT+hYK2BmFUdNKo8KcU5pfn/N wuOZ31Wodcv6aTxceD+ipbYd1oNDo2wXtnmpdhJCOi535KYqAhaZmHiBW3x4+tpG3yWr yZOtc2exog/pSZvkmSCUIq0IojG+DYB1cqFOf4QvMcYzihiuboqRq4whbZ/3VLVuXnau VKvQ== 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=A7inHjxFSKegRWGQqqs5t49oYCgVN7h+qmqFdyyUm4Q=; b=W44GfWqMyjYfR10CKvKBGQ6TDWG12yfXCYocdG7+gxkh/VNR8RK5pdvQXPyzX33zN7 sBtvs7Z+1vKP6r8PQEEGL1CHdPZFIUZ4KP9za/Y+PPHAe9aXQM1pFuCS2lL/dfQ6Gevv 3FCtehFy5BXsIspx8SdYOSCd17uKHhvO4y6qPv56eILRVaRoOK+1IZdm+fkAEcpVDqV+ AxWuwvqIiEon7tgoSAS977c4g8NTuby/OvkedXNEOic/G039QruHIJQuibq0SGouYQb0 iJa3g+/xGFm/kkK17S5CBbyTiZfVQKrBGh2L0y22qA7T5qLQKB2geqiDWrbNLeCv055v 7kxg== X-Gm-Message-State: AOAM53234cZ7z93c1B+tQdKJuM5Jw2yMxm0mImiIthoroe+s8ZDiN4om zcHsnWZFf85Rss5w6QEaFXE= X-Google-Smtp-Source: ABdhPJyz8+qZuYkN1TG5YmX3iGnFsdfMx87Xvu89fA5FS6dk7qDgpMDXn41eKhld43zlQARb0EuXLg== X-Received: by 2002:adf:bc49:: with SMTP id a9mr2725wrh.109.1619120403721; Thu, 22 Apr 2021 12:40:03 -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: "Dr. David Alan Gilbert" , qemu-riscv@nongnu.org, Juan Quintela , Peter Maydell , Claudio Fontana , qemu-arm@nongnu.org, Eduardo Habkost , qemu-ppc@nongnu.org, Richard Henderson , Laurent Vivier , qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , David Gibson , Greg Kurz Subject: [PATCH v6 11/18] cpu: Move CPUClass::virtio_is_big_endian to SysemuCPUOps Date: Thu, 22 Apr 2021 21:38:55 +0200 Message-Id: <20210422193902.2644064-12-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210422193902.2644064-1-f4bug@amsat.org> References: <20210422193902.2644064-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 a10d9fbdd16..1c325d62b94 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); /** * @legacy_vmsd: Legacy state for migration. * Do not use in new targets, use #DeviceClass::vmsd ins= tead. 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 9b598bf10a8..d071ae72ba3 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, .legacy_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 e3f2f2fefa3..8d6bc6c0087 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, .legacy_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