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.50 as permitted sender) client-ip=209.85.221.50; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f50.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1614357212; cv=none; d=zohomail.com; s=zohoarc; b=WWPSIeH9cXlDZ8exVdB0otS3MErODEJnwFJjG3N10CavTSOgVyg//e9vZeYWj9Ho6yLfXCmcO8FqdnAxV8Ncz70o5uggPV/5xGZ5b/S9zqcPp15csLatlH2fILAbhdmVpR7cHwOEpSh/G14wi4v8cKakrBejIy2jouSBR4PNif0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614357212; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=baCqRvN00Z/k/DEXOAL/5KZeUutEyX82NGJVX6NTZLs=; b=DUKK2dl13ikFRkPNOsjSDPtt5csLk4NNek7OQS+vMiBLDUx4MC07P11eIcqDdBs94Vfn0rkIIigpYUgMtCYdRo+0yn+7rtxErXf5szOnJEISkrk3p1G6lM/SYIqZ/TBcJWg9MAlxO9ZPKrlA4SWMc3q3r0uTipXcilplGYuOwFA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.zohomail.com with SMTPS id 1614357212861645.2861764225347; Fri, 26 Feb 2021 08:33:32 -0800 (PST) Received: by mail-wr1-f50.google.com with SMTP id n4so9180645wrx.1 for ; Fri, 26 Feb 2021 08:33:32 -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 k15sm16664975wrn.0.2021.02.26.08.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 08:33:30 -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=baCqRvN00Z/k/DEXOAL/5KZeUutEyX82NGJVX6NTZLs=; b=u9dJ4pVzXSwxq5IiQhegu1sOjFWEW7egjSz/FQoJsphQZou4dOyYMt0eyvd1ZgYI6r zqw8JHbducASA5HS/LZ3IDuoCxy/JoYX7PmwaANwfv1Bt2SEWk1ESZ13U652VxxjYQcA chHDFzB3YckwqnfDNaOi+A6mErQGQNHVzHcCmjtSipUb3q/7Q52B+ef0+5arwqIKxXGs c2m4stWcUo+fvEELRbJmVZjoPiEV8XVgtNdsjt4Mko0ETa5Q4OzMZezwFlgDHwg6t1fl 9og7VK24NfaTw4gzWLjpa73mLaO+wnVBT4cca6dgJXNwAfR9uX2xvLRSNbyt3Qqr5nJk j07g== 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=baCqRvN00Z/k/DEXOAL/5KZeUutEyX82NGJVX6NTZLs=; b=PFNXsAu1obS3FGWdPdBsMeEDezpfwHHv2+M3vGD3g9j8AoTeK0VRTPwKwB4AdJlBqu 62wgymhUwD39jkiwpcmxx4X/aQvpSGwM8WThppMNtpB7APXI2eM/WVn4Ycm7RmQBlKDZ 29HPI2mswLN1dCgyAwOSy6+HIKaHSNzev/+zujpTzLnvxCeZaVfkH1AJl2KRw4oURwGu mP1lS38Acnai207TYy+kTWVzPyHOxjRGOGSBQljetIGo0qrWnecJSwtEY2KQTB7VAXuA 8Ph2fMzt57obfMkKXdx3E5OeN7JI+4+Mki8b4rixRJAD/UA639U/E8IRMGnrbm0xayIE G0ZA== X-Gm-Message-State: AOAM532wtfaTQfTkQIi7H08nYZ4SkpVtzzV1xjEIqt5ONlWM7343gY6v yYNmbCpQliXJ3MXb8cS6FGw= X-Google-Smtp-Source: ABdhPJxjCs2JxncQfVm0YSDcSrxNvscTyYbwl/6+HAP3K697dMGc/y0VN2x7nHDMh7k8w+9BY14CcA== X-Received: by 2002:a5d:558b:: with SMTP id i11mr4035012wrv.176.1614357210978; Fri, 26 Feb 2021 08:33:30 -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 10/16] cpu: Move CPUClass::get_crash_info to CPUSystemOperations Date: Fri, 26 Feb 2021 17:32:21 +0100 Message-Id: <20210226163227.4097950-11-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) cpu_get_crash_info() is called on GUEST_PANICKED events, which only occur in system emulation. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/cpu.h | 6 +++++- hw/core/cpu.c | 4 ++-- target/i386/cpu.c | 2 +- target/s390x/cpu.c | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index fe85a1b81e6..87186e85d44 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -84,6 +84,11 @@ struct AccelCPUClass; * struct CPUSystemOperations: System operations specific to a CPU class */ typedef struct CPUSystemOperations { + /** + * @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. @@ -166,7 +171,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/hw/core/cpu.c b/hw/core/cpu.c index 86b65624a9e..ddf5635d87b 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->system_ops.get_crash_info) { + res =3D cc->system_ops.get_crash_info(cpu); } return res; } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ae7f7763dfc..9692843256c 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7421,7 +7421,7 @@ 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->system_ops.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 8ba8a96b4d5..f9107cb7179 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -518,7 +518,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *= data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug =3D s390_cpu_get_phys_page_debug; cc->system_ops.vmsd =3D &vmstate_s390_cpu; - cc->get_crash_info =3D s390_cpu_get_crash_info; + cc->system_ops.get_crash_info =3D s390_cpu_get_crash_info; cc->write_elf64_note =3D s390_cpu_write_elf64_note; #endif cc->disas_set_info =3D s390_cpu_disas_set_info; --=20 2.26.2