sdk/emulator/qemu.git
12 years agosheepdog: make sure we don't free aiocb before sending all requests
MORITA Kazutaka [Tue, 26 Jun 2012 22:26:21 +0000 (07:26 +0900)]
sheepdog: make sure we don't free aiocb before sending all requests

This patch increments the pending counter before sending requests, and
make sures that aiocb is not freed while sending them.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agosheepdog: use coroutine based socket functions in coroutine context
MORITA Kazutaka [Tue, 26 Jun 2012 22:26:20 +0000 (07:26 +0900)]
sheepdog: use coroutine based socket functions in coroutine context

This removes blocking network I/Os in coroutine context.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agosheepdog: restart I/O when socket becomes ready in do_co_req()
MORITA Kazutaka [Tue, 26 Jun 2012 22:26:19 +0000 (07:26 +0900)]
sheepdog: restart I/O when socket becomes ready in do_co_req()

Currently, no one reenters the yielded coroutine.  This fixes it.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agosheepdog: fix dprintf format strings
MORITA Kazutaka [Tue, 26 Jun 2012 22:26:18 +0000 (07:26 +0900)]
sheepdog: fix dprintf format strings

This fixes warnings about dprintf format in debug mode.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblockdev: warn when copy_on_read=on and readonly=on
Stefan Hajnoczi [Wed, 27 Jun 2012 17:03:13 +0000 (18:03 +0100)]
blockdev: warn when copy_on_read=on and readonly=on

If the image is read-only then it's not possible to copy read data into
it.  Therefore copy-on-read is automatically disabled for read-only
images.

Up until now this behavior was silent, add a warning so the user knows
why copy-on-read is not working.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: preserve free_byte_offset when qcow2_alloc_bytes() fails
Stefan Hajnoczi [Mon, 18 Jun 2012 13:00:57 +0000 (14:00 +0100)]
qcow2: preserve free_byte_offset when qcow2_alloc_bytes() fails

When qcow2_alloc_clusters() error handling code was introduced in commit
5d757b563d59142ca81e1073a8e8396750a0ad1a, the value of free_byte_offset
was clobbered in the error case.  This patch keeps free_byte_offset at 0
so we will try to allocate clusters again next time this function is
called.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: fix #ifdef'd qcow2_check_refcounts() callers
Stefan Hajnoczi [Fri, 15 Jun 2012 15:41:07 +0000 (16:41 +0100)]
qcow2: fix #ifdef'd qcow2_check_refcounts() callers

The DEBUG_ALLOC qcow2.h macro enables additional consistency checks
throughout the code.  This makes it easier to spot corruptions that are
introduced during development.  Since consistency check is an expensive
operation the DEBUG_ALLOC macro is used to compile checks out in normal
builds and qcow2_check_refcounts() calls missed the addition of a new
function argument.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agobitops.h: Add functions to extract and deposit bitfields
Peter Maydell [Fri, 6 Jul 2012 14:48:00 +0000 (15:48 +0100)]
bitops.h: Add functions to extract and deposit bitfields

Add functions deposit32(), deposit64(), extract32() and extract64()
to extract and deposit bitfields in 32 and 64 bit words. Based on
ideas by Jia Liu and Avi Kivity.

Suggested-by: Jia Liu <proljc@gmail.com>
Suggested-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-i386: make it clearer that op table accesses don't overrun
Peter Maydell [Thu, 5 Jul 2012 21:29:00 +0000 (22:29 +0100)]
target-i386: make it clearer that op table accesses don't overrun

Rephrase some of the expressions used to select an entry
in the SSE op table arrays so that it's clearer that they
don't overrun the op table array size.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-i386: Remove confusing X86_64_DEF macro
Peter Maydell [Thu, 5 Jul 2012 21:28:59 +0000 (22:28 +0100)]
target-i386: Remove confusing X86_64_DEF macro

The X86_64_DEF macro is a confusing way of making some terms
in a conditional only appear if TARGET_X86_64 is defined. We
only use it in two places, and in both cases this is for making
the same test, so abstract that check out into a function
where we can use a more conventional #ifdef.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-i386: Remove unused macros
Peter Maydell [Thu, 5 Jul 2012 21:28:58 +0000 (22:28 +0100)]
target-i386: Remove unused macros

Commit 11f8cdb removed all the uses of the X86_64_ONLY
macro. The BUGGY_64() macro has been unused for a long time:
it originally marked some ops which couldn't be enabled
because of issues with the pre-TCG code generation scheme.
Remove the now-unnecessary definitions of both macros.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years ago.gitignore update
Eduardo Habkost [Wed, 4 Jul 2012 19:10:47 +0000 (16:10 -0300)]
.gitignore update

