sdk/emulator/qemu.git
9 years agoacpi-test-data: update after pci rewrite
Michael S. Tsirkin [Sun, 1 Mar 2015 18:39:36 +0000 (19:39 +0100)]
acpi-test-data: update after pci rewrite

more trivial changes as more code has been rewritten in C.
we also got rid of extra Scope operators.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb().
Tang Chen [Thu, 26 Feb 2015 01:16:43 +0000 (09:16 +0800)]
acpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb().

Replace string "slot" in acpi_memory_plug_cb() with macro PC_DIMM_SLOT_PROP.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopci-hotplug-old: Has been dead for five major releases, bury
Markus Armbruster [Thu, 26 Feb 2015 16:21:13 +0000 (17:21 +0100)]
pci-hotplug-old: Has been dead for five major releases, bury

Commit 79ca616 (v1.6.0) accidentally disabled legacy x86-only HMP
commands pci_add, pci_del: it defined CONFIG_PCI_HOTPLUG only as make
variable, not as preprocessor macro, killing the code conditional on
defined(CONFIG_PCI_HOTPLUG_OLD).

In all this time, nobody reported the loss.  I only noticed it when I
tried to test some error reporting change that forced me to touch this
old crap again.

Fun: git-log hw/pci/pci-hotplug-old.c shows our faith in the backward
compatibility god has been strong enough to sacrifice at its altar
about a dozen times, but not strong enough to even once verify the
legacy feature's still there, let alone works.

Remove the commands along with the code backing them.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopci: Give a few helpers internal linkage
Markus Armbruster [Thu, 26 Feb 2015 16:21:14 +0000 (17:21 +0100)]
pci: Give a few helpers internal linkage

None of them should be used in new code.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: make build_*() routines static to aml-build.c
Igor Mammedov [Fri, 20 Feb 2015 18:22:20 +0000 (18:22 +0000)]
acpi: make build_*() routines static to aml-build.c

build_*() routines were used for composing AML
structures manually in acpi-build.c but after
conversion to AML API they are not used outside
of aml-build.c anymore, so hide them from external
users.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: remove not used anymore ssdt-[misc|pcihp].hex.generated blobs
Igor Mammedov [Fri, 20 Feb 2015 18:22:19 +0000 (18:22 +0000)]
pc: acpi: remove not used anymore ssdt-[misc|pcihp].hex.generated blobs

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: drop template patching and create PCI bus tree dynamically
Igor Mammedov [Fri, 20 Feb 2015 18:22:18 +0000 (18:22 +0000)]
pc: acpi-build: drop template patching and create PCI bus tree dynamically

Replace AML template patching with direct composing
of PCI device entries in C. It allows to simplify
PCI tree generation further and saves us about 400LOC
scattered through different files, confining tree
generation to one C function which is much easier
to deal with.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotests: ACPI: update pc/SSDT.bridge due to new alg of PCI tree creation
Igor Mammedov [Fri, 20 Feb 2015 18:22:17 +0000 (18:22 +0000)]
tests: ACPI: update pc/SSDT.bridge due to new alg of PCI tree creation

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: simplify PCI bus tree generation
Igor Mammedov [Fri, 20 Feb 2015 18:22:16 +0000 (18:22 +0000)]
pc: acpi-build: simplify PCI bus tree generation

it basicaly does the same as original approach,
* just without bus/notify tables tracking (less obscure)
  which is easier to follow.
* drops unnecessary loops and bitmaps,
  creating devices and notification method in the same loop.
* saves us ~100LOC

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotests: add ACPI blobs for qemu with bridge cases
Igor Mammedov [Fri, 20 Feb 2015 18:22:15 +0000 (18:22 +0000)]
tests: add ACPI blobs for qemu with bridge cases

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotests: bios-tables-test: add support for testing bridges
Igor Mammedov [Fri, 20 Feb 2015 18:22:14 +0000 (18:22 +0000)]
tests: bios-tables-test: add support for testing bridges

Adds alternative ACPI table blob selection for testing
non default QEMU configurations. If blob file for test
variant is not present, fallback to default blob.

