sdk/emulator/qemu.git
12 years agoPPC: Extract SPR dump generation into its own function
Alexander Graf [Thu, 21 Jun 2012 11:39:48 +0000 (13:39 +0200)]
PPC: Extract SPR dump generation into its own function

This patch moves the debug #ifdef'ed SPR trace generation into its
own function, so we can call it from multiple places.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: Add e5500 CPU target
Alexander Graf [Wed, 20 Jun 2012 19:55:55 +0000 (21:55 +0200)]
PPC: Add e5500 CPU target

This patch adds e5500's CPU initialization to the TCG CPU initialization
code.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: BookE: Make ivpr selectable by CPU type
Alexander Graf [Thu, 21 Jun 2012 13:17:59 +0000 (15:17 +0200)]
PPC: BookE: Make ivpr selectable by CPU type

IVPR can either hold 32 or 64 bit addresses, depending on the CPU type. Let
the CPU initialization function pass in its mask itself, so we can easily
extend it.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: BookE: Implement EPR SPR
Alexander Graf [Wed, 20 Jun 2012 19:27:02 +0000 (21:27 +0200)]
PPC: BookE: Implement EPR SPR

On the e500 series, accessing SPR_EPR magically turns into an access at
that CPU's IACK register on the MPIC. Implement that logic to get kernels
that make use of that feature work.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: Add support for MSR_CM
Alexander Graf [Wed, 20 Jun 2012 19:20:29 +0000 (21:20 +0200)]
PPC: Add support for MSR_CM

The BookE variant of MSR_SF is MSR_CM. Implement everything it takes in TCG to
support running 64bit code with MSR_CM set.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: Add some booke SPR defines
Alexander Graf [Wed, 20 Jun 2012 19:19:09 +0000 (21:19 +0200)]
PPC: Add some booke SPR defines

The number of SPRs avaiable in different PowerPC chip is still increasing. Add
definitions for the MAS7_MAS3 SPR and all currently known bits in EPCR.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agouImage: increase the gzip load size
Alexander Graf [Wed, 20 Jun 2012 18:58:27 +0000 (20:58 +0200)]
uImage: increase the gzip load size

Recent u-boot has different defines for its gzip extract buffer, but the
common ground seems to be 64MB. So let's bump it up to that, enabling me
to load my test image again ;).

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: allow users to set the /compatible property via -machine
Alexander Graf [Wed, 20 Jun 2012 18:46:22 +0000 (20:46 +0200)]
PPC: e500: allow users to set the /compatible property via -machine

Device trees usually have a node /compatible, which indicate which machine
type we're looking at. For quick prototyping, it can be very useful to change
the contents of that node via the command line.

Thus, introduce a new option to -machine called dt_compatible, which when
set changes the /compatible contents to its value.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agodt: make setprop argument static
Alexander Graf [Wed, 20 Jun 2012 18:39:59 +0000 (20:39 +0200)]
dt: make setprop argument static

Whatever we pass in to qemu_devtree_setprop to put into the device tree
will not get modified by that function, so it can easily be declared const.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agoPPC: e500: Refactor serial dt generation
Alexander Graf [Tue, 5 Jun 2012 23:19:40 +0000 (01:19 +0200)]
PPC: e500: Refactor serial dt generation

When generating serial port device tree nodes, we duplicate quite a bit
of code, because there are 2 of them in the mpc8544ds board we emulate.

Shove the generating code into a function, so we duplicate less code.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agodt: Add global option to set phandle start offset
Alexander Graf [Tue, 5 Jun 2012 23:01:23 +0000 (01:01 +0200)]
dt: Add global option to set phandle start offset

If anyone outside of QEMU wants to mess with a QEMU generated device tree,
he needs to know which range phandles are valid in. So let's expose a
machine option that an external program can use to set the start allocate
id for phandles in QEMU.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: Extend address/size of / to 64bit
Alexander Graf [Tue, 5 Jun 2012 22:25:06 +0000 (00:25 +0200)]
PPC: e500: Extend address/size of / to 64bit

We want to be able to support >= 4GB of RAM. To do so, we need to be able
to tell the guest OS how much RAM it has.

