On Wed, Jun 28, 2017 at 08:00:24PM +0100, Dr. David Alan Gilbert (git) wrote:
[...] > diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h > index 78a3591322..d688411674 100644 > --- a/migration/postcopy-ram.h > +++ b/migration/postcopy-ram.h > @@ -114,4 +114,30 @@ PostcopyState postcopy_state_get(void); > /* Set the state and return the old state */ > PostcopyState postcopy_state_set(PostcopyState new_state); > > +/* > + * To be called once at the start before any device initialisation initialization? > + */ > +void postcopy_infrastructure_init(void); > + > +/* Add a notifier to a list to be called when checking whether the devices > + * can support postcopy. > + * It's data is a *PostcopyNotifyData > + * It should return 0 if OK, or a negative value on failure. > + * On failure it must set the data->errp to an error. > + * > + */ > +enum PostcopyNotifyReason { > + POSTCOPY_NOTIFY_PROBE = 0, > +}; > + > +struct PostcopyNotifyData { > + enum PostcopyNotifyReason reason; > + Error **errp; > +}; > + > +void postcopy_add_notifier(NotifierWithReturn *nn); > +void postcopy_remove_notifier(NotifierWithReturn *n); > +/* Call the notifier list set by postcopy_add_start_notifier */ > +int postcopy_notify(enum PostcopyNotifyReason reason, Error **errp); > + > #endif > diff --git a/vl.c b/vl.c > index a2bd69f4e0..b6c660a703 100644 > --- a/vl.c > +++ b/vl.c > @@ -93,8 +93,9 @@ int main(int argc, char **argv) > #include "sysemu/dma.h" > #include "hw/audio/soundhw.h" > #include "audio/audio.h" > -#include "sysemu/cpus.h" > #include "migration/colo.h" > +#include "migration/postcopy-ram.h" > +#include "sysemu/cpus.h" (just curious: is moving sysemu/cpus.h intended?) > #include "sysemu/kvm.h" > #include "sysemu/hax.h" > #include "qapi/qobject-input-visitor.h" > @@ -3060,6 +3061,7 @@ int main(int argc, char **argv, char **envp) > module_call_init(MODULE_INIT_OPTS); > > runstate_init(); > + postcopy_infrastructure_init(); > > if (qcrypto_init(&err) < 0) { > error_reportf_err(err, "cannot initialize crypto: "); > -- > 2.13.0 > Thanks, -- Peter Xu