With this change implement testing with a coldplugged
bridge.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotests: ACPI test blobs update due to PCI0._CRS changes
Igor Mammedov [Fri, 20 Feb 2015 18:22:13 +0000 (18:22 +0000)]
tests: ACPI test blobs update due to PCI0._CRS changes

PCI0._CRS was moved into SSDT and became the same for
PIIX4/Q35 machines.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: drop template patching and create Device(SMC) dynamically
Igor Mammedov [Fri, 20 Feb 2015 18:22:12 +0000 (18:22 +0000)]
pc: acpi-build: drop template patching and create Device(SMC) dynamically

patch moves SMC device into SSDT and creates it only
when device is present, which makes ACPI tables smaller
in default case when device is not present.

Also it fixes wrong IO range in CRS if "iobase"
property is set to a non default value.

PS:
Testing with XP shows that current default "iobase"
used SMC device conflicts with floppy controller IO,
but it's topic for another patch and I'd leave it
to SMC device author for resolving conflict.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
CC: agraf@suse.de
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: export applesmc IO port/len
Igor Mammedov [Fri, 20 Feb 2015 18:22:11 +0000 (18:22 +0000)]
pc: export applesmc IO port/len

IO port and length will be used in following patch
to correctly generate SMC ACPI device in SSDT.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add acpi_irq_no_flags() term
Igor Mammedov [Fri, 20 Feb 2015 18:22:10 +0000 (18:22 +0000)]
acpi: add acpi_irq_no_flags() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: drop remaining ssdt_misc template
Igor Mammedov [Fri, 20 Feb 2015 18:22:09 +0000 (18:22 +0000)]
pc: acpi-build: drop remaining ssdt_misc template

It drops empty ssdt_misc templete. It also hides
from user almost all pointer arithmetic when building
SSDT which makes resulting code a bit cleaner
and concentrating only on composing ASL construct
/i.e. a task build_ssdt() should be doing/.

Also it makes one binary blob less stored in QEMU
source tree by removing need to keep and update
hw/i386/ssdt-misc.hex.generated file here in total
saving us ~430LOC.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: drop manual hole punching for GPE0 resources
Igor Mammedov [Fri, 20 Feb 2015 18:22:08 +0000 (18:22 +0000)]
pc: acpi: drop manual hole punching for GPE0 resources

Drops manual hole punching in PCI0._CRS on PIIX4 machine type
for GPE0 resources. Resources will be consumed by Device(GPE0)
that is attached to PCI namespace.
There is GPE device with HID ACPI0006 since ACPI2.0
that should be used for this purpose but none of Windows
versions support it and show it as "unknown device",
so reserve resource in old fashioned way with PNP0A06
device to make windows happy and actually reserve resources.

Along with last hole _CRS layout of PIIX4 machine becomes
the same as Q35 one, so merge them together and use the same
_CRS for both machine types.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: drop manual hole punching for CPU hotplug resources
Igor Mammedov [Fri, 20 Feb 2015 18:22:07 +0000 (18:22 +0000)]
pc: acpi: drop manual hole punching for CPU hotplug resources

Drops manual hole punching in PCI0._CRS on PIIX4 machine type
for CPU hotplug resources.
Resources will be consumed by Device(PRES) that is attached
to PCI bus. The same way how it currently works for mem hotlpug.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: drop manual hole punching for PCI hotplug resources
Igor Mammedov [Fri, 20 Feb 2015 18:22:06 +0000 (18:22 +0000)]
pc: acpi: drop manual hole punching for PCI hotplug resources

Drops manual hole punching in PCI0._CRS for PIIX4 machine type.
Resources will be consumed by Device(PHPR) that cwis attached
to PCI bus. The same way how it currently works for mem hotlpug.

Manual hole in PIIX4 _CRS wasn't correct anyway since it was
legacy size 0xF while current PCIHP MMIO region is of size 0x14.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: create PCI0._CRS dynamically
Igor Mammedov [Fri, 20 Feb 2015 18:22:05 +0000 (18:22 +0000)]
pc: acpi-build: create PCI0._CRS dynamically

