sdk/emulator/qemu.git
12 years agoPPC: e500: dt: create /cpus node dynamically
Alexander Graf [Thu, 17 May 2012 09:48:16 +0000 (11:48 +0200)]
PPC: e500: dt: create /cpus node dynamically

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: dt: create memory node dynamically
Alexander Graf [Thu, 17 May 2012 09:34:50 +0000 (11:34 +0200)]
PPC: e500: dt: create memory node dynamically

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: require libfdt
Alexander Graf [Thu, 17 May 2012 10:23:41 +0000 (12:23 +0200)]
PPC: e500: require libfdt

Now that we're moving all of the device tree generation from an external
pre-execution generated blob to runtime generation using libfdt, we absolutely
must have libfdt around.

This requirement was there before already, as the only way to not require libfdt
with e500 was to not use -kernel, which was the only way to boot the mpc8544ds
machine. This patch only manifests said requirement in the build system.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agodt: add helper for 64bit cell adds
Alexander Graf [Thu, 17 May 2012 23:53:01 +0000 (01:53 +0200)]
dt: add helper for 64bit cell adds

Some times in the device tree, we find an array of 2 u32 cells that
really are a single u64 value. This patch adds a helper to make the
creation of these easy.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agodt: add helper for phandle allocation
Alexander Graf [Thu, 17 May 2012 14:58:55 +0000 (16:58 +0200)]
dt: add helper for phandle allocation

Phandle references work by having 2 pieces:

  - a "phandle" 1-cell property in the device tree node
  - a reference to the same value in a property we want to point
    to the other node

To generate the 1-cell property, we need an allocation mechanism that
gives us a unique number space. This patch adds an allocator for these
properties.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agodt: add helper for empty dt creation
Alexander Graf [Thu, 17 May 2012 13:33:54 +0000 (15:33 +0200)]
dt: add helper for empty dt creation

We want to get rid of the concept of loading an external device tree and instead
generate our own. However, to do this we need to also create a device tree
template programatically.

This patch adds a helper to create an empty device tree in memory.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agodt: add helper for phandle enumeration
Alexander Graf [Thu, 17 May 2012 13:23:39 +0000 (15:23 +0200)]
dt: add helper for phandle enumeration

This patch adds a helper to search for a node's phandle by its path. This
is especially useful when the phandle is part of an array, not just a single
cell in which case qemu_devtree_setprop_phandle would be the easy choice.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agodt: temporarily disable subtree creation failure check
Alexander Graf [Thu, 17 May 2012 12:12:57 +0000 (14:12 +0200)]
dt: temporarily disable subtree creation failure check

Usually we want to know when creating a subtree fails. However, while
introducing this patch set we have to modify the device tree and some
times have the code to create a subtree in both the binary tree and
the dynamically created tree.

So ignore failures about this for now and enable them once we got rid
of the binary device tree.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agodt: add helper for phandle references
Alexander Graf [Thu, 17 May 2012 12:11:52 +0000 (14:11 +0200)]
dt: add helper for phandle references

Phandles are the fancy device tree name for "pointer to another node".
To create a phandle property, we most likely want to reference to the
node we're pointing to by its path. So create a helper that allows
us to do so.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agodt: add helpers for multi-cell adds
Alexander Graf [Thu, 17 May 2012 10:47:57 +0000 (12:47 +0200)]
dt: add helpers for multi-cell adds

We have device tree helpers that allow us to create single cell (u32)
wide properties. However, when creating properties that contain an array of
cells, we need to jump through hoops, manually passing in an array with
converted endianness.

To ease the pain of this, create a generic macro helper that allows us
to pass the cells as arguments.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agodt: allow add_subnode to create root subnodes
Alexander Graf [Thu, 17 May 2012 09:40:42 +0000 (11:40 +0200)]
dt: allow add_subnode to create root subnodes

Our subnode creation helper can't handle creation of root subnodes,
like "/memory". Fix this by allowing the parent node to be an empty
string, indicating the root node.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agoraw-posix: Fix build without is_allocated support
Kevin Wolf [Tue, 19 Jun 2012 22:02:51 +0000 (22:02 +0000)]
raw-posix: Fix build without is_allocated support

Move the declaration of s into the #ifdef sections that actually make
use of it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agospapr: Add "memop" hypercall
Benjamin Herrenschmidt [Mon, 18 Jun 2012 20:21:37 +0000 (20:21 +0000)]
spapr: Add "memop" hypercall

This adds a qemu-specific hypervisor call to the pseries machine
which allows to do what amounts to memmove, memcpy and xor over
regions of physical memory such as the framebuffer.

This is the simplest way to get usable framebuffer speed from
SLOF since the framebuffer isn't mapped in the VRMA and so would
otherwise require an hcall per 8 bytes access.

The performance is still not great but usable, and can be improved
with a more complex implementation of the hcall itself if needed.

This also adds some documentation for the qemu-specific hypercalls
that we add to PAPR along with a new qemu,hypertas-functions property
that mirrors ibm,hypertas-functions and provides some discoverability
for the new calls.

