mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
machine: add default_ram_size to machine class
Machines types can have different requirement for default ram size. Introduce a member in the machine class and set the current default_ram_size to 128MB. For QEMUMachine types override the value during the registration of the machine and for MachineClass introduce the generic class init setting the default_ram_size. Add helpers [K,M,G,T,P,E]_BYTE for better readability and easy usage Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
c5bc152bc3
commit
076b35b5a5
4 changed files with 32 additions and 14 deletions
|
@ -294,6 +294,14 @@ static void machine_init_notify(Notifier *notifier, void *data)
|
|||
foreach_dynamic_sysbus_device(error_on_sysbus_device, NULL);
|
||||
}
|
||||
|
||||
static void machine_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
|
||||
/* Default 128 MB as guest ram size */
|
||||
mc->default_ram_size = 128 * M_BYTE;
|
||||
}
|
||||
|
||||
static void machine_initfn(Object *obj)
|
||||
{
|
||||
MachineState *ms = MACHINE(obj);
|
||||
|
@ -463,6 +471,7 @@ static const TypeInfo machine_info = {
|
|||
.parent = TYPE_OBJECT,
|
||||
.abstract = true,
|
||||
.class_size = sizeof(MachineClass),
|
||||
.class_init = machine_class_init,
|
||||
.instance_size = sizeof(MachineState),
|
||||
.instance_init = machine_initfn,
|
||||
.instance_finalize = machine_finalize,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue