From nobody Sun Oct 5 07:42:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.53 as permitted sender) client-ip=209.85.221.53; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f53.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.53 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1619088480; cv=none; d=zohomail.com; s=zohoarc; b=jrLlt4nOMnt4CRCjI5TIk85ccxLY5b/vJOUxLBZj3GyIBKfdnClXyE5F5XhV3xyqrlIcNwhAma58ItemVwWtLeoRe8CdBg1KvTm51La11DUhUe6WRQ8FL2QNHECP1BcjGjJGSU1sUKn5n7RwwPFkpHu2UCrGQDujp2TthH2gbBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619088480; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yUcZBsD9xDOXEB+nTKfFfC4Vo6h4KKYKLXyLvxGRN4A=; b=iHzfoNRnekF8Z9Vtcjk5Qa5/hDvp2/tx8Jjo6D+3p8LHBmDrjvlv/m8RKD353j34qqQq9Txu8gZeaPaSgEt3e5zd/EMn8RhoIQjUKxhLvz35U3m0LM8zo7VJFuljLpVSQ5pU2gPohqz5OOtswOiBZJudrbCToZBxvnIPDHFviwA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.53 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by mx.zohomail.com with SMTPS id 1619088480095440.1751383242064; Thu, 22 Apr 2021 03:48:00 -0700 (PDT) Received: by mail-wr1-f53.google.com with SMTP id x7so44270109wrw.10 for ; Thu, 22 Apr 2021 03:47:59 -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 b206sm2654028wmc.15.2021.04.22.03.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 03:47:57 -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=yUcZBsD9xDOXEB+nTKfFfC4Vo6h4KKYKLXyLvxGRN4A=; b=oZ1T7SAcX+5QgMEagUvuk7YpAxq0PVXkRcqrgDLTa3apcE4X/dHyGvdMAc8NBb6Ieg bVWU/KJQu0N1fx/Era151PDglMYqzVuM0BFUnisZb98NZ00eTlJoz1/OU7owPR1b8Nlu aV2cZnXLDDS2aJR1UsMmxOXdtwtKMnAzwC18lOTxECNJM5sB/4c/bq/mIe1hZywgSpKA VYvx6rC3lBn6+b9ZhtTdSviWK1w8bJztou6OLM9TRPLEd+BFlWJgWg2Fs8L7g9GpVx8n uV7WOdsr1DzYgf7UFiyy4hQaP4az9rSWO+1IoHPBJnmc+11+fvmYgNiXbI78JUW46g1F PazA== 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=yUcZBsD9xDOXEB+nTKfFfC4Vo6h4KKYKLXyLvxGRN4A=; b=WP0CaoyqLsYH5A2AoZlkcv4p0VxQfCUtzBtRMgltQJ7qA04gK2FGTZphMzHr/yr1UL x3GyhdRlpF98EcNOYTyXMj7nfw2+eOiKAcKDonCbbJkaFl5cHgpNbGWrb04POzzid3vj yGEt5gGWgwt1GqM9u2fj12oniIAqqKaK+XCQ0F55KCIL5dAv36jgyuVnrXKVR66cma1t ZwvUhvfhFDmhnbkLS82Enwm/Jz5VAq5FCyAjy6102Tgmcgn22iC4nt31C+uqBd8f7fZZ ld2d7RAf92UoHx9zbfjzpyBqgNIgDo/grEUdPKUG3D0BcwqPEv6F9496GonouWEEgsiL 0kcg== X-Gm-Message-State: AOAM530CZPkRHBPPAT13XGVRGETbWnSUxfTGFYytydeBAfNGsz0ibOdJ HpOstQ6YSax4PN7nYczCAkM= X-Google-Smtp-Source: ABdhPJwJv4PFPjnIresrNNHLhqLInDgitpN/6v/srbaV75nNYDLTqBEDVOpHAuyQ9pVr0CLAqleTKA== X-Received: by 2002:a5d:4584:: with SMTP id p4mr3221188wrq.383.1619088478322; Thu, 22 Apr 2021 03:47:58 -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: Paolo Bonzini , Claudio Fontana , Juan Quintela , Greg Kurz , Laurent Vivier , qemu-riscv@nongnu.org, "Michael S. Tsirkin" , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Peter Maydell , qemu-arm@nongnu.org, Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Marcel Apfelbaum , David Hildenbrand , Cornelia Huck , Thomas Huth Subject: [PATCH v5 09/15] cpu: Move CPUClass::get_crash_info to SysemuCPUOps Date: Thu, 22 Apr 2021 12:46:58 +0200 Message-Id: <20210422104705.2454166-10-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210422104705.2454166-1-f4bug@amsat.org> References: <20210422104705.2454166-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 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 a0cce7aafda..538104d4557 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, .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 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.3