rename pci_hotplug_fn to hotplug_fn and make it available for other devices

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
vl: set default ram_size during variable initialization

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v2:
  - keep legacy behaviour "-m 0" resulting in default ram_size value
dimm: implement dimm device abstraction

Each hotplug-able memory slot is a DimmDevice. All DimmDevices are
attached to a new bus called DimmBus.

A hot-add operation for a DIMM:
- creates a new DimmDevice and attaches it to the DimmBus

Hotplug operations are done through normal device_add commands.
For migration case, all hotplugged DIMMs on source should be specified
on target's command line using '-device' option with properties set to
the same values as on target.

To simplify review, patch introduces only DimmDevice and DimmBus basic
QOM skeleton that will be extended by following patches to implement
actual memory hotplug and related functions.

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v3:
  pc: compile memhotplug on i386 target too
v2:
  fix typo s/DimmBus/DimmDevice/ in doc comment
  s/klass/oc/;s/*/parent_obj/;a/gtk-doc markup/
dimm: map DimmDevice into DimBus provided address space

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
dimm: add busy slot check and slot auto-allocation

- if slot property is not specified on -device/device_add command,
treat default value as request for assigning DimmDevice to
the first free slot.

- if slot is provided with -device/device_add command, attempt to
use it or fail command if it's already occupied.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v2:
  s/dc/dbc/
dimm: add busy address check and address auto-allocation

- if 'start' property is not specified on -device/device_add command,
treat default value as request for assigning DimmDevice to
the first free memory region.

- if 'start' is provided with -device/device_add command, attempt to
use it or fail command if it's already occupied or falls inside
of an existing DimmDevice memory region.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v2:
  s/dc/dbc/
dimm: add hotplug callback to DimmBus

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi/piix4: introduce memory hot-plug interface QEMU<->ACPI BIOS

- implements QEMU part of memory hotplug protocol described at
  docs/specs/acpi_mem_hotplug.txt
- handles memory add notification event.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v2:
  * acpi/piix: impl hotplug callback
pc: ACPI BIOS: implement memory hotplug interface

- provides static DSDT object for memory hotplug
- SSDT template for memory devices and runtime generator
  of them in SSDT table.

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
pc: update acpi-dsdt.hex.generated and add ssdt-mem.hex.generated

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: use enum for defining memory affinity flags

replace magic numbers with enum describing Flags field of
memory affinity in SRAT table.

MemoryAffinityFlags enum will define flags decribed by:
 ACPI spec 5.0, "5.2.16.2 Memory Affinity Structure",
 "Table 5-69 Flags - Memory Affinity Structure"

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: return PIIX4_PM from piix4_pm_init()

it will be used by pc_piix to set PIIX4_PM as
hotplug device for memory hotplug notification
to guest.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
pc: piix: make PCII440FXState type public

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
pc: piix: add memory hotplug to 440fx machine

Add 2 DimmBus-es, one for memory hotplug below 4Gb and
second above 4Gb.

* if ram_size is less tha 32-bit PCI hole start, reserve
  hotplug memory region as [ram_size,32bit-PCIhole-start)
  and for the rest of hotplug memory reserve hotplug
  memory region above "0x100000000ULL + above_4g_mem_size"

* setup memory hotplug callback to use PIIX4_PM as hotplug
  notification device

Signed-off-by: Igor Mammedov <imammedo@redhat.com>