Replace template patching and runtime calculation
in _CRS() method with static _CRS defined in SSDT.
No functional change except of as mentined above
and _CRS being moved from DSDT to SSDT.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotpm: Support for capability flags of TIS 1.3
Stefan Berger [Mon, 23 Feb 2015 14:27:20 +0000 (09:27 -0500)]
tpm: Support for capability flags of TIS 1.3

Provide the TIS 1.3 capability flags.
The interface now looks like a TIS 1.3 interface. It's fully
compatible with previous TIS 1.2 and drivers written for
TIS 1.2 continue to work.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotpm: Support for TIS selftest done flag
Stefan Berger [Mon, 23 Feb 2015 14:27:19 +0000 (09:27 -0500)]
tpm: Support for TIS selftest done flag

Extend the backend to check whether the TPM_ContinueSelfTest
finished successfully and provide a flag to the TIS front-end
if it successfully finished. The TIS then sets a flag in
all localities in the STS register and keeps it until the next
reset.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotpm: Support for XFIFO register
Stefan Berger [Mon, 23 Feb 2015 14:27:18 +0000 (09:27 -0500)]
tpm: Support for XFIFO register

Support for the XFIFO register (range) of the TIS 1.3 specification.
We support a range of 64 bytes.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotpm: Allow 32 & 16 bit accesses to the registers
Stefan Berger [Mon, 23 Feb 2015 14:27:17 +0000 (09:27 -0500)]
tpm: Allow 32 & 16 bit accesses to the registers

Improve the access to the registers with 32 and 16 bit reads and writes.
Also enable access to a non-base register address, such as reads of the
2nd byte of a register. Map the FIFO byte access to any byte within
its 4 byte register (following specs).

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotpm: Extend sts register to 32 bit
Stefan Berger [Mon, 23 Feb 2015 14:27:16 +0000 (09:27 -0500)]
tpm: Extend sts register to 32 bit

More recent TIS specs extend the STS register to 32 bit. While
we don't store the TIS interface state, yet, we can extend it
without sideeffects.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoballoon: call qdev_alias_all_properties for proxy dev in balloon class init
Denis V. Lunev [Thu, 29 Jan 2015 14:24:41 +0000 (17:24 +0300)]
balloon: call qdev_alias_all_properties for proxy dev in balloon class init

The idea is that all other virtio devices are calling this helper
to merge properties of the proxy device. This is the only difference
in between this helper and code in inside virtio_instance_init_common.
The patch should not cause any harm as property list in generic balloon
code is empty.

This also allows to avoid some dummy errors like fixed by this
    commit 91ba21208839643603e7f7fa5864723c3f371ebe
    Author: Gonglei <arei.gonglei@huawei.com>
    Date:   Tue Sep 30 14:10:35 2014 +0800
    virtio-balloon: fix virtio-balloon child refcount in transports

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Raushaniya Maksudova <rmaksudova@parallels.com>
Revieved-by: Cornelia Huck <cornelia.huck@de.ibm.com>
CC: Christian Borntraeger <borntraeger@de.ibm.com>
CC: Anthony Liguori <aliguori@amazon.com>
CC: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi-test: update expected files
Michael S. Tsirkin [Wed, 18 Feb 2015 21:29:26 +0000 (22:29 +0100)]
acpi-test: update expected files

A bunch of code moved from dsdt to ssdt,
plus we got trivial changes like 0->Zero which our test
dosn't recognize as identity yet.
Update expected files to suppress test warning.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: drop unused generated files
Michael S. Tsirkin [Wed, 18 Feb 2015 20:45:11 +0000 (21:45 +0100)]
acpi: drop unused generated files

drop ssdt-mem.hex.generated and ssdt-proc.hex.generated:
dsl files have been removed previously.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: update generated hex files
Michael S. Tsirkin [Wed, 18 Feb 2015 20:43:48 +0000 (21:43 +0100)]
acpi: update generated hex files

