]> git.proxmox.com Git - qemu.git/log
qemu.git
12 years agoaudio: add VOICE_VOLUME ctl
Marc-André Lureau [Tue, 17 Apr 2012 12:32:35 +0000 (14:32 +0200)]
audio: add VOICE_VOLUME ctl

Add a new PCM control operation to update the stream volume on the
audio backend.  The argument given is a SWVoiceOut/SWVoiceIn.

v4:
- verified other backends didn't fail/assert on this new control
  they randomly return 0 or -1, but we ignore return value.

Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agoqemu-timer.c: Remove 250us timeouts
Peter Portante [Thu, 5 Apr 2012 15:00:45 +0000 (11:00 -0400)]
qemu-timer.c: Remove 250us timeouts

Basically, the main wait loop calls qemu_run_all_timers() unconditionally. The
first thing this routine used to do is to see if a timer had been serviced,
and then reset the loop timeout to the next deadline.

However, the new deadlines had not been calculated at that point, as
qemu_run_timers() had not been called yet for each of the clocks. So
qemu_rearm_alarm_timer() would end up with a negative or zero deadline, and
default to setting a 250us timeout for the loop.

As qemu_run_timers() is called for each clock, the real deadlines would be put
in place, but because a loop timeout was already set, the loop timeout would
not be changed.

Once that 250us timeout fired, the real deadline would be used for the
subsequent timeout.

For idle VMs, this effectively doubles the number of times through the loop,
doubling the number of select() system calls, timer calls, etc. putting added
scheduling pressure on the kernel. And under cgroups, this really causes a big
problem because the cgroup code does not scale well.

By simply running the timers before trying to rearm the timer, we always rearm
with a non-zero deadline, effectively halving the number of system calls.

Signed-off-by: Peter Portante <pportant@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'kiszka/queues/pending' into staging
Anthony Liguori [Mon, 16 Apr 2012 17:56:28 +0000 (12:56 -0500)]
Merge remote-tracking branch 'kiszka/queues/pending' into staging

* kiszka/queues/pending:
  vapic: Disable for pre-1.1 machines
  Kick io-thread on qemu_chr_accept_input
  pcnet: Properly handle TX requests during Link Fail
  pcnet: Clear ERR in CSR0 on stop
  signrom: Rewrite as python script

