[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/9] Deprecate sysbus_get_default() and get_system_memory() e

From: Peter Maydell
Subject: Re: [PATCH 0/9] Deprecate sysbus_get_default() and get_system_memory() et. al
Date: Wed, 21 Sep 2022 10:47:58 +0100

On Tue, 20 Sept 2022 at 23:50, Bernhard Beschow <shentey@gmail.com> wrote:
> Am 20. September 2022 09:55:37 UTC schrieb Peter Maydell 
> <peter.maydell@linaro.org>:
> >On Tue, 20 Sept 2022 at 00:18, Bernhard Beschow <shentey@gmail.com> 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.
> My intention was to allow exactly that: By turning sytem memory and system IO 
> into non-singletons, one could have many of them, thus allowing boards to 
> create arbitrary mappings of memory and IO. Since QEMU currently assumes one 
> set (memory and IO) of addresses, I for now instantiated the SysBus once in 
> the machine class to preserve behavior.

You can already create arbitrary mappings of memory and IO
(look at the virt board for an example). The existence of the
legacy singleton system-memory and system-io doesn't prevent that,
and stuffing the singletons into the MachineState doesn't do
anything to change the code that is relying on the singletons.

> >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.
> Again, having multiple SysBuses may solve that issue.

We definitely don't want multiple sysbuses.

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]