Note: I chose note to advertise H_RTAS to the guest via that mechanism.
This is done on purpose, the guest uses the normal RTAS interfaces
provided by qemu (including SLOF) which internally calls H_RTAS.

We might in the future implement part (or even all) of RTAS inside the
guest like IBM's firmware does and replace H_RTAS with some finer grained
set of private hypercalls.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agospapr_vscsi: Error handling fixes
Benjamin Herrenschmidt [Mon, 18 Jun 2012 20:02:38 +0000 (20:02 +0000)]
spapr_vscsi: Error handling fixes

We were incorrectly g_free'ing an object that isn't allocated
in one error path and failed to release it completely in another

This fixes qemu crashes with some cases of IO errors.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Correctly create ibm,segment-page-sizes property
Benjamin Herrenschmidt [Mon, 18 Jun 2012 19:56:30 +0000 (19:56 +0000)]
pseries: Correctly create ibm,segment-page-sizes property

The core tcg/kvm code for ppc64 now has at least the outline
capability to support pagesizes beyond the standard 4k and 16MB.  The
CPUState is initialized with information advertising the available
pagesizes and their correct encodings, and under the right KVM setup
this will be populated with page sizes beyond the standard.

Obviously guests can't use the extra page sizes unless they know
they're present.  For the pseries machine, at least, there is a
defined method for conveying exactly this information, the
"ibm-segment-page-sizes" property in the guest device tree.

This patch generates this property using the supported page size
information that's already in the CPUState.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc64: Rudimentary Support for extra page sizes on server CPUs
Benjamin Herrenschmidt [Mon, 18 Jun 2012 19:56:25 +0000 (19:56 +0000)]
ppc64: Rudimentary Support for extra page sizes on server CPUs

More recent Power server chips (i.e. based on the 64 bit hash MMU)
support more than just the traditional 4k and 16M page sizes.  This
can get quite complicated, because which page sizes are supported,
which combinations are supported within an MMU segment and how these
page sizes are encoded both in the SLB entry and the hash PTE can vary
depending on the CPU model (they are not specified by the
architecture).  In addition the firmware or hypervisor may not permit
use of certain page sizes, for various reasons.  Whether various page
sizes are supported on KVM, for example, depends on whether the PR or
HV variant of KVM is in use, and on the page size of the memory
backing the guest's RAM.

This patch adds information to the CPUState and cpu defs to describe
the supported page sizes and encodings.  Since TCG does not yet
support any extended page sizes, we just set this to NULL in the
static CPU definitions, expanding this to the default 4k and 16M page
sizes when we initialize the cpu state.  When using KVM, however, we
instead determine available page sizes using the new
KVM_PPC_GET_SMMU_INFO call.  For old kernels without that call, we use
some defaults, with some guesswork which should do the right thing for
existing HV and PR implementations.  The fallback might not be correct
for future versions, but that's ok, because they'll have
KVM_PPC_GET_SMMU_INFO.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agobooke_206_tlbwe: Discard invalid bits in MAS2
Fabien Chouteau [Mon, 21 May 2012 06:11:06 +0000 (06:11 +0000)]
booke_206_tlbwe: Discard invalid bits in MAS2

The size of EPN field in MAS2 depends on page size. This patch adds a
mask to discard invalid bits in EPN field.

Definition of EPN field from e500v2 RM:
EPN Effective page number: Depending on page size, only the bits
associated with a page boundary are valid. Bits that represent offsets
within a page are ignored and should be cleared.

There is a similar (but more complicated) definition in PowerISA V2.06.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoAvoid segfault in cpu_dump_state
Fabien Chouteau [Mon, 14 May 2012 23:39:09 +0000 (23:39 +0000)]
Avoid segfault in cpu_dump_state

Do not call cpu_dump_state if logfile is NULL.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
[agraf: adjust to inline functions]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: mpc8544ds: Span initial TLB entry over as much RAM as we need
Alexander Graf [Fri, 18 May 2012 22:48:50 +0000 (00:48 +0200)]
PPC: mpc8544ds: Span initial TLB entry over as much RAM as we need

The initial TLB entry is supposed to help us run the guest -kernel payload.
This means the guest needs to be able to access its own memory, the initrd
memory and the device tree.

