在 2013-04-05五的 13:48 +0200,Paolo Bonzini写道: > Il 05/04/2013 06:28, liguang ha scritto: > > Signed-off-by: liguang <lig.f...@cn.fujitsu.com> > > --- > > vl.c | 4 ++++ > > 1 files changed, 4 insertions(+), 0 deletions(-) > > > > diff --git a/vl.c b/vl.c > > index aeed7f4..a14549e 100644 > > --- a/vl.c > > +++ b/vl.c > > @@ -171,6 +171,8 @@ int main(int argc, char **argv) > > #include "ui/qemu-spice.h" > > #include "qapi/string-input-visitor.h" > > > > +#include "hw/power.h" > > + > > //#define DEBUG_NET > > //#define DEBUG_SLIRP > > > > @@ -4295,6 +4297,8 @@ int main(int argc, char **argv, char **envp) > > > > qdev_machine_init(); > > > > + qdev_init_nofail(qdev_create(NULL, TYPE_POWER_CHIP)); > > + > > You cannot just add a random device to the machine. > > Perhaps what you want to do is define a QOM interface that some device > in the machine will implement. > > But right now this all seems very nebulous. Honestly, I read the > patches and I have no idea _why_ you are doing this.
In short, the purpose is to implement a power control process just like real world(hardware platform), a power chip(controller) connect power signals to other devices, and devices can do power (on, off, ...) controlled by power chip(controller). Is this reasonable? > > QEMUMachineInitArgs args = { .ram_size = ram_size, > > .boot_device = (boot_devices[0] == '\0') ? > > machine->boot_order : > > >