qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Selecting device variant types based on bdrv size


From: Peter Crosthwaite
Subject: [Qemu-devel] Selecting device variant types based on bdrv size
Date: Mon, 27 May 2013 17:50:06 +1000

Hi All,

I have a bit of a chicken and egg problem trying to refactor Jans AT24
I2C EEPROM model. I'm trying to migrate static class properties up to
the class level rather than down on the device property level (as we
did for EHCI in the sysbusification a while back). Problem is the
device model has part autodetection logic based on the size of the
backing image - you can instantiate the "abstract" class and selection
of what part it is depends on the backing file size. And so if we go
for one class for each separate part, we don't actually know what
concrete class to instantiate until we have a handle on the bdrv at
realize time which is way to late. Any Ideas?

Can you safely change a devices type at realize time?

realize() {
   ...
   OBJECT(dev)->class = the_now_known_correct_child_class;
   ...
}

Obviously this would need an API call in QOM to sanity check it.

Regards,
Peter



reply via email to

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