So far we only statically reserved a TLB entry from [0;256M[. This patch
fixes it to span from [0;dt_end[, allowing the guest payload to access
everything initially.

Reported-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Make hbrev table const
Blue Swirl [Wed, 30 May 2012 04:23:42 +0000 (04:23 +0000)]
ppc: Make hbrev table const

Lookup table 'hbrev' is never written to, so add a 'const' qualifier.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Add missing break
Blue Swirl [Wed, 30 May 2012 04:23:41 +0000 (04:23 +0000)]
ppc: Add missing break

Add obviously missing 'break' statement.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Move load and store helpers, switch to AREG0 free mode
Blue Swirl [Wed, 30 May 2012 04:23:40 +0000 (04:23 +0000)]
ppc: Move load and store helpers, switch to AREG0 free mode

Add an explicit CPUPPCState parameter instead of relying on AREG0
and rename op_helper.c (which only contains load and store helpers)
to mem_helper.c. Remove AREG0 swapping in
tlb_fill().

Switch to AREG0 free mode. Use cpu_ld{l,uw}_code in translation
and interrupt handling, cpu_{ld,st}{l,uw}_data in loads and stores.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Move misc helpers from helper.c to misc_helper.c
Blue Swirl [Wed, 30 May 2012 04:23:39 +0000 (04:23 +0000)]
ppc: Move misc helpers from helper.c to misc_helper.c

Move more misc helpers from helper.c to misc_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Avoid AREG0 for misc helpers
Blue Swirl [Wed, 30 May 2012 04:23:38 +0000 (04:23 +0000)]
ppc: Avoid AREG0 for misc helpers

Add an explicit CPUPPCState parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Split off misc helpers
Blue Swirl [Wed, 30 May 2012 04:23:37 +0000 (04:23 +0000)]
ppc: Split off misc helpers

Move misc helpers from op_helper.c to misc_helpers.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Avoid AREG0 for timebase helpers
Blue Swirl [Wed, 30 May 2012 04:23:36 +0000 (04:23 +0000)]
ppc: Avoid AREG0 for timebase helpers

Add an explicit CPUPPCState parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Split off timebase helpers
Blue Swirl [Wed, 30 May 2012 04:23:35 +0000 (04:23 +0000)]
ppc: Split off timebase helpers

Move decrementer and timebase helpers to a dedicated file.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Cleanup MMU merge
Blue Swirl [Wed, 30 May 2012 04:23:34 +0000 (04:23 +0000)]
ppc: Cleanup MMU merge

Remove useless wrappers. In some cases 'int' parameters are
changed to uint32_t.

Make internal functions static.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fix kvm compilation]
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Move MMU helpers from helper.c to mmu_helper.c
Blue Swirl [Wed, 30 May 2012 04:23:33 +0000 (04:23 +0000)]
ppc: Move MMU helpers from helper.c to mmu_helper.c

Move more MMU helpers from helper.c to mmu_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
[update to current helper.c state]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Avoid a warning with the next patch
Blue Swirl [Wed, 30 May 2012 04:23:32 +0000 (04:23 +0000)]
ppc: Avoid a warning with the next patch

When the code is moved together by the next patch, compiler
detects a possible uninitialized variable use. Avoid the warning
by initializing the variables.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Avoid AREG0 for MMU etc. helpers
Blue Swirl [Wed, 30 May 2012 04:23:31 +0000 (04:23 +0000)]
ppc: Avoid AREG0 for MMU etc. helpers

Add an explicit CPUPPCState parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Split MMU etc. helpers from op_helper.c
Blue Swirl [Wed, 30 May 2012 04:23:30 +0000 (04:23 +0000)]
ppc: Split MMU etc. helpers from op_helper.c

Move MMU, TLB, SLB and BAT ops to mmu_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Avoid AREG0 for integer and vector helpers
Blue Swirl [Wed, 30 May 2012 04:23:29 +0000 (04:23 +0000)]
ppc: Avoid AREG0 for integer and vector helpers

Add an explicit CPUPPCState parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
[fix unwanted whitespace line in Makefile.target]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Split integer and vector ops
Blue Swirl [Wed, 30 May 2012 04:23:28 +0000 (04:23 +0000)]
ppc: Split integer and vector ops

Move integer and vector ops to int_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Avoid AREG0 for FPU and SPE helpers
Blue Swirl [Wed, 30 May 2012 04:23:27 +0000 (04:23 +0000)]
ppc: Avoid AREG0 for FPU and SPE helpers

Add an explicit CPUPPCState parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Split FPU and SPE ops
Blue Swirl [Wed, 30 May 2012 04:23:26 +0000 (04:23 +0000)]
ppc: Split FPU and SPE ops

Move FPU and SPE helpers from op_helper.c to fpu_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Move exception helpers from helper.c to excp_helper.c
Blue Swirl [Wed, 30 May 2012 04:23:25 +0000 (04:23 +0000)]
ppc: Move exception helpers from helper.c to excp_helper.c

Move exception helpers from helper.c to excp_helper.c and
make cpu_dump_rfi() static.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Fix coding style in helper.c
Blue Swirl [Wed, 30 May 2012 04:23:24 +0000 (04:23 +0000)]
ppc: Fix coding style in helper.c

helper.c will be spilt by the next patches, fix
style issues before that.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Avoid AREG0 for exception helpers
Blue Swirl [Wed, 30 May 2012 04:23:23 +0000 (04:23 +0000)]
ppc: Avoid AREG0 for exception helpers

Add an explicit CPUPPCState parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Split exception helpers
Blue Swirl [Wed, 30 May 2012 04:23:22 +0000 (04:23 +0000)]
ppc: Split exception helpers

Move exception helpers from op_helper.c to excp_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Fix coding style in op_helper.c
Blue Swirl [Wed, 30 May 2012 04:23:21 +0000 (04:23 +0000)]
ppc: Fix coding style in op_helper.c

op_helper.c will be split by the next patches, fix
style issues before that.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoTCG: Fix compile breakage in tcg_dump_ops
Alexander Graf [Sat, 23 Jun 2012 22:05:36 +0000 (00:05 +0200)]
TCG: Fix compile breakage in tcg_dump_ops

Commit eeacee4d865 changed the syntax of tcg_dump_ops, but didn't convert
all users (notably missing the ppc ones) to it. Fix them to the new syntax.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: malc <av1474@comtv.ru>
12 years agolibcacard: build fixes
Blue Swirl [Sun, 10 Jun 2012 10:18:54 +0000 (10:18 +0000)]
libcacard: build fixes

Link trace objects to fix these errors:
  LINK  vscclient
oslib-posix.o: In function `trace_qemu_vfree':
/src/qemu/obj-amd64/./trace.h:39: undefined reference to `trace1'
oslib-posix.o: In function `trace_qemu_memalign':
/src/qemu/obj-amd64/./trace.h:31: undefined reference to `trace3'
oslib-posix.o: In function `trace_qemu_vmalloc':
/src/qemu/obj-amd64/./trace.h:35: undefined reference to `trace2'

Add LDFLAGS to vscclient link command.

Clean up also in subdirectories of libcacard.

Use quiet-command for sed invocation.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alon Levy <alevy@redhat.com>
12 years agoqtest: add a fuzz test to fdc-test
Blue Swirl [Thu, 17 May 2012 18:55:58 +0000 (18:55 +0000)]
qtest: add a fuzz test to fdc-test

Add a simple register fuzzing test to floppy controller tests.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agofdc: use LOG_UNIMP logging
Blue Swirl [Sun, 3 Jun 2012 17:16:14 +0000 (17:16 +0000)]
fdc: use LOG_UNIMP logging

Convert uses of FLOPPY_ERROR to either FLOPPY_DPRINTF
(for implemented cases) or to use LOG_UNIMP (unimplemented).

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoqemu-log: use LOG_UNIMP for some target CPU cases
Blue Swirl [Sun, 3 Jun 2012 17:06:07 +0000 (17:06 +0000)]
qemu-log: use LOG_UNIMP for some target CPU cases

Use LOG_UNIMP for some target CPU cases.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Alexander Graf <agraf@suse.de>
12 years agoqemu-log: add log category for unimplemented functionality
Blue Swirl [Sun, 3 Jun 2012 17:04:28 +0000 (17:04 +0000)]
qemu-log: add log category for unimplemented functionality

Add new log category (LOG_UNIMP) for unimplemented functionality.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoqemu-log: cleanup
Blue Swirl [Sun, 3 Jun 2012 16:35:32 +0000 (16:35 +0000)]
qemu-log: cleanup

Don't use global variables directly but via accessor functions. Rename globals.

Convert macros to functions, add GCC format attributes.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoqemu-log: move logging to qemu-log.c
Blue Swirl [Sun, 3 Jun 2012 15:03:23 +0000 (15:03 +0000)]
qemu-log: move logging to qemu-log.c

Move logging functions from exec.c to qemu-log.c,
compile it only once.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoxilinx_timer: Fixed deadlock issue
Peter A. G. Crosthwaite [Sat, 16 Jun 2012 05:20:59 +0000 (15:20 +1000)]
xilinx_timer: Fixed deadlock issue

The timer was deadlocking when the interval was set too low. It would cause a
flood of timer events and the CPU would halt indefinately. This is a known issue
and theres a generic workaround in place in ptimer on ptimer_set_limit(),
however the Xilinx timer uses ptimer_set_count() instead of set_limit. Changed
the call to set_count() to an equivalent call of set_limit() instead, which
brings the workaround into play.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_timer: Removed include of qemu-timer
Peter A. G. Crosthwaite [Sat, 16 Jun 2012 05:20:58 +0000 (15:20 +1000)]
xilinx_timer: Removed include of qemu-timer

The Xilinx timer does not interact with the qemu_timer API, so dont include it.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoAllow machines to configure the QEMU_VERSION that's exposed via hardware
Crístian Viana [Wed, 30 May 2012 03:35:51 +0000 (00:35 -0300)]
Allow machines to configure the QEMU_VERSION that's exposed via hardware

QEMU exposes its version to the guest's hardware and in some cases that is wrong
(e.g. Windows prints messages about driver updates when you switch
the QEMU version).
There is a new field now on the struct QEmuMachine, hw_version, which may
contain the version that the specific machine should report. If that field is
set, then that machine will report that version to the guest.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAdd PIIX4 properties to control PM system states.
Gleb Natapov [Mon, 4 Jun 2012 11:31:55 +0000 (14:31 +0300)]
Add PIIX4 properties to control PM system states.

This patch adds two things. First it allows QEMU to distinguish between
regular powerdown and S4 powerdown. Later separate QMP notification will
be added for S4 powerdown. Second it allows S3/S4 states to be disabled
from QEMU command line. Some guests known to be broken with regards to
power management, but allow to use it anyway. Using new properties
management will be able to disable S3/S4 for such guests.

Supported system state are passed to a firmware using new fw_cfg file.
The file contains  6 byte array. Each byte represents one system
state. If byte at offset X has its MSB set it means that system state
X is supported and to enter it guest should use the value from lowest 3
bits.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomake: automatically include dependencies in recursive subdir rules (v2)
Anthony Liguori [Mon, 18 Jun 2012 00:01:32 +0000 (19:01 -0500)]
make: automatically include dependencies in recursive subdir rules (v2)

I think I understand enough of what's going on in these rules to ensure this is
right.  But I could certainly use a second or third opinion...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: fix -enable-debug with newer toolchains
Avi Kivity [Wed, 6 Jun 2012 09:03:18 +0000 (12:03 +0300)]
configure: fix -enable-debug with newer toolchains

Fedora 17's toolchain wants optimization enabled for _FORTIFY_SOURCE;
so disable _FORTIFY_SOURCE when debugging.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'afaerber-or/qom-next-2' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:35:16 +0000 (10:35 -0500)]
Merge remote-tracking branch 'afaerber-or/qom-next-2' into staging

* afaerber-or/qom-next-2: (22 commits)
  qom: Push error reporting to object_property_find()
  qdev: Remove qdev_prop_exists()
  qbus: Initialize in standard way
  qbus: Make child devices links
  qdev: Connect busses with their parent devices
  qdev: Convert busses to QEMU Object Model
  qdev: Move SysBus initialization to sysbus.c
  qdev: Use wrapper for qdev_get_path
  qdev: Remove qdev_prop_set_defaults
  qdev: Clean up global properties
  qdev: Move bus properties to abstract superclasses
  qdev: Move bus properties to a separate global
  qdev: Push "type" property up to Object
  arm_l2x0: Rename "type" property to "cache-type"
  m48t59: Rename "type" property to "model"
  qom: Assert that public types have a non-NULL parent field
  qom: Drop type_register_static_alias() macro
  qom: Make Object a type
  qom: Add class_base_init
  qom: Add object_child_foreach()
  ...

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:35:13 +0000 (10:35 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  build: install qmp-commands.txt
  Add rate limiting of RTC_CHANGE, BALLOON_CHANGE & WATCHDOG events
  Add event notification for guest balloon changes
  Fix some more license versions (GPL2+ instead of GPL2)
  monitor: Fix memory leak with readline completion
  qmp: do not include monitor.h from qapi-types-core.h
  qmp: include monitor.h when needed
  kvm: add missing include files

12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:34:59 +0000 (10:34 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (39 commits)
  qemu-iotests: add 036 autoclear feature bit test
  qemu-iotests: add qcow2.py set-feature-bit command
  fdc-test: introduced qtest read_without_media
  fdc: fix implied seek while there is no media in drive
  qcow2: fix autoclear image header update
  xen: Don't peek behind the BlockDriverState abstraction
  xen: Don't change -drive if=xen device name during machine init
  block: Replace bdrv_get_format() by bdrv_get_format_name()
  qemu-img: document qed format on qemu-img man page
  qemu-iotests: COW with many AIO requests on the same cluster
  qemu-iotests: Some backing file COW tests
  qcow2: Fix avail_sectors in cluster allocation code
  qcow2: Simplify calculation for COW area at the end
  qcow2: always operate caches in writeback mode
  ide: support enable/disable write cache
  block: always open drivers in writeback mode
  block: add bdrv_set_enable_write_cache
  block: copy enable_write_cache in bdrv_append
  savevm: flush after saving vm state
  block: flush in writethrough mode after writes
  ...

12 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:18:44 +0000 (10:18 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

* mst/tags/for_anthony:
  pci_bridge_dev: fix error path in pci_bridge_dev_initfn()
  qdev: release parent properties on dc->init failure
  msi: Use msi/msix_present more consistently
  msi: Invoke msi/msix_write_config from PCI core
  msi: Guard msi/msix_write_config with msi_present
  msi: Invoke msi/msix_reset from PCI core
  msi: Guard msi_reset with msi_present
  ahci: Clean up reset functions
  intel-hda: Fix reset of MSI function
  ahci: Fix reset of MSI function
  rtl8139: honor RxOverflow flag in can_receive method
  shpc: unparent device before free

12 years agoMerge remote-tracking branch 'sweil/for-anthony' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:18:26 +0000 (10:18 -0500)]
Merge remote-tracking branch 'sweil/for-anthony' into staging

* sweil/for-anthony:
  Fix some more license versions (GPL2+ instead of GPL2)
  dump: Fix license version (GPL2+ instead of GPL2)
  configure: Fix build for some versions of glibc (9pfs)
  monitor: Fix memory leak with readline completion

12 years agoqom: Push error reporting to object_property_find()
Paolo Bonzini [Thu, 12 Apr 2012 16:00:18 +0000 (18:00 +0200)]
qom: Push error reporting to object_property_find()

Avoids duplicated error_set().

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Also drop error_set() in object_property_del().]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Remove qdev_prop_exists()
Paolo Bonzini [Fri, 30 Mar 2012 12:54:31 +0000 (14:54 +0200)]
qdev: Remove qdev_prop_exists()

Can be replaced everywhere with object_property_find().

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqbus: Initialize in standard way
Anthony Liguori [Fri, 3 Feb 2012 19:32:19 +0000 (13:32 -0600)]
qbus: Initialize in standard way

Move code to an initfn and finalizer.
Replace do_qbus_create_inplace() with qbus_realize().

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqbus: Make child devices links
Anthony Liguori [Fri, 23 Dec 2011 21:34:39 +0000 (15:34 -0600)]
qbus: Make child devices links

Make qbus children show up as link<> properties.  There is no stable
addressing for qbus children so we use an unstable naming convention.

This is okay in QOM though because the composition name is expected to
be what's stable.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Connect busses with their parent devices
Anthony Liguori [Wed, 2 May 2012 08:39:01 +0000 (10:39 +0200)]
qdev: Connect busses with their parent devices

This makes SysBus part of the root hierarchy and all busses children of
their respective parent DeviceState.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Convert busses to QEMU Object Model
Anthony Liguori [Wed, 2 May 2012 07:00:20 +0000 (09:00 +0200)]
qdev: Convert busses to QEMU Object Model

This is far less interesting than it sounds.  We simply add an Object to each
BusState and then register the types appropriately.  Most of the interesting
refactoring will follow in the next patches.

Since we're changing fundamental type names (BusInfo -> BusClass), it all needs
to convert at once.  Fortunately, not a lot of code is affected.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Made all new bus TypeInfos static const.]
[AF: Made qbus_free() call object_delete(), required {qom,glib}_allocated]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Move SysBus initialization to sysbus.c
Paolo Bonzini [Wed, 2 May 2012 10:06:55 +0000 (12:06 +0200)]
qdev: Move SysBus initialization to sysbus.c

TYPE_SYSTEM_BUS will be local to hw/sysbus.c, so move existing references
to main_system_bus and system_bus_info there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Use wrapper for qdev_get_path
Anthony Liguori [Fri, 3 Feb 2012 18:28:43 +0000 (12:28 -0600)]
qdev: Use wrapper for qdev_get_path

This makes it easier to remove it from BusInfo.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Drop now unnecessary NULL initialization in scsibus_get_dev_path()]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Remove qdev_prop_set_defaults
Paolo Bonzini [Mon, 2 Apr 2012 20:40:26 +0000 (22:40 +0200)]
qdev: Remove qdev_prop_set_defaults

Instead, qdev_property_add_static can set the default.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Clean up global properties
Paolo Bonzini [Tue, 3 Apr 2012 08:05:07 +0000 (10:05 +0200)]
qdev: Clean up global properties

Now that global properties do not depend on buses anymore, set
them directly in the device instance_init function.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Move bus properties to abstract superclasses
Paolo Bonzini [Wed, 28 Mar 2012 16:12:47 +0000 (18:12 +0200)]
qdev: Move bus properties to abstract superclasses

In qdev, each bus in practice identified an abstract superclass, but
this was mostly hidden.  In QOM, instead, these abstract classes are
explicit so we can move bus properties there.

All bus property walks are removed, and all device property walks
are changed to look along the class hierarchy instead.

We would have duplicates if class A defines some properties and its
subclass B does not define any, because class_b->props will be
left equal to class_a->props.

The solution here is to reintroduce the class_base_init TypeInfo
callback, that was present in one of the early QOM versions but
removed (on my request...) before committing.

This breaks global bus properties, an obscure feature when used
with the command-line which is actually useful and used when used by
backwards-compatible machine types.  So this patch also adjusts the
global bus properties in hw/pc_piix.c to refer to the abstract class.

Globals and other properties must be modified in the same patch to
avoid complications related to initialization ordering.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Move bus properties to a separate global
Paolo Bonzini [Wed, 28 Mar 2012 16:01:36 +0000 (18:01 +0200)]
qdev: Move bus properties to a separate global

Simple code movement in order to simplify future refactoring.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Push "type" property up to Object
Paolo Bonzini [Mon, 2 Apr 2012 15:33:51 +0000 (17:33 +0200)]
qdev: Push "type" property up to Object

Now that Object is a type, add an instance_init function and push
the "type" property from qdev to there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoarm_l2x0: Rename "type" property to "cache-type"
Andreas Färber [Thu, 7 Jun 2012 14:32:53 +0000 (16:32 +0200)]
arm_l2x0: Rename "type" property to "cache-type"

Resolves a name conflict with the qdev "type" property that is about to
be moved to Object.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
12 years agom48t59: Rename "type" property to "model"
Paolo Bonzini [Wed, 23 May 2012 17:25:34 +0000 (19:25 +0200)]
m48t59: Rename "type" property to "model"

This resolves a name conflict with the qdev "type" property that is
about to move into Object.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Add braces missing in original code.]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Assert that public types have a non-NULL parent field
Paolo Bonzini [Wed, 4 Apr 2012 13:58:40 +0000 (15:58 +0200)]
qom: Assert that public types have a non-NULL parent field

