Peter Maydell <peter.mayd...@linaro.org> writes:

> On Mon, 17 Feb 2020 at 17:20, Philippe Mathieu-Daudé <phi...@redhat.com> 
> wrote:
>> Quick check with TYPE_BITBAND which is a SysBus device, we have:
>>
>> static void bitband_realize(DeviceState *dev, Error **errp)
>> {
>>      BitBandState *s = BITBAND(dev);
>>
>>      if (!s->source_memory) {
>>          error_setg(errp, "source-memory property not set");
>>          return;
>>      }
>>
>>      address_space_init(&s->source_as, s->source_memory, "bitband-source");
>> }
>>
>> Do we need the equivalent:
>>
>> static void bitband_unrealize(DeviceState *dev, Error **errp)
>> {
>>      BitBandState *s = BITBAND(dev);
>>
>>      address_space_destroy(&s->source_as);
>> }
>>
>> Or instead mark the device user_creatable=false because of the link to a
>> TYPE_MEMORY_REGION?
>
> I don't believe that this device is user-creatable. The
> base class sysbus_device_class_init() sets user_creatable
> to false by default for all sysbus devices, and a sysbus
> device which wants to opt into being user-created has to
> set it to true.

As far as I can tell, you additionally have to
machine_class_allow_dynamic_sysbus_dev().  Sysbus is special.

> Also the device's type name string is "ARM,bitband-memory"
> and the -device option at least does not like the comma
> in the middle of the name, so I don't know how you'd
> create it on the command line even if it wasn't marked
> not user-creatable.

Double the comma.

If I remember correctly, the use of comma in type comes from IEEE-1275.
It's quite inappropriate for QEMU.


Reply via email to