hw/core: introduced qemu machine as QOM object

The main functionality change is to convert QEMUMachine into QemuMachineClass
and QEMUMachineInitArgs into QemuMachineState, instance of QemuMachineClass.

As a first step, in order to make possible an incremental developement,
both QEMUMachine and QEMUMachineInitArgs are being embeded into the
new types.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
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.

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>