From nobody Tue Apr 15 11:36:09 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1622074010; cv=none; d=zohomail.com; s=zohoarc; b=GWQFj4EGbYoTJJeePiFVeQvt7akzj/kJgBwDH9nJ7prhlPS3oHH5JdPl4Ubzel9CZtpAah22YBLhRNHdpJhzmQ3kUBOk78Xbg6xED4qigFq1+b/HQj4FmqalQnt+mX1bnNUOpi0fF1kFBKr6FUgSNBpI8I5LG+Qd5Zk9ZZvrARM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622074010; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PfGGDG54V+Z0/V/+AKWHcOfTeapHdTuypjBhgufuU0w=; b=mIO1/YL6VUrEgKezoyXKzNUIIOHKP0b1h1ITuCuS/YdTOawVTu3ChLSpb0mf5DDL0pKsMmz1uy9RkUtmCEDemg8NVjysuO0z6RnYM1FNNBOK9Vg6YYwng7yVCvzmRXd2GIObeYdZMSBTFKFmiD1NfnW+JZ0+o8dkMKZRIdGeu9s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622074010207309.23038049111517; Wed, 26 May 2021 17:06:50 -0700 (PDT) Received: from localhost ([::1]:47210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3Y1-00052m-4P for importer@patchew.org; Wed, 26 May 2021 20:06:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FW-0005xS-2i for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:42 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:46981) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FN-0004aP-6V for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:41 -0400 Received: by mail-pl1-x633.google.com with SMTP id d20so1407894pls.13 for ; Wed, 26 May 2021 16:47:32 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PfGGDG54V+Z0/V/+AKWHcOfTeapHdTuypjBhgufuU0w=; b=Aq2PNBYmBol/sPj/oIA2vpVqD1YeLNautafMJZ5wGel/QzBernrUCJ77JietGIG+tn yAZpLJImw2uy8v5b3e4G/79fKFwyhQpxZn5BZcU+9PEG39i7WxuOp2i3YCGQrChEtQg7 Zx2GjHfSAw04nL7fC7bAmi4h1Nqbm4UIO3pybludCyWVbG8YSz3XN2N+nT1uIatbVr4J xqa2ua0xr/lI111XSseHLXBt4vb95AE/LSBvOfoiEv1+7JBSd5RYE5vyo+Bg1aX7CYn2 l1Vt2zQpXUCWqQPWPV4Wrfm80N/adCNqnMbbRrLFDHBpN6tYdpwcpaHhQtxgMjEXpJ4T fMIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PfGGDG54V+Z0/V/+AKWHcOfTeapHdTuypjBhgufuU0w=; b=Uy9L1+EzUnK8AxTplbF+jsnLfD7QPfQHy8TgtPK1sBi3CoByIY0l618qQZT8VyPifZ zlf+n0jppBiC8rf7sNBAHh0Q9jYsMp2xBkd9JDOF+CH93aF4untAED1yX/St9eNzFUH5 Yipx7xepJ7gV4Kr8YdHdY139xFazPHT38iSCprEFSyVYXrpgqzD/2YudjMNCNHyd7flo SxYEx6qV799o4cxV919NA4Nv9yqNV3neKl26qaLKDxrwe0pFKU7jzz4NTXyG06lcrwW5 jEn46y0e1/IuWwGSIomOlQXOKWLeFbGcJYRxoIL99AK+6EwWQU1NNhtJTUUcMBCu0LE+ u6uQ== X-Gm-Message-State: AOAM531TP4qKrJvFZ3gAuPza7MRG70uvoPrC4CpVCakrEGM7Cy9nzIR1 KLY5lA9RhWKRlZIJrVQdT6ltp5m9BxAL2A== X-Google-Smtp-Source: ABdhPJz2ChYFL3KBWKha45EYW9nyMOrsICiJ8e5msoKh5Bk/WCvxtKZt7ioew41Zy2/sAmp29Vi16g== X-Received: by 2002:a17:902:74c9:b029:fd:23e6:1bd9 with SMTP id f9-20020a17090274c9b02900fd23e61bd9mr618525plt.36.1622072851796; Wed, 26 May 2021 16:47:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 24/31] cpu: Move CPUClass::get_crash_info to SysemuCPUOps Date: Wed, 26 May 2021 16:47:03 -0700 Message-Id: <20210526234710.125396-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 cpu_get_crash_info() is called on GUEST_PANICKED events, which only occur in system emulation. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-18-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 1 - include/hw/core/sysemu-cpu-ops.h | 5 +++++ hw/core/cpu-sysemu.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 dd3f5f996e..bf7d11b14f 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -151,7 +151,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 8fa98bf2a7..b9383101fc 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-sysemu.c b/hw/core/cpu-sysemu.c index bad7d2cb01..90b5ac8eb9 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -138,8 +138,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 761fffee34..7761f2fa4c 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6718,6 +6718,7 @@ static Property x86_cpu_properties[] =3D { #include "hw/core/sysemu-cpu-ops.h" =20 static const struct SysemuCPUOps i386_sysemu_ops =3D { + .get_crash_info =3D x86_cpu_get_crash_info, .legacy_vmsd =3D &vmstate_x86_cpu, }; #endif @@ -6752,7 +6753,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 d7ab7c95b1..d2175a87f5 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -480,6 +480,7 @@ static void s390_cpu_reset_full(DeviceState *dev) #include "hw/core/sysemu-cpu-ops.h" =20 static const struct SysemuCPUOps s390_sysemu_ops =3D { + .get_crash_info =3D s390_cpu_get_crash_info, .legacy_vmsd =3D &vmstate_s390_cpu, }; #endif @@ -524,7 +525,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.25.1