This protects against unwanted effects of changing TYPE_OBJECT from
NULL to a string.

Suggested-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Drop type_register_static_alias() macro
Paolo Bonzini [Wed, 23 May 2012 16:58:15 +0000 (18:58 +0200)]
qom: Drop type_register_static_alias() macro

It's unused.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Make Object a type
Paolo Bonzini [Sat, 31 Mar 2012 14:45:54 +0000 (16:45 +0200)]
qom: Make Object a type

Right now the base Object class has a special NULL type.  Change this so
that we will be able to add class_init and class_base_init callbacks.
To do this, remove some special casing of ObjectClass that is not really
necessary.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Add class_base_init
Paolo Bonzini [Wed, 2 May 2012 11:30:55 +0000 (13:30 +0200)]
qom: Add class_base_init

The class_base_init TypeInfo callback was present in one of the early
QOM versions but removed (on my request...) before committing.  We
will need it soon, add it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Add object_child_foreach()
Paolo Bonzini [Wed, 11 Apr 2012 21:30:20 +0000 (23:30 +0200)]
qom: Add object_child_foreach()

A utility function that will be used to implement hierarchical realization.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
[AF: Drop unrelated whitespace change, add Returns: in documentation]
[AF: Use new object_property_is_child() helper.]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Introduce object_property_is_{child,link}()
Andreas Färber [Sat, 26 May 2012 22:32:40 +0000 (00:32 +0200)]
qom: Introduce object_property_is_{child,link}()