Used for IASL builds.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: reserve PCIHP MMIO resources
Igor Mammedov [Wed, 18 Feb 2015 19:14:50 +0000 (19:14 +0000)]
pc: acpi-build: reserve PCIHP MMIO resources

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: pcihp: expose MMIO base and len as properties
Igor Mammedov [Wed, 18 Feb 2015 19:14:49 +0000 (19:14 +0000)]
pc: pcihp: expose MMIO base and len as properties

it will be used later to dynamically reserve MMIO region
instead of manually punching holes in PCI0._CRS

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_word_bus_number(), aml_word_io(), aml_dword_memory(), aml_qword_memory...
Igor Mammedov [Wed, 18 Feb 2015 19:14:48 +0000 (19:14 +0000)]
acpi: add aml_word_bus_number(), aml_word_io(), aml_dword_memory(), aml_qword_memory() terms

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: create memory hotplug IO region dynamically
Igor Mammedov [Wed, 18 Feb 2015 19:14:47 +0000 (19:14 +0000)]
pc: acpi-build: create memory hotplug IO region dynamically

it replaces a static complied in DSDT MMIO region
for memory hotplug with one created at runtime
leaving only truly static memory hotplug related
ASL bits in DSDT. And replaces template patching
of MEMORY_SLOTS_NUMBER value with ASL API created
named value.

Later it also would make easier to reuse current
ACPI memory hotplug on other targets.

Also later it would be possible to move remaining
memory hotplug ASL methods into build_ssdt() and
add all memory hotplug related AML into SSDT only
when memory hotplug is enabled, further reducing
ACPI tables blob if memory hotplug isn't used.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: drop template patching and memory hotplug objects dynamically
Igor Mammedov [Wed, 18 Feb 2015 19:14:46 +0000 (19:14 +0000)]
pc: acpi-build: drop template patching and memory hotplug objects dynamically

in addition it saves us ~330LOC and makes it one binary blob less
stored in QEMU source tree by removing need to keep and update
hw/i386/ssdt-mem.hex.generated file there.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_reserved_field() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:45 +0000 (19:14 +0000)]
acpi: add aml_reserved_field() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: create CPU hotplug IO region dynamically
Igor Mammedov [Wed, 18 Feb 2015 19:14:44 +0000 (19:14 +0000)]
pc: acpi-build: create CPU hotplug IO region dynamically

it replaces a static complied in DSDT MMIO region
for CPU hotplug with one created at runtime
leaving only truly static CPU hotplug related ASL
bits in DSDT.
It also puts CPU_HOTPLUG_RESOURCE_DEVICE into
PCI0 scope and reserves resources from it,
preparing for dropping manual hole punching
in PCI0._CRS.

Later it also would make easier to reuse current
ACPI CPU hotplug on other targets.

Also later it would be possible to move remaining
CPU hotplug ASL methods into build_ssdt() and
add all CPU hotplug related AML into SSDT only
when CPU hotplug is enabled, further reducing
ACPI tables blob if CPU hotplug isn't used.

impl. detail:
Windows XP can't handle /BSODs/ OperationRegion
declaration in DSDT when variable from SSDT is used
for specifying its address/length and also when
Field declared in DSDT with OperationRegion from
SSDT if DSDT is being parsed before SSDT.
But it works just fine when referencing named
fields from another table. Hence OperationRegion
and Field declaration are moved to SSDT to make
XP based editions work.

PS:
Later Windows editions seem to be fine with above
conditions.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: drop template patching and CPU hotplug objects dynamically
Igor Mammedov [Wed, 18 Feb 2015 19:14:43 +0000 (19:14 +0000)]
pc: acpi-build: drop template patching and CPU hotplug objects dynamically

in addition it saves us ~400LOC and makes it
one binary blob less stored in QEMU source
tree by removing need to keep and update
hw/i386/ssdt-proc.hex.generated file there.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_eisaid() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:42 +0000 (19:14 +0000)]
acpi: add aml_eisaid() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_processor() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:41 +0000 (19:14 +0000)]
acpi: add aml_processor() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_equal() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:40 +0000 (19:14 +0000)]
acpi: add aml_equal() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_varpackage() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:39 +0000 (19:14 +0000)]
acpi: add aml_varpackage() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: generate pvpanic device description dynamically
Igor Mammedov [Wed, 18 Feb 2015 19:14:38 +0000 (19:14 +0000)]
pc: acpi-build: generate pvpanic device description dynamically

