]> git.proxmox.com Git - qemu.git/log
qemu.git
10 years agoconfigure: Don't write .pyc files by default (python -B)
Stefan Weil [Tue, 27 Aug 2013 13:12:41 +0000 (15:12 +0200)]
configure: Don't write .pyc files by default (python -B)

When a Python script is run, Python normally writes bytecode into a .pyc file.
QEMU's build process uses several Python scripts which are called from
configure or make.

The generated .pyc files take disk space without being of much use, because
those scripts are short, not time critical and only called a few times.

Python's option -B disables writing of .pyc files. QEMU now uses "python -B"
as default, but it is still possible to choose a different call by passing
--python=PYTHON to configure.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agocurl: qemu_bh_new() can never return NULL
Stefan Hajnoczi [Mon, 26 Aug 2013 11:38:50 +0000 (13:38 +0200)]
curl: qemu_bh_new() can never return NULL

Drop error code path which cannot be taken since qemu_bh_new() does not
return NULL.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoslirp/arp_table.c: Avoid shifting into sign bit of signed integers
Peter Maydell [Fri, 23 Aug 2013 16:36:48 +0000 (17:36 +0100)]
slirp/arp_table.c: Avoid shifting into sign bit of signed integers

"0xf << 28" shifts right into the sign bit, since 0xf is a signed
integer. Use the 'U' suffix to force an unsigned shift to avoid
this undefined behaviour and a clang sanitizer warning.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconfigure: disable clang -Wstring-plus-int warning
Peter Maydell [Mon, 5 Aug 2013 19:16:40 +0000 (20:16 +0100)]
configure: disable clang -Wstring-plus-int warning

Some versions of clang will warn about adding integers to strings:

disas/i386.c:4753:23: error: adding 'char' to a string does not append
      to the string [-Werror,-Wstring-plus-int]
      oappend ("%es:" + intel_syntax);
               ~~~~~~~^~~~~~~~~~~~~~
disas/i386.c:4753:23: note: use array indexing to silence this warning
      oappend ("%es:" + intel_syntax);
                      ^
               &      [             ]

disas/i386.c uses this idiom to to skip a "%" prefix if using intel
rather than AT&T syntax. This seems like a reasonable  thing to do,
and I don't think anybody contributing to QEMU is likely to believe
that '+' is a string concatenation operator in C, so just disable
-Wstring-plus-int.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agordma: silly ipv6 bugfix
Michael R. Hines [Mon, 19 Aug 2013 02:27:08 +0000 (22:27 -0400)]
rdma: silly ipv6 bugfix

My bad - but it's very important for us to warn the user that
IPv6 is broken on RoCE in linux right now, until linux releases
a fixed version.

Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agomisc: Fix some typos in names and comments
Stefan Weil [Sun, 18 Aug 2013 17:40:06 +0000 (19:40 +0200)]
misc: Fix some typos in names and comments

Most typos were found using a modified version of codespell:

accross -> across
issueing -> issuing
TICNT_THRESHHOLD -> TICNT_THRESHOLD
bandwith -> bandwidth
VCARD_7816_PROPIETARY -> VCARD_7816_PROPRIETARY
occured -> occurred
gaurantee -> guarantee
sofware -> software

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoslirp: Port redirection option behave differently on Linux and Windows
Taimoor Mirza [Thu, 15 Aug 2013 18:13:28 +0000 (23:13 +0500)]
slirp: Port redirection option behave differently on Linux and Windows

port redirection code uses SO_REUSEADDR socket option before binding to
host port. Behavior of SO_REUSEADDR is different on Windows and Linux.
Relaunching QEMU with same host and guest port redirection values on Linux
throws error but on Windows it does not throw any error.
Problem is discussed in http://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03089.html