Avoids hardcoding partial string comparisons.

Signed-off-by: Alexander Barabash <alexander_barabash@mentor.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqom: Add object_class_get_parent()
Paolo Bonzini [Wed, 2 May 2012 11:30:54 +0000 (13:30 +0200)]
qom: Add object_class_get_parent()

This simple bit of functionality was missing and we'll need it soon,
so add it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
[AF: Document possible NULL return value]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoaudio/winwave: Fix typo
malc [Fri, 15 Jun 2012 16:58:54 +0000 (20:58 +0400)]
audio/winwave: Fix typo

Signed-off-by: malc <av1474@comtv.ru>
12 years agobuild: install qmp-commands.txt
Bruce Rogers [Wed, 13 Jun 2012 22:29:17 +0000 (16:29 -0600)]
build: install qmp-commands.txt

File is targeted for install, but is never installed.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoAdd rate limiting of RTC_CHANGE, BALLOON_CHANGE & WATCHDOG events
Daniel P. Berrange [Thu, 14 Jun 2012 17:12:57 +0000 (18:12 +0100)]
Add rate limiting of RTC_CHANGE, BALLOON_CHANGE & WATCHDOG events

Allow certain event types to be rate limited to avoid flooding
monitor clients. The monitor_protocol_event() method is changed
such that instead of immediately emitting the event to Monitor
instances, it will call a new monitor_protocol_event_queue()
method.

