From nobody Tue Feb 10 04:15:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14877867987121016.2035886258525; Wed, 22 Feb 2017 10:06:38 -0800 (PST) Received: from localhost ([::1]:54524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgbJD-0003Cp-Bn for importer@patchew.org; Wed, 22 Feb 2017 13:06:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgbHK-00028X-Cz for qemu-devel@nongnu.org; Wed, 22 Feb 2017 13:04:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgbHJ-0006Ew-ET for qemu-devel@nongnu.org; Wed, 22 Feb 2017 13:04:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59346) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgbHJ-0006EW-8s for qemu-devel@nongnu.org; Wed, 22 Feb 2017 13:04:37 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 604DA6AAEB for ; Wed, 22 Feb 2017 18:04:37 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-116-160.ams2.redhat.com [10.36.116.160]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1MI4OAh032732; Wed, 22 Feb 2017 13:04:34 -0500 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 22 Feb 2017 19:04:22 +0100 Message-Id: <20170222180423.26571-3-pbonzini@redhat.com> In-Reply-To: <20170222180423.26571-1-pbonzini@redhat.com> References: <20170222180423.26571-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 22 Feb 2017 18:04:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/3] cpu: implement get_crash_info through QOM properties X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Provide a generic implementation for all CPU subclasses. Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- include/qom/cpu.h | 1 - qom/cpu.c | 11 ++++------- target/i386/cpu.c | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 1bc3ad2..04d3a2c 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -158,7 +158,6 @@ typedef struct CPUClass { uint8_t *buf, int len, bool is_write); void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprint= f, int flags); - GuestPanicInformation* (*get_crash_info)(CPUState *cpu); void (*dump_statistics)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, int flags); int64_t (*get_arch_id)(CPUState *cpu); diff --git a/qom/cpu.c b/qom/cpu.c index 7e005af..a9482ce 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -22,6 +22,8 @@ #include "qapi/error.h" #include "qemu-common.h" #include "qom/cpu.h" +#include "qom/qom-qobject.h" +#include "qapi-visit.h" #include "sysemu/hw_accel.h" #include "qemu/notify.h" #include "qemu/log.h" @@ -220,13 +222,8 @@ static bool cpu_common_exec_interrupt(CPUState *cpu, i= nt int_req) =20 GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - GuestPanicInformation *res =3D NULL; - - if (cc->get_crash_info) { - res =3D cc->get_crash_info(cpu); - } - return res; + return OBJECT_PROPERTY_GET_PTR(OBJECT(cpu), "crash-information", + GuestPanicInformation, NULL); } =20 void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 63be816..3071769 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3516,6 +3516,7 @@ static GuestPanicInformation *x86_cpu_get_crash_info(= CPUState *cs) =20 return panic_info; } + static void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -3731,7 +3732,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc= , void *data) cc->do_interrupt =3D x86_cpu_do_interrupt; cc->cpu_exec_interrupt =3D x86_cpu_exec_interrupt; cc->dump_state =3D x86_cpu_dump_state; - cc->get_crash_info =3D x86_cpu_get_crash_info; cc->set_pc =3D x86_cpu_set_pc; cc->synchronize_from_tb =3D x86_cpu_synchronize_from_tb; cc->gdb_read_register =3D x86_cpu_gdb_read_register; --=20 2.9.3