Signed-off-by: Taimoor Mirza <tmirza@codesourcery.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Fri, 30 Aug 2013 17:26:04 +0000 (12:26 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Wenchao Xia (15) and Stefan Weil (1)
# Via Luiz Capitulino
* luiz/queue/qmp:
  monitor: improve auto complete of "help" for single command in sub group
  monitor: allow "help" show message for single command in sub group
  monitor: support sub command in auto completion
  monitor: refine monitor_find_completion()
  monitor: support sub command in help
  monitor: refine parse_cmdline()
  monitor: code move for parse_cmdline()
  monitor: avoid direct use of global variable *mon_cmds
  monitor: split off monitor_data_init()
  monitor: call sortcmdlist() only one time
  monitor: avoid use of global *cur_mon in readline_completion()
  monitor: avoid use of global *cur_mon in monitor_find_completion()
  monitor: avoid use of global *cur_mon in block_completion_it()
  monitor: avoid use of global *cur_mon in file_completion()
  monitor: avoid use of global *cur_mon in cmd_completion()
  monitor: Add missing attributes to local function

Message-id: 1377865357-6742-1-git-send-email-lcapitulino@redhat.com

10 years agoMerge remote-tracking branch 'borntraeger/tags/kdump' into staging
Anthony Liguori [Fri, 30 Aug 2013 17:25:56 +0000 (12:25 -0500)]
Merge remote-tracking branch 'borntraeger/tags/kdump' into staging

This is a set of patches dealing with kdump support for s390x/kvm.
kdump on s390x uses subcode 1 of diagnose 0x308 to put the hardware
in a defined state. This is different from a full reset, since it
does not touch all CPU registers.
These patches define the cpu resets, the subsystem reset a load
function and also wires up the "nmi" command to issue a RESTART
interrupt as defined in the z/Architecture principles of operation.

This allows recent guest kernels with properly setup userspace
to trigger kdump:
- via guest crash
- via nmi from the host

# gpg: Signature made Fri 30 Aug 2013 07:19:18 AM CDT using RSA key ID B5A61C7C
# gpg: Can't check signature: public key not found

# By Christian Borntraeger (5) and Eugene (jno) Dvurechenski (2)
# Via Christian Borntraeger
* borntraeger/tags/kdump:
  s390: wire up nmi command to raise a RESTART interrupt on S390
  s390: Implement load normal reset
  s390/cpu: split CPU reset into architectured functions
  s390: provide a cpu load normal function
  s390: provide I/O subsystem reset
  s390/kvm: basic implementation of diagnose 308 subcode 6
  s390x/kvm: Fix switch/case indentation for handle_diag

Message-id: 1377810649-47484-1-git-send-email-borntraeger@de.ibm.com

10 years agos390: wire up nmi command to raise a RESTART interrupt on S390
Eugene (jno) Dvurechenski [Wed, 5 Dec 2012 14:50:07 +0000 (15:50 +0100)]
s390: wire up nmi command to raise a RESTART interrupt on S390

There is the 'nmi' command that is used to trigger a guest dump via kdump feature on x86.
s390 uses RESTART interrupt to trigger kdump.
So, this patch provides a mean to use 'nmi' command on s390 to raise RESTART interrupt.

The CPU to receive the RESTART interrupt is the "default" one.

There is an infrastructure to select the "default" CPU using 'cpu' command.
The 'info cpus' command can be used to see which one is the "default".

In order to wire up the RESTART to 'nmi' command we had to:
1. implement the kvm_s390_cpu_restart function by exporting the existing code
2. implement s390_cpu_restart function as kvm-aware wrapper
3. modify the qmp_inject_nmi function to enable (for s390) the scan for
   "default" CPU and call s390_cpu_restart for it;
3. fix some messages.

Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
10 years agos390: Implement load normal reset
Christian Borntraeger [Thu, 25 Jul 2013 14:57:45 +0000 (16:57 +0200)]
s390: Implement load normal reset

kdump on s390 uses a load normal reset to bring the system in a defined
state by doing a subsystem reset. The issuing CPUs will have an initial
CPU reset, all other CPUs will have a CPU reset as defined in POP (no
register content will change).

Implement this as architectured.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390/cpu: split CPU reset into architectured functions
Christian Borntraeger [Fri, 28 Jun 2013 08:51:09 +0000 (10:51 +0200)]
s390/cpu: split CPU reset into architectured functions

s390 provides several CPU resets:
- CPU reset, clears interrupts, stop processing, clears TLB, but does
  not touch registers
- initial CPU reset, like CPU reset, but also clears PSW, prefix, FPC,
  timer and control registers. It does not touch gprs, fprs and acrs (!)
- Power on reset: the full monty

wire up CPUClass reset to the full monty, but provide the lesser resets
as part of S390CPUClass.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agomonitor: improve auto complete of "help" for single command in sub group
Wenchao Xia [Tue, 27 Aug 2013 12:38:27 +0000 (20:38 +0800)]
monitor: improve auto complete of "help" for single command in sub group

Now special case "help *" in auto completion can work with sub commands,
such as "help info u*".

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: allow "help" show message for single command in sub group
Wenchao Xia [Tue, 27 Aug 2013 12:38:26 +0000 (20:38 +0800)]
monitor: allow "help" show message for single command in sub group

A new parameter type 'S' is introduced to allow user input any string.
"help info block" works normal now.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: support sub command in auto completion
Wenchao Xia [Tue, 27 Aug 2013 12:38:25 +0000 (20:38 +0800)]
monitor: support sub command in auto completion

This patch allows auto completion work normal for sub command case,
"info block [DEVICE]" can auto complete now, by re-enter the completion
function. In original code "info" is treated as a special case, now it
is treated as a sub command group, global variable info_cmds is not used
any more.

"help" command is still treated as a special case, since it is not a sub
command group but want to auto complete command in root command table.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: refine monitor_find_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:24 +0000 (20:38 +0800)]
monitor: refine monitor_find_completion()

In order to support sub command in auto completion, a reentrant function
is needed, so monitor_find_completion() is split into two parts. The
first part does parsing of user input which need to be done only once,
the second part does the auto completion job according to the parsing
result, which contains the necessary code to support sub command and
works as the reentrant function. The global "info_cmds" is still used
in second part, which will be replaced by sub command code later.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: support sub command in help
Wenchao Xia [Tue, 27 Aug 2013 12:38:23 +0000 (20:38 +0800)]
monitor: support sub command in help

The old code in help_cmd() uses global 'info_cmds' and treats it as a
special case. Actually 'info_cmds' is a sub command group of 'mon_cmds',
in order to avoid direct use of it, help_cmd() needs to change its work
mechanism to support sub command and not treat it as a special case
any more.

To support sub command, help_cmd() will first parse the input and then call
help_cmd_dump(), which works as a reentrant function. When it meets a sub
command, it simply enters the function again. Since help dumping needs to
know whole input to printf full help message include prefix, for example,
"help info block" need to printf prefix "info", so help_cmd_dump() takes all
args from input and extra parameter arg_index to identify the progress.
Another function help_cmd_dump_one() is introduced to printf the prefix
and command's help message.

Now help supports sub command, so later if another sub command group is
added in any depth, help will automatically work for it. Still "help info
block" will show error since command parser reject additional parameter,
which can be improved later. "log" is still treated as a special case.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: refine parse_cmdline()
Wenchao Xia [Tue, 27 Aug 2013 12:38:22 +0000 (20:38 +0800)]
monitor: refine parse_cmdline()

Since this function will be used by help_cmd() later, so improve
it to make it more generic and easier to use. free_cmdline_args()
is added too as paired function to free the result.

One change of this function is that, when the valid args in input
exceed the limit of MAX_ARGS, it fails now, instead of return with
MAX_ARGS of parsed args in old code. This should not impact much
since it is rare that user input many args in monitor's "help" and
auto complete scenario.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: code move for parse_cmdline()
Wenchao Xia [Tue, 27 Aug 2013 12:38:21 +0000 (20:38 +0800)]
monitor: code move for parse_cmdline()