This will check to see if the rate limit for the event has been
exceeded, and if so schedule a timer to wakeup at the end of the
rate limit period. If further events arrive before the timer fires,
the previously queued event will be discarded in favour of the new
event. The event will eventually be emitted when the timer fires.

This logic is applied to RTC_CHANGE, BALLOON_CHANGE & WATCHDOG
events, since the data associated with these events is stateless

 * monitor.c: Add support for rate limiting
 * monitor.h: Define monitor_global_init for one-time setup tasks
 * vl.c: Invoke monitor_global_init
 * trace-events: Add hooks for monitor event tracing

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoAdd event notification for guest balloon changes
Daniel P. Berrange [Thu, 14 Jun 2012 17:12:56 +0000 (18:12 +0100)]
Add event notification for guest balloon changes

After setting a balloon target value, applications have to
continually poll 'query-balloon' to determine whether the
guest has reacted to this request. The virtio-balloon backend
knows exactly when the guest has reacted though, and thus it
is possible to emit a JSON event to tell the mgmt application
whenever the guest balloon changes.

This introduces a new 'qemu_balloon_changed()' API which is
to be called by balloon driver backends, whenever they have
a change in balloon value. This takes the 'actual' balloon
value, as would be found in the BalloonInfo struct.

The qemu_balloon_change API emits a JSON monitor event which
looks like:

  {"timestamp": {"seconds": 1337162462, "microseconds": 814521},
   "event": "BALLOON_CHANGE", "data": {"actual": 944766976}}