However, that information today is capped to 32bit. So let's extend the
offset and size fields to 64bit, so we can fit in big addresses and even
one day - if we wish to do so - map devices above 32bit.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: Define addresses as always 64bit
Alexander Graf [Tue, 5 Jun 2012 22:30:36 +0000 (00:30 +0200)]
PPC: e500: Define addresses as always 64bit

Every time we use an address constant, it needs to potentially fit into
a 64bit physical address space. So let's define things accordingly.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: Use new SOC dt format
Alexander Graf [Tue, 5 Jun 2012 22:20:20 +0000 (00:20 +0200)]
PPC: e500: Use new SOC dt format

Due to popular demand, let's clean up the soc node a bit and use
more recent dt notions.

Requested-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: Use new MPIC dt format
Alexander Graf [Tue, 5 Jun 2012 22:14:34 +0000 (00:14 +0200)]
PPC: e500: Use new MPIC dt format

Due to popular demand, we're updating the way we generate the MPIC
node and interrupt lines based on what the current state of art is.

Requested-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoRevert "dt: temporarily disable subtree creation failure check"
Alexander Graf [Thu, 17 May 2012 23:45:01 +0000 (01:45 +0200)]
Revert "dt: temporarily disable subtree creation failure check"

This reverts commit "dt: temporarily disable subtree creation
failure check" which was meant as a temporary solution to keep
external and dynamic device tree construction intact.

Now that we switched to fully dynamic dt construction, it's no
longer necessary.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: enable manual loading of dtb blob
Alexander Graf [Tue, 22 May 2012 12:28:50 +0000 (14:28 +0200)]
PPC: e500: enable manual loading of dtb blob

We want to be able to override the automatically created device tree
by using the -dtb option. Implement this for the mpc8544ds machine.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: dt: use target_phys_addr_t for ramsize
Alexander Graf [Fri, 18 May 2012 00:14:46 +0000 (02:14 +0200)]
PPC: e500: dt: use target_phys_addr_t for ramsize

We're passing the ram size as uint32_t, capping it to 32 bits atm.
Change to target_phys_addr_t (uint64_t) to make sure we have all
the bits.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: dt: use 64bit cell helper
Alexander Graf [Thu, 17 May 2012 23:56:46 +0000 (01:56 +0200)]
PPC: e500: dt: use 64bit cell helper

We have a nice 64bit helper to ease the device tree generation and
make the code more readable when creating 64bit 2-cell parameters.
Use it when generating the device tree.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agodt: Add -machine dumpdtb option to dump the current dtb
Alexander Graf [Thu, 17 May 2012 22:11:33 +0000 (00:11 +0200)]
dt: Add -machine dumpdtb option to dump the current dtb

Now that we are dynamically creating the dtb, it's really useful to
be able to dump the created blob for debugging.

This patch implements a -machine dumpdtb=<file> option for e500 that
dumps the dtb exactly in the form the guest would get it to disk. It
can then be analyzed by dtc to get information about the guest
configuration.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: dt: start with empty device tree
Alexander Graf [Thu, 17 May 2012 13:50:14 +0000 (15:50 +0200)]
PPC: e500: dt: start with empty device tree

Now that all of the device tree bits are generated during runtime, we
can get rid of the device tree blob and instead start from scratch with
an empty device tree.

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

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: dt: create global-utils node dynamically
Alexander Graf [Thu, 17 May 2012 12:52:46 +0000 (14:52 +0200)]
PPC: e500: dt: create global-utils node dynamically

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

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: dt: create serial nodes dynamically
Alexander Graf [Thu, 17 May 2012 12:51:34 +0000 (14:51 +0200)]
PPC: e500: dt: create serial nodes dynamically

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: dt: create /soc8544 node dynamically
Alexander Graf [Thu, 17 May 2012 12:51:07 +0000 (14:51 +0200)]
PPC: e500: dt: create /soc8544 node dynamically

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: dt: create /chosen node dynamically
Alexander Graf [Thu, 17 May 2012 12:49:20 +0000 (14:49 +0200)]
PPC: e500: dt: create /chosen node dynamically

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

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

Signed-off-by: Alexander Graf <agraf@suse.de>
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>