help_cmd() need this function later, so move it. get_str() is called by
parse_cmdline() so it is moved also. Some code style error reported by
check script, is also fixed.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid direct use of global variable *mon_cmds
Wenchao Xia [Tue, 27 Aug 2013 12:38:20 +0000 (20:38 +0800)]
monitor: avoid direct use of global variable *mon_cmds

New member *cmd_table is added in structure Monitor to avoid direct usage of
*mon_cmds. Now monitor have an associated command table, when global variable
*info_cmds is also discarded, structure Monitor would gain full control about
how to deal with user input.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: split off monitor_data_init()
Wenchao Xia [Tue, 27 Aug 2013 12:38:19 +0000 (20:38 +0800)]
monitor: split off monitor_data_init()

In qmp_human_monitor_command(), the monitor need to initialized for
basic functionalities, and later more init code will be added, so
split off this function. Note that it is different with QMP mode
monitor which accept json string from monitor's input,
qmp_human_monitor_command() retrieve the human style command from
QMP input, then send the command to a normal mode monitor.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: call sortcmdlist() only one time
Wenchao Xia [Tue, 27 Aug 2013 12:38:18 +0000 (20:38 +0800)]
monitor: call sortcmdlist() only one time

It doesn't need to be done for every monitor, so change it.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid use of global *cur_mon in readline_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:17 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in readline_completion()

Now all completion functions do not use *cur_mon any more, instead
they use rs->mon. In short, structure ReadLineState decide where
the complete action would be taken now.

Tested with the case that qemu have two telnet monitors, auto
completion function works normal.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid use of global *cur_mon in monitor_find_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:16 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in monitor_find_completion()

