vl: use qemu machine QOM class instead of global machines list

The machine registration flow is refactored to use the QOM functionality.
Instead of linking the machines into a list, each machine has a type
and the types can be traversed in the QOM way.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
hw/boards: converted current_machine to be an instance of QemuMachineCLass

In order to allow attaching machine options to a machine instance,
current_machine is converted into QemuMachineState.
As a first step of deprecating QEMUMachine, some of the functions
were modified to return QemuMachineCLass.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
hw/machine: add qemu machine opts as properties to QemuMachineState

It is cleaner to query current_machine's properties than
accessing QemuOpts from the code.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
qapi: output visitor crashes qemu if it encounters a NULL value

A NULL value is not added to visitor's stack, but there
is no check for that when the visitor tries to return
that value, leading to Qemu crash.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
vl.c: do not set 'type' property in obj_set_property

Filter out also 'type' property when setting
object's properties

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
qom: add object_property_is_set

Sometimes is not enough to get property's value,
but it is needed to know if the value was actually set.

This is especially useful when querying bool properties
and having different defaults on different scenarios.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
machine-opts: replace qemu_opt_get by QOM QemuMachine queries

It is cleaner to query current_machine's properties than
accessing QemuOpts from the code.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
hw/core: mapped QemuOpts into QEMUMachineInitArgs fields to remove duplication

The QOM machine has both field per QemuOpt and an instance of
QEMUMachineInitArgs. Removed dupplications.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>