[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/9] hw/riscv/sifive_e: Fix inheritance of SiFiveEState
- To: Bernhard Beschow <shentey@xxxxxxxxx>, qemu-devel@xxxxxxxxxx, Palmer Dabbelt <palmerdabbelt@xxxxxxxxxx>
- From: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
- Date: Tue, 20 Sep 2022 06:47:22 +0200
- Cc: "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Magnus Damm <magnus.damm@xxxxxxxxx>, Aleksandar Rikalo <aleksandar.rikalo@xxxxxxxxxx>, Bandan Das <bsd@xxxxxxxxxx>, Matthew Rosato <mjrosato@xxxxxxxxxxxxx>, Daniel Henrique Barboza <danielhb413@xxxxxxxxx>, Sergio Lopez <slp@xxxxxxxxxx>, Alexey Kardashevskiy <aik@xxxxxxxxx>, Xiaojuan Yang <yangxiaojuan@xxxxxxxxxxx>, Cameron Esfahani <dirty@xxxxxxxxx>, Michael Rolnik <mrolnik@xxxxxxxxx>, Song Gao <gaosong@xxxxxxxxxxx>, Jagannathan Raman <jag.raman@xxxxxxxxxx>, Greg Kurz <groug@xxxxxxxx>, Kamil Rytarowski <kamil@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>, Joel Stanley <joel@xxxxxxxxx>, Alistair Francis <Alistair.Francis@xxxxxxx>, "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, haxm-team@xxxxxxxxx, Roman Bolshakov <r.bolshakov@xxxxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>, Eric Auger <eric.auger@xxxxxxxxxx>, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>, Daniel P. Berrangé <berrange@xxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>, Cédric Le Goater <clg@xxxxxxxx>, Stefan Hajnoczi <stefanha@xxxxxxxxxx>, qemu-block@xxxxxxxxxx, Eduardo Habkost <eduardo@xxxxxxxxxxx>, Hervé Poussineau <hpoussin@xxxxxxxxxxx>, qemu-ppc@xxxxxxxxxx, Cornelia Huck <cohuck@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, qemu-riscv@xxxxxxxxxx, Stafford Horne <shorne@xxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Havard Skinnemoen <hskinnemoen@xxxxxxxxxx>, Elena Ufimtseva <elena.ufimtseva@xxxxxxxxxx>, Alexander Graf <agraf@xxxxxxxxx>, Thomas Huth <thuth@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Wenchao Wang <wenchao.wang@xxxxxxxxx>, Tony Krowiak <akrowiak@xxxxxxxxxxxxx>, Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx>, qemu-s390x@xxxxxxxxxx, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, Eric Farman <farman@xxxxxxxxxxxxx>, Reinoud Zandijk <reinoud@xxxxxxxxxx>, Alexander Bulekov <alxndr@xxxxxx>, Yanan Wang <wangyanan55@xxxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, Tyrone Ting <kfting@xxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, John Snow <jsnow@xxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Darren Kenny <darren.kenny@xxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, Qiuhao Li <Qiuhao.Li@xxxxxxxxxxx>, John G Johnson <john.g.johnson@xxxxxxxxxx>, Bin Meng <bin.meng@xxxxxxxxxxxxx>, Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, qemu-arm@xxxxxxxxxx, Marcelo Tosatti <mtosatti@xxxxxxxxxx>, Peter Maydell <peter.maydell@xxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Andrew Jeffery <andrew@xxxxxxxx>, Artyom Tarasenko <atar4qemu@xxxxxxxxx>, Halil Pasic <pasic@xxxxxxxxxxxxx>, "Maciej S. Szmigiero" <maciej.szmigiero@xxxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Laurent Vivier <laurent@xxxxxxxxx>, Alistair Francis <alistair@xxxxxxxxxxxxx>, Jason Herne <jjherne@xxxxxxxxxxxxx>
- Delivery-date: Tue, 20 Sep 2022 04:47:50 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 20/9/22 01:17, Bernhard Beschow wrote:
SiFiveEState inherits from SysBusDevice while it's TypeInfo claims it to
inherit from TYPE_MACHINE. This is an inconsistency which can cause
undefined behavior such as memory corruption.
Change SiFiveEState to inherit from MachineState since it is registered
as a machine.
Signed-off-by: Bernhard Beschow <shentey@xxxxxxxxx>
---
include/hw/riscv/sifive_e.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/hw/riscv/sifive_e.h b/include/hw/riscv/sifive_e.h
index 83604da805..d738745925 100644
--- a/include/hw/riscv/sifive_e.h
+++ b/include/hw/riscv/sifive_e.h
@@ -22,6 +22,7 @@
#include "hw/riscv/riscv_hart.h"
#include "hw/riscv/sifive_cpu.h"
#include "hw/gpio/sifive_gpio.h"
+#include "hw/boards.h"
#define TYPE_RISCV_E_SOC "riscv.sifive.e.soc"
#define RISCV_E_SOC(obj) \
@@ -41,7 +42,7 @@ typedef struct SiFiveESoCState {
typedef struct SiFiveEState {
/*< private >*/
- SysBusDevice parent_obj;
+ MachineState parent_obj;
Ouch.
Fixes: 0869490b1c ("riscv: sifive_e: Manually define the machine")
Reviewed-by: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
|