]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Wed, 15 Aug 2012 16:15:02 +0000 (11:15 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  update-linux-headers.sh: Pull in asm-generic/kvm_para.h
  kvmvapic: Disable if there is insufficient memory
  kvm: i8254: Finish time conversion fix
  kvm: i8254: Cache kernel clock offset in KVMPITState

11 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Wed, 15 Aug 2012 16:14:06 +0000 (11:14 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

* stefanha/tracing:
  trace/simple: Replace asprintf by g_strdup_printf
  trace/simple: Fix compiler warning for 32 bit hosts
  trace: avoid pointer aliasing in trace_record_finish()
  trace: drop unused TraceBufferRecord->next_tbuf_idx field
  trace: remove unnecessary write_to_buffer() typecasting
  trace: rename TraceRecordHeader to TraceLogHeader

11 years agoupdate-linux-headers.sh: Pull in asm-generic/kvm_para.h
Peter Maydell [Wed, 25 Jul 2012 15:29:07 +0000 (16:29 +0100)]
update-linux-headers.sh: Pull in asm-generic/kvm_para.h

Add asm-generic/kvm_para.h to the set of non-architecture specific
KVM kernel headers we copy into QEMU. This header may be included
by an architecture's kvm_para.h header.

Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agokvmvapic: Disable if there is insufficient memory
Jan Kiszka [Tue, 14 Aug 2012 11:43:12 +0000 (13:43 +0200)]
kvmvapic: Disable if there is insufficient memory

We need at least 1M of RAM to map the option ROM. Otherwise, we will
corrupt host memory or even crash:

    $ qemu-system-x86_64 -nodefaults --enable-kvm -vnc :0 -m 640k
    Segmentation fault (core dumped)

Reported-and-tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agokvm: i8254: Finish time conversion fix
Jan Kiszka [Tue, 14 Aug 2012 08:24:47 +0000 (10:24 +0200)]
kvm: i8254: Finish time conversion fix

0cdd3d1444 fixed reading back the counter load time from the kernel
while assuming the kernel would always update its load time on writing
the state. That is only true for channel 1, and so pit_get_channel_info
returned wrong output pin states for high counter values.

Fix this by applying the offset also on kvm_pit_put. Now we also need to
update the offset when we write the state while the VM is stopped as it
keeps on changing in that state.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agokvm: i8254: Cache kernel clock offset in KVMPITState
Jan Kiszka [Tue, 14 Aug 2012 08:24:03 +0000 (10:24 +0200)]
kvm: i8254: Cache kernel clock offset in KVMPITState

To prepare the final fix for clock calibration issues with the in-kernel
PIT, we want to cache the offset between vmclock and the clock used by
the in-kernel PIT. So far, we only need to update it when the VM state
changes between running and stopped because we only read the in-kernel
PIT state while the VM is running.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoMerge remote-tracking branch 'origin/master' into staging
Anthony Liguori [Tue, 14 Aug 2012 20:19:50 +0000 (15:19 -0500)]
Merge remote-tracking branch 'origin/master' into staging

* origin/master:
  linux-user: ARM: Ignore immediate value for svc in thumb mode
  linux-user: Use init_guest_space when -R and -B are specified
  linux-user: Factor out guest space probing into a function
  flatload: fix bss clearing
  linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type
  linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option
  linux-user: pass sockaddr from host to target
  x86: switch to AREG0 free mode
  x86: avoid AREG0 in segmentation helpers
  x86: avoid AREG0 for misc helpers
  x86: use wrappers for memory access helpers
  x86: avoid AREG0 for SMM helpers
  x86: avoid AREG0 for SVM helpers
  x86: avoid AREG0 for integer helpers
  x86: avoid AREG0 for condition code helpers
  x86: avoid AREG0 for FPU helpers
  linux-user: Move target_to_host_errno_table[] setup out of ioctl loop
  linux-user: Fix SNDCTL_DSP_MAP{IN, OUT}BUF ioctl definitions
  linux-user: Fix incorrect TARGET_BLKBSZGET, TARGET_BLKBSZSET

11 years agoMerge branch 'linux-user.next' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Tue, 14 Aug 2012 19:50:22 +0000 (19:50 +0000)]
Merge branch 'linux-user.next' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'linux-user.next' of git://git.linaro.org/people/pmaydell/qemu-arm:
  linux-user: ARM: Ignore immediate value for svc in thumb mode
  linux-user: Use init_guest_space when -R and -B are specified
  linux-user: Factor out guest space probing into a function
  flatload: fix bss clearing
  linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type
  linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option
  linux-user: pass sockaddr from host to target
  linux-user: Move target_to_host_errno_table[] setup out of ioctl loop
  linux-user: Fix SNDCTL_DSP_MAP{IN, OUT}BUF ioctl definitions
  linux-user: Fix incorrect TARGET_BLKBSZGET, TARGET_BLKBSZSET

11 years agolinux-user: ARM: Ignore immediate value for svc in thumb mode
Alexander Graf [Tue, 29 May 2012 05:30:26 +0000 (05:30 +0000)]
linux-user: ARM: Ignore immediate value for svc in thumb mode

When running in thumb mode, Linux doesn't evaluate the immediate value
of the svc instruction, but instead just always assumes the syscall number
to be in r7.

This fixes executing go_bootstrap while building go for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agolinux-user: Use init_guest_space when -R and -B are specified
Meador Inge [Thu, 26 Jul 2012 16:50:02 +0000 (16:50 +0000)]
linux-user: Use init_guest_space when -R and -B are specified

Roll the code used to initialize the guest memory space when -R
or -B is used into 'init_guest_space' and then call 'init_guest_space'
from the driver.  This way the reserved guest memory space can
be probed for.  Calling 'mmap' just once as is currently done is not
guaranteed to succeed since the host address space validation might fail.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
[PMM: Fixed minor whitespace errors.]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agolinux-user: Factor out guest space probing into a function
Meador Inge [Thu, 26 Jul 2012 16:50:01 +0000 (16:50 +0000)]
linux-user: Factor out guest space probing into a function

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoflatload: fix bss clearing
Mike Frysinger [Mon, 9 Jul 2012 03:04:57 +0000 (03:04 +0000)]
flatload: fix bss clearing

The current bss clear logic assumes the target mmap address and host
address are the same.  Use g2h to translate from the target address
space to the host so we can call memset on it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agolinux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type
Jing Huang [Tue, 24 Jul 2012 14:01:42 +0000 (14:01 +0000)]
linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type

Signed-off-by: Jing Huang <jing.huang.pku@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agolinux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option
Jing Huang [Tue, 24 Jul 2012 13:59:23 +0000 (13:59 +0000)]
linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option

Signed-off-by: Jing Huang <jing.huang.pku@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agolinux-user: pass sockaddr from host to target
Jing Huang [Tue, 24 Jul 2012 13:58:02 +0000 (13:58 +0000)]
linux-user: pass sockaddr from host to target

Signed-off-by: Jing Huang <jing.huang.pku@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agox86: switch to AREG0 free mode
Blue Swirl [Sun, 29 Apr 2012 20:35:48 +0000 (20:35 +0000)]
x86: switch to AREG0 free mode

Add an explicit CPUX86State parameter instead of relying on AREG0.

Remove temporary wrappers and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: avoid AREG0 in segmentation helpers
Blue Swirl [Sun, 29 Apr 2012 19:47:06 +0000 (19:47 +0000)]
x86: avoid AREG0 in segmentation helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Rename remains of op_helper.c to seg_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: avoid AREG0 for misc helpers
Blue Swirl [Sun, 29 Apr 2012 18:42:47 +0000 (18:42 +0000)]
x86: avoid AREG0 for misc helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: use wrappers for memory access helpers
Blue Swirl [Sun, 29 Apr 2012 19:11:01 +0000 (19:11 +0000)]
x86: use wrappers for memory access helpers

Switch to wrapped versions of memory access functions.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: avoid AREG0 for SMM helpers
Blue Swirl [Sun, 29 Apr 2012 17:54:21 +0000 (17:54 +0000)]
x86: avoid AREG0 for SMM helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: avoid AREG0 for SVM helpers
Blue Swirl [Sun, 29 Apr 2012 15:51:49 +0000 (15:51 +0000)]
x86: avoid AREG0 for SVM helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: avoid AREG0 for integer helpers
Blue Swirl [Sun, 29 Apr 2012 14:11:56 +0000 (14:11 +0000)]
x86: avoid AREG0 for integer helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

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

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agox86: avoid AREG0 for FPU helpers
Blue Swirl [Sat, 28 Apr 2012 21:28:09 +0000 (21:28 +0000)]
x86: avoid AREG0 for FPU helpers

Make FPU helpers take a parameter for CPUState instead
of relying on global env.

Introduce temporary wrappers for FPU load and store ops. Remove
wrappers for non-AREG0 code. Don't call unconverted helpers
directly.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge remote-tracking branch 'kraxel/seabios-5a02306' into staging
Anthony Liguori [Tue, 14 Aug 2012 18:46:35 +0000 (13:46 -0500)]
Merge remote-tracking branch 'kraxel/seabios-5a02306' into staging

* kraxel/seabios-5a02306:
  update seabios to latest master

11 years agoMAINTAINERS: Update email address for Stefan Hajnoczi
Stefan Hajnoczi [Tue, 14 Aug 2012 09:10:09 +0000 (10:10 +0100)]
MAINTAINERS: Update email address for Stefan Hajnoczi

Switch to my personal email address.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotrace/simple: Replace asprintf by g_strdup_printf
Stefan Weil [Mon, 13 Aug 2012 19:51:16 +0000 (21:51 +0200)]
trace/simple: Replace asprintf by g_strdup_printf

asprintf is not available for all hosts. g_strdup_printf is
more portable and simplifies the code because if does not
need error handling.

The static variable does not need an explicit assignment to be NULL.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agotrace/simple: Fix compiler warning for 32 bit hosts
Stefan Weil [Mon, 13 Aug 2012 19:50:56 +0000 (21:50 +0200)]
trace/simple: Fix compiler warning for 32 bit hosts

gcc complains when a 32 bit pointer is casted to a 64 bit integer.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agotrace: avoid pointer aliasing in trace_record_finish()
Harsh Prateek Bora [Fri, 20 Jul 2012 13:22:15 +0000 (18:52 +0530)]
trace: avoid pointer aliasing in trace_record_finish()

Declaring a TraceRecord on the stack works fine.  No need for a
uint8_t array and pointer aliasing.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agotrace: drop unused TraceBufferRecord->next_tbuf_idx field
Harsh Prateek Bora [Fri, 20 Jul 2012 13:22:14 +0000 (18:52 +0530)]
trace: drop unused TraceBufferRecord->next_tbuf_idx field

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agotrace: remove unnecessary write_to_buffer() typecasting
Harsh Prateek Bora [Fri, 20 Jul 2012 13:22:13 +0000 (18:52 +0530)]
trace: remove unnecessary write_to_buffer() typecasting

The buffer argument is void* so it is not necessary to cast.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agotrace: rename TraceRecordHeader to TraceLogHeader
Harsh Prateek Bora [Fri, 20 Jul 2012 13:22:12 +0000 (18:52 +0530)]
trace: rename TraceRecordHeader to TraceLogHeader

The TraceRecordHeader is really the header for the entire trace log
file.  It's not per-record header so make this obvious by renaming it.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Mon, 13 Aug 2012 21:12:35 +0000 (16:12 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp: (48 commits)
  target-ppc: add implementation of query-cpu-definitions (v2)
  target-i386: add implementation of query-cpu-definitions (v2)
  qapi: add query-cpu-definitions command (v2)
  compiler: add macro for GCC weak symbols
  qapi: add query-machines command
  qapi: mark QOM commands stable
  qmp: introduce device-list-properties command
  qmp: add SUSPEND_DISK event
  qmp: qmp-events.txt: add missing doc for the SUSPEND event
  qmp: qmp-events.txt: put events in alphabetical order
  qmp: emit the WAKEUP event when the guest is put to run
  qmp: don't emit the RESET event on wakeup from S3
  scripts: qapi-commands.py: qmp-commands.h: include qdict.h
  docs: writing-qmp-commands.txt: update error section
  error, qerror: drop QDict member
  qerror: drop qerror_table and qerror_format()
  error, qerror: pass desc string to error calls
  error: drop error_get_qobject()/error_set_qobject()
  qemu-ga: switch to the new error format on the wire
  qmp: switch to the new error format on the wire
  ...

11 years agoMerge remote-tracking branch 'quintela/migration-next-20120808' into staging
Anthony Liguori [Mon, 13 Aug 2012 21:02:11 +0000 (16:02 -0500)]
Merge remote-tracking branch 'quintela/migration-next-20120808' into staging

* quintela/migration-next-20120808:
  Restart optimization on stage3 update version
  Add XBZRLE statistics
  Add migration accounting for normal and duplicate pages
  Change total_time to total-time in MigrationStats
  Add migrate_set_cache_size command
  Add XBZRLE to ram_save_block and ram_save_live
  Add xbzrle_encode_buffer and xbzrle_decode_buffer functions
  Add uleb encoding/decoding functions
  Add cache handling functions
  Add XBZRLE documentation
  Add migrate-set-capabilities
  Add migration capabilities

11 years agoMerge remote-tracking branch 'pmaydell/arm-devs.next' into staging
Anthony Liguori [Mon, 13 Aug 2012 20:59:11 +0000 (15:59 -0500)]
Merge remote-tracking branch 'pmaydell/arm-devs.next' into staging

* pmaydell/arm-devs.next:
  arm: Move some ARM devices into libhw
  ssd0323: abort() instead of exit(1) on error.
  hw/sd.c: make sd_wp_addr() return bool
  hw/sd.c: make sd_dataready() return bool
  hw/sd.c: convert binary variables to bool
  hw/sd.c: introduce wrapper for conversion address to wp group
  hw/sd.c: make sd_wp_addr() accept 64 bit address argument
  hw/sd.c: convert wp_groups in SDState to bitfield
  armv7m: Guard against no -kernel argument
  hw/armv7m_nvic: Fix incorrect default for num-irqs property

11 years agotarget-ppc: add implementation of query-cpu-definitions (v2)
Anthony Liguori [Fri, 10 Aug 2012 16:04:15 +0000 (11:04 -0500)]
target-ppc: add implementation of query-cpu-definitions (v2)

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agotarget-i386: add implementation of query-cpu-definitions (v2)
Anthony Liguori [Fri, 10 Aug 2012 16:04:14 +0000 (11:04 -0500)]
target-i386: add implementation of query-cpu-definitions (v2)

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqapi: add query-cpu-definitions command (v2)
Anthony Liguori [Fri, 10 Aug 2012 16:04:13 +0000 (11:04 -0500)]
qapi: add query-cpu-definitions command (v2)

This command attempts to map to the behavior of -cpu ?.  Unfortunately, the
output of this command differs wildly across targets.

To accommodate this, we use a weak symbol to implement a default version of the
command that fails with a QERR_NOT_SUPPORTED error code.  Targets can then
override and implement this command if it makes sense for them.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agocompiler: add macro for GCC weak symbols
Anthony Liguori [Fri, 10 Aug 2012 16:04:12 +0000 (11:04 -0500)]
compiler: add macro for GCC weak symbols

This lets us provide a default implementation of a symbol which targets can
override.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqapi: add query-machines command
Anthony Liguori [Fri, 10 Aug 2012 16:04:11 +0000 (11:04 -0500)]
qapi: add query-machines command

This provides the same output as -M ? but in a structured way.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqapi: mark QOM commands stable
Anthony Liguori [Fri, 10 Aug 2012 16:04:10 +0000 (11:04 -0500)]
qapi: mark QOM commands stable

We've had a cycle to tweak.  It is time to commit to supporting them.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqmp: introduce device-list-properties command
Anthony Liguori [Fri, 10 Aug 2012 16:04:09 +0000 (11:04 -0500)]
qmp: introduce device-list-properties command

This can be used in conjunction with qom-list-types to determine the supported
set of devices and their parameters.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqmp: add SUSPEND_DISK event
Luiz Capitulino [Wed, 8 Aug 2012 20:03:01 +0000 (17:03 -0300)]
qmp: add SUSPEND_DISK event

Emitted when the guest makes a request to enter S4 state.

There are three possible ways of having this event, as described here:

 http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg02307.html

I've decided to add a new event and make it indepedent of SHUTDOWN.
This means that the SHUTDOWN event will eventually follow the
SUSPEND_DISK event.

I've choosen this way because of two reasons:

 1. Having an indepedent event makes it possible to query for its
    existence by using query-events

 2. In the future, we may allow the user to change what QEMU should
    do as a result of the guest entering S4. So it's a good idea to
    keep both events separated

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqmp: qmp-events.txt: add missing doc for the SUSPEND event
Luiz Capitulino [Thu, 9 Aug 2012 15:02:21 +0000 (12:02 -0300)]
qmp: qmp-events.txt: add missing doc for the SUSPEND event

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqmp: qmp-events.txt: put events in alphabetical order
Luiz Capitulino [Thu, 9 Aug 2012 14:40:27 +0000 (11:40 -0300)]
qmp: qmp-events.txt: put events in alphabetical order

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqmp: emit the WAKEUP event when the guest is put to run
Luiz Capitulino [Thu, 9 Aug 2012 14:27:30 +0000 (11:27 -0300)]
qmp: emit the WAKEUP event when the guest is put to run

Today, the WAKEUP event is emitted when a wakeup _request_ is made.
This could be the system_wakeup command, for example.

A better semantic would be to emit the event when the guest is
already running, as that's what matters in the end. This commit does
that change.

In theory, this could break compatibility. In practice, it shouldn't
happen though, as clients shouldn't rely on timing characteristics of
the events. That is, a client relying that the guest is not running
when the event arrives may break if the event arrives after the guest
is already running.

This commit also adds the missing documentation for the WAKEUP event.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqmp: don't emit the RESET event on wakeup from S3
Luiz Capitulino [Wed, 8 Aug 2012 20:29:17 +0000 (17:29 -0300)]
qmp: don't emit the RESET event on wakeup from S3

QEMU is basically using reset logic when waking up from S3. This
causes the QMP RESET event to be emitted, which is wrong. Also,
the runstate checks done in reset are not necessary for S3 wakeup.

Fix this by untangling wakeup from reset logic and passing
VMRESET_SILENT to qemu_system_reset() to avoid emitting the RESET
event.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoscripts: qapi-commands.py: qmp-commands.h: include qdict.h
Luiz Capitulino [Mon, 6 Aug 2012 14:35:22 +0000 (11:35 -0300)]
scripts: qapi-commands.py: qmp-commands.h: include qdict.h

qmp-commands.h declares several functions that have arguments of
type QDict. However, qdict.h is not included. This will cause a
build breakage when a file includes qmp-commands.h but doesn't
include qdict.h.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agodocs: writing-qmp-commands.txt: update error section
Luiz Capitulino [Mon, 6 Aug 2012 14:35:22 +0000 (11:35 -0300)]
docs: writing-qmp-commands.txt: update error section

Add information about the new error format and improve the text a bit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoerror, qerror: drop QDict member
Luiz Capitulino [Wed, 1 Aug 2012 21:06:44 +0000 (18:06 -0300)]
error, qerror: drop QDict member

Used to store error information, but it's unused now.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: drop qerror_table and qerror_format()
Luiz Capitulino [Fri, 27 Jul 2012 21:11:16 +0000 (18:11 -0300)]
qerror: drop qerror_table and qerror_format()

They are unused since last commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoerror, qerror: pass desc string to error calls
Luiz Capitulino [Fri, 27 Jul 2012 20:51:03 +0000 (17:51 -0300)]
error, qerror: pass desc string to error calls

This commit changes all QERR_ macros to contain a human message (ie.
the desc string found in qerr_table[]) instead of a json dictionary
in string format.

Before this commit, error_set() and qerror_report() would receive
a json dictionary in string format and build a qobject from it. Now,
both function receive a human message instead and the qobject is
not built anymore.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoerror: drop error_get_qobject()/error_set_qobject()
Luiz Capitulino [Wed, 1 Aug 2012 20:59:59 +0000 (17:59 -0300)]
error: drop error_get_qobject()/error_set_qobject()

error_get_qobject() is unused since last commit, error_set_qobject()
has never been used. Also drops error_int.h.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqemu-ga: switch to the new error format on the wire
Luiz Capitulino [Wed, 1 Aug 2012 19:30:13 +0000 (16:30 -0300)]
qemu-ga: switch to the new error format on the wire

IMPORTANT: this BREAKS qemu-ga compatibility for the error response.

Instead of returning something like:

{ "error": { "class": "InvalidParameterValue",
             "data": {"name": "mode", "expected": "halt|powerdown|reboot" } } }

qemu-ga now returns:

 { "error": { "class": "GenericError",
              "desc": "Parameter 'mode' expects halt|powerdown|reboot" } }

Notice that this is also a bug fix, as qemu-ga wasn't returning the
human message.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqmp: switch to the new error format on the wire
Luiz Capitulino [Fri, 27 Jul 2012 19:18:16 +0000 (16:18 -0300)]
qmp: switch to the new error format on the wire

IMPORTANT: this BREAKS QMP's compatibility for the error response.

This commit changes QMP's wire protocol to make use of the simpler
error format introduced by previous commits.

There are two important (and mostly incompatible) changes:

 1. Almost all error classes have been replaced by GenericError. The
    only classes that are still supported for compatibility with
    libvirt are: CommandNotFound, DeviceNotActive, KVMMissingCap,
    DeviceNotFound and MigrationExpected

 2. The 'data' field of the error dictionary is gone

As an example, an error response like:

  { "error": { "class": "DeviceNotRemovable",
               "data": { "device": "virtio0" },
               "desc": "Device 'virtio0' is not removable" } }

Will now be emitted as:

  { "error": { "class": "GenericError",
               "desc": "Device 'virtio0' is not removable" } }

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoerror: drop unused functions
Luiz Capitulino [Fri, 27 Jul 2012 00:30:40 +0000 (21:30 -0300)]
error: drop unused functions

Besides being unused, they operate on the current error format,
which is going to be replaced soon.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agohmp: hmp_change(): use error_get_class()
Luiz Capitulino [Mon, 6 Aug 2012 18:55:22 +0000 (15:55 -0300)]
hmp: hmp_change(): use error_get_class()

The error_is_type() function is going to be dropped.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoerror: add error_get_class()
Luiz Capitulino [Wed, 1 Aug 2012 19:29:38 +0000 (16:29 -0300)]
error: add error_get_class()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: add proper ErrorClass value for QERR_ macros
Luiz Capitulino [Fri, 27 Jul 2012 18:50:19 +0000 (15:50 -0300)]
qerror: add proper ErrorClass value for QERR_ macros

This commit replaces the place holder value for the ErrorClass
argument with a proper ErrorClass value for all QERR_ macros.

All current errors are mapped to GenericError, except for errors
CommandNotFound, DeviceEncrypted, DeviceNotActive, DeviceNotFound,
KVMMissingCap and MigrationExpected, which are maintained as they
are today.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoerror, qerror: add ErrorClass argument to error functions
Luiz Capitulino [Fri, 27 Jul 2012 17:09:29 +0000 (14:09 -0300)]
error, qerror: add ErrorClass argument to error functions

The new argument is added to functions qerror_report() and error_set().
It's stored in Error and QError. qerror_report_err() is also updated to
take care of it.

The QERR_ macros are changed to contain a place holder value for the
new argument, so that the value is used on all current calls to
qerror_report() and error_set() (and also to initialize qerror_table[]).

Next commit will update the QERR_ macros with a proper ErrorClass
value.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: qerror_table: don't use C99 struct initializers
Luiz Capitulino [Fri, 27 Jul 2012 16:58:30 +0000 (13:58 -0300)]
qerror: qerror_table: don't use C99 struct initializers

This allows for changing QERR_ macros to initialize two struct members
at the same time. See next commit for more details.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqapi-schema: add ErrorClass enum
Luiz Capitulino [Fri, 27 Jul 2012 12:34:50 +0000 (09:34 -0300)]
qapi-schema: add ErrorClass enum

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqapi: don't convert enum strings to lowercase
Luiz Capitulino [Fri, 27 Jul 2012 12:38:05 +0000 (09:38 -0300)]
qapi: don't convert enum strings to lowercase

Next commit will introduce enum strings in camel case.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqapi: generate correct enum names for camel case enums
Luiz Capitulino [Fri, 27 Jul 2012 18:44:25 +0000 (15:44 -0300)]
qapi: generate correct enum names for camel case enums

An enum like GenericError in the schema, should generate
GENERIC_ERROR and not GENERICERROR.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqapi: qapi-types.h: don't include qapi/qapi-types-core.h
Luiz Capitulino [Fri, 27 Jul 2012 13:56:33 +0000 (10:56 -0300)]
qapi: qapi-types.h: don't include qapi/qapi-types-core.h

qapi-types.h needs only qemu-common.h. Including qapi-types-core.h
causes problems when qerror.h or error.h includes qapi-types.h.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agohmp: hmp.h: include qdict.h
Luiz Capitulino [Fri, 27 Jul 2012 13:55:29 +0000 (10:55 -0300)]
hmp: hmp.h: include qdict.h

hmp.h is relying on qdict.h being provided by qapi-types.h. Fix this,
as a future commit will change qapi-types.h not to provide qdict.h.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoblock: block_int: include qerror.h
Luiz Capitulino [Fri, 27 Jul 2012 13:52:18 +0000 (10:52 -0300)]
block: block_int: include qerror.h

Several block/ files are relying on qerror.h being provided by
qapi-types.h. Fix this, as a future commit will change qapi-types.h
not to provide qerror.h.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: drop QERR_SOCKET_CONNECT_IN_PROGRESS
Luiz Capitulino [Wed, 1 Aug 2012 17:26:53 +0000 (14:26 -0300)]
qerror: drop QERR_SOCKET_CONNECT_IN_PROGRESS

Unused since last commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agomigration: don't rely on any QERR_SOCKET_*
Luiz Capitulino [Mon, 6 Aug 2012 19:26:47 +0000 (16:26 -0300)]
migration: don't rely on any QERR_SOCKET_*

Use the in_progress argument for QERR_SOCKET_CONNECT_IN_PROGRESS. The
other errors are handled the same by checking if the error is set and
then calling migrate_fd_error() if it's.

It's also necessary to change inet_connect_opts() not to set
QERR_SOCKET_CONNECT_IN_PROGRESS. This error is only used by
tcp_start_outgoing_migration() and not changing it along with the
usage of in_progress would break migration.

Furthermore this commit fixes a bug. Today, there's a spurious error
report when migration succeeds:

(qemu) migrate tcp:0:4444
migrate: Connection can not be completed immediately
(qemu)

After this commit no spurious error is reported anymore.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agonet: inet_connect(), inet_connect_opts(): add in_progress argument
Luiz Capitulino [Wed, 1 Aug 2012 16:42:47 +0000 (13:42 -0300)]
net: inet_connect(), inet_connect_opts(): add in_progress argument

It's used to indicate the special case where a valid file-descriptor
is returned (ie. success) but the connection can't be completed
w/o blocking.

This is needed because QERR_SOCKET_CONNECT_IN_PROGRESS is not
treated like an error and a future commit will drop it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agohmp_change(): don't access DeviceEncrypted's data
Luiz Capitulino [Mon, 6 Aug 2012 18:49:34 +0000 (15:49 -0300)]
hmp_change(): don't access DeviceEncrypted's data

It's not needed. As the device name is already known, we can replace
the duplicated password prompting code by monitor_read_block_device_key().

This overly simplifies hmp_change().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agohmp: hmp_cont(): don't rely on QERR_DEVICE_ENCRYPTED
Luiz Capitulino [Thu, 26 Jul 2012 23:41:53 +0000 (20:41 -0300)]
hmp: hmp_cont(): don't rely on QERR_DEVICE_ENCRYPTED

This commit changes hmp_cont() to loop through all block devices
and proactively set an encryption key for any encrypted device
missing a key.

This change is needed because QERR_DEVICE_ENCRYPTED is going to be
dropped by a future commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqmp: query-block: add 'encryption_key_missing' field
Luiz Capitulino [Thu, 26 Jul 2012 23:28:44 +0000 (20:28 -0300)]
qmp: query-block: add 'encryption_key_missing' field

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoerror: don't delay error message construction
Luiz Capitulino [Fri, 20 Jul 2012 16:43:37 +0000 (13:43 -0300)]
error: don't delay error message construction

Today, the error message is only constructed when it's used. This commit
changes that to construct the error message when the error object is
built (ie. when the error is reported).

This simplifies the Error object.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: don't delay error message construction
Luiz Capitulino [Fri, 20 Jul 2012 15:02:58 +0000 (12:02 -0300)]
qerror: don't delay error message construction

Today, the error message is only constructed when it's used. This commit
changes qerror to construct the error message when the error object is
built (ie. when the error is reported).

This eliminates the need of storing a pointer to qerror_table[], which
will be dropped soon, and also simplifies the code.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: qerror_format(): return an allocated string
Luiz Capitulino [Fri, 20 Jul 2012 16:30:18 +0000 (13:30 -0300)]
qerror: qerror_format(): return an allocated string

Simplifies current and future users.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: QError: drop file, linenr, func
Luiz Capitulino [Fri, 20 Jul 2012 14:08:17 +0000 (11:08 -0300)]
qerror: QError: drop file, linenr, func

They have never been fully used and conflict with future error
improvements.

Also makes qerror_report() a proper function, as there's no point
in having it as a macro anymore.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: avoid passing qerr pointer
Luiz Capitulino [Tue, 31 Jul 2012 18:41:13 +0000 (15:41 -0300)]
qerror: avoid passing qerr pointer

Helps dropping/modifying qerror functions.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: drop qerror_abort()
Luiz Capitulino [Fri, 20 Jul 2012 13:35:18 +0000 (10:35 -0300)]
qerror: drop qerror_abort()

qerror_abort() depends on the 'file', 'func' and 'linenr' members of
QError. However, these members are going to be dropped by the next
commit, so let's drop qerror_abort() in favor of printing an error
message to stderr plus a call to abort().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: reduce public exposure
Luiz Capitulino [Thu, 19 Jul 2012 20:29:34 +0000 (17:29 -0300)]
qerror: reduce public exposure

qerror will be dropped in a near future, let's reduce its public
exposure by making functions only used in qerror.c static.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: QERR_DEVICE_ENCRYPTED: change error message
Luiz Capitulino [Wed, 25 Jul 2012 16:16:53 +0000 (13:16 -0300)]
qerror: QERR_DEVICE_ENCRYPTED: change error message

Match what HMP commands print on DeviceEncrypted errors.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoqerror: QERR_AMBIGUOUS_PATH: drop %(object) from human msg
Luiz Capitulino [Wed, 25 Jul 2012 16:18:41 +0000 (13:18 -0300)]
qerror: QERR_AMBIGUOUS_PATH: drop %(object) from human msg

Actually, renames it to 'object'. This must be what the original author
meant to write, as there's no 'object' in the error's data member.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agomonitor: drop unused monitor debug code
Luiz Capitulino [Thu, 19 Jul 2012 22:34:38 +0000 (19:34 -0300)]
monitor: drop unused monitor debug code

In the old QMP days, this code was used to find out QMP commands that
might be calling monitor_printf() down its call chain.

This is almost impossible to happen today, because the qapi converted
commands don't even have a monitor object. Besides, it's been more than
a year since I used this last time.

Let's just drop it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
11 years agoarm: Move some ARM devices into libhw
Andreas Färber [Mon, 13 Aug 2012 02:11:12 +0000 (02:11 +0000)]
arm: Move some ARM devices into libhw

Avoids some unnecessary dependencies on cpu.h and prepares for
a future armeb-softmmu where most machines would not be built.

Defer touching the SoC devices since most have implicit or explicit
dependencies on the CPU.

Signed-off-by: Andreas Färber <andreas.faerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 13 Aug 2012 14:25:48 +0000 (09:25 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  kvm: Add documentation comment for kvm_irqchip_in_kernel()
  kvm: Decouple 'GSI routing' from 'kernel irqchip'
  kvm: Decouple 'MSI routing via irqfds' from 'kernel irqchip'
  kvm: Decouple 'irqfds usable' from 'kernel irqchip'
  kvm: Move kvm_allows_irq0_override() to target-i386, fix return type
  kvm: Rename kvm_irqchip_set_irq() to kvm_set_irq()
  kvm: Decouple 'async interrupt delivery' from 'kernel irqchip'
  configure: Don't implicitly hardcode list of KVM architectures
  kvm: Check if smp_cpus exceeds max cpus supported by kvm

11 years agolinux-user: Move target_to_host_errno_table[] setup out of ioctl loop
Peter Maydell [Mon, 23 Jul 2012 08:07:22 +0000 (08:07 +0000)]
linux-user: Move target_to_host_errno_table[] setup out of ioctl loop

The code to initialise the target_to_host_errno_table[] array was
accidentally inside the loop through checking and initialising all
the supported ioctls. This was harmless but meant that we reinitialised the
array several hundred times on startup.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agolinux-user: Fix SNDCTL_DSP_MAP{IN, OUT}BUF ioctl definitions
Peter Maydell [Mon, 23 Jul 2012 08:06:15 +0000 (08:06 +0000)]
linux-user: Fix SNDCTL_DSP_MAP{IN, OUT}BUF ioctl definitions

Fix the SNDCTL_DSP_MAP{IN,OUT}BUF ioctl definitions so that they
refer to a suitably defined target struct layout rather than hardcoding
the ioctl number. This fixes complaints from the syscall_init()
consistency check when running an x86_64-to-x86_64 linux-user qemu.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agolinux-user: Fix incorrect TARGET_BLKBSZGET, TARGET_BLKBSZSET
Peter Maydell [Mon, 23 Jul 2012 08:05:20 +0000 (08:05 +0000)]
linux-user: Fix incorrect TARGET_BLKBSZGET, TARGET_BLKBSZSET

The definitions for the ioctl numbers TARGET_BLKBSZGET and
TARGET_BLKBSZSET had the wrong size parameters (they are defined
with size_t, not int, even though the ioctl implementations themselves
read and write integers). Since commit 354a0008 we now have an
ioctl wrapper definition for BLKBSZGET and so on an x86-64-to-x86-64
linux-user binary we were triggering the mismatch warning in
syscall_init().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agossd0323: abort() instead of exit(1) on error.
Peter A. G. Crosthwaite [Mon, 13 Aug 2012 10:04:07 +0000 (11:04 +0100)]
ssd0323: abort() instead of exit(1) on error.

To be more consistent with the newer ways of error signalling. That and SIGABT
is easier to debug with than exit(1).

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: make sd_wp_addr() return bool
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:07 +0000 (11:04 +0100)]
hw/sd.c: make sd_wp_addr() return bool

For the sake of code clarity

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: make sd_dataready() return bool
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:07 +0000 (11:04 +0100)]
hw/sd.c: make sd_dataready() return bool