Parameter *mon is added, and local variable *mon added in previous patch
is removed. The caller readline_completion(), pass rs->mon as value, which
should be initialized in readline_init() called by monitor_init().

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid use of global *cur_mon in block_completion_it()
Wenchao Xia [Tue, 27 Aug 2013 12:38:15 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in block_completion_it()

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid use of global *cur_mon in file_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:14 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in file_completion()

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid use of global *cur_mon in cmd_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:13 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in cmd_completion()

A new local variable *mon is added in monitor_find_completion()
to make compile pass, which will be removed later in
conversion patch for monitor_find_completion().

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: Add missing attributes to local function
Stefan Weil [Thu, 22 Aug 2013 19:30:09 +0000 (21:30 +0200)]
monitor: Add missing attributes to local function

Function expr_error gets a format string and variable arguments like printf.
It also never returns. Add the necessary attributes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agos390: provide a cpu load normal function
Christian Borntraeger [Thu, 25 Jul 2013 14:45:51 +0000 (16:45 +0200)]
s390: provide a cpu load normal function

Some code needs to perform an IPL-like bootup that mimics the
ESA (31bit) restart. Provide a cpu class method that does so.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
10 years agos390: provide I/O subsystem reset
Christian Borntraeger [Thu, 25 Jul 2013 14:37:37 +0000 (16:37 +0200)]
s390: provide I/O subsystem reset

Provide a function that resets the I/O subsystem.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
10 years agos390/kvm: basic implementation of diagnose 308 subcode 6
Eugene (jno) Dvurechenski [Wed, 19 Jun 2013 15:27:15 +0000 (17:27 +0200)]
s390/kvm: basic implementation of diagnose 308 subcode 6

Linux uses a check for subcode 6 to decide if other subcodes are
available. Provide a minimal implementation for subcode 6, as well
as for subcode 5.

Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
[Move code from kvm.c into misc_helper.c]

10 years agos390x/kvm: Fix switch/case indentation for handle_diag
Christian Borntraeger [Fri, 30 Aug 2013 09:06:56 +0000 (11:06 +0200)]
s390x/kvm: Fix switch/case indentation for handle_diag

This alignes case statements to switch statements in the handle_diag
function as mandated by coding style.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5
Anthony Liguori [Thu, 29 Aug 2013 22:21:51 +0000 (17:21 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5

* qemu-kvm/uq/master:
  kvm-stub: fix compilation
  kvm: shorten the parameter list for get_real_device()
  kvm: i386: fix LAPIC TSC deadline timer save/restore
  kvm-all.c: max_cpus should not exceed KVM vcpu limit
  kvm: Simplify kvm_handle_io
  kvm: x86: fix setting IA32_FEATURE_CONTROL with nested VMX disabled
  kvm: add KVM_IRQFD_FLAG_RESAMPLE support
  kvm: migrate vPMU state
  target-i386: remove tabs from target-i386/cpu.h
  Initialize IA32_FEATURE_CONTROL MSR in reset and migration

Conflicts:
target-i386/cpu.h
target-i386/kvm.c

aliguori: fixup trivial conflicts due to whitespace and added cpu
          argument

Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
10 years agoMerge remote-tracking branch 'sweil/mingw' into stable-1.5
Anthony Liguori [Thu, 29 Aug 2013 22:20:17 +0000 (17:20 -0500)]
Merge remote-tracking branch 'sweil/mingw' into stable-1.5

# By Stefan Weil
# Via Stefan Weil
* sweil/mingw:
  gtk: Remove unused include statements which are not portable
  w32: Add an icon resource
  w32: Fix broken out-of-tree builds (missing version.o)

Message-id: 1377607132-21336-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
10 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into stable-1.5
Anthony Liguori [Thu, 29 Aug 2013 22:19:19 +0000 (17:19 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into stable-1.5

pc,pci,virtio fixes and cleanups

This includes pc and pci cleanups, future-proofing of ROM files,
and a virtio bugfix correcting splice on virtio console.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon 26 Aug 2013 01:34:20 AM CDT using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Markus Armbruster (5) and others
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table
  pc_piix: Kill pc_init1() memory region args
  pc: pc_compat_1_4() now can call pc_compat_1_5()
  pc: Create pc_compat_*() functions
  pc: Kill pc_init_pci_1_0()
  pc: Don't explode QEMUMachineInitArgs into local variables needlessly
  pc: Don't prematurely explode QEMUMachineInitArgs
  ppc: Don't duplicate QEMUMachineInitArgs in PPCE500Params
  ppc: Don't explode QEMUMachineInitArgs into local variables needlessly
  sun4: Don't prematurely explode QEMUMachineInitArgs
  q35: Add PCIe switch to example q35 configuration
  loader: store FW CFG ROM files in RAM
  arch_init: align MR size to target page size
  pc: cleanup 1.4 compat support

Message-id: 1377535318-30491-1-git-send-email-mst@redhat.com

10 years agotcg-i386: Remove abort from GETPC_LDST
Richard Henderson [Thu, 29 Aug 2013 15:21:37 +0000 (08:21 -0700)]
tcg-i386: Remove abort from GETPC_LDST

Indeed, remove it entirely and remove the is_tcg_gen_code check
from GETPC_EXT.

Fixes https://bugs.launchpad.net/qemu/+bug/1218098 wherein a call
to a "normal" helper function performed a sequence of tail calls
all the way into the memory helper functions, leading to a stack
frame in which the memory helper function appeared to be called
directly from tcg.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-mips: fix get_physical_address() #if 0 build error
James Hogan [Tue, 27 Aug 2013 16:48:36 +0000 (17:48 +0100)]
target-mips: fix get_physical_address() #if 0 build error

In get_physical_address() is a qemu_log() call inside an #if 0 block.
When enabled the following build error is hit:

target-mips/helper.c In function ‘get_physical_address’:
target-mips/helper.c:220:13: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘hwaddr’ [-Werror=format]

Fix the *physical (hwaddr) formatting by using "%"HWADDR_PRIx instead of
TARGET_FMT_lx.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agokvm-stub: fix compilation
Paolo Bonzini [Tue, 27 Aug 2013 15:13:44 +0000 (17:13 +0200)]
kvm-stub: fix compilation

Non-KVM targets fail compilation on the uq/master branch.
Fix the prototype of kvm_irqchip_add_irqfd_notifier to match
the one in kvm-all.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
10 years agogtk: Remove unused include statements which are not portable
Stefan Weil [Sun, 18 Aug 2013 07:26:34 +0000 (09:26 +0200)]
gtk: Remove unused include statements which are not portable

These include files don't exist for MinGW and are not needed for Linux
(and hopefully for other hosts as well), so remove them.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
10 years agow32: Add an icon resource
Stefan Weil [Sat, 17 Aug 2013 07:32:04 +0000 (09:32 +0200)]
w32: Add an icon resource

The QEMU mascot which was already used for the NSIS installer
is now used for all QEMU executables.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
10 years agow32: Fix broken out-of-tree builds (missing version.o)
Stefan Weil [Fri, 16 Aug 2013 19:51:53 +0000 (21:51 +0200)]
w32: Fix broken out-of-tree builds (missing version.o)

Commit 0b516ef0dfad9a7b34c675c98e8ec92ab4d38466 added version.o to all
executables, but broke out-of-tree builds: for those builds the pattern
rule %.o: %.rc from rules.mak does not match, so version.o was no longer
built.

Adding explicit build rules fixes this.

Reported-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotcg-i386: Use new return-argument ld/st helpers
Richard Henderson [Thu, 25 Jul 2013 17:16:52 +0000 (07:16 -1000)]
tcg-i386: Use new return-argument ld/st helpers

Discontinue the jump-around-jump-to-jump scheme, trading it for a single
immediate move instruction.  The two extra jumps always consume 7 bytes,
whereas the immediate move is either 5 or 7 bytes depending on where the
code_gen_buffer gets located.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Tidy softmmu_template.h
Richard Henderson [Fri, 26 Jul 2013 18:29:15 +0000 (08:29 -1000)]
tcg: Tidy softmmu_template.h

Avoid a loop in the tlb_fill path; the fill will either succeed or
generate an exception.

Inline the slow_ld/st function; it was a complete copy of the main
helper except for the actual cross-page unaligned code, and the
compiler was inlining it anyway.

Add unlikely markers optimizing for the most common case of simple
tlb miss.

Make sure the compiler can optimize away the unaligned paths for a
1 byte access.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Add mmu helpers that take a return address argument
Richard Henderson [Thu, 25 Jul 2013 00:54:12 +0000 (14:54 -1000)]
tcg: Add mmu helpers that take a return address argument

Allow the code that tcg generates to be less obtuse, passing in
the return address directly instead of computing it in the helper.

Maintain the old entrance point unchanged as an alternate entry point.

Delete the helper_st*_cmmu prototypes; the implementations did not exist.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Tidy qemu_ld/st slow path
Richard Henderson [Thu, 25 Jul 2013 16:33:33 +0000 (06:33 -1000)]
tcg-i386: Tidy qemu_ld/st slow path

Use existing stack space for arguments; don't push/pop.
Use less ifdefs and more C ifs.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Try pc-relative lea for constant formation
Richard Henderson [Thu, 25 Jul 2013 20:00:41 +0000 (10:00 -1000)]
tcg-i386: Try pc-relative lea for constant formation

Use a 7 byte lea before the ultimate 10 byte movq.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Add and use tcg_out64
Richard Henderson [Thu, 25 Jul 2013 19:42:17 +0000 (09:42 -1000)]
tcg-i386: Add and use tcg_out64

No point in splitting the write into 32-bit pieces.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Tidy generated code for tcg_outN
Richard Henderson [Wed, 14 Aug 2013 16:46:38 +0000 (09:46 -0700)]
tcg: Tidy generated code for tcg_outN

Aliasing was forcing s->code_ptr to be re-read after the store.
Keep the pointer in a local variable to help the compiler.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Mon, 26 Aug 2013 14:19:50 +0000 (09:19 -0500)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Alex Bligh (32) and others
# Via Stefan Hajnoczi
* stefanha/block: (42 commits)
  win32-aio: drop win32_aio_flush_cb()
  aio-win32: replace incorrect AioHandler->opaque usage with ->e
  aio / timers: remove dummy_io_handler_flush from tests/test-aio.c
  aio / timers: Remove legacy interface
  aio / timers: Switch entire codebase to the new timer API
  aio / timers: Add scripts/switch-timer-api
  aio / timers: Add test harness for AioContext timers
  aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API
  aio / timers: Convert rtc_clock to be a QEMUClockType
  aio / timers: Remove main_loop_timerlist
  aio / timers: Rearrange timer.h & make legacy functions call non-legacy
  aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms
  aio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline
  aio / timers: Remove alarm timers
  aio / timers: Add documentation and new format calls
  aio / timers: Use all timerlists in icount warp calculations
  aio / timers: Introduce new API timer_new and friends
  aio / timers: On timer modification, qemu_notify or aio_notify
  aio / timers: Convert mainloop to use timeout
  aio / timers: Convert aio_poll to use AioContext timers' deadline
  ...

Message-id: 1377202298-22896-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
10 years agoMerge remote-tracking branch 'afaerber/tags/0.15-maintainer-for-anthony' into staging
Anthony Liguori [Mon, 26 Aug 2013 14:19:36 +0000 (09:19 -0500)]
Merge remote-tracking branch 'afaerber/tags/0.15-maintainer-for-anthony' into staging

MAINTAINERS update for stable-0.15

# gpg: Signature made Thu 22 Aug 2013 10:59:31 AM CDT using RSA key ID 3E7E013F
# gpg: Can't check signature: public key not found

# By Andreas Färber
# Via Andreas Färber
* afaerber/tags/0.15-maintainer-for-anthony:
  MAINTAINERS: Take over 0.15 maintenance

10 years agovirtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor...
yinyin [Thu, 22 Aug 2013 06:47:16 +0000 (14:47 +0800)]
virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table

virtqueue_get_avail_bytes: when found a indirect desc, we need loop over it.
           /* loop over the indirect descriptor table */
           indirect = 1;
           max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
           num_bufs = i = 0;
           desc_pa = vring_desc_addr(desc_pa, i);
But, It init i to 0, then use i to update desc_pa. so we will always get:
desc_pa = vring_desc_addr(desc_pa, 0);
the last two line should swap.

Cc: qemu-stable@nongnu.org
Signed-off-by: Yin Yin <yin.yin@cs2c.com.cn>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agodisas-objdump: Pass --adjust-vma to objdump
Richard Henderson [Sat, 17 Aug 2013 06:29:47 +0000 (23:29 -0700)]
disas-objdump: Pass --adjust-vma to objdump

This gives the dumped blob its correct address during disassembly,
which makes pc-relative insns much easier to interpret.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agodisas: Add disas-objdump.pl
Richard Henderson [Sat, 17 Aug 2013 06:29:46 +0000 (23:29 -0700)]
disas: Add disas-objdump.pl

The script massages the output produced for architectures that are
not supported internally by qemu though an external objdump program
for disassembly.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agodisas: Implement fallback to dump object code as hex
Richard Henderson [Sat, 17 Aug 2013 06:29:45 +0000 (23:29 -0700)]
disas: Implement fallback to dump object code as hex

The OBJD-[HT] tags will be used by a script to run the hex blob
through objdump --disassemble.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agokvm: shorten the parameter list for get_real_device()
Wei Yang [Thu, 22 Aug 2013 16:40:12 +0000 (18:40 +0200)]
kvm: shorten the parameter list for get_real_device()

get_real_device() has 5 parameters with the last 4 is contained in the first
structure.

This patch removes the last 4 parameters and directly use them from the first
parameter.

Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agowin32-aio: drop win32_aio_flush_cb()
Stefan Hajnoczi [Thu, 22 Aug 2013 13:28:36 +0000 (15:28 +0200)]
win32-aio: drop win32_aio_flush_cb()

The io_flush argument to qemu_aio_set_event_notifier() has been removed
since the block layer learnt to drain requests by itself.  Fix the
Windows build for win32-aio.o by updating the
qemu_aio_set_event_notifier() call and dropping win32_aio_flush_cb().

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio-win32: replace incorrect AioHandler->opaque usage with ->e
Stefan Hajnoczi [Thu, 22 Aug 2013 13:28:35 +0000 (15:28 +0200)]
aio-win32: replace incorrect AioHandler->opaque usage with ->e

The AioHandler->opaque field does not exist in aio-win32.c.  The code
that uses it was incorrectly copied from aio-posix.c.  For Windows we
can use AioHandler->e to match against AioContext->notifier.

This patch fixes the Windows build for aio-win32.o.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: remove dummy_io_handler_flush from tests/test-aio.c
Alex Bligh [Thu, 22 Aug 2013 18:59:16 +0000 (19:59 +0100)]
aio / timers: remove dummy_io_handler_flush from tests/test-aio.c

Remove dummy_io_handler_flush from tests/test-aio.c as it does
nothing now.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Remove legacy interface
Alex Bligh [Wed, 21 Aug 2013 15:03:09 +0000 (16:03 +0100)]
aio / timers: Remove legacy interface

Remove the legacy interface from include/qemu/timers.h.

Ensure struct QEMUClock is not exposed at all.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Switch entire codebase to the new timer API
Alex Bligh [Wed, 21 Aug 2013 15:03:08 +0000 (16:03 +0100)]
aio / timers: Switch entire codebase to the new timer API

This is an autogenerated patch using scripts/switch-timer-api.

Switch the entire code base to using the new timer API.

Note this patch may introduce some line length issues.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Add scripts/switch-timer-api
Alex Bligh [Wed, 21 Aug 2013 15:03:07 +0000 (16:03 +0100)]
aio / timers: Add scripts/switch-timer-api

Add scripts/switch-timer-api to programatically rewrite source
files to use the new timer system.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Add test harness for AioContext timers
Alex Bligh [Wed, 21 Aug 2013 15:03:06 +0000 (16:03 +0100)]
aio / timers: Add test harness for AioContext timers

Add a test harness for AioContext timers. The g_source equivalent is
unsatisfactory as it suffers from false wakeups.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: convert block_job_sleep_ns and co_sleep_ns to new API
Alex Bligh [Wed, 21 Aug 2013 15:03:05 +0000 (16:03 +0100)]
aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API

Convert block_job_sleep_ns and co_sleep_ns to use the new timer
API.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Convert rtc_clock to be a QEMUClockType
Alex Bligh [Wed, 21 Aug 2013 15:03:04 +0000 (16:03 +0100)]
aio / timers: Convert rtc_clock to be a QEMUClockType

Convert rtc_clock to be a QEMUClockType

Move rtc_clock users to use the new API

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Remove main_loop_timerlist
Alex Bligh [Wed, 21 Aug 2013 15:03:03 +0000 (16:03 +0100)]
aio / timers: Remove main_loop_timerlist

Now we have timerlistgroups implemented and main_loop_tlg, we
no longer need the concept of a default timer list associated
with each clock. Remove it and simplify initialisation of
clocks and timer lists.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Rearrange timer.h & make legacy functions call non-legacy
Alex Bligh [Wed, 21 Aug 2013 15:03:02 +0000 (16:03 +0100)]
aio / timers: Rearrange timer.h & make legacy functions call non-legacy

Rearrange timer.h so it is in order by function type.

Make legacy functions call non-legacy functions rather than vice-versa.

Convert cpus.c to use new API.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms
Alex Bligh [Wed, 21 Aug 2013 15:03:01 +0000 (16:03 +0100)]
aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms

Add utility functions qemu_clock_get_ms and qemu_clock_get_us

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline
Alex Bligh [Wed, 21 Aug 2013 15:03:00 +0000 (16:03 +0100)]
aio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline

Remove qemu_clock_deadline and qemu_timerlist_deadline now we are using
the ns functions throughout.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Remove alarm timers
Alex Bligh [Wed, 21 Aug 2013 15:02:59 +0000 (16:02 +0100)]
aio / timers: Remove alarm timers

Remove alarm timers from qemu-timers.c now we use g_poll / ppoll
instead.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Add documentation and new format calls
Alex Bligh [Wed, 21 Aug 2013 15:02:58 +0000 (16:02 +0100)]
aio / timers: Add documentation and new format calls

Add documentation for existing qemu timer calls. Add new format
calls of the format timer_XXX rather than qemu_XXX_timer
for consistency.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Use all timerlists in icount warp calculations
Alex Bligh [Wed, 21 Aug 2013 15:02:57 +0000 (16:02 +0100)]
aio / timers: Use all timerlists in icount warp calculations

Notify all timerlists derived from vm_clock in icount warp
calculations.

When calculating timer delay based on vm_clock deadline, use
all timerlists.

For compatibility, maintain an apparent bug where when using
icount, if no vm_clock timer was set, qemu_clock_deadline
would return INT32_MAX and always set an icount clock expiry
about 2 seconds ahead.

NB: thread safety - when different timerlists sit on different
threads, this will need some locking.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Introduce new API timer_new and friends
Alex Bligh [Wed, 21 Aug 2013 15:02:56 +0000 (16:02 +0100)]
aio / timers: Introduce new API timer_new and friends

Introduce new API for creating timers - timer_new and
_ns, _ms, _us derivatives.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: On timer modification, qemu_notify or aio_notify
Alex Bligh [Wed, 21 Aug 2013 15:02:55 +0000 (16:02 +0100)]
aio / timers: On timer modification, qemu_notify or aio_notify

On qemu_mod_timer_ns, ensure qemu_notify or aio_notify is called to
end the appropriate poll(), irrespective of use_icount value.

On qemu_clock_enable, ensure qemu_notify or aio_notify is called for
all QEMUTimerLists attached to the QEMUClock.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Convert mainloop to use timeout
Alex Bligh [Wed, 21 Aug 2013 15:02:54 +0000 (16:02 +0100)]
aio / timers: Convert mainloop to use timeout

Convert mainloop to use timeout from default timerlist group
(i.e. the current 3 static timers)

main-loop.c produces a (possibly spurious) warning about
multiple iterations. Adapt the way this works for a signed
timeout and make the warning a bit safer.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Convert aio_poll to use AioContext timers' deadline
Alex Bligh [Wed, 21 Aug 2013 15:02:53 +0000 (16:02 +0100)]
aio / timers: Convert aio_poll to use AioContext timers' deadline

Convert aio_poll to use deadline based on AioContext's timers.

aio_poll has been changed to return accurately whether progress
has occurred. Prior to this commit, aio_poll always returned
true if g_poll was entered, whether or not any progress was
made. This required a change to tests/test-aio.c where an
assert was backwards.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Add aio_timer_init & aio_timer_new wrappers
Alex Bligh [Wed, 21 Aug 2013 15:02:52 +0000 (16:02 +0100)]
aio / timers: Add aio_timer_init & aio_timer_new wrappers

Add aio_timer_init and aio_timer_new wrapper functions.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: aio_ctx_prepare sets timeout from AioContext timers
Alex Bligh [Wed, 21 Aug 2013 15:02:51 +0000 (16:02 +0100)]
aio / timers: aio_ctx_prepare sets timeout from AioContext timers

Calculate the timeout in aio_ctx_prepare taking into account
the timers attached to the AioContext.

Alter aio_ctx_check similarly.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Add a notify callback to QEMUTimerList
Alex Bligh [Wed, 21 Aug 2013 15:02:50 +0000 (16:02 +0100)]
aio / timers: Add a notify callback to QEMUTimerList

Add a notify pointer to QEMUTimerList so it knows what to notify
on a timer change.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Add QEMUTimerListGroup to AioContext
Alex Bligh [Wed, 21 Aug 2013 15:02:49 +0000 (16:02 +0100)]
aio / timers: Add QEMUTimerListGroup to AioContext

Add a QEMUTimerListGroup each AioContext (meaning a QEMUTimerList
associated with each clock is added) and delete it when the
AioContext is freed.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Add QEMUTimerListGroup and helper functions
Alex Bligh [Wed, 21 Aug 2013 15:02:48 +0000 (16:02 +0100)]
aio / timers: Add QEMUTimerListGroup and helper functions

Add QEMUTimerListGroup and helper functions, to represent
a QEMUTimerList associated with each clock. Add a default
QEMUTimerListGroup representing the default timer lists
which are not associated with any other object (e.g.
an AioContext as added by future patches).

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Untangle include files
Alex Bligh [Wed, 21 Aug 2013 15:02:47 +0000 (16:02 +0100)]
aio / timers: Untangle include files

include/qemu/timer.h has no need to include main-loop.h and
doing so causes an issue for the next patch. Unfortunately
various files assume including timers.h will pull in main-loop.h.
Untangle this mess.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Split QEMUClock into QEMUClock and QEMUTimerList
Alex Bligh [Wed, 21 Aug 2013 15:02:46 +0000 (16:02 +0100)]
aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList

Split QEMUClock into QEMUClock and QEMUTimerList so that we can
have more than one QEMUTimerList associated with the same clock.

Introduce a main_loop_timerlist concept and make existing
qemu_clock_* calls that actually should operate on a QEMUTimerList
call the relevant QEMUTimerList implementations, using the clock's
default timerlist. This vastly reduces the invasiveness of this
change and means the API stays constant for existing users.

Introduce a list of QEMUTimerLists associated with each clock
so that reenabling the clock can cause all the notifiers
to be called. Note the code to do the notifications is added
in a later patch.

Switch QEMUClockType to an enum. Remove global variables vm_clock,
host_clock and rt_clock and add compatibility defines. Do not
fix qemu_next_alarm_deadline as it's going to be deleted.

Add qemu_clock_use_for_deadline to indicate whether a particular
clock should be used for deadline calculations. When use_icount
is true, vm_clock should not be used for deadline calculations
as it does not contain a nanosecond count. Instead, icount
timeouts come from the execution thread doing aio_notify or
qemu_notify as appropriate. This function is used in the next
patch.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Make qemu_run_timers and qemu_run_all_timers return progress
Alex Bligh [Wed, 21 Aug 2013 15:02:45 +0000 (16:02 +0100)]
aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress

Make qemu_run_timers and qemu_run_all_timers return progress
so that aio_poll etc. can determine whether a timer has been
run.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack
Alex Bligh [Wed, 21 Aug 2013 15:02:44 +0000 (16:02 +0100)]
aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack

Where supported, called prctl(PR_SET_TIMERSLACK, 1, ...) to
set one nanosecond timer slack to increase precision of timer
calls.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: add ppoll support with qemu_poll_ns
Alex Bligh [Wed, 21 Aug 2013 15:02:43 +0000 (16:02 +0100)]
aio / timers: add ppoll support with qemu_poll_ns

Add qemu_poll_ns which works like g_poll but takes a nanosecond
timeout.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoMAINTAINERS: Take over 0.15 maintenance
Andreas Färber [Fri, 13 Apr 2012 15:54:02 +0000 (17:54 +0200)]
MAINTAINERS: Take over 0.15 maintenance

SUSE is shipping qemu-kvm 0.15.1 with SLES 11 SP2 so we will be actively
tracking all KVM-related issues. Therefore upgrade to Supported.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Thu, 22 Aug 2013 14:29:25 +0000 (09:29 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Laszlo Ersek (8) and others
# Via Luiz Capitulino
* luiz/queue/qmp:
  scripts/qapi.py: Avoid syntax not supported by Python 2.4
  monitor: print the invalid char in error message
  OptsVisitor: introduce unit tests, with test cases for range flattening
  add "test-int128" and "test-bitops" to .gitignore
  OptsVisitor: don't try to flatten overlong integer ranges
  OptsVisitor: opts_type_uint64(): recognize intervals when LM_IN_PROGRESS
  OptsVisitor: rebase opts_type_uint64() to parse_uint_full()
  OptsVisitor: opts_type_int(): recognize intervals when LM_IN_PROGRESS
  OptsVisitor: introduce list modes for interval flattening
  OptsVisitor: introduce basic list modes
  Convert stderr message calling error_get_pretty() to error_report()

Message-id: 1377015041-6567-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
10 years agoMerge remote-tracking branch 'jliu/or32' into staging
Anthony Liguori [Thu, 22 Aug 2013 14:29:13 +0000 (09:29 -0500)]
Merge remote-tracking branch 'jliu/or32' into staging

# By Jia Liu
# Via Jia Liu
* jliu/or32:
  hw/openrisc: Avoid undefined shift in openrisc_pic_cpu_handler()
  hw/openrisc: Fix masking in openrisc_pic_cpu_handler()
  hw/openrisc: Avoid using uninitialised variable 'entry'

Message-id: 1377050811-11116-1-git-send-email-proljc@gmail.com
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
10 years agoaio / timers: Consistent treatment of disabled clocks for deadlines
Alex Bligh [Wed, 21 Aug 2013 15:02:42 +0000 (16:02 +0100)]
aio / timers: Consistent treatment of disabled clocks for deadlines

Make treatment of disabled clocks consistent in deadline calculation

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: add qemu-timer.c utility functions
Alex Bligh [Wed, 21 Aug 2013 15:02:41 +0000 (16:02 +0100)]
aio / timers: add qemu-timer.c utility functions

Add utility functions to qemu-timer.c for nanosecond timing.

Add qemu_clock_deadline_ns to calculate deadlines to
nanosecond accuracy.

Add utility function qemu_soonest_timeout to calculate soonest deadline.

Add qemu_timeout_ns_to_ms to convert a timeout in nanoseconds back to
milliseconds for when ppoll is not used.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Rename qemu_new_clock and expose clock types
Alex Bligh [Wed, 21 Aug 2013 15:02:40 +0000 (16:02 +0100)]
aio / timers: Rename qemu_new_clock and expose clock types

Rename qemu_new_clock to qemu_clock_new.

Expose clock types.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio / timers: Rename qemu_timer_* functions
Alex Bligh [Wed, 21 Aug 2013 15:02:39 +0000 (16:02 +0100)]
aio / timers: Rename qemu_timer_* functions

Rename four functions in preparation for new API.

Rename qemu_timer_expired to timer_expired
Rename qemu_timer_expire_time_ns to timer_expire_time_ns
Rename qemu_timer_pending to timer_pending
Rename qemu_timer_expired_ns to timer_expired_ns

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agovmdk: support vmfs files
Paolo Bonzini [Mon, 19 Aug 2013 10:54:28 +0000 (18:54 +0800)]
vmdk: support vmfs files

VMware ESX hosts also use different create and extent types for flat
files, respectively "vmfs" and "VMFS".  This is not documented, but it
can be found at http://kb.vmware.com/kb/10002511 (Recreating a missing
virtual machine disk (VMDK) descriptor file).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agovmdk: support vmfsSparse files
Fam Zheng [Mon, 19 Aug 2013 10:54:27 +0000 (18:54 +0800)]
vmdk: support vmfsSparse files

VMware ESX hosts use a variant of the VMDK3 format, identified by the
vmfsSparse create type ad the VMFSSPARSE extent type.

It has 16 KB grain tables (L2) and a variable-size grain directory (L1).
In addition, the grain size is always 512, but that is not a problem
because it is included in the header.

The format of the extents is documented in the VMDK spec.  The format
of the descriptor file is not documented precisely, but it can be
found at http://kb.vmware.com/kb/10026353 (Recreating a missing virtual
machine disk (VMDK) descriptor file for delta disks).

With these patches, vmfsSparse files only work if opened through the
descriptor file.  Data files without descriptor files, as far as I
could understand, are not supported by ESX.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
--
v2: Rebase to patch 01.
    Change le64_to_cpu to le32_to_cpu.
    Rename vmdk_open_vmdk3 to vmdk_open_vmfs_sparse, which represents the
    current usage of this format.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agovmdk: fix L1 and L2 table size in vmdk3 open
Fam Zheng [Mon, 19 Aug 2013 10:54:26 +0000 (18:54 +0800)]
vmdk: fix L1 and L2 table size in vmdk3 open

VMDK3 header has the field l1dir_size, but vmdk_open_vmdk3 hardcoded the
value. This patch honors the header field.

And the L2 table size is 4096 according to VMDK spec[1], instead of
1 << 9 (512).

[1]:
http://www.vmware.com/support/developer/vddk/vmdk_50_technote.pdf?src=vmdk

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agovmdk: Move l1_size check into vmdk_add_extent()
Fam Zheng [Mon, 19 Aug 2013 10:54:25 +0000 (18:54 +0800)]
vmdk: Move l1_size check into vmdk_add_extent()

This header check is common to VMDK3 and VMDK4, so move it into
vmdk_add_extent().

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: better error message for read only format name
Fam Zheng [Thu, 22 Aug 2013 07:36:59 +0000 (15:36 +0800)]
block: better error message for read only format name

When user tries to use read-only whitelist format in the command line
option, failure message was "'foo' invalid format". It might be invalid
only for writable, but valid for read-only, so it is confusing. Give the
user easier to understand information.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Produce zeros when protocols reading beyond end of file
MORITA Kazutaka [Tue, 6 Aug 2013 01:53:40 +0000 (09:53 +0800)]
block: Produce zeros when protocols reading beyond end of file

While Asias is debugging an issue creating qcow2 images on top of
non-file protocols.  It boils down to this example using NBD:

$ qemu-io -c 'open -g nbd+unix:///?socket=/tmp/nbd.sock' -c 'read -v 0 512'

Notice the open -g option to set bs->growable.  This means you can
read/write beyond end of file.  Reading beyond end of file is supposed
to produce zeroes.

We rely on this behavior in qcow2_create2() during qcow2 image
creation.  We create a new file and then write the qcow2 header
structure using bdrv_pwrite().  Since QCowHeader is not a multiple of
sector size, block.c first uses bdrv_read() on the empty file to fetch
the first sector (should be all zeroes).

Here is the output from the qemu-io NBD example above:

$ qemu-io -c 'open -g nbd+unix:///?socket=/tmp/nbd.sock' -c 'read -v 0 512'
00000000:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
00000010:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
00000020:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
...

We are not zeroing the buffer!  As a result qcow2 image creation on top
of protocols is not guaranteed to work even when file creation is
supported by the protocol.

[Adapted this patch to use bs->zero_beyond_eof.
-- Stefan]

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Asias He <asias@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Introduce bs->zero_beyond_eof
Asias He [Thu, 22 Aug 2013 07:24:14 +0000 (15:24 +0800)]
block: Introduce bs->zero_beyond_eof

In 4146b46c42e0989cb5842e04d88ab6ccb1713a48 (block: Produce zeros when
protocols reading beyond end of file), we break qemu-iotests ./check
-qcow2 022. This happens because qcow2 temporarily sets ->growable = 1
for vmstate accesses (which are stored beyond the end of regular image
data).

We introduce the bs->zero_beyond_eof to allow qcow2_load_vmstate() to
disable ->zero_beyond_eof temporarily in addition to enable ->growable.

[Since the broken patch "block: Produce zeros when protocols reading
beyond end of file" has not been merged yet, I have applied this fix
*first* and will then apply the next patch to keep the tree bisectable.
-- Stefan]

Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Asias He <asias@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agopc_piix: Kill pc_init1() memory region args
Eduardo Habkost [Wed, 21 Aug 2013 18:14:45 +0000 (15:14 -0300)]
pc_piix: Kill pc_init1() memory region args

All callers always use the same values (get_system_memory(),
get_system_io()), so the parameters are pointless.

If one day we decide to eliminate get_system_memory() and
get_system_io(), we will be able to do that more easily by adding the
values to struct QEMUMachineInitArgs.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>