Drops AML template patching and allows to
save some space in SSDT if pvpanic device doesn't
exist by not including disabled device description
into SSDT. It also makes device description
smaller by replacing _STA method with named value
and dropping _INI method.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_string() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:37 +0000 (19:14 +0000)]
acpi: add aml_string() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_local() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:36 +0000 (19:14 +0000)]
acpi: add aml_local() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_field() & aml_named_field() terms
Igor Mammedov [Wed, 18 Feb 2015 19:14:35 +0000 (19:14 +0000)]
acpi: add aml_field() & aml_named_field() terms

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_operation_region() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:34 +0000 (19:14 +0000)]
acpi: add aml_operation_region() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: include PkgLength size only when requested
Igor Mammedov [Wed, 18 Feb 2015 19:14:33 +0000 (19:14 +0000)]
acpi: include PkgLength size only when requested

Named/Reserved{Field} definition uses PkgLength [1] encoding to specify
field length, however it doesn't include size of PkgLength field itself,
while other block objects that have explicit length of its body account
for PkgLength size while encoding it [2].
This special casing isn't mentioned in ACPI spec, but that's what 'iasl'
compiles NamedField to so add extra argument to build_prepend_pkg_length()
to allow it handle the case.

--
1. ACPI Spec 5.0, 20.2.5.2 Named Objects Encoding, page 822
2. ACPI Spec 5.0, 5.4 Definition Block Encoding

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_io() helper
Igor Mammedov [Wed, 18 Feb 2015 19:14:32 +0000 (19:14 +0000)]
acpi: add aml_io() helper

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_resource_template() helper
Igor Mammedov [Wed, 18 Feb 2015 19:14:31 +0000 (19:14 +0000)]
acpi: add aml_resource_template() helper

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_buffer() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:30 +0000 (19:14 +0000)]
acpi: add aml_buffer() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: generate _S[345] packages dynamically
Igor Mammedov [Wed, 18 Feb 2015 19:14:29 +0000 (19:14 +0000)]
pc: acpi-build: generate _S[345] packages dynamically

Replaces template patching with packages composed
using AML API.

Note on behavior change:
If S3 or S4 is disabled, respective packages won't
be created and put into SSDT. Which saves us some
space in SSDT and doesn't confuse guest OS with
mangled package names as it was done originally.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_package() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:28 +0000 (19:14 +0000)]
acpi: add aml_package() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_call1(), aml_call2(), aml_call3(), aml_call4() helpers
Igor Mammedov [Wed, 18 Feb 2015 19:14:27 +0000 (19:14 +0000)]
acpi: add aml_call1(), aml_call2(), aml_call3(), aml_call4() helpers

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_notify() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:26 +0000 (19:14 +0000)]
acpi: add aml_notify() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_and() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:25 +0000 (19:14 +0000)]
acpi: add aml_and() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_store() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:24 +0000 (19:14 +0000)]
acpi: add aml_store() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_arg() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:23 +0000 (19:14 +0000)]
acpi: add aml_arg() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_return() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:22 +0000 (19:14 +0000)]
acpi: add aml_return() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_int() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:21 +0000 (19:14 +0000)]
acpi: add aml_int() term

* factor out ACPI const int packing out of build_append_value()
  and rename build_append_value() to build_append_int_noprefix()
  it will be reused for adding a plain integer value into AML.
  will be used by is aml_processor() and CRS macro helpers
* extend build_append_int{_noprefix}() to support 64-bit values
  it will be used PCI for generating 64bit _CRS entries

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_name() & aml_name_decl() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:20 +0000 (19:14 +0000)]
acpi: add aml_name() & aml_name_decl() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_if() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:19 +0000 (19:14 +0000)]
acpi: add aml_if() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_method() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:18 +0000 (19:14 +0000)]
acpi: add aml_method() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_device() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:17 +0000 (19:14 +0000)]
acpi: add aml_device() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi-build: use aml_scope() for \_SB scope
Igor Mammedov [Wed, 18 Feb 2015 19:14:16 +0000 (19:14 +0000)]
pc: acpi-build: use aml_scope() for \_SB scope