Makes sure the following files are ignored:

  libcacard/.libs/
  libcacard/libcacard.la
  libcacard/libcacard.pc
  libcacard/libcacard/
  libcacard/osdep.lo
  libcacard/oslib-posix.lo
  libcacard/qemu-thread-posix.lo
  libcacard/qemu-timer-common.lo
  libcacard/trace.lo
  libcacard/trace/
  tests/test-visitor-serialization
  vscclient

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 7 Jul 2012 09:00:38 +0000 (09:00 +0000)]
Merge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  hw/cadence_gem: Make rx_desc_addr and tx_desc_addr uint32_t
  i.MX31: KZM-ARM11-01 evaluation board
  i.MX31: Interrupt Controller
  i.MX31: Timers
  i.MX31: Clock Control Module
  i.MX: UART support
  Exynos4: add RTC device
  hw/exynos4210.c: Fix misleading initialization of IROM mirror
  hw/exynos4210_pwm.c: Fix STOP status in tick handler.
  ARM: hw/exynos4210_mct.c: Fix a bug which hangs Linux kernel.

12 years agotarget-i386: Fix compilation with --enable-debug
Stefan Weil [Fri, 29 Jun 2012 20:38:20 +0000 (22:38 +0200)]
target-i386: Fix compilation with --enable-debug

commit c4baa0503d9623f1ce891f525ccd140c598bc29a improved SSE table
type safety which now raises compiler errors when latest QEMU was
configured with --enable-debug.

Fix this by splitting the SSE tables even further to separate
helper functions with different signatures.

Instead of crashing by calling address 0, the code now jumps to
label illegal_op.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/cadence_gem: Make rx_desc_addr and tx_desc_addr uint32_t
Peter Maydell [Wed, 4 Jul 2012 10:50:58 +0000 (10:50 +0000)]
hw/cadence_gem: Make rx_desc_addr and tx_desc_addr uint32_t

Make the state fields rx_desc_addr and tx_desc_addr uint32_t;
this matches the VMStateDescription, and also conforms to how
hardware works: the registers don't magically become larger
if the device is attached to a CPU with a larger physical
address size. It also fixes a compile failure if the
target_phys_addr_t type is changed to 64 bits.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agoi.MX31: KZM-ARM11-01 evaluation board
Peter Chubb [Wed, 4 Jul 2012 10:43:34 +0000 (10:43 +0000)]
i.MX31: KZM-ARM11-01 evaluation board

Board support for Kyoto Micro's KZM-ARM11-01, an evaluation board built
around the Freescale i.MX31.

Signed-off-by: Philip O'Sullivan <philipo@ok-labs.com>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoi.MX31: Interrupt Controller
Peter Chubb [Wed, 4 Jul 2012 10:43:34 +0000 (10:43 +0000)]
i.MX31: Interrupt Controller

Implement the Freescale i.MX31 advanced vectored interrupt controller, at least
to the extent it is used by Linux 3.x

Vectors are not implemented.

Signed-off-by: Philip O'Sullivan <philipo@ok-labs.com>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoi.MX31: Timers
Peter Chubb [Wed, 4 Jul 2012 10:43:33 +0000 (10:43 +0000)]
i.MX31: Timers

Implement the timers on the Freescale i.MX31 SoC.
This is not a complete implementation, but gives enough for
Linux to boot and run. In particular external triggers, which are
not useful under QEMU, are not implemented.

Signed-off-by: Philip O'Sullivan <philipo@ok-labs.com>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoi.MX31: Clock Control Module
Peter Chubb [Wed, 4 Jul 2012 10:43:33 +0000 (10:43 +0000)]
i.MX31: Clock Control Module

For Linux to be able to work out how fast its clocks are going, so
that timer ticks come approximately at the right time, it needs to
be able to query the clock control module (CCM).

This is the start of a CCM implementation.  It currently knows only about
the MCU, HSP and IPG clocks --- i.e., the ones used to feed the periodic
and general purpose timers.

Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoi.MX: UART support
Peter Chubb [Wed, 4 Jul 2012 10:43:33 +0000 (10:43 +0000)]
i.MX: UART support

Implement the Freescale i.MX UART.  This uart is used in a variety of
SoCs, including some by Motorola, as well as in the Freescale i.MX
series.