* balloon.c, balloon.h: Introduce qemu_balloon_changed() for
  emitting balloon change events on the monitor
* hw/virtio-balloon.c: Invoke qemu_balloon_changed() whenever
  the guest changes the balloon actual value
* monitor.c, monitor.h: Define QEVENT_BALLOON_CHANGE

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoFix some more license versions (GPL2+ instead of GPL2)
Stefan Weil [Mon, 11 Jun 2012 05:49:18 +0000 (07:49 +0200)]
Fix some more license versions (GPL2+ instead of GPL2)

Cc: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agomonitor: Fix memory leak with readline completion
Stefan Weil [Mon, 14 May 2012 19:47:20 +0000 (21:47 +0200)]
monitor: Fix memory leak with readline completion

Each string which is shown during readline completion in the QEMU monitor
is allocated dynamically but currently never deallocated.

Add the missing loop which calls g_free for the allocated strings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqmp: do not include monitor.h from qapi-types-core.h
Paolo Bonzini [Thu, 7 Jun 2012 02:02:22 +0000 (04:02 +0200)]
qmp: do not include monitor.h from qapi-types-core.h

The comment is stale, monitor.h is not needed anymore (only qerror.h
is, because it contains the schema for errors).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqmp: include monitor.h when needed
Paolo Bonzini [Thu, 7 Jun 2012 02:02:21 +0000 (04:02 +0200)]
qmp: include monitor.h when needed