prepares for incremental conversion of SSDT content to AML API

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_scope() term
Igor Mammedov [Wed, 18 Feb 2015 19:14:15 +0000 (19:14 +0000)]
acpi: add aml_scope() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: introduce AML composer aml_append()
Igor Mammedov [Wed, 18 Feb 2015 19:14:14 +0000 (19:14 +0000)]
acpi: introduce AML composer aml_append()

Adds for dynamic AML creation, which will be used
for piecing ASL/AML primitives together and hiding
from user/caller details about how nested context
should be closed/packed leaving less space for
mistakes and necessity to know how AML should be
encoded, allowing user to concentrate on ASL
representation instead.

For example it will allow to create AML like this:

init_aml_allocator();
...
Aml *scope = aml_scope("PCI0")
Aml *dev = aml_device("PM")
    aml_append(dev, aml_name_decl("_ADR", aml_int(addr)))
aml_append(scope, dev);
...
free_aml_allocator();

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio_ring.h: s/__inline__/inline/
Michael S. Tsirkin [Wed, 18 Feb 2015 15:37:35 +0000 (16:37 +0100)]
virtio_ring.h: s/__inline__/inline/

Thomas Huth noticed that some linux headers
use __inline__, change to inline to be consistent
with the rest of QEMU.

Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agostandard-headers: include stdint.h
Michael S. Tsirkin [Wed, 18 Feb 2015 15:44:35 +0000 (16:44 +0100)]
standard-headers: include stdint.h

The importing script got it right already, I just forgot to re-run it.

Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-serial-bus.c: drop virtio_ids.h
Michael S. Tsirkin [Wed, 18 Feb 2015 15:42:30 +0000 (16:42 +0100)]
virtio-serial-bus.c: drop virtio_ids.h

virtio-serial.h pulls that in already.

Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoupdate-linux-headers.sh: s/__inline__/inline/
Michael S. Tsirkin [Wed, 18 Feb 2015 15:37:35 +0000 (16:37 +0100)]
update-linux-headers.sh: s/__inline__/inline/

Thomas Huth noticed that some linux headers
use __inline__, change to inline to be consistent
with the rest of QEMU.

Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: use local var for accessing ACPI tables blob in acpi_build()
Igor Mammedov [Mon, 9 Feb 2015 10:53:24 +0000 (10:53 +0000)]
pc: acpi: use local var for accessing ACPI tables blob in acpi_build()

except of shortening of lines and making code a bit more readable,
it will reduce renaming noise when changing tables blob from GArray* to
Aml* type.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi-build: skip hotplugged bridges
Michael S. Tsirkin [Wed, 28 Jan 2015 16:30:38 +0000 (18:30 +0200)]
acpi-build: skip hotplugged bridges

hotplugged bridges don't get bsel allocated so acpi hotplug doesn't work
for them anyway.  OTOH adding them in ACPI creates a host of problems,
e.g. they can't be hot-unplugged themselves which is surprising to
users.

So let's just skip these.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: add feature checking helpers
Cornelia Huck [Thu, 11 Dec 2014 13:25:06 +0000 (14:25 +0100)]
virtio: add feature checking helpers

Add a helper function for checking whether a bit is set in the guest
features for a vdev as well as one that works on a feature bit set.

Convert code that open-coded this: It cleans up the code and makes it
easier to extend the guest feature bits.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: feature bit manipulation helpers
Cornelia Huck [Thu, 11 Dec 2014 13:25:05 +0000 (14:25 +0100)]
virtio: feature bit manipulation helpers

Add virtio_{add,clear}_feature helper functions for manipulating a
feature bits variable. This has some benefits over open coding:
- add check that the bit is in a sane range
- make it obvious at a glance what is going on
- have a central point to change when we want to extend feature bits

