sdk/emulator/qemu.git
12 years agow64: Fix data type of next_tb and tcg_qemu_tb_exec
Stefan Weil [Fri, 16 Mar 2012 22:50:54 +0000 (23:50 +0100)]
w64: Fix data type of next_tb and tcg_qemu_tb_exec

next_tb is the numeric value of a tcg target (= QEMU host) address.

Using tcg_target_ulong instead of unsigned long shows this and makes
the code portable for hosts with an unusual size of long (w64).

The type cast '(long)(next_tb & ~3)' was not needed (casting
unsigned long to long does not change the bits, and nor does
casting long to pointer for most (= all non w64) hosts.
It is removed here.

Macro or function tcg_qemu_tb_exec is used to set next_tb.
The function also returns next_tb. Therefore tcg_qemu_tb_exec
must return a tcg_target_ulong.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosoftfloat: fix for C99
Avi Kivity [Tue, 27 Dec 2011 15:11:20 +0000 (17:11 +0200)]
softfloat: fix for C99

C99 appears to consider compound literals as non-constants, and complains
when they are used in static initializers.  Switch to ordinary initializer
syntax.

Signed-off-by: Avi Kivity <avi@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
Reported-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 17 Mar 2012 12:59:41 +0000 (12:59 +0000)]
Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Decode SETEND correctly in Thumb
  target-arm: Clear IT bits when taking exceptions in v7M
  target-arm: Fix typo in ARM946 cp15 c5 handling

12 years agoMerge branch 'malta' of git://qemu.weilnetz.de/qemu
Blue Swirl [Sat, 17 Mar 2012 12:59:36 +0000 (12:59 +0000)]
Merge branch 'malta' of git://qemu.weilnetz.de/qemu

* 'malta' of git://qemu.weilnetz.de/qemu:
  malta: Fix display for LED array
  malta: Use symbolic hardware addresses
  malta: Always allocate flash memory
  malta: Clean allocation of bios region alias

12 years agoMerge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
Blue Swirl [Sat, 17 Mar 2012 12:59:23 +0000 (12:59 +0000)]
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf

* 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf:
  PPC: Fix openpic with relative memregions
  pseries: Configure PCI bridge using properties
  PPC: KVM: Synchronize regs on CPU dump
  kvm: Comparison with ioctl number macros needs to be unsigned
  ppc: Correctly define POWERPC_INSNS2_DEFAULT
  pseries: Add support for level interrupts to XICS
  PPC: Fix large page support in TCG
  PPC: Add PIR register to POWER7 CPU
  pseries: Remove PCI device from PCI host bridge code
  pseries: Remove unused constant from PCI code
  pseries: Update SLOF firmware image
  PPC64: Add support for ldbrx and stdbrx instructions
  pseries: Don't try to munmap() a malloc()ed TCE table
  ppc: Add missing 'static' to spin_rw_ops
  PPC: 405: Fix ppc405ep initialization
  Bad zero comparison for sas_ss_flags on powerpc

12 years agovmstate: fix varrays with uint32_t indexes
Amos Kong [Tue, 13 Mar 2012 06:05:36 +0000 (14:05 +0800)]
vmstate: fix varrays with uint32_t indexes

VMSTATE_VARRAY_UINT32() is used in hw/ds1225y.c, and we checked
VMS_VARRAY_UINT32 bit of field->flags in vmstate_load_state(),
but we don't check this bit in vmstate_save_state().

Signed-off-by: Amos Kong <akong@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoFix large memory chunks allocation with tcg_malloc.
Kirill Batuzov [Fri, 2 Mar 2012 09:22:17 +0000 (13:22 +0400)]
Fix large memory chunks allocation with tcg_malloc.

An attempt to allocate a large memory chunk after a small one resulted in
circular links in list of pools.  It caused the same memory being
allocated twice for different arrays.

Now pools for large memory chunks are kept in separate list and are
freed during pool reset because current allocator can not reuse them.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomalta: Fix display for LED array
Stefan Weil [Sat, 28 Jan 2012 05:18:19 +0000 (05:18 +0000)]
malta: Fix display for LED array

The 8-LED array was already implemented in the first commit to Malta,
but this implementation was incomplete.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agomalta: Use symbolic hardware addresses
Stefan Weil [Sat, 28 Jan 2012 05:18:18 +0000 (05:18 +0000)]
malta: Use symbolic hardware addresses

The patch adds definitions of some hardware addresses and uses these
definitions.

It also replaces the type of all addresses from signed to unsigned values.
This is only a cosmetic change because addresses are unsigned values,
the functions called also expect unsigned values,
and we need no sign extension here.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agomalta: Always allocate flash memory
Stefan Weil [Sat, 28 Jan 2012 05:18:17 +0000 (05:18 +0000)]
malta: Always allocate flash memory