For the sake of code clarity

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: convert binary variables to bool
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:06 +0000 (11:04 +0100)]
hw/sd.c: convert binary variables to bool

Several members of SDState have type int when they actually are binary variables.
Change type of these variables to bool to improve code readability. Change SD API
to be in consistency with new variables type.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: introduce wrapper for conversion address to wp group
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:06 +0000 (11:04 +0100)]
hw/sd.c: introduce wrapper for conversion address to wp group

Add wrapper function sd_addr_to_wpnum() to replace long address-->wg_group
conversion line.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: make sd_wp_addr() accept 64 bit address argument
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:06 +0000 (11:04 +0100)]
hw/sd.c: make sd_wp_addr() accept 64 bit address argument

Currently sd_wp_addr() accepts 32 bit address arguments therefore implicitly
restricting SD card address range. Change address argument type to uint64_t.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: convert wp_groups in SDState to bitfield
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:06 +0000 (11:04 +0100)]
hw/sd.c: convert wp_groups in SDState to bitfield

Representing each group write protection flag with only one bit instead of int
variable significantly reduces memory consumption.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoarmv7m: Guard against no -kernel argument
Peter A. G. Crosthwaite [Mon, 13 Aug 2012 10:04:05 +0000 (11:04 +0100)]
armv7m: Guard against no -kernel argument