Convert existing code manipulating features to use the new helpers.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: cull virtio_bus_set_vdev_features
Cornelia Huck [Thu, 11 Dec 2014 13:25:04 +0000 (14:25 +0100)]
virtio: cull virtio_bus_set_vdev_features

The only user of this function was virtio-ccw, and it should use
virtio_set_features() like everybody else: We need to make sure
that bad features are masked out properly, which this function did
not do.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agos390: use standard headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:58 +0000 (22:36 +0100)]
s390: use standard headers

Drop duplicated macros in favor of values from
standard headers.

Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agostandard-headers: add s390 virtio headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:53 +0000 (22:36 +0100)]
standard-headers: add s390 virtio headers

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoscripts: add arch specific standard-headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:48 +0000 (22:36 +0100)]
scripts: add arch specific standard-headers

Copy arch specific virtio headers.
ATM this applies to s390 only.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: use standard headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:43 +0000 (22:36 +0100)]
virtio-pci: use standard headers

Drop duplicate code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agolinux-headers: use standard-headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:37 +0000 (22:36 +0100)]
linux-headers: use standard-headers

Drop duplicated code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoupdate-linux-headers: use standard-headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:32 +0000 (22:36 +0100)]
update-linux-headers: use standard-headers

Drop the linux-specific virtio headers, use the copy from
standard-headers instead.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-serial: switch to standard-headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:26 +0000 (22:36 +0100)]
virtio-serial: switch to standard-headers

Drop duplicate code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-scsi: use standard-headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:20 +0000 (22:36 +0100)]
virtio-scsi: use standard-headers

Drop duplicated code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agovirtio-rng: use standard-headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:15 +0000 (22:36 +0100)]
virtio-rng: use standard-headers

Drop duplicated code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
9 years agovirtio-net,tap: use standard-headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:09 +0000 (22:36 +0100)]
virtio-net,tap: use standard-headers

Drop duplicated code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
9 years agovirtio-blk: switch to standard-headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:36:03 +0000 (22:36 +0100)]
virtio-blk: switch to standard-headers

Drop duplicated code. Minor codechanges were required
as geometry is a sub-structure now.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
9 years agovirtio-9p: use standard headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:35:57 +0000 (22:35 +0100)]
virtio-9p: use standard headers

Drop code duplicated from standard headers.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
9 years agovirtio-balloon: use standard headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:35:52 +0000 (22:35 +0100)]
virtio-balloon: use standard headers

Drop code duplicated from standard headers.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
9 years agovirtio: use standard-headers
Michael S. Tsirkin [Mon, 16 Feb 2015 21:35:46 +0000 (22:35 +0100)]
virtio: use standard-headers

Drop a bunch of code duplicated from virtio_config.h and virtio_ring.h.
This makes us rename event index accessors which conflict,
as reusing the ones from virtio_ring.h isn't trivial.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
9 years agovirtio: use standard virtio_ring.h
Michael S. Tsirkin [Mon, 16 Feb 2015 21:35:40 +0000 (22:35 +0100)]
virtio: use standard virtio_ring.h

Switch to virtio_ring.h from standard headers.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoinclude: import virtio headers from linux 4.0
Michael S. Tsirkin [Mon, 16 Feb 2015 21:35:31 +0000 (22:35 +0100)]
include: import virtio headers from linux 4.0

Add files imported from linux-next (what will become linux 4.0) using
scripts/update-linux-headers.sh

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoscripts/update-linux-headers.sh: pull virtio hdrs
Michael S. Tsirkin [Mon, 16 Feb 2015 21:35:25 +0000 (22:35 +0100)]
scripts/update-linux-headers.sh: pull virtio hdrs

It doesn't make sense to copy values manually:
the only issue with getting headers from linux
seems to be dealing with linux/types, we
can easily fix that automatically while importing.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
9 years agoacpi-build: simplify rsdp management for legacy
Michael S. Tsirkin [Tue, 17 Feb 2015 09:40:30 +0000 (10:40 +0100)]
acpi-build: simplify rsdp management for legacy

