From nobody Tue Feb 10 07:42:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) client-ip=209.85.221.46; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f46.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1614808087; cv=none; d=zohomail.com; s=zohoarc; b=ieGYx6chpul4UgyDawvlh5I/Rz3dxMnsWQVOf6hvyLcBj/HwOYqdlD287/AqYgP0+8kQyTuGDQBFuK/LGX0nRtNAmvE0DYCRklgrUr6vDigIx6RXH2qVg14QqObFRiK1Z+H+5SUPnjEtkirMZddm8HI6qVkHjhOnWK+FP3Elhlo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614808087; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qFTBHcwtMLt6piI19qY9hIVE30tS0o+fHbwt4Y38uFg=; b=i5SWmm5JH/D0sEhnH9PMSEr6oC04yLL03GrGScvtkakLVGNw1Zpk/dFNVzUNh+0Qqk8JXbQ8RbzzTGdQ9rfxJMA5MY/fPyZuUCcaCu33D3sIahPK8s9OhV9HwrWhrPjj047bCQlZonac4kyDcglKTvEXQa5XOXwWdDY96eenjCI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.zohomail.com with SMTPS id 16148080874506.858865857769274; Wed, 3 Mar 2021 13:48:07 -0800 (PST) Received: by mail-wr1-f46.google.com with SMTP id d15so10137596wrv.5 for ; Wed, 03 Mar 2021 13:48:06 -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 w6sm12282220wrl.49.2021.03.03.13.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 13:48:05 -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=qFTBHcwtMLt6piI19qY9hIVE30tS0o+fHbwt4Y38uFg=; b=KQtjxa8q0oGu1P01ZHc+oTFvjQlJ2RKqckDvVT6RTLR1PDEEHrvrxVoTAzCNYHWo80 xBpq6O/SZh554bRL3TgBSl+OP6Nc9ZNudPNKHx2VqRjpYeKJ+UXNMMgm2IlSclBcmfDV 9ulqH1zn0OTBIS2ph46dudYv0N+tFC8b2M8Aw7anGhvbgmBSoyhmrpp9k0err+9GBfnE dqqJq3R0x9HAL7LIOuXzP3LLD1TSRQtC5qhoukDRqxK5COfT4+1/vulhzpcoCOzoW/eQ yj5WzfLibe7gLHigWZtWvU3h7Fj/wIKlqF+jH1QhLzDib8q8RTbxc6/MIddH3Q38ivV3 PcZg== 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=qFTBHcwtMLt6piI19qY9hIVE30tS0o+fHbwt4Y38uFg=; b=ZzxtqcsKK8Ht1bUaucLPzelxzv2WiyT3xsdZzJJFFuV8zggJWWfgwd2L1nl/VrsdwU tN7GoHDVV4YwxOMkhvkx30zdkd+PIWivXpwiszqlc7RHjbg6KOstzmuivJo3x0CXDZTO 0qh2XmGL0tECv6zMwSuhfiUjXN2MnXZ8rxor9NK6mE7Mqy9OP7A68klgI8lbln4IM2K+ CToHOccGEieNG7mYZoxNSjWuixCKSSg4FZv6wVTv1ag2qHOYgId4UClnmfebvW6FEu6e lVVsfcFEk02s0YW3Mzj/eoBoCVG431UeVYVrL9MD62dHVKjhzJFKRwxU3HNtWszXWTDS 9aow== X-Gm-Message-State: AOAM532nYSuO382eAEI0BKwQOQerIHWnR8nwHYHj8MV2x3AoG9L5qGEj g+YSXEanplnSvTKHj7rH1EA= X-Google-Smtp-Source: ABdhPJxMaEhVPf2fe/w19zrKLULEho24wRE6zwqlZ6aAS3z9ICzA5F4ZQ7d+oIM/Mkgue9RwcrMVPw== X-Received: by 2002:adf:a2c7:: with SMTP id t7mr804405wra.42.1614808085777; Wed, 03 Mar 2021 13:48:05 -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: Claudio Fontana , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Richard Henderson , qemu-s390x@nongnu.org, Thomas Huth , qemu-ppc@nongnu.org, Laurent Vivier , Cornelia Huck , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , David Hildenbrand Subject: [PATCH v4 10/28] cpu: Move CPUClass::get_crash_info to SysemuCPUOps Date: Wed, 3 Mar 2021 22:46:50 +0100 Message-Id: <20210303214708.1727801-11-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303214708.1727801-1-f4bug@amsat.org> References: <20210303214708.1727801-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 | 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 dfb50b60128..781cd8fc42b 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 9c3ac4f2280..b9ffca07665 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 b8f056849a7..362ad56ab68 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7388,6 +7388,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, .vmsd =3D &vmstate_x86_cpu, }; #endif @@ -7427,7 +7428,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 fe908d9bc40..fdc169bb0ac 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, .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.2