There is no reason why there should not be a flash memory when the
Malta emulation is started with a Linux kernel. When flash memory
is always available, the code is simpler, and it can be better tested.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agomalta: Clean allocation of bios region alias
Stefan Weil [Sat, 28 Jan 2012 05:18:16 +0000 (05:18 +0000)]
malta: Clean allocation of bios region alias

It is sufficient to define the region alias once for all code branches.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotarget-arm: Decode SETEND correctly in Thumb
Peter Maydell [Wed, 14 Mar 2012 12:26:11 +0000 (12:26 +0000)]
target-arm: Decode SETEND correctly in Thumb

Decode the SETEND instruction correctly in Thumb mode,
rather than accidentally treating it like CPS. We don't
support BE8 mode, but this change brings the Thumb mode
in to line with behaviour in ARM mode: 'SETEND BE' is
not supported and will provoke an UNDEF exception, but
'SETEND LE' is correctly handled as a no-op.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reported-by: Daniel Forsgren <daniel.forsgren@enea.com>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
12 years agotarget-arm: Clear IT bits when taking exceptions in v7M
Peter Maydell [Wed, 14 Mar 2012 12:26:10 +0000 (12:26 +0000)]
target-arm: Clear IT bits when taking exceptions in v7M

When taking an exception for an M profile core, we must clear
the IT bits. Since the IT bits are cached in env->condexec_bits
we must clear them there: writing the bits in env->uncached_cpsr
has no effect. (Reported as LP:944645.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Fix typo in ARM946 cp15 c5 handling
Peter Maydell [Wed, 14 Mar 2012 12:26:10 +0000 (12:26 +0000)]
target-arm: Fix typo in ARM946 cp15 c5 handling

Fix a typo in handling of the ARM946 cp15 c5 c0 0 1 handling
(instruction access permission bits) that meant it would
return the data access permission bits by mistake.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoPPC: Fix openpic with relative memregions
Alexander Graf [Wed, 14 Mar 2012 19:17:07 +0000 (20:17 +0100)]
PPC: Fix openpic with relative memregions

After commit 5312bd8b3152 we got memory region relative offsets into our mmio
callbacks instead of page boundary based offsets.

This broke the OpenPIC emulation which expected offsets to be on page boundary
and substracted its region offset manually.

This patch gets rid of that manual substraction and lets the memory api do its
magic instead.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Configure PCI bridge using properties
David Gibson [Mon, 12 Mar 2012 17:50:24 +0000 (17:50 +0000)]
pseries: Configure PCI bridge using properties

Currently, the function spapr_create_phb() uses its parameters to
initialize the correct memory windows for the new PCI Host Bridge
(PHB).  This is not the way things are supposed to be done with qdevs,
and means you can't create extra PHBs easily using -device.

Since pSeries machines can and do have many PHBs with various
configurations, this is a real limitation, not just a theoretical.
This patch, therefore, alters the PHB initialization code to use qdev
properties to set these parameters of the new bridge, moving most of
the code from spapr_create_phb() to spapr_phb_init().

While we're at it, we change the naming of each PCI bus and its
associated memory regions to be less arbitrary and make it easier to
relate the guest and qemu views of memory to each other.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: KVM: Synchronize regs on CPU dump
Alexander Graf [Tue, 13 Mar 2012 23:13:22 +0000 (00:13 +0100)]
PPC: KVM: Synchronize regs on CPU dump

When we dump the CPU registers, there's a certain chance they haven't been
synchronized with KVM yet, so we have to manually trigger that.

This aligns the code with x86 and fixes a bug where the register state was
bogus on invalid/unknown kvm exit reasons.

Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agokvm: Comparison with ioctl number macros needs to be unsigned
David Gibson [Wed, 7 Mar 2012 14:41:09 +0000 (14:41 +0000)]
kvm: Comparison with ioctl number macros needs to be unsigned

In kvm-all.c we store an ioctl cmd number in the irqchip_inject_ioctl field
of KVMState, which has type 'int'.  This seems to make sense since the
ioctl() man page says that the cmd parameter has type int.

However, the kernel treats ioctl numbers as unsigned - sys_ioctl() takes an
unsigned int, and the macros which generate ioctl numbers expand to
unsigned expressions.  Furthermore, some ioctls (IOC_READ ioctls on x86
and IOC_WRITE ioctls on powerpc) have bit 31 set, and so would be negative
if interpreted as an int. This has the surprising and compile-breaking
consequence that in kvm_irqchip_set_irq() where we do:
    return (s->irqchip_inject_ioctl == KVM_IRQ_LINE) ? 1 : event.status;
We will get a "comparison is always false due to limited range of data
type" warning from gcc if KVM_IRQ_LINE is one of the bit-31-set ioctls,
which it is on powerpc.

So, despite the fact that the man page and posix say ioctl numbers are
signed, they're actually unsigned.  The kernel uses unsigned, the glibc
header uses unsigned long, and FreeBSD, NetBSD and OSX also use unsigned
long ioctl numbers in the code.

Therefore, this patch changes the variable to be unsigned, fixing the
compile.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Correctly define POWERPC_INSNS2_DEFAULT
Meador Inge [Thu, 23 Feb 2012 03:44:14 +0000 (03:44 +0000)]
ppc: Correctly define POWERPC_INSNS2_DEFAULT

'POWERPC_INSNS2_DEFAULT' was defined incorrectly which was causing the
opcode table creation code to erroneously register 'eieio' and 'mbar'
for the "default" processor:

   ** ERROR: opcode 1a already assigned in opcode table 16
   *** ERROR: unable to insert opcode [1f-16-1a]
   *** ERROR initializing PowerPC instruction 0x1f 0x16 0x1a

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Add support for level interrupts to XICS
David Gibson [Wed, 7 Mar 2012 15:12:21 +0000 (15:12 +0000)]
pseries: Add support for level interrupts to XICS

The pseries "xics" interrupt controller, like most interrupt
controllers can support both message (i.e. edge sensitive) interrupts
and level sensitive interrupts, but it needs to know which are which.

When I implemented the xics emulation for qemu, the only devices we
supported were the PAPR virtual IO devices.  These devices only use
message interrupts, so they were the only ones I implemented in xics.

Since then, however, we have added support for PCI devices, which use
level sensitive interrupts.  It turns out the message interrupt logic
still actually works most of the time for these, but there are
circumstances where we can lost interrupts due to the incorrect
interrupt logic.

This patch, therefore, implements the correct xics level-sensitive
interrupt logic.  The type of the interrupt is set when a device
allocates a new xics interrupt.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: Fix large page support in TCG
Nathan Whitehorn [Fri, 9 Mar 2012 04:30:41 +0000 (04:30 +0000)]
PPC: Fix large page support in TCG

Fix large page support in TCG. The old code would overwrite the large page
table entry with the fake 4 KB one generated here whenever the ref/change bits
were updated, causing it to point to the wrong area of memory.

Signed-off-by: Nathan Whitehorn <nwhitehorn@freebsd.org>
Acked-by: David Gibson <david@gibson.drobpear.id.au>
[agraf: fix whitespace, braces]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: Add PIR register to POWER7 CPU
Nathan Whitehorn [Sat, 3 Mar 2012 06:36:36 +0000 (06:36 +0000)]
PPC: Add PIR register to POWER7 CPU

The POWER7 emulation is missing the Processor Identification Register,
mandatory in recent POWER CPUs, that is required for SMP on at least
some operating systems (e.g. FreeBSD) to function properly. This patch
copies the existing PIR code from the other CPUs that implement it.

Signed-off-by: Nathan Whitehorn <nwhitehorn@freebsd.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Remove PCI device from PCI host bridge code
Alexey Kardashevskiy [Mon, 27 Feb 2012 17:18:12 +0000 (17:18 +0000)]
pseries: Remove PCI device from PCI host bridge code

The sPAPR PCI code defines a PCI device "spapr-pci-host-bridge-pci" which
is never used.  This came over from the earlier bridge driver we used as
a template.  Some other bridges appear on their own PCI bus as a device,
but that is not true of pSeries bridges, which are pure host to PCI with
no visible presence on the PCI side.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Remove unused constant from PCI code
David Gibson [Mon, 27 Feb 2012 17:18:11 +0000 (17:18 +0000)]
pseries: Remove unused constant from PCI code

The 'bars' constant array was used in experimental device allocation code
which is no longer necessary now that we always run the SLOF firmware.
This patch removes the now redundant variable.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Update SLOF firmware image
David Gibson [Mon, 27 Feb 2012 17:18:10 +0000 (17:18 +0000)]
pseries: Update SLOF firmware image

This patch updates the SLOF firmware image used on the pseries
machine.  The new version adds support for Cirrus VGA and virtfs, as
well as including a number of bugfixes.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC64: Add support for ldbrx and stdbrx instructions
Thomas Huth [Mon, 27 Feb 2012 17:18:08 +0000 (17:18 +0000)]
PPC64: Add support for ldbrx and stdbrx instructions

These instructions for loading and storing byte-swapped 64-bit values have
been introduced in PowerISA 2.06.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Don't try to munmap() a malloc()ed TCE table
David Gibson [Mon, 27 Feb 2012 17:18:07 +0000 (17:18 +0000)]
pseries: Don't try to munmap() a malloc()ed TCE table

For the pseries machine, TCE (IOMMU) tables can either be directly
malloc()ed in qemu or, when running on a KVM which supports it, mmap()ed
from a KVM ioctl.  The latter option is used when available, because it
allows the (frequent bottlenext) H_PUT_TCE hypercall to be KVM accelerated.
However, even when KVM is persent, TCE acceleration is not always possible.
Only KVM HV supports this ioctl(), not KVM PR, or the kernel could run out
of contiguous memory to allocate the new table.  In this case we need to
fall back on the malloc()ed table.

When a device is removed, and we need to remove the TCE table, we need to
either munmap() or free() the table as appropriate for how it was
allocated.  The code is supposed to do that, but we buggily fail to
initialize the tcet->fd variable in the malloc() case, which is used as a
flag to determine which is the right choice.

This patch fixes the bug, and cleans up error messages relating to this
path while we're at it.

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 agoppc: Add missing 'static' to spin_rw_ops
Stefan Weil [Sat, 25 Feb 2012 02:37:12 +0000 (02:37 +0000)]
ppc: Add missing 'static' to spin_rw_ops

spin_rw_ops is only used in hw/ppce500_spin.c.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: 405: Fix ppc405ep initialization
Alexander Graf [Tue, 21 Feb 2012 18:01:11 +0000 (19:01 +0100)]
PPC: 405: Fix ppc405ep initialization

When trying to run a ppc405 guest, it segfaults quite quickly, trying to
access timers that weren't initialized. Initialize them properly instead.

Reported-by: Andreas Faerber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoBad zero comparison for sas_ss_flags on powerpc
Alex Barcelo [Thu, 9 Feb 2012 23:55:46 +0000 (23:55 +0000)]
Bad zero comparison for sas_ss_flags on powerpc

All architectures work the same way, and all check for sas_ss_flags ==
0. The powerpc lines are wrong, and do the check the other way round
(it's a qemu internal check, which is done wrong only for this
architecture, it's more a typo than a bug). It's NOT ppc specific,
it's POSIX standard (sigaltstack) and qemu internal.

I have a test source that I will send in a follow-up (it's longer than
I would have wished, I'm sure that a better test case can be written
if needed)

Signed-off-by: Alex Barcelo <abarcelo@ac.upc.edu>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-lm32/microblaze: Drop second CPU{LM32, MB}State typedef
Andreas Färber [Thu, 15 Mar 2012 00:19:42 +0000 (01:19 +0100)]
target-lm32/microblaze: Drop second CPU{LM32, MB}State typedef

Commit 9b9a970a23625de4ae6b7461906a9a0d98d3ca95
(target-lm32/microblaze: Typedef struct CPU{MB,LM32}State)
introduced necessary typedefs for cpu_mmu_index() and mmu.h
respectively.

On some GCC versions this leads to "error: redefinition of typedef".

Drop the original typedef to hopefully fix the build.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'afaerber/qom-cpu.v5' into staging
Anthony Liguori [Wed, 14 Mar 2012 21:47:49 +0000 (16:47 -0500)]
Merge remote-tracking branch 'afaerber/qom-cpu.v5' into staging

* afaerber/qom-cpu.v5: (43 commits)
  qom: Introduce CPU class
  Rename CPUState -> CPUArchState
  xtensa hw/: Don't use CPUState
  sparc hw/: Don't use CPUState
  sh4 hw/: Don't use CPUState
  s390x hw/: Don't use CPUState
  ppc hw/: Don't use CPUState
  mips hw/: Don't use CPUState
  microblaze hw/: Don't use CPUState
  m68k hw/: Don't use CPUState
  lm32 hw/: Don't use CPUState
  i386 hw/: Don't use CPUState
  cris hw/: Don't use CPUState
  arm hw/: Don't use CPUState
  alpha hw/: Don't use CPUState
  xtensa-semi: Don't use CPUState
  m68k-semi: Don't use CPUState
  arm-semi: Don't use CPUState
  target-xtensa: Don't overuse CPUState
  target-unicore32: Don't overuse CPUState
  ...

12 years agovnc: Limit r/w access to size of allocated memory
Stefan Weil [Wed, 14 Mar 2012 06:58:48 +0000 (07:58 +0100)]
vnc: Limit r/w access to size of allocated memory

This fixes memory reads and writes which exceeded the upper limit
of allocated memory vd->guest.ds->data and vd->server->data.

Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovnc: don't mess up with iohandlers in the vnc thread
Corentin Chary [Wed, 14 Mar 2012 06:58:47 +0000 (07:58 +0100)]
vnc: don't mess up with iohandlers in the vnc thread

The threaded VNC servers messed up with QEMU fd handlers without
any kind of locking, and that can cause some nasty race conditions.

Using qemu_mutex_lock_iothread() won't work because vnc_dpy_cpy(),
which will wait for the current job queue to finish, can be called with
the iothread lock held.

Instead, we now store the data in a temporary buffer, and use a bottom
half to notify the main thread that new data is available.

vnc_[un]lock_ouput() is still needed to access VncState members like
abort, csock or jobs_buffer.

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: Introduce CPU class
Andreas Färber [Sat, 28 Jan 2012 15:39:52 +0000 (16:39 +0100)]
qom: Introduce CPU class

Reintroduce CPUState as QOM object: It's abstract and derived directly
from TYPE_OBJECT for compatibility with the user emulators.
The identifier CPUState avoids conflicts between CPU() and the struct.

Introduce $(qom-twice-y) to build it separately for system and for user
emulators.

Prepare a virtual reset method, (re)introduce cpu_reset() as wrapper.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRename CPUState -> CPUArchState
Andreas Färber [Wed, 14 Mar 2012 00:38:32 +0000 (01:38 +0100)]
Rename CPUState -> CPUArchState

Scripted conversion:
  for file in *.[hc] hw/*.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do
    sed -i "s/CPUState/CPUArchState/g" $file
  done

All occurrences of CPUArchState are expected to be replaced by QOM CPUState,
once all targets are QOM'ified and common fields have been extracted.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoxtensa hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:24 +0000 (01:38 +0100)]
xtensa hw/: Don't use CPUState

Scripted conversion:
  for file in hw/xtensa_*.[hc]; do
    sed -i "s/CPUState/CPUXtensaState/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosparc hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:24 +0000 (01:38 +0100)]
sparc hw/: Don't use CPUState

Scripted conversion:
  for file in hw/sun4m.c hw/sun4u.c hw/grlib.h hw/leon3.c; do
    sed -i "s/CPUState/CPUSPARCState/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosh4 hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
sh4 hw/: Don't use CPUState

Scripted conversion:
  for file in hw/sh.h hw/shix.c hw/r2d.c; do
    sed -i "s/CPUState/CPUSH4State/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agos390x hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
s390x hw/: Don't use CPUState

Scripted conversion:
  for file in hw/s390-*.[hc]; do
    sed -i "s/CPUState/CPUS390XState/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoppc hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
ppc hw/: Don't use CPUState

Scripted conversion:
  for file in hw/ppc*.[hc] hw/mpc8544_guts.c hw/spapr*.[hc] hw/virtex_ml507.c hw/xics.c; do
    sed -i "s/CPUState/CPUPPCState/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomips hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
mips hw/: Don't use CPUState

Scripted conversion:
  for file in hw/mips_*.[hc]; do
    sed -i "s/CPUState/CPUMIPSState/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomicroblaze hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
microblaze hw/: Don't use CPUState

Scripted conversion:
  for file in hw/microblaze_*.[hc] hw/petalogix_ml605_mmu.c hw/petalogix_s3adsp1800_mmu.c; do
    sed -i "s/CPUState/CPUMBState/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agom68k hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
m68k hw/: Don't use CPUState

Scripted conversion:
  for file in hw/an5206.c hw/dummy_m68k.c hw/mcf.h hw/mcf5206.c hw/mcf5208.c hw/mcf_intc.c; do
    sed -i "s/CPUState/CPUM68KState/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agolm32 hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
lm32 hw/: Don't use CPUState

Scripted conversion:
  for file in hw/lm32_boards.c hw/milkymist.c; do
    sed -i "s/CPUState/CPULM32State/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoi386 hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
i386 hw/: Don't use CPUState

Scripted conversion:
  for file in hw/apic.h hw/kvm/apic.c hw/kvmvapic.c hw/pc.c hw/vmport.c hw/xen_machine_pv.c; do
    sed -i "s/CPUState/CPUX86State/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocris hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
cris hw/: Don't use CPUState

Scripted conversion:
  for file in hw/cris-boot.[hc] hw/cris_pic_cpu.c hw/axis_dev88.c hw/etraxfs.h hw/etraxfs_ser.c; do
    sed -i "s/CPUState/CPUCRISState/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoarm hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
arm hw/: Don't use CPUState

Scripted conversion:
  for file in hw/arm-misc.h hw/arm_boot.c hw/arm_pic.c hw/armv7m.c hw/exynos4210.h hw/highbank.c hw/integratorcp.c hw/musicpal.c hw/omap.h hw/pxa.h hw/pxa2xx_gpio.c hw/pxa2xx_pic.c hw/realview.c hw/strongarm.h hw/versatilepb.c hw/vexpress.c  hw/xilinx_zynq.c ; do
    sed -i "s/CPUState/CPUARMState/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoalpha hw/: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
alpha hw/: Don't use CPUState

Scripted conversion:
  for file in hw/alpha_*.[hc]; do
    sed -i "s/CPUState/CPUAlphaState/g" $file
  done

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoxtensa-semi: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
xtensa-semi: Don't use CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUXtensaState/g" xtensa-semi.c

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agom68k-semi: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
m68k-semi: Don't use CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUM68KState/g" m68k-semi.c

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoarm-semi: Don't use CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
arm-semi: Don't use CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUARMState/g" arm-semi.c

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-xtensa: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
target-xtensa: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUXtensaState/g" target-xtensa/*.[hc]
  sed -i "s/#define CPUXtensaState/#define CPUState/" target-xtensa/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-unicore32: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:23 +0000 (01:38 +0100)]
target-unicore32: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUUniCore32State/g" target-unicore32/*.[hc]
  sed -i "s/#define CPUUniCore32State/#define CPUState/" target-unicore32/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-sparc: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:22 +0000 (01:38 +0100)]
target-sparc: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUSPARCState/g" target-sparc/*.[hc]
  sed -i "s/#define CPUSPARCState/#define CPUState/" target-sparc/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-sh4: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:22 +0000 (01:38 +0100)]
target-sh4: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUSH4State/g" target-sh4/*.[hc]
  sed -i "s/#define CPUSH4State/#define CPUState/" target-sh4/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-s390x: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:22 +0000 (01:38 +0100)]
target-s390x: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUS390XState/g" target-s390x/*.[hc]
  sed -i "s/#define CPUS390XState/#define CPUState/" target-s390x/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-ppc: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:22 +0000 (01:38 +0100)]
target-ppc: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUPPCState/g" target-ppc/*.[hc]
  sed -i "s/#define CPUPPCState/#define CPUState/" target-ppc/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-mips: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:22 +0000 (01:38 +0100)]
target-mips: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUMIPSState/g" target-mips/*.[hc]
  sed -i "s/#define CPUMIPSState/#define CPUState/" target-mips/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-microblaze: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:22 +0000 (01:38 +0100)]
target-microblaze: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUMBState/g" target-microblaze/*.[hc]
  sed -i "s/#define CPUMBState/#define CPUState/" target-microblaze/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-m68k: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:22 +0000 (01:38 +0100)]
target-m68k: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUM68KState/g" target-m68k/*.[hc]
  sed -i "s/#define CPUM68KState/#define CPUState/" target-m68k/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-lm32: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:22 +0000 (01:38 +0100)]
target-lm32: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPULM32State/g" target-lm32/*.[hc]
  sed -i "s/#define CPULM32State/#define CPUState/" target-lm32/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-i386: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:21 +0000 (01:38 +0100)]
target-i386: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUX86State/g" target-i386/*.[hc]
  sed -i "s/#define CPUX86State/#define CPUState/" target-i386/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-cris: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:21 +0000 (01:38 +0100)]
target-cris: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUCRISState/g" target-cris/*.[hc]
  sed -i "s/#define CPUCRISState/#define CPUState/" target-cris/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-arm: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:21 +0000 (01:38 +0100)]
target-arm: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUARMState/g" target-arm/*.[hc]
  sed -i "s/#define CPUARMState/#define CPUState/" target-arm/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-alpha: Don't overuse CPUState
Andreas Färber [Wed, 14 Mar 2012 00:38:21 +0000 (01:38 +0100)]
target-alpha: Don't overuse CPUState

Scripted conversion:
  sed -i "s/CPUState/CPUAlphaState/g" target-alpha/*.[hc]
  sed -i "s/#define CPUAlphaState/#define CPUState/" target-alpha/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agobsd-user: Don't overuse CPUState
Andreas Färber [Sat, 25 Feb 2012 03:29:56 +0000 (04:29 +0100)]
bsd-user: Don't overuse CPUState

Use CPU*State where applicable.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agodarwin-user: Don't overuse CPUState
Andreas Färber [Sat, 25 Feb 2012 03:27:43 +0000 (04:27 +0100)]
darwin-user: Don't overuse CPUState

Use CPU*State where applicable.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agolinux-user: Don't overuse CPUState
Andreas Färber [Sat, 25 Feb 2012 02:37:53 +0000 (03:37 +0100)]
linux-user: Don't overuse CPUState

In target-specific code use CPU*State.

While at it, fix indentation on those lines.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agohw/mc146818: Drop unneeded #includes
Andreas Färber [Sat, 25 Feb 2012 01:14:24 +0000 (02:14 +0100)]
hw/mc146818: Drop unneeded #includes

pc.h and apic.h are not needed; apic.h would drag in x86 CPUState and
is now included directly for TARGET_I386.

isa.h is already #included from mc146818rtc.h.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-unicore32: Rename to CPUUniCore32State
Andreas Färber [Wed, 15 Feb 2012 23:12:24 +0000 (00:12 +0100)]
target-unicore32: Rename to CPUUniCore32State

This aids in refactoring CPUState by adopting the common naming scheme.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-sparc: Typedef struct CPUSPARCState early
Andreas Färber [Fri, 24 Feb 2012 16:15:27 +0000 (17:15 +0100)]
target-sparc: Typedef struct CPUSPARCState early

Will be needed for qemu_irq_ack callback.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-lm32/microblaze: Typedef struct CPU{MB,LM32}State
Andreas Färber [Fri, 24 Feb 2012 15:59:17 +0000 (16:59 +0100)]
target-lm32/microblaze: Typedef struct CPU{MB,LM32}State

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomonitor: Avoid CPUState in read/write functions
Andreas Färber [Mon, 20 Feb 2012 05:44:56 +0000 (06:44 +0100)]
monitor: Avoid CPUState in read/write functions

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomonitor: Don't access registers through CPUState
Andreas Färber [Wed, 15 Feb 2012 23:40:47 +0000 (00:40 +0100)]
monitor: Don't access registers through CPUState

Use CPUX86State etc. instead (hand-converted).

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRename cpu_reset() to cpu_state_reset()
Andreas Färber [Wed, 8 Feb 2012 02:03:33 +0000 (03:03 +0100)]
Rename cpu_reset() to cpu_state_reset()

Frees the identifier cpu_reset for QOM CPUs (manual rename).

Don't hide the parameter type behind explicit casts, use static
functions with strongly typed argument to indirect.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoPPC: 405: Use proper CPU reset
Alexander Graf [Tue, 21 Feb 2012 18:41:59 +0000 (19:41 +0100)]
PPC: 405: Use proper CPU reset

On ppc405ep there is a register that allows for software to reset the
core, but not the whole system. Implement this reset using a reset
interrupt.

This gets rid of a bunch of #if 0'ed code.

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Introduce object_class_get_list()
Andreas Färber [Sat, 25 Feb 2012 22:07:34 +0000 (23:07 +0100)]
qom: Introduce object_class_get_list()

This function allows to obtain a singly-linked list of classes, which
can be sorted by the caller.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom/object.c: rename type_class_init() to type_initialize()
Igor Mitsyanko [Tue, 28 Feb 2012 11:57:11 +0000 (15:57 +0400)]
qom/object.c: rename type_class_init() to type_initialize()

Function name type_class_init() gave us a wrong impression of separation
of type's "class" and "object" entities initialization. Name type_initialize()
is more appropriate for type_class_init() function (considering what operations
it performs).

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: if @instance_size==0, assign size of object to parent object size
Igor Mitsyanko [Tue, 28 Feb 2012 11:57:10 +0000 (15:57 +0400)]
qom: if @instance_size==0, assign size of object to parent object size

QOM documentation states that for objects of type with @instance_size == 0 size
will be assigned to match parent object's size. But currently this feauture is
not implemented and qemu asserts during creation of object with zero instance_size.

Set appropriate value for type instance_size during type_class_init() call.
object_initialize_with_type() must call type_class_init() before asserting
type->instance_size, and object_new_with_type() must call type_class_init() before
object allocation.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agokvmvapic: align start address as well as size
Avi Kivity [Tue, 6 Mar 2012 15:50:10 +0000 (17:50 +0200)]
kvmvapic: align start address as well as size

The kvmvapic code remaps a section of ROM as RAM to allow the guest to
maintain state there.  It is careful to align the section size to a page
boundary, to avoid creating subpages, but neglects to do the same for
the start address.  These leads to an assert later on when the memory
core tries to create a page which is half RAM and half ROM.

Fix by aligning the start address to a page boundary.

This can be triggered by running qemu-system-x86_64 -enable-kvm -vga none.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Tue, 13 Mar 2012 18:56:13 +0000 (13:56 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

* kiszka/queues/slirp:
  slirp: Fix compiler warning for w64
  slirp: Cleanup resources on instance removal
  slirp: Remove unneeded if_queued
  slirp: Fix queue walking in if_start
  slirp: Prevent recursion of if_start
  slirp: Keep next_m always valid

12 years agoMerge remote-tracking branch 'kraxel/usb.44' into staging
Anthony Liguori [Tue, 13 Mar 2012 18:55:02 +0000 (13:55 -0500)]
Merge remote-tracking branch 'kraxel/usb.44' into staging

* kraxel/usb.44:
  Endian fix an assertion in usb-msd
  uhci: alloc can't fail, drop check.
  uhci: new uhci_handle_td return code for tds still in flight
  uhci: renumber uhci_handle_td return codes
  uhci: use enum for uhci_handle_td return codes
  uhci: tracing support
  uhci: cancel on schedule stop.
  uhci: fix uhci_async_cancel_all
  uhci: pass addr to uhci_async_alloc
  usb: improve packet state sanity checks
  usb-ohci: DMA writeback bug fixes
  usb-ehci: drop unused isoch_pause variable
  usb: zap hw/ush-{ohic,uhci}.h + init wrappers
  usb: the big rename

12 years agoqom: Add QOM support to user emulators
Andreas Färber [Sun, 4 Mar 2012 20:32:36 +0000 (21:32 +0100)]
qom: Add QOM support to user emulators

Link the Object base class and the module infrastructure for class
registration. Introduce $(universal-obj-y) for objects that are more
common than $(common-obj-y), so that those only get built once.

Call QOM module init for type registration.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: Register QOM infrastructure early
Andreas Färber [Sun, 4 Mar 2012 20:32:35 +0000 (21:32 +0100)]
qom: Register QOM infrastructure early

The constructors for QOM TYPE_INTERFACE were executed rather late in
vl.c's main(). Call them very early so that QOM can safely be used for
machines and CPUs.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agokvmclock: Always register type
Andreas Färber [Sun, 4 Mar 2012 20:32:34 +0000 (21:32 +0100)]
kvmclock: Always register type

Currently, the "kvmclock" type is only registered when kvm_enabled().

This breaks when moving type registration to before command line
parsing (so that QOM types can be used for CPU and machine).

Since the QOM classes are lazy-initialized anyway and kvmclock_create()
has another kvm_enabled() check, simply drop the KVM check in
kvmclock_register_types().

kvm-i8259, kvm-apic and kvm-ioapic do not suffer from such a check.

Reviewed-by: please.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoslirp: Fix compiler warning for w64
Stefan Weil [Sat, 10 Mar 2012 20:20:53 +0000 (21:20 +0100)]
slirp: Fix compiler warning for w64

Casting a pointer to an integer value must use uintptr_t or intptr_t
(not long) for portable code. MinGW-w64 requires this because
sizeof(long) != sizeof(void *) for w64 hosts, so casting to long
raises a compiler warning.

I use uintptr_t instead of intptr_t because changing the sign does not
matter here and casting pointers to unsigned values seems more
reasonable (the unsigned value is a non negative offset.

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoslirp: Cleanup resources on instance removal
Jan Kiszka [Wed, 29 Feb 2012 18:14:23 +0000 (19:14 +0100)]
slirp: Cleanup resources on instance removal

Close & free sockets when shutting down a slirp instance, also release
all buffers.

CC: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoslirp: Remove unneeded if_queued
Jan Kiszka [Mon, 5 Mar 2012 23:02:23 +0000 (00:02 +0100)]
slirp: Remove unneeded if_queued

There is now a trivial check on entry of if_start for pending packets,
so we can drop the additional tracking via if_queued.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoslirp: Fix queue walking in if_start
Jan Kiszka [Mon, 5 Mar 2012 23:00:07 +0000 (00:00 +0100)]
slirp: Fix queue walking in if_start

Another attempt to get this right: We need to carefully walk both the
fastq and the batchq in if_start while trying to send packets to
possibly not yet resolved hosts on the virtual network.

So far we just requeued a delayed packet where it was and then started
walking the queues from the top again - that couldn't work. Now we pre-
calculate the next packet in the queue so that the current one can
safely be removed if it was sent successfully. We also need to take into
account that the next packet can be from the same session if the current
one was sent and there are no other sessions.

CC: Fabien Chouteau <chouteau@adacore.com>
CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Stefan Weil <sw@weilnetz.de>
Tested-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoslirp: Prevent recursion of if_start
Jan Kiszka [Mon, 5 Mar 2012 18:50:39 +0000 (19:50 +0100)]
slirp: Prevent recursion of if_start

if_start can be called recursively via if_encap. Avoid this as our
scheme of dequeuing packets is not compatible with this.

CC: Fabien Chouteau <chouteau@adacore.com>
CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoslirp: Keep next_m always valid
Jan Kiszka [Wed, 29 Feb 2012 08:27:33 +0000 (09:27 +0100)]
slirp: Keep next_m always valid

Make sure that next_m always points to a packet if batchq is non-empty.
This will simplify walking the queues in if_start.

CC: Fabien Chouteau <chouteau@adacore.com>
CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoEndian fix an assertion in usb-msd
Benjamin Herrenschmidt [Thu, 8 Mar 2012 00:41:10 +0000 (11:41 +1100)]
Endian fix an assertion in usb-msd

This fixes a broken endian assumption in an assertion in usb-msd.

Cc: Gerd Hoffman <kraxel@redhat.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agouhci: alloc can't fail, drop check.
Gerd Hoffmann [Fri, 9 Mar 2012 10:10:48 +0000 (11:10 +0100)]
uhci: alloc can't fail, drop check.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agouhci: new uhci_handle_td return code for tds still in flight
Gerd Hoffmann [Fri, 9 Mar 2012 10:15:41 +0000 (11:15 +0100)]
uhci: new uhci_handle_td return code for tds still in flight

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agouhci: renumber uhci_handle_td return codes
Gerd Hoffmann [Fri, 9 Mar 2012 10:11:46 +0000 (11:11 +0100)]
uhci: renumber uhci_handle_td return codes

Step #2 (separate for better bisectability): renumber so the silly '-1'
goes away.  Pick a range which doesn't overlap the old values.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agouhci: use enum for uhci_handle_td return codes
Gerd Hoffmann [Fri, 9 Mar 2012 10:09:49 +0000 (11:09 +0100)]
uhci: use enum for uhci_handle_td return codes

Step #1 (separate for better bisectability): replace numbers with names.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agouhci: tracing support
Gerd Hoffmann [Thu, 8 Mar 2012 12:12:38 +0000 (13:12 +0100)]
uhci: tracing support

Zap DPRINTF, add tracepoints instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agouhci: cancel on schedule stop.
Gerd Hoffmann [Thu, 8 Mar 2012 12:37:52 +0000 (13:37 +0100)]
uhci: cancel on schedule stop.

Cancel any in-flight transaction when the guest stops the uhci schedule.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agouhci: fix uhci_async_cancel_all
Gerd Hoffmann [Thu, 8 Mar 2012 12:29:07 +0000 (13:29 +0100)]
uhci: fix uhci_async_cancel_all

It should also free all queues.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>