On Mon, 25 May 2020 10:02:00 +0100 Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk> wrote:
> On 20/05/2020 11:07, Igor Mammedow wrote: > > > On Thu, 14 May 2020 14:13:11 +0200 > > Philippe Mathieu-Daudé <f4...@amsat.org> wrote: > > > >> On 5/14/20 12:09 PM, Igor Mammedov wrote: > >>> On Sun, 10 May 2020 13:35:05 +0200 > >>> Philippe Mathieu-Daudé <f4...@amsat.org> wrote: > >>> > >>>> Since commit 82b911aaff3, machine_run_board_init() checks for > >>>> ram_memdev_id and consume it. As TYPE_SUN4M_MEMORY is no more > >>>> needed, replace it by the generic memdev allocated MemoryRegion > >>>> and remove it. This completes commit b2554752b1da7c8f. > >>> > >>> I don't get justification here. > >>> You are removing 'frontend' device model that has little/nothing > >>> to do with how backend is instantiated. > >>> > >>> TYPE_SUN4M_MEMORY is analog to pc-dimm, only for builtin RAM > >>> (not really useful but could serve as an example). > >> > >> I have no idea about the benefits of using memory frontend/backend > >> with emulation. Is there documentation and examples? I'm seeing > >> this code as a complicated way of doing a simple thing, but I > >> guess I'm missing the big picture here. > > > > Examples are pc-dimm and nv-dimm which thanks to separation easily > > reusable across pc/spapr/virt-arm. > > > > Having frontend is also useful for mgmt purposes, where HMP/QMP > > just has to enumerate all RAM devices, otherwise boards would have > > to provide a callback to describe their custom mappings. > > > > But for embed boards with a single blob of RAM nailed down, > > having frontend is probably overkill (at least ATM). > > So I'm fine with this patch /with amended commit message/ > > I don't feel too strongly about this, however if there is a standard > way of doing things then I would prefer to do that since it makes it > easier for me as a maintainer if there are existing (and up-to-date) > examples that I can use as a reference. > > Presumably it also means that if HMP/QMP commands are added in > relation to machine RAM then the SPARC machines would get that new > functionality automatically... I'm afraid there is no standard way to do it yet. Even for virt targeted boards we have a mix of 1. explicit mapping of memory region (arm/virt, x86, spapr), -m/-machine memory-backend CLI options (with optional partitioning of it internally, using aliases (pc/q35, some other embed boards)) which now maps auto-created or user provided hostmem back-end memory region This area is quite a mess. 2. device based RAM in guise of pc-dimm or nv-dimm, where user explicitly provides hostmem back-end and pairing it with [pc|nv]-dimm frontend on CLI (i.e. like on real hardware machines). Theoretically you can reuse pc-dimm if whole dimm maps into VM address space. It will get accounted in HMP info commands automatically. But it hasn't been done for main RAM on any machine yet so thta's an area to experiment with. which opens questions: * how to map -m/-machine memory-backend to frontend * or maybe ditch -m and force user to specify all DIMMs on CLI explicitly. > > ATB, > > Mark. >