i440fx: remove unused parameter i440fx_state of i440fx_init.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
i440fx: rename i440FX to i440FX-PMC

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
i440fx: rename i440FX-pcihost to i440FX

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
i440fx: prepare for composition

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
i440fx pmc: create pmc through comosition

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
i440fx-pmc: calculate PCI memory hole directly

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
i440fx-pmc: create pci address space

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
q35-mch: create pci address space

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
i440fx-pmc: move ram initialization into i440fx-pmc

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
q35-mch: move ram initialization into q35-mch

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
introduce ISAPc

Previous refactor breaks isapc. This patch introduces ISAPc and move
isapc initializing code to ISAPc.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
introduce memory controller

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
i440fx pmc: inherit from MemoryController

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
q35 mch: inherit from MemoryController

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
move bios loading to MemoryController and ISAPc

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
qapi: make visit_type_size fallback to v->type_int()

In case of v->type_uint64 is NULL, fallback to v->type_int, by calling
visit_type_uint64().

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Add SIZE type to qdev properties

This patch adds a 'SIZE' type property to qdev.

It will make dimm description more convenient by allowing sizes to be specified
with K,M,G,T prefixes instead of number of bytes e.g.:
-device dimm,id=mem0,size=2G,bus=membus.0

Credits go to Ian Molton for original patch. See:
http://patchwork.ozlabs.org/patch/38835/

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
qemu-option: export parse_option_number

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Implement dimm device abstraction

Each hotplug-able memory slot is a DimmDevice. All DimmDevices are attached
to a new bus called DimmBus. This bus is introduced so that we no longer
depend on hotplug-capability of main system bus (the main bus does not allow
hotplugging). The DimmBus should be attached to a chipset Device (i440fx in case
of the pc)

A hot-add operation for a particular dimm:
- creates a new DimmDevice and attaches it to the DimmBus
- creates a new MemoryRegion of the given physical address offset, size and
node proximity, and attaches it to main system memory as a sub_region.

Hotplug operations are done through normal device_add commands.
Also add properties to DimmDevice.

TODO/FIXME: Dimm configurations are specified at qemu startup at the command
line. Dimms with "populated=off" are actually not created, but their config
is saved in the corresponding bus. If user does not specify the correct bus
for a dimm device during device_add and there are multiple memory buses in the
machine (e.g. right now membus.0 and membus.pv are created in this pachset) the
first bus found in the device tree that matches the device type is picked. This
bus may be the wrong one, and the dimm config is not retrieved, thus creating a
useless dimm device. A solution would be to delete the new dimm if the dimm
config was not found (see commented qmp_device_del in dimm_init) but this does
not look clean. This design needs to be fixed somehow to avoid similar problems
if multiple memory buses are present in the same machine.

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
vl: handle "-device dimm"

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>