A -kernel argument must be specified for this machine. Guard against no -kernel
argument. Previously gave an unhelpful "bad address" error message.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/armv7m_nvic: Fix incorrect default for num-irqs property
Peter Maydell [Mon, 13 Aug 2012 10:04:05 +0000 (11:04 +0100)]
hw/armv7m_nvic: Fix incorrect default for num-irqs property

Fix an incorrect default value for the num-irqs property (we were
attempting to override it from the default set by the parent class
but not succeeding, which meant that the lm3s6965evb model would
assert on startup attempting to wire up nonexistent irq lines).
Instead of trying to override the parent's Property array, we
define an instance_init function which runs after default setup
but before user property setting and can just fix up the default
value in the gic_state struct.

Reported-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Tested-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoqom: Reimplement Interfaces
Anthony Liguori [Fri, 10 Aug 2012 03:16:10 +0000 (13:16 +1000)]
qom: Reimplement Interfaces

The current implementation of Interfaces is poorly designed.  Each interface
that an object implements ends up being an object that's tracked by the
implementing object.  There's all sorts of gymnastics to deal with casting
between these objects.

But an interface shouldn't be associated with an Object.  Interfaces are global
to a class.  This patch moves all Interface knowledge to ObjectClass eliminating
the relationship between Object and Interfaces.

Interfaces are now abstract (as they should be) but this is okay.  Interfaces
essentially act as additional parents for the classes and are treated as such.

With this new implementation, we should fully support derived interfaces
including reimplementing an inherited interface.

PC: Rebased against qom-next merge Jun-2012.

PC: Removed replication of cast logic for interfaces, i.e. there is only
one cast function - object_dynamic_cast() (and object_dynamic_cast_assert())

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoxilinx_axi*: Re-implemented interconnect
Peter A. G. Crosthwaite [Fri, 10 Aug 2012 03:16:11 +0000 (13:16 +1000)]
xilinx_axi*: Re-implemented interconnect

Re-implemented the interconnect between the Xilinx AXI ethernet and DMA
controllers. A QOM interface "stream" is created, for the two stream interfaces.

As per Edgars request, this is designed to be more generic than AXI-stream,
so in the future we may see more clients of this interface beyond AXI stream.

This is based primarily on Paolos original refactoring of the interconnect.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter A.G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Sun, 12 Aug 2012 00:49:03 +0000 (19:49 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  target-arm: Fix typos in comments
  arm: translate: comment typo - s/middel/middle/
  vl.c: Exit QEMU early if no machine is found