[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/27] add memdev backend infrastructure
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 07/27] add memdev backend infrastructure |
Date: |
Mon, 25 Nov 2013 17:09:37 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 |
Il 25/11/2013 17:01, Igor Mammedov ha scritto:
>> > So this is why you need a new command-line option.
>> >
>> > I think we need a generic mechanism for post-initialization of whatever
>> > is given on the command line. Perhaps you can do that with an
>> > interface, and get rid of -memdev and memdev_add altogether?
>> >
>> > MemoryBackend's implementation of the interface's sole method would call
>> > get_memory, of course.
>
> What I would use instead of memdev_add in CLI/HMP/QMP?
We could add a new object_add command.
> Could you explain it a bit more, please?
The interface would look like
struct QOMCommandLineIface {
void complete(Object *object, Error **errp);
Object *get_base_path(void);
}
MemoryBackend could implement it like this:
void memory_backend_complete(Object *object, Error **errp)
{
MemoryBackend *backend = MEMORY_BACKEND(object);
MemoryBackendClass *bc = MEMORY_BACKEND_GET_CLASS(obj);
if (bc->get_memory) {
bc->get_memory(backend, errp);
}
}
Object *memory_backend_get_base_path(void);
{
return container_get(qdev_get_backend(), "/memdev"),
}
A default implementation can be added to RNGBackend and TPMBackend.
vl.c can use the interface like this in object_create:
obj = object_new(type);
QOMCommandLineIface *cmdline_iface;
if (IS_QOM_COMMAND_LINE(obj)) {
object_unref(obj);
error...
return -1;
}
if (qemu_opt_foreach(opts, object_set_property, obj, 1) < 0) {
object_unref(obj);
return -1;
}
cmdline_iface = QOM_COMMAND_LINE_GET_IFACE(obj);
cmdline_iface->complete(obj, &local_err);
if (local_err)) {
error_propagate(...)
object_unref(obj);
return -1;
}
object_property_add_child(cmdline_iface->get_base_path(),
id, obj, NULL);
Then you can just use -object instead of -memdev.
- Re: [Qemu-devel] [PATCH 05/27] qapi: add SIZE type parser to string_input_visitor, (continued)
- Re: [Qemu-devel] [PATCH 05/27] qapi: add SIZE type parser to string_input_visitor, Michael S. Tsirkin, 2013/11/25
- Re: [Qemu-devel] [PATCH 05/27] qapi: add SIZE type parser to string_input_visitor, Paolo Bonzini, 2013/11/25
- Re: [Qemu-devel] [PATCH 05/27] qapi: add SIZE type parser to string_input_visitor, Eric Blake, 2013/11/25
- Re: [Qemu-devel] [PATCH 05/27] qapi: add SIZE type parser to string_input_visitor, Paolo Bonzini, 2013/11/25
- Re: [Qemu-devel] [PATCH 05/27] qapi: add SIZE type parser to string_input_visitor, Markus Armbruster, 2013/11/27
- Re: [Qemu-devel] [PATCH 05/27] qapi: add SIZE type parser to string_input_visitor, Paolo Bonzini, 2013/11/27
[Qemu-devel] [PATCH 06/27] get reference to /backend container via qemu_get_backend(), Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 07/27] add memdev backend infrastructure, Igor Mammedov, 2013/11/20
Re: [Qemu-devel] [PATCH 07/27] add memdev backend infrastructure, Eric Blake, 2013/11/27
[Qemu-devel] [PATCH 08/27] dimm: implement dimm device abstraction, Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 09/27] dimm: map DimmDevice into DimBus provided address space, Igor Mammedov, 2013/11/20