From nobody Wed Nov 19 04:32:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) client-ip=209.85.221.51; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f51.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1614357209; cv=none; d=zohomail.com; s=zohoarc; b=FH2ybE5R+k2EW0gKAZwimEVbh6hDH5PH68FuQjIOe+7/L/CPgYnLhiTLdsD1gCd4dG9Jwud6u1nhDYVveJrxbavcAcw43PLIkhqSP5EfZCEHO9OTD5L41nF7mDx9Y9FMsu/60kb3z2xx3V6XCg/qn8Gme8OW1gKX/PM38z45dsc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614357209; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R56Oi6nr8e9B0WiiV+if7tvwfnjn9mxxVgPa8IGhuYc=; b=elHzuCw5T7LitmTLr+HYXJpe/ByGXeOnPVJn5LcLuy9e1k7y+tivyB93KbPtpKmw2yIaFHhiI8tFpCpSotYJIt5Bt8+p+1Utm05Kle1x6QFIjrQncvfk0egPqhHwAQ4G6jaT63wUaFvTIQ10eTpEiDc5Qcu99iezJPwO5KeJx3E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mx.zohomail.com with SMTPS id 1614357209078651.4373196450185; Fri, 26 Feb 2021 08:33:29 -0800 (PST) Received: by mail-wr1-f51.google.com with SMTP id a18so953119wrc.13 for ; Fri, 26 Feb 2021 08:33:26 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id m6sm14242583wrv.73.2021.02.26.08.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 08:33:24 -0800 (PST) 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=R56Oi6nr8e9B0WiiV+if7tvwfnjn9mxxVgPa8IGhuYc=; b=GIK9QnVGxJj+2JyxxpSs2kwEIQSaQgByN23qMxB9CnyIZlfO11v5Cy1mdDF7/FZg9S hT+clxlxxrXwtpxbNMie7alBa+EdYWAPFEAIaFZlxCQ4PMR4QUAAbyeidWQs4SugWkBB NkiTYrLn8oYYy6TZzgU6+066q+Z5gvVDK2YqIxJPrMgcsA2OjQTLDskYj5SgvzExQkfi MWS5BPvufyr6ibMRkbheWeD1oYk1KUxGr2CNrhDeezx0guNLLylObuwgI+JZL8gary51 h5FgfO14/4kLCyrquBEp/OMkE2yq+6lPMzxvemYCBDVaTIokK+szjW0RmD93Pv6362SI NmmA== 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=R56Oi6nr8e9B0WiiV+if7tvwfnjn9mxxVgPa8IGhuYc=; b=MdCgMov7afpcw2FY7stXJeobN5ytX4zsoRh85TIei328BHTLJRhLxAue7HI3OxloLc xaOmvw3VgeCEvHeEoTWPUPHt1Q/mngVsLdpFOtmpRA+7aWTNU1JN7R97/SEXuILT2Y7b 4sywLb7+18KFpxtZIAtlkOz+n2yNj6nnCpphXlFJWAWIPOF1UyeTmVb3SWmvao83o2UL Ck+DzZIkuUQfmM7dR/Nz/8iOIPTuvhtNprIfYTTwUgmKLBHEX5bkop6j6Qxo9VFmwD1E g48IqD4MTgN08MoIHWYl7SSPVwWJmT8KXV7cKgOzJGJUyiGVPy8uS13LWHq0amG8B+ep aChg== X-Gm-Message-State: AOAM5328XFhuGh8+AB1pYegwZld5TbK2ai4SVLkyJp+/Z2s4ETC2domO HmU0NS5dxQ2nn/3mM4mxkR0= X-Google-Smtp-Source: ABdhPJxDb1NSzZxAVDXyJpmM/HE7k20qbNt0LkezV0LwNuf9xxvYg+GA9NeqMNOj3xAo6Ws07C81uQ== X-Received: by 2002:a5d:570c:: with SMTP id a12mr4117870wrv.209.1614357205310; Fri, 26 Feb 2021 08:33:25 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Sarah Harris , Paolo Bonzini , Max Filippov , Yoshinori Sato , qemu-s390x@nongnu.org, Michael Rolnik , qemu-ppc@nongnu.org, Marek Vasut , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alistair Francis , Michael Walle , Guan Xuetao , Laurent Vivier , Anthony Green , Palmer Dabbelt , David Hildenbrand , qemu-riscv@nongnu.org, David Gibson , Peter Maydell , Cornelia Huck , Jiaxun Yang , Richard Henderson , Chris Wulff , "Michael S. Tsirkin" , Aurelien Jarno , Aleksandar Rikalo , Sagar Karandikar , Claudio Fontana , Thomas Huth , Artyom Tarasenko , Greg Kurz , Stafford Horne , Bastian Koppelmann , Mark Cave-Ayland , Marcel Apfelbaum , "Edgar E. Iglesias" Subject: [PATCH 09/16] cpu: Move CPUClass::virtio_is_big_endian to CPUSystemOperations Date: Fri, 26 Feb 2021 17:32:20 +0100 Message-Id: <20210226163227.4097950-10-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210226163227.4097950-1-f4bug@amsat.org> References: <20210226163227.4097950-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. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/cpu.h | 13 ++++++++----- hw/core/cpu.c | 4 ++-- target/arm/cpu.c | 2 +- target/ppc/translate_init.c.inc | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index bd1cb3b0d37..fe85a1b81e6 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -84,6 +84,14 @@ struct AccelCPUClass; * struct CPUSystemOperations: System operations specific to a CPU class */ typedef struct CPUSystemOperations { + /** + * @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. */ @@ -97,10 +105,6 @@ typedef struct CPUSystemOperations { * @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. @@ -159,7 +163,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/hw/core/cpu.c b/hw/core/cpu.c index 5abf8bed2e4..86b65624a9e 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->system_ops.virtio_is_big_endian) { + return cc->system_ops.virtio_is_big_endian(cpu); } return target_words_bigendian(); } diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 11505e1db10..3cbb17a5879 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2300,7 +2300,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void = *data) cc->get_phys_page_attrs_debug =3D arm_cpu_get_phys_page_attrs_debug; cc->asidx_from_attrs =3D arm_asidx_from_attrs; cc->system_ops.vmsd =3D &vmstate_arm_cpu; - cc->virtio_is_big_endian =3D arm_cpu_virtio_is_big_endian; + cc->system_ops.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; #endif diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.= inc index 65c45e7870a..2e5c272190b 100644 --- a/target/ppc/translate_init.c.inc +++ b/target/ppc/translate_init.c.inc @@ -10909,7 +10909,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, voi= d *data) 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; + cc->system_ops.virtio_is_big_endian =3D ppc_cpu_is_big_endian; #endif cc->disas_set_info =3D ppc_disas_set_info; =20 --=20 2.26.2