Conflicts:
hw/pc_piix.c

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 16 Apr 2012 17:52:22 +0000 (12:52 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

* mst/tags/for_anthony:
  pci: fix corrupted pci conf index register by unaligned write
  acpi: explicitly account for >1 device per slot
  acpi_piix4: Re-define PCI hotplug eject register read
  acpi_piix4: Remove PCI_RMV_BASE write code
  acpi_piix4: Fix PCI hotplug race
  acpi_piix4: Disallow write to up/down PCI hotplug registers
  virtio-pci: change virtio balloon PCI class code
  ivshmem: add missing msix calls
  vhost: readd assert statement
  vhost: Fix size of dirty log sync on resize
  pc: reduce duplication in compat machine types
  piix_pci: fix typo in i400FX chipset init code

12 years agoMerge remote-tracking branch 'sstabellini/for_anthony' into staging
Anthony Liguori [Mon, 16 Apr 2012 17:50:12 +0000 (12:50 -0500)]
Merge remote-tracking branch 'sstabellini/for_anthony' into staging

* sstabellini/for_anthony:
  xen: introduce an event channel for buffered io event notifications
  xen-mapcache: don't unmap locked entry during mapcache invalidation
  Xen, mapcache: Fix the compute of the size of bucket.
  xen: handle backend deletion from xenstore
  Xen: Add xen-apic support and hook it up.
  Xen: basic HVM MSI injection support.

12 years agovapic: Disable for pre-1.1 machines
Jan Kiszka [Thu, 29 Mar 2012 12:07:46 +0000 (14:07 +0200)]
vapic: Disable for pre-1.1 machines

The kvmvapic was not present in older QEMU versions, thus must be
disabled in compat machines.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoKick io-thread on qemu_chr_accept_input
Jan Kiszka [Fri, 16 Mar 2012 12:18:00 +0000 (13:18 +0100)]
Kick io-thread on qemu_chr_accept_input

Once a chr frontend is able to receive input again, we need to inform
the io-thread about this fact. Otherwise, main_loop_wait may continue to
select without the related backend file descriptor in its set. This can
cause high input latencies if only low-rate events arrive otherwise.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agopcnet: Properly handle TX requests during Link Fail
Jan Kiszka [Wed, 29 Feb 2012 14:37:43 +0000 (15:37 +0100)]
pcnet: Properly handle TX requests during Link Fail

As long as we have no link and we aren't in internal loopback mode, no
packet must be sent. Instead, LCAR needs to be set in any active TX
descriptor and also CERR in CSR0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agopcnet: Clear ERR in CSR0 on stop
Jan Kiszka [Wed, 29 Feb 2012 14:33:48 +0000 (15:33 +0100)]
pcnet: Clear ERR in CSR0 on stop

pcnet_stop already clears any reason (BABL, CERR, MISS, MERR) why ERR
(bit 15) should be set in CRS0. So we have to clear that bit as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agosignrom: Rewrite as python script
Jan Kiszka [Fri, 27 Jan 2012 18:44:53 +0000 (19:44 +0100)]
signrom: Rewrite as python script

Now that we have a hard dependency on python anyway, we can replace the
slow shell script to calculate the option ROM checksum with a fast AND
portable python version. Tested both with python 2.7 and 3.1.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoMerge branch 'w64' of git://qemu.weilnetz.de/qemu
Blue Swirl [Sun, 15 Apr 2012 19:56:06 +0000 (19:56 +0000)]
Merge branch 'w64' of git://qemu.weilnetz.de/qemu

* 'w64' of git://qemu.weilnetz.de/qemu:
  w64: Fix time conversion for some versions of MinGW-w64
  nbd: Fix compiler warning (w64)
  disas: Replace 'unsigned long' by 'uintptr_t'
  cpu-exec: Remove non-portable type cast and fix format string
  target-mips: Fix type cast for w64 (uintptr_t)
  w64: Fix type cast in os_host_main_loop_wait
  w64: Fix data types in softmmu*.h
  w64: Use uintptr_t in exec.c
  softmmu: Use uintptr_t for physaddr and rename it
  w64: Fix struct CPUTLBEntry
  w64: Fix definition of setjmp
  w32: Move defines for socket specific errors to qemu-os-win32.h
  w64: Use larger alignment for section with generated code
  w64: Fix data types in cpu-all.h, exec.c
  w64: Fix type casts used in some macros in cpu-all.h
  tcg/i386: Add support for w64 ABI
  tcg/i386: Use GDB JIT debugging interface only for hosts with ELF

12 years agotarget-alpha: QOM'ify CPU init
Andreas Färber [Fri, 6 Apr 2012 23:19:45 +0000 (01:19 +0200)]
target-alpha: QOM'ify CPU init

Move code from cpu_alpha_init() into a CPU initializer.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-alpha: QOM'ify CPU
Andreas Färber [Fri, 6 Apr 2012 17:46:48 +0000 (19:46 +0200)]
target-alpha: QOM'ify CPU

Embed CPUAlphaState as first member of AlphaCPU.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Richard Henderson <rth@twiddle.net>
12 years agow64: Fix time conversion for some versions of MinGW-w64
Stefan Weil [Thu, 12 Apr 2012 20:33:12 +0000 (22:33 +0200)]
w64: Fix time conversion for some versions of MinGW-w64

tb.time is a time value, but not necessarily of the same size as time_t:
while time_t is 64 bit for w64, tb.time still is 32 bit only.

Therefore we need en explicit conversion.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agonbd: Fix compiler warning (w64)
Stefan Weil [Thu, 12 Apr 2012 20:30:16 +0000 (22:30 +0200)]
nbd: Fix compiler warning (w64)

Portable printing of dev_offset (data type off_t) needs a type cast.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agodisas: Replace 'unsigned long' by 'uintptr_t'
Stefan Weil [Thu, 12 Apr 2012 13:44:35 +0000 (15:44 +0200)]
disas: Replace 'unsigned long' by 'uintptr_t'

This is needed for w64. It changes nothing for other hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agocpu-exec: Remove non-portable type cast and fix format string
Stefan Weil [Thu, 12 Apr 2012 13:44:24 +0000 (15:44 +0200)]
cpu-exec: Remove non-portable type cast and fix format string

This change is needed for w64, but also changes the code for other hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotarget-mips: Fix type cast for w64 (uintptr_t)
Stefan Weil [Thu, 12 Apr 2012 13:43:09 +0000 (15:43 +0200)]
target-mips: Fix type cast for w64 (uintptr_t)

This changes nothing for other hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix type cast in os_host_main_loop_wait
Stefan Weil [Thu, 12 Apr 2012 18:42:34 +0000 (20:42 +0200)]
w64: Fix type cast in os_host_main_loop_wait

Casting a pointer to an integer must use (DWORD_PTR) instead of (DWORD).
This also matches the definition of 'fd' (gint for w32, gint64 for w64).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix data types in softmmu*.h
Stefan Weil [Thu, 12 Apr 2012 12:14:51 +0000 (14:14 +0200)]
w64: Fix data types in softmmu*.h

w64 requires uintptr_t.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Use uintptr_t in exec.c
Stefan Weil [Thu, 12 Apr 2012 13:42:19 +0000 (15:42 +0200)]
w64: Use uintptr_t in exec.c

Replace all type casts to 'long' or 'unsigned long' by 'intptr_t' or 'uintptr_t'.

For type casts which are only used to extract the lower bits of an address
or to modify those bits, signedness does not matter. There I always use 'uintptr_t'.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agosoftmmu: Use uintptr_t for physaddr and rename it
Stefan Weil [Sun, 15 Apr 2012 19:02:09 +0000 (21:02 +0200)]
softmmu: Use uintptr_t for physaddr and rename it

Variable physaddr is a host address which should be represented by
data type 'uintptr_t'.

This is needed for w64 and changes nothing for other hosts.

v2:
Rename physaddr -> hostaddr (suggested by Blue Swirl).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix struct CPUTLBEntry
Stefan Weil [Thu, 12 Apr 2012 18:29:36 +0000 (20:29 +0200)]
w64: Fix struct CPUTLBEntry

For w64, some entries need 'uintptr_t' instead of 'unsigned long'.

For other host systems, both data types are identical, so nothing changes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix definition of setjmp
Stefan Weil [Thu, 12 Apr 2012 19:13:28 +0000 (21:13 +0200)]
w64: Fix definition of setjmp

The default definition of setjmp which is implemented in MinGW-w64
cannot be used with programs like QEMU which call longjmp from
code without structured exception handling (SEH).

This code therefore disables stack unwinding.

We could also implement SEH for QEMU's generated JIT code, but
that is much more difficult. Stack unwinding would also cost
execution time.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow32: Move defines for socket specific errors to qemu-os-win32.h
Stefan Weil [Thu, 12 Apr 2012 19:13:15 +0000 (21:13 +0200)]
w32: Move defines for socket specific errors to qemu-os-win32.h

As those defines are only used for w32,
they should be in the header file for w32.

All files which include slirp.h or qemu_socket.h also
include qemu-os-win32.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Use larger alignment for section with generated code
Stefan Weil [Wed, 4 Apr 2012 05:45:21 +0000 (07:45 +0200)]
w64: Use larger alignment for section with generated code

The MinGW-w64 compiler allows __attribute__((aligned (32)).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix data types in cpu-all.h, exec.c
Stefan Weil [Fri, 16 Mar 2012 19:23:49 +0000 (20:23 +0100)]
w64: Fix data types in cpu-all.h, exec.c

w64 needs uintptr_t instead of unsigned long.
For other hosts, nothing changes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix type casts used in some macros in cpu-all.h
Stefan Weil [Sun, 15 Apr 2012 13:18:29 +0000 (15:18 +0200)]
w64: Fix type casts used in some macros in cpu-all.h

Instead of type casts to long, w64 needs type casts to intptr_t.
For other hosts, this changes nothing.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotcg/i386: Add support for w64 ABI
Stefan Weil [Thu, 12 Apr 2012 18:46:32 +0000 (20:46 +0200)]
tcg/i386: Add support for w64 ABI

w64 uses the registers rcx, rdx, r8 and r9 for function arguments,
so it needs a different declaration of tcg_target_call_iarg_regs.

rax, rcx, rdx, r8, r9, r10 and r11 may be changed by function calls.

rbx, rbp, rdi, rsi, r12, r13, r14 and r15 remain unchanged by function calls.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotcg/i386: Use GDB JIT debugging interface only for hosts with ELF
Stefan Weil [Fri, 6 Apr 2012 06:06:41 +0000 (08:06 +0200)]
tcg/i386: Use GDB JIT debugging interface only for hosts with ELF

Not all i386 / x86_64 hosts use ELF.
Ask the compiler whether ELF is used.

On w64, gdb crashes when ELF_HOST_MACHINE is defined.

Cc: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoMerge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
Blue Swirl [Sun, 15 Apr 2012 18:39:55 +0000 (18:39 +0000)]
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf

* 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf:
  pseries: Fix reset of VIO network device
  pseries: Reset vscsi properly
  pseries: Correctly use the device model reset hooks
  pseries: Remove old hcalls hook stub
  pseries: Remove old debug leftovers from spapr_vscsi
  pseries: Fix RTAS based config access
  target-ppc/machine.c: Drop unnecessary ifdefs
  target-ppc: Init dcache and icache size for e500 user mode
  target-ppc: Fix type casts for w64 (uintptr_t)
  target-ppc: QOM'ify CPU reset
  target-ppc: Start QOM'ifying CPU init
  target-ppc: QOM'ify CPU
  target-ppc: Add hooks for handling tcg and kvm limitations
  target-ppc: Drop cpu_ppc_close()
  pseries: Consolidate hack for RTAS display-character usage
  pseries: Remove unused fields from VIOsPAPRBus structure
  pseries: Implement RTAS system-reboot call
  pseries: Fix bug with reset of VIO CRQs
  pseries: Clean up hcall_dprintf() debugging messages
  PPC: Fix TLB invalidation bug within the PPC interrupt handler.

12 years agopseries: Fix reset of VIO network device
David Gibson [Thu, 12 Apr 2012 02:44:15 +0000 (12:44 +1000)]
pseries: Fix reset of VIO network device

Currently, the PAPR VIO network device does not have a reset handler.  This
means that after a hard reset, H_REGISTER_LOGICAL_LAN will return an error
when the new guest boot attempts to initialize the device.

This patch corrects this, adding a suitable reset hook.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Reset vscsi properly
David Gibson [Thu, 12 Apr 2012 02:44:14 +0000 (12:44 +1000)]
pseries: Reset vscsi properly

Currently the PAPR vscsi implementation does not properly clear its table
of request tags when the system is reset.  This patch adds a reset hook
to do so.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Correctly use the device model reset hooks
David Gibson [Thu, 12 Apr 2012 02:44:13 +0000 (12:44 +1000)]
pseries: Correctly use the device model reset hooks

Recently we added code to properly clean away VIO CRQs on reset  However,
this directly uses qemu_register, rather than the existing device model
reset callbacks.  This patch cleans this up by adding proper use of the
reset hook to the VIO bus model.  The existing CRQ reset code is converted
to the new method.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Remove old hcalls hook stub
David Gibson [Thu, 12 Apr 2012 02:44:12 +0000 (12:44 +1000)]
pseries: Remove old hcalls hook stub

Some time ago we removed all use of the 'hcalls' callback in the pseries
VIO code, which was used to workaround an ordering problem which has since
been solved properly.  However, the function pointer for the hook remains.
This patch cleans it away.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Remove old debug leftovers from spapr_vscsi
David Gibson [Thu, 12 Apr 2012 02:44:11 +0000 (12:44 +1000)]
pseries: Remove old debug leftovers from spapr_vscsi

The PAPR VSCSI emulation contains a few lines of code which were once used
for debug but now do nothing at all.  This patch removes them.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Fix RTAS based config access
David Gibson [Mon, 2 Apr 2012 04:17:35 +0000 (14:17 +1000)]
pseries: Fix RTAS based config access

On the pseries platform, access to PCI config space is via RTAS calls(
which go to the hypervisor) rather than MMIO.  This means we don't use
the same code path as nearly everyone else which goes through pci_host.c
and we're missing some of the parameter checking along the way.

We do have some parameter checking in the RTAS calls, but it's not enough.
It checks for overruns, but does not check for unaligned accesses,
oversized accesses (which means the guest could trigger an assertion
failure from pci_host_config_{read,write}_common().  Worse it doesn't do
the basic checking for the number of RTAS arguments and results before
accessing them.

This patch fixes these bugs.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[AF: Fix typos spotted by mst]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-xtensa: add license to core-fsf.c
Max Filippov [Sun, 15 Apr 2012 15:12:18 +0000 (19:12 +0400)]
target-xtensa: add license to core-fsf.c

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add license to core-dc232b.c
Max Filippov [Sun, 15 Apr 2012 15:12:17 +0000 (19:12 +0400)]
target-xtensa: add license to core-dc232b.c

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add dc233c core
Max Filippov [Sun, 15 Apr 2012 15:12:16 +0000 (19:12 +0400)]
target-xtensa: add dc233c core

This is Diamond 233L Standard Core Rev.C (LE), implemented through
linux/gdb overlay.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agolinux-user: Fix exit syscall with QOM CPU
Andreas Färber [Sun, 15 Apr 2012 16:51:01 +0000 (18:51 +0200)]
linux-user: Fix exit syscall with QOM CPU

For QOM'ified CPUs we cannot g_free() CPUArchState, we must
object_delete() the object it is embedded into.

Fixes LP#982321 (invalid free() while executing pacman with qemu-arm).

Reported-by: Serge Schneider <serge@xecdesign.com>
Reported-by: Russell Keith Davis <russell@russelldavis.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Serge Schneider <serge@xecdesign.com>
Tested-by: Russell Keith Davis <russell@russelldavis.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-ppc/machine.c: Drop unnecessary ifdefs
Juan Quintela [Mon, 19 Mar 2012 22:57:36 +0000 (23:57 +0100)]
target-ppc/machine.c: Drop unnecessary ifdefs

machine.c is only compiled for softmmu targets, so checks for
!defined(CONFIG_USER_ONLY) are unnecessary and can be dropped.

Signed-off-by: Juan Quintela <quintela@redhat.com>
[AF: Use more verbose commit message suggested by PMM]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-ppc: Init dcache and icache size for e500 user mode
Meador Inge [Tue, 10 Apr 2012 20:04:23 +0000 (15:04 -0500)]
target-ppc: Init dcache and icache size for e500 user mode

commit f7aa558396dd0f6b7a2b22c05cb503c655854102 pulled the dcache and icache
line size initialization inside of a '#if !defined(CONFIG_USER_ONLY)' block.
This is not correct because instructions like 'dcbz' need the dcache size
initialized even for user mode.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Cc: Varun Sethi <Varun.Sethi@freescale.com>
[AF: Simplify #ifdefs by using cache line size 32 for *-user as before]
Suggested-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-ppc: Fix type casts for w64 (uintptr_t)
Stefan Weil [Sun, 15 Apr 2012 14:13:48 +0000 (16:13 +0200)]
target-ppc: Fix type casts for w64 (uintptr_t)

This changes nothing for other hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-ppc: QOM'ify CPU reset
Andreas Färber [Fri, 6 Apr 2012 13:35:34 +0000 (15:35 +0200)]
target-ppc: QOM'ify CPU reset

Move code from cpu_state_reset() into ppc_cpu_reset().
Reorder #include of helper_regs.h to use it in translate_init.c.

Adjust whitespace and add braces.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
12 years agotarget-ppc: Start QOM'ifying CPU init
Andreas Färber [Fri, 6 Apr 2012 13:09:01 +0000 (15:09 +0200)]
target-ppc: Start QOM'ifying CPU init

Move code not dependent on ppc_def_t from cpu_ppc_init() into an initfn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
12 years agotarget-ppc: QOM'ify CPU
Andreas Färber [Fri, 6 Apr 2012 12:39:03 +0000 (14:39 +0200)]
target-ppc: QOM'ify CPU

Embed CPUPPCState as first member of PowerPCCPU.
Distinguish between "powerpc-cpu", "powerpc64-cpu" and
"embedded-powerpc-cpu".

Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
12 years agotarget-ppc: Add hooks for handling tcg and kvm limitations
David Gibson [Wed, 4 Apr 2012 05:02:05 +0000 (15:02 +1000)]
target-ppc: Add hooks for handling tcg and kvm limitations

On target-ppc, our table of CPU types and features encodes the features as
found on the hardware, regardless of whether these features are actually
usable under TCG or KVM.  We already have cases where the information from
the cpu table must be fixed up to account for limitations in the emulation
method we're using.  e.g. TCG does not support the DFP and VSX instructions
and KVM needs different numbering of the CPUs in order to tell it the
correct thread to core mappings.

This patch cleans up these hacks to handle emulation limitations by
consolidating them into a pair of functions specifically for the purpose.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[AF: Style and typo fixes, rename new functions and drop ppc_def_t arg]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-ppc: Drop cpu_ppc_close()
Andreas Färber [Fri, 6 Apr 2012 12:42:59 +0000 (14:42 +0200)]
target-ppc: Drop cpu_ppc_close()

It is unused, so avoid QOM'ifying it unneededly.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
12 years agopseries: Consolidate hack for RTAS display-character usage
David Gibson [Wed, 4 Apr 2012 05:02:07 +0000 (15:02 +1000)]
pseries: Consolidate hack for RTAS display-character usage

Currently the pseries machine contains not one but two somewhat ugly hacks
to allow printing of early debug messages before the guest has properly
read the device tree.

First, we special case H_PUT_TERM_CHAR so that a vtermno of 0 (usually
invalid) will look for a suitable vty and use that.  This supports Linux's
early debug code which will use H_PUT_TERM_CHAR with vtermno==0 before
reading the device tree.  Second, we support the RTAS display-character call.
This takes no vtermno so we assume the address of the default first VTY.

This patch makes things more consistent by folding the second hack into the
first.  Now, display-character uses the existing vty_lookup() function to
do the same search for a suitable VTY.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Remove unused fields from VIOsPAPRBus structure
David Gibson [Wed, 4 Apr 2012 05:02:06 +0000 (15:02 +1000)]
pseries: Remove unused fields from VIOsPAPRBus structure

The VIOsPAPRBus structure, used on the pseries machine contains some old
fields which are no longer used anywhere.  This patch removes them.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Implement RTAS system-reboot call
David Gibson [Wed, 28 Mar 2012 21:39:47 +0000 (08:39 +1100)]
pseries: Implement RTAS system-reboot call

This patch adds the PAPR defined RTAS system-reboot call to the pseries
machine emulation, providing the guest with a way to trigger a reboot.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Fix bug with reset of VIO CRQs
David Gibson [Wed, 28 Mar 2012 21:39:46 +0000 (08:39 +1100)]
pseries: Fix bug with reset of VIO CRQs

PAPR specifies a Command Response Queue (CRQ) mechanism used for virtual
IO, which we implement.  However, we don't correctly clean up registered
CRQs when we reset the system.

This patch adds a reset handler to fix this bug.  While we're at it, add
in some of the extra debug messages that were used to track the problem
down.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[AF: Updated hcall_dprintf()s to not duplicate the function name]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Clean up hcall_dprintf() debugging messages
David Gibson [Wed, 28 Mar 2012 21:39:45 +0000 (08:39 +1100)]
pseries: Clean up hcall_dprintf() debugging messages

The pseries machine code has a number of debug messages for debugging PAPR
hypercalls, dependent on DEBUG_SPAPR_HCALLS.  This patch cleans these
messages up a bit, by adding __func__ to the hcall_dprintf() macro and
simplifying up a number of the individual messages accordingly.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoPPC: Fix TLB invalidation bug within the PPC interrupt handler.
Mark Cave-Ayland [Tue, 27 Mar 2012 15:41:55 +0000 (16:41 +0100)]
PPC: Fix TLB invalidation bug within the PPC interrupt handler.

Commit 41557447d30eeb944e42069513df13585f5e6c7f also introduced a subtle TLB
flush bug. By applying a mask to the interrupt MSR which cleared the IR/DR
bits at the start of the interrupt handler, the logic towards the end of the
handler to force a TLB flush if either one of these bits were set would never
be triggered.

This patch simply changes the IR/DR bit check in the TLB flush logic to use
the original MSR value (albeit with some interrupt-specific bits cleared) so
that the IR/DR bits are preserved at the point where the check takes place.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopci: fix corrupted pci conf index register by unaligned write
Avi Kivity [Wed, 4 Jan 2012 14:28:42 +0000 (16:28 +0200)]
pci: fix corrupted pci conf index register by unaligned write

Commit d0ed8076cbdc261 converted the PCI config access to the memory
API, but also inadvertantly changed it to accept unaligned writes,
and corrupt the index register in the process.  This causes a regression
booting NetBSD.

Fix by ignoring unaligned or non-dword writes.

https://bugs.launchpad.net/qemu/+bug/897771

Reported-by: Andreas Gustafsson <gson@gson.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoacpi: explicitly account for >1 device per slot
Michael S. Tsirkin [Sun, 15 Apr 2012 09:00:52 +0000 (12:00 +0300)]
acpi: explicitly account for >1 device per slot

Slot present bit is cleared apparently for each device. Hotplug and non
hotplug devices should not mix normally, and we only set the bit when we
add a device so it should all work out, but it's more robust to
explicitly account for more than one device per slot.

Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoacpi_piix4: Re-define PCI hotplug eject register read
Alex Williamson [Thu, 5 Apr 2012 17:07:28 +0000 (11:07 -0600)]
acpi_piix4: Re-define PCI hotplug eject register read

The PCI hotplug eject register has always returned 0, so let's redefine
it as a hotplug feature register.  The existing model of using separate
up & down read-only registers and an eject via write to this register
becomes the base implementation.  As we make use of new interfaces we'll
set bits here to allow the BIOS and AML implementation to optimize for
the platform implementation.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoacpi_piix4: Remove PCI_RMV_BASE write code
Alex Williamson [Thu, 5 Apr 2012 17:07:21 +0000 (11:07 -0600)]
acpi_piix4: Remove PCI_RMV_BASE write code

Clarify this register as read-only and remove write code.  No
change in existing behavior.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoacpi_piix4: Fix PCI hotplug race
Alex Williamson [Thu, 5 Apr 2012 17:07:15 +0000 (11:07 -0600)]
acpi_piix4: Fix PCI hotplug race

As Michael Tsirkin demonstrated, current PCI hotplug is vulnerable
to a few races.  The first is a race with other hotplug operations
because we clear the up & down registers at each event.  If a new
event comes before the last is processed, up/down is cleared and
the event is lost.

To fix this for the down register, we create a life cycle for
the event request that starts with the hot unplug request in
piix4_device_hotplug() and ends when the device is ejected.
This allows us to mask and clear individual bits, preserving them
against races.  For the up register, we have no clear end point
for when the event is finished.  We could modify the BIOS to
acknowledge the bit and clear it, but this creates BIOS compatibiliy
issues without offering a complete solution.  Instead we note that
gratuitous ACPI device checks are not harmful, which allows us to
issue a device check for every slot.  We know which slots are present
and we know which slots are hotpluggable, so we can easily reduce
this to a more manageable set for the guest.

The other race Michael noted was that an unplug request followed
by reset may also lose the eject notification, which may also
result in the eject request being lost which a subsequent add
or remove.  Once we're in reset, the device is unused and we can
flush the queue of device removals ourselves.  Previously if a
device_del was issued to a guest without ACPI PCI hotplug support,
it was necessary to shutdown the guest to recover the device.
With this, a guest reboot is sufficient.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoacpi_piix4: Disallow write to up/down PCI hotplug registers
Alex Williamson [Thu, 5 Apr 2012 17:07:08 +0000 (11:07 -0600)]
acpi_piix4: Disallow write to up/down PCI hotplug registers

The write side of these registers is never used and actually can't be
used as defined because any read/modify/write sequence from the guest
potentially races with qemu.  Drop the write support and define these
as read-only registers.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agopcspk: initialize PC speaker if compiled in
Hervé Poussineau [Sat, 14 Apr 2012 20:51:33 +0000 (22:51 +0200)]
pcspk: initialize PC speaker if compiled in

PC speaker has been moved to target-independant code in 71093711589dafcb920dc3bc9bb811eaf8b14101,
so do not depend of target to include it or not.

Cc: malc <av1474@comtv.ru>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Herv? Poussineau <hpoussin@reactos.org>
Signed-off-by: malc <av1474@comtv.ru>
12 years agotests: remove .SECONDARY special target
Paolo Bonzini [Sat, 31 Mar 2012 10:50:21 +0000 (12:50 +0200)]
tests: remove .SECONDARY special target

The special target should not be needed anymore, and caused (perhaps
due to a Make bug) a failure with "make -j2".  In any case, the
main makefile is a better place for such special targets rather
than an included makefile.

Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add test for IBREAK invalidation
Max Filippov [Mon, 9 Apr 2012 22:48:20 +0000 (02:48 +0400)]
target-xtensa: add test for IBREAK invalidation

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add tests for LBEG/LEND invalidation
Max Filippov [Mon, 9 Apr 2012 22:48:19 +0000 (02:48 +0400)]
target-xtensa: add tests for LBEG/LEND invalidation

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: fix tb invalidation for IBREAK and LOOP
Max Filippov [Mon, 9 Apr 2012 22:48:18 +0000 (02:48 +0400)]
target-xtensa: fix tb invalidation for IBREAK and LOOP

Instruction breakpoint/zero overhead loop handling code is built into
TBs pointed to by IBREAKA/LEND SRs. When these or related SRs get
changed TBs at virtual addresses corresponding to their old and their
new values must be invalidated.

Virtual address range is passed to the tb_invalidate_phys_page_range,
which is incorrect in system emulation mode.

To fix it use guest TLB/MMU to translate virtual address to physical
address.

However the guest may not have virtual-to-physical mapping at the moment
of IBREAKA/LEND change, thus this fix is not 100% accurate.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec: provide tb_invalidate_phys_addr function
Max Filippov [Mon, 9 Apr 2012 22:48:17 +0000 (02:48 +0400)]
exec: provide tb_invalidate_phys_addr function

Allow TB invalidation by its physical address, extract implementation
from the breakpoint_invalidate function.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoUse uintptr_t for various op related functions
Blue Swirl [Mon, 9 Apr 2012 14:20:20 +0000 (14:20 +0000)]
Use uintptr_t for various op related functions

Use uintptr_t instead of void * or unsigned long in
several op related functions, env->mem_io_pc and
GETPC() macro.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agocoroutine-gthread.c: Avoid threading APIs deprecated in GLib 2.31
Peter Maydell [Sat, 3 Mar 2012 04:52:56 +0000 (04:52 +0000)]
coroutine-gthread.c: Avoid threading APIs deprecated in GLib 2.31

The GLib threading APIs were revamped in GLib 2.31 and a number
of the old interfaces were deprecated, which means they provoke
compilation warnings (errors if -Werror) now. Add support for the
new interfaces while retaining the old ones so we can still compile
on older versions of GLib too.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa
Blue Swirl [Sat, 14 Apr 2012 10:56:04 +0000 (10:56 +0000)]
Merge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa

* 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa:
  target-xtensa: Start QOM'ifying CPU init
  target-xtensa: QOM'ify CPU reset
  target-xtensa: QOM'ify CPU
  target-xtensa: improve unit tests debugging
  target-xtensa: Move helpers.h to helper.h

12 years agoMerge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 14 Apr 2012 10:55:00 +0000 (10:55 +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/arm_gic: Remove stray hardcoded tab
  hw/arm_gic: gic_set_pending_private() is NVIC only
  hw/arm_gic: Use NVIC instead of LEGACY_INCLUDED_GIC define
  hw/arm_gic: Make gic_reset a sysbus reset function
  hw/arm11mpcore: Convert to using sysbus GIC device
  hw/exynos4210_gic: Convert to using sysbus GIC
  hw/realview_gic: switch to sysbus GIC
  hw/a9mpcore: Switch to using sysbus GIC
  hw/a15mpcore: switch to using sysbus GIC
  hw/arm_gic: Make the GIC its own sysbus device
  hw/arm_gic: Expose PPI inputs as gpio inputs
  hw/arm_gic: Move gic_get_current_cpu into arm_gic.c
  hw/arm_gic: Move NCPU definition to arm_gic.c
  hw/exynos4210_combiner.c: Drop excessive read/write access check.
  ARM: Exynos4210: Drop gic_cpu_write() after initialization.
  Fix bit test in Exynos4210 UART emulation to use & instead of &&

12 years agotarget-xtensa: Start QOM'ifying CPU init
Andreas Färber [Wed, 11 Apr 2012 16:24:50 +0000 (18:24 +0200)]
target-xtensa: Start QOM'ifying CPU init

Move XtensaConfig-independent code from cpu_xtensa_init() into a
QOM initfn, as a start.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: QOM'ify CPU reset
Andreas Färber [Wed, 11 Apr 2012 16:24:49 +0000 (18:24 +0200)]
target-xtensa: QOM'ify CPU reset

Move code from cpu_state_reset() into QOM xtensa_cpu_reset().
To avoid moving reset_mmu() and dependencies, make it non-static.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: QOM'ify CPU
Andreas Färber [Wed, 11 Apr 2012 16:24:48 +0000 (18:24 +0200)]
target-xtensa: QOM'ify CPU

Embed CPUXtensaState as first member of XtensaCPU.
Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: improve unit tests debugging
Max Filippov [Thu, 15 Mar 2012 21:24:57 +0000 (01:24 +0400)]
target-xtensa: improve unit tests debugging

- add testcase announcement;
- add global symbols for individual tests;
- add host-debug-* makefile target.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: Move helpers.h to helper.h
Lluís Vilanova [Mon, 13 Feb 2012 15:33:58 +0000 (16:33 +0100)]
target-xtensa: Move helpers.h to helper.h

Provides a file naming scheme consistent with other targets.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agoxen: introduce an event channel for buffered io event notifications
Stefano Stabellini [Fri, 13 Apr 2012 17:46:01 +0000 (17:46 +0000)]
xen: introduce an event channel for buffered io event notifications

Use the newly introduced HVM_PARAM_BUFIOREQ_EVTCHN to receive
notifications for buffered io events.
After the first notification is received leave the event channel masked
and setup a timer to process the rest of the batch.
Once we have completed processing the batch, unmask the event channel
and delete the timer.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoxen-mapcache: don't unmap locked entry during mapcache invalidation
Julien Grall [Fri, 13 Apr 2012 17:33:02 +0000 (17:33 +0000)]
xen-mapcache: don't unmap locked entry during mapcache invalidation

When an IOREQ_TYPE_INVALIDATE is sent to QEMU, it invalidates all entry
of the map cache even if it's locked.

QEMU is not able to know that entry was invalidated, so when an IO
access is requested a segfault occured.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoXen, mapcache: Fix the compute of the size of bucket.
Anthony PERARD [Fri, 13 Apr 2012 17:18:56 +0000 (17:18 +0000)]
Xen, mapcache: Fix the compute of the size of bucket.

Because the size of a mapping is wrong when there is an offset and a
size >= bucket_size.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoxen: handle backend deletion from xenstore
Stefano Stabellini [Fri, 30 Mar 2012 14:33:03 +0000 (14:33 +0000)]
xen: handle backend deletion from xenstore

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoXen: Add xen-apic support and hook it up.
Wei Liu [Thu, 12 Apr 2012 10:02:47 +0000 (10:02 +0000)]
Xen: Add xen-apic support and hook it up.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoXen: basic HVM MSI injection support.
Wei Liu [Thu, 12 Apr 2012 10:01:43 +0000 (10:01 +0000)]
Xen: basic HVM MSI injection support.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 13 Apr 2012 13:04:43 +0000 (08:04 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  configure: Insist on a Python 2, not Python 3
  bsd-user: fix compile failure
  ps2: avoid repeated header file includes
  make: Always set LC_ALL=C for makeinfo
  configure: Fix wrong preprocessor statement
  configure: Remove useless uses of ARCH_CFLAGS

12 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Fri, 13 Apr 2012 13:04:31 +0000 (08:04 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  kvmclock: guest stop notification
  kvm: update linux headers
  kvm: set gsi_bits and max_gsi correctly
  kvm: Drop unused kvm_pit_in_kernel
  kvm: allow arbitrarily sized mmio ioeventfd
  kvm: Drop redundant kvm_enabled from cpu_thread_is_idle
  kvm: add flightrecorder script

12 years agoMerge remote-tracking branch 'afaerber/qom-cpu-lm32.v3' into staging
Anthony Liguori [Fri, 13 Apr 2012 13:04:13 +0000 (08:04 -0500)]
Merge remote-tracking branch 'afaerber/qom-cpu-lm32.v3' into staging

* afaerber/qom-cpu-lm32.v3:
  target-lm32: QOM'ify CPU reset
  target-lm32: QOM'ify CPU init
  target-lm32: QOM'ify CPU

12 years agohw/arm_gic: Remove stray hardcoded tab
Peter Maydell [Fri, 13 Apr 2012 11:39:09 +0000 (11:39 +0000)]
hw/arm_gic: Remove stray hardcoded tab

Remove the single instance of a hardcoded tab from hw/arm_gic.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: gic_set_pending_private() is NVIC only
Peter Maydell [Fri, 13 Apr 2012 11:39:09 +0000 (11:39 +0000)]
hw/arm_gic: gic_set_pending_private() is NVIC only

The function gic_set_pending_private() is now used by the NVIC
only (for the GIC we now set PPI interrupts via gpio lines and
gic_set_irq()). So make it #ifdef NVIC and remove the 'attribute
unused' annotation.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Use NVIC instead of LEGACY_INCLUDED_GIC define
Peter Maydell [Fri, 13 Apr 2012 11:39:09 +0000 (11:39 +0000)]
hw/arm_gic: Use NVIC instead of LEGACY_INCLUDED_GIC define

Now all the A profile cores have been switched to use the standalone
sysbus GIC, the only remaining code which #includes arm_gic.c is
the v7M NVIC. The coupling is much closer here so it's not so
easily disentangled. For now, add a comment about how arm_gic.c
is compiled, and assume that the NVIC always includes arm_gic.c
and the non-NVIC GIC is always compiled standalone.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Make gic_reset a sysbus reset function
Peter Maydell [Fri, 13 Apr 2012 11:39:09 +0000 (11:39 +0000)]
hw/arm_gic: Make gic_reset a sysbus reset function

Make gic_reset a sysbus reset function, so we actually
reset the GIC on system reset rather than only at init.
For the NVIC this requires us also to implement reset
of the SysTick.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm11mpcore: Convert to using sysbus GIC device
Peter Maydell [Fri, 13 Apr 2012 11:39:08 +0000 (11:39 +0000)]
hw/arm11mpcore: Convert to using sysbus GIC device

Convert arm11mpcore to using the standalone sysbus GIC device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/exynos4210_gic: Convert to using sysbus GIC
Peter Maydell [Fri, 13 Apr 2012 11:39:08 +0000 (11:39 +0000)]
hw/exynos4210_gic: Convert to using sysbus GIC

Convert the Exynos GIC code to use the standalone sysbus
GIC device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Evgeny Voevodin <e.voevodin@samsung.com>
12 years agohw/realview_gic: switch to sysbus GIC
Peter Maydell [Fri, 13 Apr 2012 11:39:08 +0000 (11:39 +0000)]
hw/realview_gic: switch to sysbus GIC

Switch the realview_gic device to the standalone sysbus GIC.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/a9mpcore: Switch to using sysbus GIC
Peter Maydell [Fri, 13 Apr 2012 11:39:08 +0000 (11:39 +0000)]
hw/a9mpcore: Switch to using sysbus GIC

Switch the a9mpcore to using the sysbus GIC device rather
than having the a9mp private memory region device subclass
the GIC.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/a15mpcore: switch to using sysbus GIC
Peter Maydell [Fri, 13 Apr 2012 11:39:07 +0000 (11:39 +0000)]
hw/a15mpcore: switch to using sysbus GIC

Switch the a15mpcore private peripheral region to using
the standalone sysbus GIC device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Make the GIC its own sysbus device
Peter Maydell [Fri, 13 Apr 2012 11:39:07 +0000 (11:39 +0000)]
hw/arm_gic: Make the GIC its own sysbus device

Compile arm_gic.c as a standalone C file to produce a self contained
sysbus GIC device. Support the legacy usage by #include of the .c file
by making those users #define LEGACY_INCLUDED_GIC, so we can convert
them one by one.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Evgeny Voevodin <e.voevodin@samsung.com>
12 years agohw/arm_gic: Expose PPI inputs as gpio inputs
Peter Maydell [Fri, 13 Apr 2012 11:39:07 +0000 (11:39 +0000)]
hw/arm_gic: Expose PPI inputs as gpio inputs

Expose the Private Peripheral Interrupt inputs as GPIO inputs.
The layout of the GPIO array is thus:
  [0..N-1] SPIs
  [N..N+31] PPIs for CPU 0
  [N+32..N+63] PPIs for CPU 1
  ...

Treating PPIs as being another kind of input line is in line with the
GIC architecture specification, where they are clearly described that
way. The 11MPCore TRM is a bit more ambiguous, but there is no practical
difference between "set PPI X as pending" and "0->1 transition on a
PPI input line configured as edge triggered", and PPIs are always
edge triggered, so this change won't affect behaviour.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Move gic_get_current_cpu into arm_gic.c
Peter Maydell [Fri, 13 Apr 2012 11:39:07 +0000 (11:39 +0000)]
hw/arm_gic: Move gic_get_current_cpu into arm_gic.c

Move the gic_get_current_cpu() function into arm_gic.c.
There are only two implementations: (1) "get the index
of the currently executing CPU", used by all multicore
GICs, and (2) "always 0", used by all GICs instantiated
with a single CPU interface (the Realview board GIC and
the v7M NVIC). So we can move this into the main GIC
source file.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Evgeny Voevodin <e.voevodin@samsung.com>
12 years agohw/arm_gic: Move NCPU definition to arm_gic.c
Peter Maydell [Fri, 13 Apr 2012 11:39:07 +0000 (11:39 +0000)]
hw/arm_gic: Move NCPU definition to arm_gic.c

Move the NCPU definition to arm_gic.c: the maximum number
of CPU interfaces is defined by the GIC architecture specification
to be 8, so we don't need to have this #define in each of the
sources files which currently includes arm_gic.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Evgeny Voevodin <e.voevodin@samsung.com>
12 years agohw/exynos4210_combiner.c: Drop excessive read/write access check.
Evgeny Voevodin [Fri, 13 Apr 2012 11:39:06 +0000 (11:39 +0000)]
hw/exynos4210_combiner.c: Drop excessive read/write access check.

Access to reserved area at offset higher than 0x3c is allowed in
External Combiner. Samsung Galaxy Kernel implements this. So, drop
excessive checks in read/write functions.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoARM: Exynos4210: Drop gic_cpu_write() after initialization.
Evgeny Voevodin [Fri, 13 Apr 2012 11:39:06 +0000 (11:39 +0000)]
ARM: Exynos4210: Drop gic_cpu_write() after initialization.

Remove gic_cpu_write() call after initialization that was emulating
functionality of earliest SOC bootloader which enables external
GIC CPU1 interface. Instead introduce Exynos4210-specific secondary
CPU bootloader, which enables both Internal and External GIC CPU1
interfaces.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>