For legacy machine types, rsdp is not in RAM, so we need a copy of rsdp
for fw cfg. We previously used g_array_free with false parameter,
but this seems to confuse people.
This also wastes a bit of memory as the buffer is unused for new
machine types.

Let's just use plain g_memdup, and free original memory together with
the array.

TODO: rationalize tcpalog memory management, and get rid of the mfre
parameter.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
9 years agoacpi: has_immutable_rsdp->!rsdp_in_ram
Michael S. Tsirkin [Tue, 17 Feb 2015 09:04:40 +0000 (10:04 +0100)]
acpi: has_immutable_rsdp->!rsdp_in_ram

As comment in acpi-build.c notes, RSDP is not really immutable.  So it's
really a question of whether it's in RAM, name the variable accordingly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
9 years agoacpi-build: fix ACPI RAM management
Michael S. Tsirkin [Sun, 15 Feb 2015 16:12:11 +0000 (17:12 +0100)]
acpi-build: fix ACPI RAM management

This fixes multiple issues around ACPI RAM management:

RSDP and linker RAM aren't currently marked dirty
on update, so they won't be migrated correctly.

Let's handle all tables in the same way: set correct size (assert if
too big), update, mark RAM dirty.

This also drops assert checking that table size didn't change: table
size is fundamentally dynamic and depends on hw configuration,
just set the correct size and use that (memory core asserts if size is
too large).

This also means we can drop tracking table size, memory core does this
for us now.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoexec: round up size on MR resize
Michael S. Tsirkin [Tue, 17 Feb 2015 09:15:30 +0000 (10:15 +0100)]
exec: round up size on MR resize

Block size must fundamentally be a multiple of target page size.
Aligning automatically removes need to worry about the alignment
from callers.

Note: the only caller of qemu_ram_resize (acpi) already happens to have
size padded to a power of 2, but we would like to drop the padding in
ACPI core, and don't want to expose target page size knowledge to ACPI.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Paolo Bonzini <ponzini@redhat.com>
9 years agopc: acpi-build: migrate RSDP table
Igor Mammedov [Mon, 9 Feb 2015 13:59:55 +0000 (13:59 +0000)]
pc: acpi-build: migrate RSDP table

Makes sure that RSDP stays the same
/i.e. matches ACPI tables blob in source/
if guest is migrated during RSDP reading or
has been already shadowed by firmware.

Fix applies only to new machine types starting
from 2.3, so it won't break migration for old
machine types.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
9 years agopc: acpi-build: update linker on guest access
Igor Mammedov [Mon, 9 Feb 2015 13:59:54 +0000 (13:59 +0000)]
pc: acpi-build: update linker on guest access

Linker table is build only once, so if later during
tables rebuild sizes of other ACPI tables change
pointers will be patched incorrectly due to wrong
offsets in linker. Resulting in guest not being able
to find ACPI tables.
Fix it by updating 'linker' table with the rest of
tables when firmware reads it.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
9 years agoacpi: update RSDP on guest access
Michael S. Tsirkin [Mon, 9 Feb 2015 13:59:53 +0000 (13:59 +0000)]
acpi: update RSDP on guest access

RSDT offset can change across reboots and that makes
immutable RSDP, which is build at startup, point to
incorrect place in ACPI table blob. That results in
BIOS corrupting tables and guest OS failing to find
ACPI tables.
We really should have put it in a ROM region, but
we can't change that for old machine types,
let's just set the callback and update it explicitly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
9 years agopc: memory: Validate alignment of maxram_size to page size
Peter Krempa [Thu, 29 Jan 2015 13:48:41 +0000 (14:48 +0100)]
pc: memory: Validate alignment of maxram_size to page size

If the maxram_size is not aligned and dimm devices were added on the
command line qemu would terminate with a rather unhelpful message:

ERROR:hw/mem/pc-dimm.c:150:pc_dimm_get_free_addr: assertion failed:
(QEMU_ALIGN_UP(address_space_size, align) == address_space_size)

In case no dimm device was originally added on the commandline qemu
exits on the assertion failure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>