qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* qdev instance_init vs realize split
@ 2022-02-15 10:19 Damien Hedde
  2022-02-15 11:15 ` Philippe Mathieu-Daudé via
  2022-02-15 11:32 ` Peter Maydell
  0 siblings, 2 replies; 6+ messages in thread
From: Damien Hedde @ 2022-02-15 10:19 UTC (permalink / raw)
  To: QEMU Developers, Paolo Bonzini, Daniel P. Berrange,
	Eduardo Habkost, Philippe Mathieu-Daudé

Hi,

I'm wondering if there are rules or convention about what we put in the 
instance_init() vs realize() for simple devices ? (For complex ones we 
generally have no choice to put everything in realize())

For example we can declare irqs and mmios in instance_init() or 
realize() if they do not depend on some property.

This is not a big deal, but given how works the help message generation 
in the monitor, there are difference if the device is user-creatable.

If we leave irqs and mmios declaration in the instance_init(). They 
appear in the help message.
 > (qemu) device_add ibex-timer,help
 > ibex-timer options:
 >   ibex-timer[0]=<child<memory-region>>
 >   sysbus-irq[0]=<link<irq>>
 >   timebase-freq=<uint32> -  (default: 10000)

If we delay the declaration in realize(), we only have the declared 
qdev-properties (which is maybe more what we expect at this point):

 > (qemu) device_add ibex-timer,help
 > ibex-timer options:
 >   timebase-freq=<uint32> -  (default: 10000)

Any comments ?

Thanks,
Damien


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-15 16:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-15 10:19 qdev instance_init vs realize split Damien Hedde
2022-02-15 11:15 ` Philippe Mathieu-Daudé via
2022-02-15 11:32 ` Peter Maydell
2022-02-15 13:21   ` Damien Hedde
2022-02-15 13:35     ` Peter Maydell
2022-02-15 16:42       ` Damien Hedde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).