[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 0/9] Deprecate sysbus_get_default() and get_system_memory() et. al
- To: Bernhard Beschow <shentey@xxxxxxxxx>
- From: Peter Maydell <peter.maydell@xxxxxxxxxx>
- Date: Tue, 20 Sep 2022 10:55:37 +0100
- Cc: 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@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>, Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>, 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>, 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 09:56:09 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Tue, 20 Sept 2022 at 00:18, Bernhard Beschow <shentey@xxxxxxxxx> wrote:
>
> In address-spaces.h it can be read that get_system_memory() and
> get_system_io() are temporary interfaces which "should only be used
> temporarily
> until a proper bus interface is available". This statement certainly extends
> to
> the address_space_memory and address_space_io singletons.
This is a long standing "we never really completed a cleanup"...
> This series attempts
> to stop further proliferation of their use by turning TYPE_SYSTEM_BUS into an
> object-oriented, "proper bus interface" inspired by PCIBus.
>
> While at it, also the main_system_bus singleton is turned into an attribute of
> MachineState. Together, this resolves five singletons in total, making the
> ownership relations much more obvious which helps comprehension.
...but I don't think this is the direction we want to go.
Overall the reason that the "system memory" and "system IO"
singletons are weird is that in theory they should not be necessary
at all -- board code should create devices and map them into an
entirely arbitrary MemoryRegion or set of MemoryRegions corresponding
to address space(s) for the CPU and for DMA-capable devices. But we
keep them around because
(a) there is a ton of legacy code that assumes there's only one
address space in the system and this is it
(b) when modelling the kind of board where there really is only
one address space, having the 'system memory' global makes
the APIs for creating and connecting devices a lot simpler
Retaining the whole-system singleton but shoving it into MachineState
doesn't really change much, IMHO.
More generally, sysbus is rather weird because it isn't really a
bus. Every device in the system of TYPE_SYS_BUS_DEVICE is "on"
the unique TYPE_SYSTEM_BUS bus, but that doesn't mean they're
all in the same address space or that in real hardware they'd
all be on the same bus. sysbus has essentially degraded into a
hack for having devices get reset. I really really need to make
some time to have another look at reset handling. If we get that
right then I think it's probably possible to collapse the few
things TYPE_SYS_BUS_DEVICE does that TYPE_DEVICE does not down
into TYPE_DEVICE and get rid of sysbus altogether...
thanks
-- PMM
|