This is needed to get file descriptors from SCM_RIGHTS.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agokvm: add missing include files
Paolo Bonzini [Thu, 7 Jun 2012 02:02:20 +0000 (04:02 +0200)]
kvm: add missing include files

These are included via monitor.h right now, add them explicitly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqemu-iotests: add 036 autoclear feature bit test
Stefan Hajnoczi [Thu, 14 Jun 2012 12:58:18 +0000 (13:58 +0100)]
qemu-iotests: add 036 autoclear feature bit test

This new test validates the autoclear feature bit behavior.  When QEMU
opens a qcow2v3 image file with an unknown autoclear feature bit the bit
should be cleared in the image file header.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: add qcow2.py set-feature-bit command
Stefan Hajnoczi [Thu, 14 Jun 2012 12:58:17 +0000 (13:58 +0100)]
qemu-iotests: add qcow2.py set-feature-bit command

This new command sets feature bits in the image file header:

  qcow2.py set-feature-bit incompatible|compatible|autoclear <bit>

The bit number must be in the range [0, 64).

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc-test: introduced qtest read_without_media
Pavel Hrdina [Wed, 13 Jun 2012 13:43:12 +0000 (15:43 +0200)]
fdc-test: introduced qtest read_without_media

If you try to read from a floppy drive without a media, you should get
an abnormal termination error.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: fix implied seek while there is no media in drive
Pavel Hrdina [Wed, 13 Jun 2012 13:43:11 +0000 (15:43 +0200)]
fdc: fix implied seek while there is no media in drive

The Windows uses 'READ' command at the start of an instalation
without checking the 'dir' register. We have to abort the transfer
with an abnormal termination if there is no media in the drive.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: fix autoclear image header update
Stefan Hajnoczi [Thu, 14 Jun 2012 10:42:23 +0000 (11:42 +0100)]
qcow2: fix autoclear image header update

The autoclear feature bits can be used for qcow2 file format features
that are safe to "drop" by old programs that do not understand the
feature.  Upon opening the image file unknown autoclear feature bits are
cleared and the image file header is rewritten, but this was happening
too early in the code when critical header fields were not yet loaded.

Process autoclear feature bits after all necessary header information
has been loaded.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoxen: Don't peek behind the BlockDriverState abstraction
Markus Armbruster [Wed, 13 Jun 2012 08:11:50 +0000 (10:11 +0200)]
xen: Don't peek behind the BlockDriverState abstraction

First offender is xen_config_dev_blk()'s use of disk->bdrv->filename.
Get the filename from disk->opts instead.  Same result, except for
snapshots: there, we now get the filename specified by the user
instead of the name of the temporary image created by bdrv_open().
Should be an improvement.

Second offender is blk_init()'s use of blkdev->bs->drv->format_name.
Simply use the appropriate interface to get the format name.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoxen: Don't change -drive if=xen device name during machine init
Markus Armbruster [Wed, 13 Jun 2012 08:11:49 +0000 (10:11 +0200)]
xen: Don't change -drive if=xen device name during machine init

A "top" BlockDriverState has a non-empty device_name.  If the user
doesn't specify one with -drive parameter id, the system supplies a
default name.

xen_config_dev_blk() changes this name, during machine initialization.
Naughty.  Don't do that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Replace bdrv_get_format() by bdrv_get_format_name()
Markus Armbruster [Wed, 13 Jun 2012 08:11:48 +0000 (10:11 +0200)]
block: Replace bdrv_get_format() by bdrv_get_format_name()

So callers don't need to know anything about maximum name length.
Returning a pointer is safe, because the name string lives as long as
the block driver it names, and block drivers don't die.

Requested by Peter Maydell.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-img: document qed format on qemu-img man page
Stefan Hajnoczi [Wed, 13 Jun 2012 13:29:15 +0000 (14:29 +0100)]
qemu-img: document qed format on qemu-img man page

The qemu-img.1 man page is missing the qed format from its list of
supported formats.  Document the image creation options for qed.

Suggested-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>