This patch gives only a `bare-bones' implementation, enough to run Linux
or OKL4, but that's about it.

Signed-off-by: Philip O'Sullivan <philipo@ok-labs.com>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoExynos4: add RTC device
Oleg Ogurtsov [Wed, 4 Jul 2012 10:43:32 +0000 (10:43 +0000)]
Exynos4: add RTC device

Signed-off-by: Oleg Ogurtsov <o.ogurtsov@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/exynos4210.c: Fix misleading initialization of IROM mirror
Evgeny Voevodin [Wed, 4 Jul 2012 10:43:32 +0000 (10:43 +0000)]
hw/exynos4210.c: Fix misleading initialization of IROM mirror

We want to mirror whole IROM and should pass zero instead of
EXYNOS4210_IROM_BASE_ADDR (though it equals to zero too) since
memory_region_init_alias takes an offset within an original
region as an argument.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/exynos4210_pwm.c: Fix STOP status in tick handler.
Evgeny Voevodin [Wed, 4 Jul 2012 10:43:31 +0000 (10:43 +0000)]
hw/exynos4210_pwm.c: Fix STOP status in tick handler.

START/STOP bit was not cleaned correctly.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoARM: hw/exynos4210_mct.c: Fix a bug which hangs Linux kernel.
Stanislav Vorobiov [Wed, 4 Jul 2012 10:43:30 +0000 (10:43 +0000)]
ARM: hw/exynos4210_mct.c: Fix a bug which hangs Linux kernel.

After some long period of time Linux kernel hanged due to
ptimer_get_count may return 0 before timer interrupt occurs,
thus, causing FRC to jump back in time

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agobsd-user: fix build
Blue Swirl [Sun, 24 Jun 2012 20:15:05 +0000 (20:15 +0000)]
bsd-user: fix build

Link in oslib objects also for BSD user, but avoid using the version of
qemu_vmalloc() defined in oslib-posix.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: rename op_helper.c to seg_helper.c
Blue Swirl [Thu, 21 Jun 2012 19:19:15 +0000 (19:19 +0000)]
x86: rename op_helper.c to seg_helper.c

Rename what is remaining of op_helper.c to seg_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: split off memory access helpers
Blue Swirl [Sun, 29 Apr 2012 16:39:13 +0000 (16:39 +0000)]
x86: split off memory access helpers

Move memory access helpers to mem_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: split off misc helpers
Blue Swirl [Sun, 29 Apr 2012 18:20:34 +0000 (18:20 +0000)]
x86: split off misc helpers

Move various functions to misc_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: split off SMM helpers
Blue Swirl [Sun, 29 Apr 2012 17:48:05 +0000 (17:48 +0000)]
x86: split off SMM helpers

Move SMM helpers to smm_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: split off SVM helpers
Blue Swirl [Sun, 29 Apr 2012 14:42:35 +0000 (14:42 +0000)]
x86: split off SVM helpers

Move SVM helpers to svm_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: split off integer helpers
Blue Swirl [Sun, 29 Apr 2012 13:12:26 +0000 (13:12 +0000)]
x86: split off integer helpers

Move integer and bit field helpers to int_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: split off condition code helpers
Blue Swirl [Sun, 29 Apr 2012 12:21:21 +0000 (12:21 +0000)]
x86: split off condition code helpers

Move condition code helpers to cc_helper.c.

Move the shared inline functions lshift(), cpu_load_eflags() and
cpu_cc_compute_all() to cpu.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: prepare eflags helpers for general use
Blue Swirl [Sun, 29 Apr 2012 15:01:21 +0000 (15:01 +0000)]
x86: prepare eflags helpers for general use

Adjust function names and add an explicit CPUX86State
parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: split condition code and shift templates
Blue Swirl [Sat, 12 May 2012 20:39:26 +0000 (20:39 +0000)]
x86: split condition code and shift templates

Move shift templates from helper_template.h to
shift_helper_template.h and the condition code helpers
to cc_helper_template.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: fix coding style in helper_template.h
Blue Swirl [Sun, 29 Apr 2012 12:27:33 +0000 (12:27 +0000)]
x86: fix coding style in helper_template.h

Fix coding style in helper_template.h before next commit.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: improve SSE table type safety
Blue Swirl [Sun, 13 May 2012 18:53:07 +0000 (18:53 +0000)]
x86: improve SSE table type safety

SSE function tables could easily be corrupted because of use
of void pointers.

Introduce function pointer types and helper variables in order
to improve type safety.

Split sse_op_table3 according to types used.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: split off FPU helpers
Blue Swirl [Sat, 28 Apr 2012 20:21:41 +0000 (20:21 +0000)]
x86: split off FPU helpers

Move FPU and MMX/SSE helpers to fpu_helpers.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: fix coding style in ops_sse.h
Blue Swirl [Sun, 29 Apr 2012 08:54:44 +0000 (08:54 +0000)]
x86: fix coding style in ops_sse.h

Fix coding style in ops_sse.h before next commit.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: avoid an extern declaration
Blue Swirl [Sun, 29 Apr 2012 09:07:22 +0000 (09:07 +0000)]
x86: avoid an extern declaration

After the previous patch, we can use the proper
declaration in a common header file.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: split off exception handlers
Blue Swirl [Sat, 28 Apr 2012 19:53:52 +0000 (19:53 +0000)]
x86: split off exception handlers

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

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: avoid AREG0 for exceptions
Blue Swirl [Sat, 28 Apr 2012 19:35:10 +0000 (19:35 +0000)]
x86: avoid AREG0 for exceptions

Add an explicit CPUX86State parameter instead of relying on AREG0.

Merge raise_exception_env() to raise_exception(), likewise with
raise_exception_err_env() and raise_exception_err().

Introduce cpu_svm_check_intercept_param() and cpu_vmexit()
as wrappers.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: prepare op_helper.c for splitting
Blue Swirl [Sat, 28 Apr 2012 15:33:48 +0000 (15:33 +0000)]
x86: prepare op_helper.c for splitting

Fix coding style and a few typos.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoAdd a memory barrier to DMA functions
Benjamin Herrenschmidt [Wed, 27 Jun 2012 04:50:47 +0000 (14:50 +1000)]
Add a memory barrier to DMA functions

The emulated devices can run simultaneously with the guest, so
we need to be careful with ordering of load and stores done by
them to the guest system memory, which need to be observed in
the right order by the guest operating system.

This adds a barrier call to the basic DMA read/write ops which
is currently implemented as a smp_mb(), but could be later
improved for more fine grained control of barriers.

Additionally, a _relaxed() variant of the accessors is provided
to easily convert devices who would be performance sensitive
and negatively impacted by the change.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopseries: Implement IOMMU and DMA for PAPR PCI devices
David Gibson [Wed, 27 Jun 2012 04:50:46 +0000 (14:50 +1000)]
pseries: Implement IOMMU and DMA for PAPR PCI devices

Currently the pseries machine emulation does not support DMA for emulated
PCI devices, because the PAPR spec always requires a (guest visible,
paravirtualized) IOMMU which was not implemented.  Now that we have
infrastructure for IOMMU emulation, we can correct this and allow PCI DMA
for pseries.

With the existing PAPR IOMMU code used for VIO devices, this is almost
trivial. We use a single DMAContext for each (virtual) PCI host bridge,
which is the usual configuration on real PAPR machines (which often have
_many_ PCI host bridges).

Cc: Alex Graf <agraf@suse.de>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoiommu: Allow PCI to use IOMMU infrastructure
David Gibson [Wed, 27 Jun 2012 04:50:45 +0000 (14:50 +1000)]
iommu: Allow PCI to use IOMMU infrastructure

This patch adds some hooks to let PCI devices and busses use the new IOMMU
infrastructure.  When IOMMU support is enabled, each PCI device now
contains a DMAContext * which is used by the pci_dma_*() wrapper functions.

By default, the contexts are initialized to NULL, assuming no IOMMU.
However the platform or host bridge code which sets up the PCI bus can use
pci_setup_iommu() to set a function which will determine the correct
DMAContext for a given PCI device.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopseries: Convert sPAPR TCEs to use generic IOMMU infrastructure
David Gibson [Wed, 27 Jun 2012 04:50:44 +0000 (14:50 +1000)]
pseries: Convert sPAPR TCEs to use generic IOMMU infrastructure

The pseries platform already contains an IOMMU implementation, since it is
essential for the platform's paravirtualized VIO devices.  This IOMMU
support is currently built into the implementation of the VIO "bus" and
the various VIO devices.

This patch converts this code to make use of the new common IOMMU
infrastructure.

We don't yet handle synchronization of map/unmap callbacks vs. invalidations,
this will require some complex interaction with the kernel and is not a
major concern at this stage.

Cc: Alex Graf <agraf@suse.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoiommu: Introduce IOMMU emulation infrastructure
David Gibson [Wed, 27 Jun 2012 04:50:43 +0000 (14:50 +1000)]
iommu: Introduce IOMMU emulation infrastructure

This patch adds the basic infrastructure necessary to emulate an IOMMU
visible to the guest.  The DMAContext structure is extended with
information and a callback describing the translation, and the various
DMA functions used by devices will now perform IOMMU translation using
this callback.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agousb: Convert usb_packet_{map, unmap} to universal DMA helpers
David Gibson [Wed, 27 Jun 2012 04:50:42 +0000 (14:50 +1000)]
usb: Convert usb_packet_{map, unmap} to universal DMA helpers

The USB UHCI and EHCI drivers were converted some time ago to use the
pci_dma_*() helper functions.  However, this conversion was not complete
because in some places both these drivers do DMA via the usb_packet_map()
function in usb-libhw.c.  That function directly used
cpu_physical_memory_map().

Now that the sglist code uses DMA wrappers properly, we can convert the
functions in usb-libhw.c, thus conpleting the conversion of UHCI and EHCI
to use the DMA wrappers.

Note that usb_packet_map() invokes dma_memory_map() with a NULL invalidate
callback function.  When IOMMU support is added, this will mean that
usb_packet_map() and the corresponding usb_packet_unmap() must be called in
close proximity without dropping the qemu device lock - otherwise the guest
might invalidate IOMMU mappings while they are still in use by the device
code.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoide/ahci: Use universal DMA helper functions
David Gibson [Wed, 27 Jun 2012 04:50:41 +0000 (14:50 +1000)]
ide/ahci: Use universal DMA helper functions

The AHCI device can provide both PCI and SysBus AHCI device
emulations.  For this reason, it wasn't previously converted to use
the pci_dma_*() helper functions.  Now that we have universal DMA
helper functions, this converts AHCI to use them.

The DMAContext is obtained from pci_dma_context() in the PCI case and
set to NULL in the SysBus case (i.e. we assume for now that a SysBus
AHCI has no IOMMU translation).

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoiommu: Make sglists and dma_bdrv helpers use new universal DMA helpers
David Gibson [Wed, 27 Jun 2012 04:50:40 +0000 (14:50 +1000)]
iommu: Make sglists and dma_bdrv helpers use new universal DMA helpers

dma-helpers.c contains a number of helper functions for doing
scatter/gather DMA, and various block device related DMA.  Currently,
these directly access guest memory using cpu_physical_memory_*(),
assuming no IOMMU translation.

This patch updates this code to use the new universal DMA helper
functions.  qemu_sglist_init() now takes a DMAContext * to describe
the DMA address space in which the scatter/gather will take place.

We minimally update the callers qemu_sglist_init() to pass NULL
(i.e. no translation, same as current behaviour).  Some of those
callers should pass something else in some cases to allow proper IOMMU
translation in future, but that will be fixed in later patches.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agousb-ohci: Use universal DMA helper functions
David Gibson [Wed, 27 Jun 2012 04:50:39 +0000 (14:50 +1000)]
usb-ohci: Use universal DMA helper functions

The OHCI device emulation can provide both PCI and SysBus OHCI
implementations.  Because of this, it was not previously converted to
use the PCI DMA helper functions.

This patch converts it to use the new universal DMA helper functions.
In the PCI case, it obtains its DMAContext from pci_dma_context(), in
the SysBus case, it uses NULL - i.e. assumes for now that there will
be no IOMMU translation for a SysBus OHCI.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoiommu: Add universal DMA helper functions
David Gibson [Wed, 27 Jun 2012 04:50:38 +0000 (14:50 +1000)]
iommu: Add universal DMA helper functions

Not that long ago, every device implementation using DMA directly
accessed guest memory using cpu_physical_memory_*().  This meant that
adding support for a guest visible IOMMU would require changing every
one of these devices to go through IOMMU translation.

Shortly before qemu 1.0, I made a start on fixing this by providing
helper functions for PCI DMA.  These are currently just stubs which
call the direct access functions, but mean that an IOMMU can be
implemented in one place, rather than for every PCI device.

Clearly, this doesn't help for non PCI devices, which could also be
IOMMU translated on some platforms.  It is also problematic for the
devices which have both PCI and non-PCI version (e.g. OHCI, AHCI) - we
cannot use the the pci_dma_*() functions, because they assume the
presence of a PCIDevice, but we don't want to have to check between
pci_dma_*() and cpu_physical_memory_*() every time we do a DMA in the
device code.

This patch makes the first step on addressing both these problems, by
introducing new (stub) dma helper functions which can be used for any
DMA capable device.

These dma functions take a DMAContext *, a new (currently empty)
variable describing the DMA address space in which the operation is to
take place.  NULL indicates untranslated DMA directly into guest
physical address space.  The intention is that in future non-NULL
values will given information about any necessary IOMMU translation.

DMA using devices must obtain a DMAContext (or, potentially, contexts)
from their bus or platform.  For now this patch just converts the PCI
wrappers to be implemented in terms of the universal wrappers,
converting other drivers can take place over time.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoBetter support for dma_addr_t variables
David Gibson [Wed, 27 Jun 2012 04:50:37 +0000 (14:50 +1000)]
Better support for dma_addr_t variables

A while back, we introduced the dma_addr_t type, which is supposed to
be used for bus visible memory addresses.  At present, this is an
alias for target_phys_addr_t, but this will change when we eventually
add support for guest visible IOMMUs.

There are some instances of target_phys_addr_t in the code now which
should really be dma_addr_t, but can't be trivially converted due to
missing features which this patch corrects.

 * We add DMA_ADDR_BITS analagous to TARGET_PHYS_ADDR_BITS.  This is
   important where we need to make a compile-time (#if) based on the
   size of dma_addr_t.

 * We add a new helper macro to create device properties which take a
   dma_addr_t, currently an alias to DEFINE_PROP_TADDR().

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agortl8139: validate rx ring before receiving packets
Jason Wang [Thu, 17 May 2012 05:25:43 +0000 (13:25 +0800)]
rtl8139: validate rx ring before receiving packets

Commit ff71f2e8cacefae99179993204172bc65e4303df prevent the possible
crash during initialization of linux driver by checking the operating
mode.This seems too strict as:

- the real card could still work in mode other than normal
- some buggy driver who does not set correct opmode after eeprom
 access

So, considering rx ring address were reset to zero (which could be
safely trated as an address not intened to DMA to), in order to
both letting old guest work and preventing the unexpected DMA to
guest, we can forbid packet receiving when rx ring address is zero.

Tested-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRemove support for non-threaded VNC server
Daniel P. Berrange [Wed, 20 Jun 2012 13:24:28 +0000 (14:24 +0100)]
Remove support for non-threaded VNC server

QEMU now has a fundamental requirement for pthreads, so there
is no compelling reason to retain support for the non-threaded
VNC server. Remove the --{enable,disable}-vnc-thread configure
arguments, and all CONFIG_VNC_THREAD conditionals

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: Assure existence of linux-headers/ build directory
Andreas Färber [Thu, 14 Jun 2012 15:14:33 +0000 (15:14 +0000)]
configure: Assure existence of linux-headers/ build directory

Commit ec5b06d (configure: ensure directory exists when creating symlinks)
moved the creation of directories into the symlink() function but forgot
the case where no symlink is created.

This leads to build errors on arm Linux due to -I../linux-headers.

Unbreak the build on arm Linux by reverting part of that commit.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMakefile.target: Update clean command to clean hw/ directory
Peter Maydell [Wed, 20 Jun 2012 17:02:33 +0000 (18:02 +0100)]
Makefile.target: Update clean command to clean hw/ directory

Now we create object files in a hierarchy under hw/, so the
'clean' target must also be updated to delete those object files.
Rather than using a manual list of subdirectories which will
easily drift out of date, we just delete all .o and .d files
in the target directory hierarchy.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqtest: fix infinite loop when QEMU aborts abruptly
Anthony Liguori [Wed, 27 Jun 2012 13:20:43 +0000 (08:20 -0500)]
qtest: fix infinite loop when QEMU aborts abruptly

From Markus:

Makes "make check" hang:

    QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 gtester -k --verbose -m=quick tests/crash-test tests/rtc-test
    TEST: tests/crash-test... (pid=972)
    qemu-system-x86_64: Device needs media, but drive is empty
[Nothing happens, wait a while, then hit ^C]
    make: *** [check-qtest-x86_64] Interrupt

This was due to the fact that we weren't checked for errors when
reading from the QMP socket.  This patch adds appropriate error
checking.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqdev: fix use-after-free in the error path of qdev_init_nofail
Anthony Liguori [Wed, 27 Jun 2012 12:37:54 +0000 (07:37 -0500)]
qdev: fix use-after-free in the error path of qdev_init_nofail

From Markus:

Before:

    $ qemu-system-x86_64 -display none -drive if=ide
    qemu-system-x86_64: Device needs media, but drive is empty
    qemu-system-x86_64: Initialization of device ide-hd failed
    [Exit 1 ]

After:

    $ qemu-system-x86_64 -display none -drive if=ide
    qemu-system-x86_64: Device needs media, but drive is empty
    Segmentation fault (core dumped)
    [Exit 139 (SIGSEGV)]

This error always existed as qdev_init() frees the object.  But QOM
goes a bit further and purposefully sets the class pointer to NULL to
help find use-after-free.  It worked :-)

Cc: Andreas Faerber <afaerber@suse.de>
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMAINTAINERS: Added device tree
Peter A. G. Crosthwaite [Tue, 26 Jun 2012 04:29:42 +0000 (14:29 +1000)]
MAINTAINERS: Added device tree

Agreed between myself and Alex:
http://lists.nongnu.org/archive/html/qemu-devel/2012-06/msg03561.html

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoMAINTAINERS: Added Xilinx EDK devices
Peter A. G. Crosthwaite [Tue, 26 Jun 2012 04:29:41 +0000 (14:29 +1000)]
MAINTAINERS: Added Xilinx EDK devices

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoMAINTAINERS: Add Petalogix ml605 machine model
Peter A. G. Crosthwaite [Tue, 26 Jun 2012 04:29:40 +0000 (14:29 +1000)]
MAINTAINERS: Add Petalogix ml605 machine model

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Tue, 26 Jun 2012 20:09:47 +0000 (15:09 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  tci: Support INDEX_op_bswap64_i64
  target-i386: Use QEMU instead of Qemu
  Makefile.hw: avoid overly large 'make clean' rm command
  configure: Fix typo
  arm_gic: Send dbg msgs to stderr not stdout
  checkpatch: Add QEMU specific rule
  qemu-config: Use QEMU instead of Qemu
  libqtest: Fix socket_accept() to pass address_len
  Makefile.user: Define CONFIG_USER_ONLY for libuser/
  Makefile: Remove macro qapi-dir
  Makefile: Remove BUILD_DIR from qapi-dir
  Install 'bepo' keymap already included in Qemu source

12 years agoMerge remote-tracking branch 'spice/spice.v58' into staging
Anthony Liguori [Tue, 26 Jun 2012 20:07:03 +0000 (15:07 -0500)]
Merge remote-tracking branch 'spice/spice.v58' into staging

* spice/spice.v58:
  vga: raise default vgamem size
  add pc-1.2
  qxl: add vgamem_size_mb and vgamem_size
  vga: make vram size configurable
  vga: raise xres+yres limits
  qxl: reset current_async on qxl_soft_reset
  hw/qxl: ignore guest from guestbug until reset
  qxl: stop dirty loging when not in vga mode
  hw/qxl: s/qxl_guest_bug/qxl_set_guest_bug/
  ui/spice-display.c: add missing initialization for valgrind

12 years agoMerge remote-tracking branch 'mdroth/qga-pull-6-21-12' into staging
Anthony Liguori [Tue, 26 Jun 2012 20:06:09 +0000 (15:06 -0500)]
Merge remote-tracking branch 'mdroth/qga-pull-6-21-12' into staging

* mdroth/qga-pull-6-21-12:
  qemu-ga: add guest-fstrim command
  qemu-ga: make names more generic for mount list functions

12 years agoMerge remote-tracking branch 'sstabellini/compile-xs' into staging
Anthony Liguori [Tue, 26 Jun 2012 20:05:45 +0000 (15:05 -0500)]
Merge remote-tracking branch 'sstabellini/compile-xs' into staging

* sstabellini/compile-xs:
  xenstore: Use <xenstore.h>
  xen: Reorganize includes of Xen headers.

12 years agoMerge remote-tracking branch 'sstabellini/xen-pt' into staging
Anthony Liguori [Tue, 26 Jun 2012 20:05:33 +0000 (15:05 -0500)]
Merge remote-tracking branch 'sstabellini/xen-pt' into staging

* sstabellini/xen-pt:
  Introduce Xen PCI Passthrough, MSI
  Introduce apic-msidef.h
  Introduce Xen PCI Passthrough, PCI config space helpers
  Introduce Xen PCI Passthrough, qdevice
  qdev-properties: Introduce pci-host-devaddr.
  pci.c: Add opaque argument to pci_for_each_device.
  Introduce XenHostPCIDevice to access a pci device on the host.
  configure: Introduce --enable-xen-pci-passthrough.
  pci_ids: Add INTEL_82599_SFP_VF id.

12 years agoMerge remote-tracking branch 'kraxel/usb.54' into staging
Anthony Liguori [Tue, 26 Jun 2012 20:01:47 +0000 (15:01 -0500)]
Merge remote-tracking branch 'kraxel/usb.54' into staging

* kraxel/usb.54:
  uhci: fix uhci_async_cancel_all
  usb-host: live migration support
  usb-host: attach only to running guest
  ehci: tracing improvements
  usb: restore USBDevice->attached on vmload
  ehci: add live migration support

12 years agotarget-ppc: Fix 2nd parameter for tcg_gen_shri_tl
Stefan Weil [Sun, 24 Jun 2012 04:18:41 +0000 (04:18 +0000)]
target-ppc: Fix 2nd parameter for tcg_gen_shri_tl

This fixes a compiler error when QEMU was configured with --enable-debug.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-ppc: Fix build with --enable-debug
Stefan Weil [Sun, 24 Jun 2012 04:04:17 +0000 (04:04 +0000)]
target-ppc: Fix build with --enable-debug

The order of the arguments was wrong (copy+paste error).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotci: don't write zero for reloc in tci_out_label
Scott Wood [Tue, 19 Jun 2012 02:31:36 +0000 (21:31 -0500)]
tci: don't write zero for reloc in tci_out_label

If tci_out_label is called in the context of tcg_gen_code_search_pc, we
could be overwriting an already patched relocation with zero -- and not
repatch it because the set_label is past search_pc, causing a QEMU crash
when it tries to branch to a zero label.

Not writing anything to the relocation area seems to be in line with what
other backends do from the couple I looked at (x86, ppc).

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomake: Fix dependencies for fpu/*.c and tcg/*.c
Stefan Weil [Thu, 21 Jun 2012 20:18:39 +0000 (22:18 +0200)]
make: Fix dependencies for fpu/*.c and tcg/*.c

Commit dcff25f2cd8c11a9368cc2369aeb0319c32d9e26 removed too many *.d
files. The directories fpu/ and tcg/ still don't use the recursive
subdir rules.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoqemu-log: Add GCC format attribute
Stefan Weil [Sat, 23 Jun 2012 18:41:10 +0000 (20:41 +0200)]
qemu-log: Add GCC format attribute

The new inline function qemu_log_vprintf should use this attribute.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
Blue Swirl [Sun, 24 Jun 2012 10:48:56 +0000 (10:48 +0000)]
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf

* 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf: (72 commits)
  PPC: BookE206: Bump MAS2 to 64bit
  PPC: BookE: Support 32 and 64 bit wide MAS2
  PPC: Extract SPR dump generation into its own function
  PPC: Add e5500 CPU target
  PPC: BookE: Make ivpr selectable by CPU type
  PPC: BookE: Implement EPR SPR
  PPC: Add support for MSR_CM
  PPC: Add some booke SPR defines
  uImage: increase the gzip load size
  PPC: e500: allow users to set the /compatible property via -machine
  dt: make setprop argument static
  PPC: e500: Refactor serial dt generation
  dt: Add global option to set phandle start offset
  PPC: e500: Extend address/size of / to 64bit
  PPC: e500: Define addresses as always 64bit
  PPC: e500: Use new SOC dt format
  PPC: e500: Use new MPIC dt format
  Revert "dt: temporarily disable subtree creation failure check"
  PPC: e500: enable manual loading of dtb blob
  PPC: e500: dt: use target_phys_addr_t for ramsize
  ...

12 years agoMerge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sun, 24 Jun 2012 10:48:01 +0000 (10:48 +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: (33 commits)
  target-arm: Remove ARM_CPUID_* macros
  target-arm: Remove remaining old cp15 infrastructure
  target-arm: Move block cache ops to new cp15 framework
  target-arm: Remove c0_cachetype CPUARMState field
  target-arm: Convert final ID registers
  target-arm: Convert MPIDR
  target-arm: Convert cp15 cache ID registers
  target-arm: Convert cp15 crn=0 crm={1,2} feature registers
  target-arm: Convert cp15 crn=1 registers
  target-arm: Convert cp15 crn=9 registers
  target-arm: Convert cp15 crn=6 registers
  target-arm: convert cp15 crn=7 registers
  target-arm: Convert cp15 VA-PA translation registers
  target-arm: Convert cp15 MMU TLB control
  target-arm: Convert cp15 crn=15 registers
  target-arm: Convert cp15 crn=10 registers
  target-arm: Convert cp15 crn=13 registers
  target-arm: Convert cp15 crn=2 registers
  target-arm: Convert MMU fault status cp15 registers
  target-arm: Convert cp15 c3 register
  ...

12 years agoMerge branch 's390-for-upstream' of git://repo.or.cz/qemu/agraf
Blue Swirl [Sun, 24 Jun 2012 10:45:55 +0000 (10:45 +0000)]
Merge branch 's390-for-upstream' of git://repo.or.cz/qemu/agraf

* 's390-for-upstream' of git://repo.or.cz/qemu/agraf:
  s390: stop target cpu on sigp initial reset
  s390: make kvm_stat work on s390
  kvm: Update kernel headers
  s390x: fix s390 virtio aliases

12 years agoMerge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sun, 24 Jun 2012 07:09:30 +0000 (07:09 +0000)]
Merge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  arm_boot: Conditionalised DTB command line update
  cadence_ttc: changed master clock frequency
  cadence_gem: avoid stack-writing buffer-overrun
  hw/a9mpcore: Fix compilation failure if physaddrs are 64 bit
  hw/omap.h: Drop broken MEM_VERBOSE tracing
  hw/armv7m_nvic: Make the NVIC a freestanding class
  hw/arm_gic: Move CPU interface memory region setup into arm_gic_init
  hw/arm_gic.c: Make NVIC interrupt numbering a runtime setting
  hw/arm_gic: Make CPU target registers RAZ/WI on uniprocessor
  hw/arm_gic: Add qdev property for GIC revision
  hw/armv7m_nvic: Use MemoryRegions for NVIC specific registers
  hw/arm_gic: Move NVIC specific reset to armv7m_nvic_reset
  hw/arm_gic: Remove the special casing of NCPU for the NVIC
  hw/arm_gic: Remove NVIC ifdefs from gic_state struct
  arm_boot: Fix typos in comment
  ARM: Exynos4210 IRQ: Introduce new IRQ gate functionality.

12 years agoPPC: BookE206: Bump MAS2 to 64bit
Alexander Graf [Thu, 21 Jun 2012 11:34:20 +0000 (13:34 +0200)]
PPC: BookE206: Bump MAS2 to 64bit

On 64bit capable systems, MAS2 can actually hold a 64bit virtual page
address. So increase the mask for its EPN.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: BookE: Support 32 and 64 bit wide MAS2
Alexander Graf [Thu, 21 Jun 2012 12:01:06 +0000 (14:01 +0200)]
PPC: BookE: Support 32 and 64 bit wide MAS2

The MAS registers on BookE are all 32 bit wide, except for MAS2, which
can hold up to 64 bit on 64 bit capable CPUs. Reflect this in the SPR
setting code, so that the guest can never write invalid values in them.

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