[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
qdev instance_init vs realize split
|
From: |
Damien Hedde |
|
Subject: |
qdev instance_init vs realize split |
|
Date: |
Tue, 15 Feb 2022 11:19:56 +0100 |
|
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 |
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
- qdev instance_init vs realize split,
Damien Hedde <=