[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>
- From: Alistair Francis <alistair23@xxxxxxxxx>
- Date: Tue, 20 Sep 2022 09:31:10 +1000
- Cc: "qemu-devel@xxxxxxxxxx Developers" <qemu-devel@xxxxxxxxxx>, "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 <qemu-block@xxxxxxxxxx>, Eduardo Habkost <eduardo@xxxxxxxxxxx>, Hervé Poussineau <hpoussin@xxxxxxxxxxx>, "open list:New World" <qemu-ppc@xxxxxxxxxx>, Cornelia Huck <cohuck@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>, "open list:RISC-V" <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 <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>, "open list:X86" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, John Snow <jsnow@xxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Darren Kenny <darren.kenny@xxxxxxxxxx>, "open list:Overall" <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 <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: Mon, 19 Sep 2022 23:31:46 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Tue, Sep 20, 2022 at 9:18 AM Bernhard Beschow <shentey@xxxxxxxxx> 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>
Reviewed-by: Alistair Francis <alistair.francis@xxxxxxx>
Alistair
> ---
> 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;
>
> /*< public >*/
> SiFiveESoCState soc;
> --
> 2.37.3
>
>
|