From nobody Mon Feb 9 04:57:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) client-ip=209.85.221.54; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f54.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1619120410; cv=none; d=zohomail.com; s=zohoarc; b=SX4butGrNvG1fcb+sYSRpYCwcSP6pGrMwjl7+wedRg0+sTsei0oDrnbFuy+Yy0XfIlN2LEgvXOspzrAAtyX9vjE7EkluKKCj5MUY/4JfNpumXuv9QygsCVw0ltZICo7O4cN3TxryOsAy01kg+E+UCAKEwBowbXm0x7wyfVCK+q8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619120410; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uLpgUUvTtmkbS378/dgmetDuRLNqY34+bULmG92CLFU=; b=eBltzGqOmhUnMWBH9dvprY31xzvM6ZLV1emjEToy2ZvBos/BTOpO2vCW7FBotv8y6jSgK6kVy1aWRSb0M72/AQ9UQeqcCAEQ5RWh5+iCBpMt0IwOfz8QcmUYhWS1aj79vIw9lnsyLvhsNtPRAXrefZtlKJOIOktZuXkKskGTC4U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.zohomail.com with SMTPS id 16191204106941007.5964747350027; Thu, 22 Apr 2021 12:40:10 -0700 (PDT) Received: by mail-wr1-f54.google.com with SMTP id j5so44974656wrn.4 for ; Thu, 22 Apr 2021 12:40:10 -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 o17sm4522281wmq.47.2021.04.22.12.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 12:40:08 -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=uLpgUUvTtmkbS378/dgmetDuRLNqY34+bULmG92CLFU=; b=b8OAqAl9ljQ5ZYTsPIy6IFqdLayCI/yYsKDOC9fZHCO/poQfztK8RSq3K9FdmStWrE Y8qByfa9glVNiWKx9Br+7OsqD9PrfR5qiT2fQX6+oqGg02AP5FsuXB6xDSsaPLN4o21h uQLBvB1Ot1sZUcxGiOF9hjjv5fgfFO81pd4nJB1IkjY2VEKMJen7eMgp+k32Cxnx9+iT 5HM1hh81nqw3aZ29DLTqhzfOQGY8vz30+JSQ9T8bbv8weukT+341TPBPoebRwnJFvtGc J3LDVtsXCXqgtVhHvCPrJEyDlGF7YRQCb3KYmPIL3Za2ZfkeKk928Z3YCwX1uMI9+eXJ I+tA== 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=uLpgUUvTtmkbS378/dgmetDuRLNqY34+bULmG92CLFU=; b=jFPO3mDhNbIOpjXe9dHsdco70khFeLNUke8JWb2hOjWQYeCF1Y39iA9CHgDcm4ugNl 5i81lBlY5mTopY8+WMG12CzBxcrCrDBUe6W7hh3wRtIE0qFmpnUguAysPJianrMtjqjW L8i7G1j9dC1PDG8G9zNuyxgp56ekBdBnGIlT3SMRwuQkQnec+0pi7hKP0aqnwAe1o0SD wGIYpDGZATJuRHEYcpsuV4bHq+OUud/nW6EqLax/jX3nCfyQ0LDw6hjqqsuI4I6A05lp FWf5GNmS88xgqRiUsGbq9vYELbUMe4Sn948pOEJuBMaFZDfmIJCqbw530fNfAHHaZ79Z eVJw== X-Gm-Message-State: AOAM532r4mtTWs1dwqtaZcTz3lYXMvY9W/j2RPBbrwTKDkgoc0Kjt0vq 6HLfM7/WjhUJuDV4ls8KP1s= X-Google-Smtp-Source: ABdhPJzY13FoHhOEcp8xqb/Skv7Z4klTFux9/UotxkAZJtjnjEAHsebHcjQo7cCcvwWHr/VUgvK7pg== X-Received: by 2002:a5d:4b8e:: with SMTP id b14mr39922wrt.86.1619120408939; Thu, 22 Apr 2021 12:40:08 -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 , Paolo Bonzini , Cornelia Huck , Thomas Huth , David Hildenbrand Subject: [PATCH v6 12/18] cpu: Move CPUClass::get_crash_info to SysemuCPUOps Date: Thu, 22 Apr 2021 21:38:56 +0200 Message-Id: <20210422193902.2644064-13-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) cpu_get_crash_info() is called on GUEST_PANICKED events, which only occur in system emulation. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/cpu.h | 1 - include/hw/core/sysemu-cpu-ops.h | 5 +++++ hw/core/cpu.c | 4 ++-- target/i386/cpu.c | 2 +- target/s390x/cpu.c | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index e3c702b8b74..4289cd0d78a 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -150,7 +150,6 @@ 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); - GuestPanicInformation* (*get_crash_info)(CPUState *cpu); void (*dump_statistics)(CPUState *cpu, int flags); int64_t (*get_arch_id)(CPUState *cpu); bool (*get_paging_enabled)(const CPUState *cpu); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index 1c325d62b94..f7a91a66e06 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -16,6 +16,11 @@ * struct SysemuCPUOps: System operations specific to a CPU class */ typedef struct SysemuCPUOps { + /** + * @get_crash_info: Callback for reporting guest crash information in + * GUEST_PANICKED events. + */ + GuestPanicInformation* (*get_crash_info)(CPUState *cpu); /** * @virtio_is_big_endian: Callback to return %true if a CPU which supp= orts * runtime configurable endianness is currently big-endian. diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 09eaa3fa49f..0aebc18c41f 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -220,8 +220,8 @@ GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) CPUClass *cc =3D CPU_GET_CLASS(cpu); GuestPanicInformation *res =3D NULL; =20 - if (cc->get_crash_info) { - res =3D cc->get_crash_info(cpu); + if (cc->sysemu_ops->get_crash_info) { + res =3D cc->sysemu_ops->get_crash_info(cpu); } return res; } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index eb96dd42556..ab0c07fe9b4 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7393,6 +7393,7 @@ static Property x86_cpu_properties[] =3D { =20 #ifndef CONFIG_USER_ONLY static const struct SysemuCPUOps i386_sysemu_ops =3D { + .get_crash_info =3D x86_cpu_get_crash_info, .legacy_vmsd =3D &vmstate_x86_cpu, }; #endif @@ -7432,7 +7433,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc= , void *data) cc->asidx_from_attrs =3D x86_asidx_from_attrs; cc->get_memory_mapping =3D x86_cpu_get_memory_mapping; cc->get_phys_page_attrs_debug =3D x86_cpu_get_phys_page_attrs_debug; - cc->get_crash_info =3D x86_cpu_get_crash_info; cc->write_elf64_note =3D x86_cpu_write_elf64_note; cc->write_elf64_qemunote =3D x86_cpu_write_elf64_qemunote; cc->write_elf32_note =3D x86_cpu_write_elf32_note; diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 131e7dfdf82..55d7a727602 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -479,6 +479,7 @@ static void s390_cpu_reset_full(DeviceState *dev) =20 #ifndef CONFIG_USER_ONLY static const struct SysemuCPUOps s390_sysemu_ops =3D { + .get_crash_info =3D s390_cpu_get_crash_info, .legacy_vmsd =3D &vmstate_s390_cpu, }; #endif @@ -523,7 +524,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *= data) cc->gdb_write_register =3D s390_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug =3D s390_cpu_get_phys_page_debug; - cc->get_crash_info =3D s390_cpu_get_crash_info; cc->write_elf64_note =3D s390_cpu_write_elf64_note; cc->sysemu_ops =3D &s390_sysemu_ops; #endif --=20 2.26.3