On Fri, 21 Apr 2023 at 02:13, Gurchetan Singh
<gurchetansi...@chromium.org> wrote:

> Though the api does make an exception:
>
> "There is an exception to the above rule: it is okay to call
> object_unparent at any time for an alias or a container region. It is
> therefore also okay to create or destroy alias and container regions
> dynamically during a device’s lifetime."
>
> I believe we are trying to create a container subregion, but that's
> still failing?


> @@ -671,6 +677,14 @@ rutabaga_cmd_resource_map_blob(VirtIOGPU *g,
>      result = rutabaga_resource_map(rutabaga, mblob.resource_id, &mapping);
>      CHECK_RESULT(result, cmd);
>
> +    memory_region_transaction_begin();
> +    memory_region_init_ram_device_ptr(&res->region, OBJECT(g), NULL,
> +                                      mapping.size, (void *)mapping.ptr);

This isn't a container MemoryRegion -- it is a RAM MR. That is,
accesses to it are backed by a lump of host memory (viz, the
one provided here via the mapping.ptr). A container MR is one
which provides no backing mechanism (neither host RAM, nor
MMIO read/write callbacks), and whose contents are purely
those of any other MemoryRegions that you add to it via
memory_region_add_subregion(). So the exception listed in the
API docs does not apply here.

-- PMM

Reply via email to