Commit Graph

12465 Commits

Author SHA1 Message Date
Ryan Harper 15c7733bb2 Don't reset bs->is_temporary in bdrv_open_common
To fix https://bugs.launchpad.net/qemu/+bug/597402 where qemu fails to
call unlink() on temporary snapshots due to bs->is_temporary getting clobbered
in bdrv_open_common() after being set in bdrv_open() which calls the former.

We don't need to initialize bs->is_temporary in bdrv_open_common().

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02 13:18:01 +02:00
Markus Armbruster 0c6f9c17f3 blockdev: Remove drive_get_serial()
Unused since commit 6ced55a5.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02 13:18:01 +02:00
Markus Armbruster fa12fbbece ide: Make it explicit that ide_create_drive() can't fail
All callers of ide_create_drive() ignore its value.  Currently
harmless, because it fails only when qdev_init() fails, which fails
only when ide_drive_initfn() fails, which never fails.

Brittle.  Change it to die instead of silently ignoring failure.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02 13:18:01 +02:00
Markus Armbruster fa66b909f3 scsi: scsi_bus_legacy_handle_cmdline() can fail, fix callers
None of its callers checks for failure.  scsi_hot_add() can crash
because of that:

(qemu) drive_add 4 if=scsi,format=host_device,file=/dev/sg1
scsi-generic: scsi generic interface too old
Segmentation fault (core dumped)

Fix all callers, not just scsi_hot_add().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02 13:18:01 +02:00
Christoph Hellwig 39508e7adb block: allow filenames with colons again for host devices
Before the raw/file split we used to allow filenames with colons for host
device only.  While this was more by accident than by design people rely
on it, so we need to bring it back.

So move the host device probing to be before the protocol detection
again.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02 13:18:01 +02:00
Kevin Wolf 19dbcbf7cc qcow2: Fix error handling during metadata preallocation
People were wondering why qemu-img check failed after they tried to preallocate
a large qcow2 file and ran out of disk space.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02 13:18:01 +02:00
Andi Kleen 8713f8ffb8 Don't declare XSAVE as supported
i386 cpuid.c currently claims XSAVE is supported in the CPUID filter,
but that's not true: Only FXSAVE is supported. Remove that bit
from the filter.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-02 01:55:38 +02:00
Andi Kleen c045af25a5 Add more boundary checking to sse3/4 parsing
ssse3 uses tables with only two entries per op, but it is indexed
with b1 which can contain variables upto 3. This happens when ssse3
or sse4 are used with REP* prefixes.

Add boundary checking for this case.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-02 01:53:37 +02:00
Chih-Min Chao 4c4fd3f852 target-arm : fix parallel saturated subtraction implementation
Signed-off-by: Chih-Min Chao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-01 23:45:29 +02:00
Chih-Min Chao ed89a2f1b1 target-arm : fix thumb2 parallel add/sub opcode decoding
Signed-off-by: Chih-Min Chao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-01 23:45:29 +02:00
Chih-Min Chao bb42e28bdb target-arm: fix addsub/subadd implementation
Signed-off-by: Chih-Min Chao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-01 23:45:29 +02:00
Hidetoshi Seto d6f3a84511 Makefile: add qemu-options.def to distclean
Remove generated qemu-options.def at "make distclean".

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-01 23:45:29 +02:00
Hidetoshi Seto d7a5842b03 Add QMP/qmp-commands.txt to .gitignore
QMP/qmp-commands.txt is a generated file.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-01 23:45:28 +02:00
Richard Henderson 7418027ea4 target-i386: fix xchg rax,r8
We were ignoring REX_B while special-casing NOP, i.e. xchg eax,eax.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-01 23:45:28 +02:00
Aurelien Jarno afa88c3ae5 target-mips: add Loongson support prefetch
Loongson CPU uses a load to zero register for prefetch.
Emulate it as a NOP.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-01 23:45:28 +02:00
Jan Kiszka a6c4d36425 monitor: Allow to exclude commands from QMP
Ported commands that are marked 'user_only' will not be considered for
QMP monitor sessions. This allows to implement new commands that do not
(yet) provide a sufficiently stable interface for QMP use.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:14 -03:00
Luiz Capitulino e4940c603a QMP: handle_qmp_command(): Small cleanup
Drop a unneeded label and QDECREF() call.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:14 -03:00
Luiz Capitulino 0bbab46db6 QMP: Drop old input object checking
Previous commit added qmp_check_input_obj(), it does all the
checking we need.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino c917c8f3d0 QMP: Introduce qmp_check_input_obj()
This is similar to qmp_check_client_args(), but it checks if
the input object follows the specification (QMP/qmp-spec.txt
section 2.3).

As we're limited to three keys, the work here is quite simple:
we iterate over the input object, checking each time if the
current argument complies to the specification.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino 60d76d7b07 QError: Introduce QERR_QMP_EXTRA_MEMBER
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino f6b4fc8b23 QMP: Drop old client argument checker
Previous two commits added qmp_check_client_args(), which
fully replaces this code and is way better.

It's important to note that the new checker doesn't support
the '/' arg type. As we don't have any of those handlers
converted to QMP, this is just dead code.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino 4af9193ae9 QMP: New argument checker (second part)
This commit introduces the second (and last) part of QMP's new
argument checker.

The job is done by check_client_args_type(), it iterates over
the client's argument qdict and for for each argument it checks
if it exists and if its type is valid.

It's important to observe the following changes from the existing
argument checker:

  - If the handler accepts an O-type argument, unknown arguments
    are passed down to it. It's up to O-type handlers to validate
    their arguments

  - Boolean types (eg. 'b' and '-') don't accept integers anymore,
    only json-bool

  - Argument types '/' and '.' are currently unsupported under QMP,
    thus they're not handled

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino 2dbc8db0ba QMP: New argument checker (first part)
Current QMP's argument checker is more complex than it should be
and has (at least) one serious bug: it ignores unknown arguments.

To solve both problems we introduce a new argument checker. It's
added on top of the existing one, so that there are no regressions
during the transition.

This commit introduces the first part of the new checker, which
is run by qmp_check_client_args() and does the following:

  1. Check if all mandatory arguments were provided
  2. Set flags for argument validation

In order to do that, we transform the args_type string (from
qemu-montor.hx) into a qdict and iterate over it.

Next commit adds the new checker's second part: type checking and
invalid argument detection.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino eb159d13ee Monitor: handle optional '-' arg as a bool
Historically, user monitor arguments beginning with '-' (eg. '-f')
were passed as integers down to handlers.

I've maintained this behavior in the new monitor because we didn't
have a boolean type at the very beginning of QMP. Today we have it
and this behavior is causing trouble to QMP's argument checker.

This commit fixes the problem by doing the following changes:

1. User Monitor

   Before: the optional arg was represented as a QInt, we'd pass 1
           down to handlers if the user specified the argument or
           0 otherwise

   This commit: the optional arg is represented as a QBool, we pass
                true down to handlers if the user specified the
                argument, otherwise _nothing_ is passed

2. QMP

   Before: the client was required to pass the arg as QBool, but we'd
           convert it to QInt internally. If the argument wasn't passed,
           we'd pass 0 down

   This commit: still require a QBool, but doesn't do any conversion and
                doesn't pass any default value

3. Convert existing handlers (do_eject()/do_migrate()) to the new way

   Before: Both handlers would expect a QInt value, either 0 or 1

   This commit: Change the handlers to accept a QBool, they handle the
                following cases:

                   A) true is passed: the option is enabled
                   B) false is passed: the option is disabled
                   C) nothing is passed: option not specified, use
                                         default behavior

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino 35006ac856 QDict: Introduce qdict_get_try_bool()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino d02c6bd428 check-qdict: Introduce test for the new iteration API
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino f2b07f35d2 QDict: Introduce new iteration API
It's composed of functions qdict_first() and qdict_next(), plus
functions to access QDictEntry values.

This API was suggested by Markus Armbruster <armbru@redhat.com> and
it offers full control over the iteration process.

The usage is simple, the following example prints all keys in 'qdict'
(it's hopefully better than any English description):

   QDict *qdict;
   const QDictEntry *ent;

   [...]

   for (ent = qdict_first(qdict); ent; ent = qdict_next(qdict, ent)) {
        printf("%s ", qdict_entry_key(ent));
    }

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino 0d078b2ade QDict: Introduce functions to retrieve QDictEntry values
Next commit will introduce a new QDict iteration API which
returns QDictEntry entries, but we don't want users to directly
access its members since QDictEntry should be private to QDict.

In the near future this kind of data type will be turned into a
forward reference.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino c8bc3cd72b QDict: Small terminology change
Let's call a 'hash' only what is returned by our hash function,
anything else is a 'bucket'.

This helps avoiding confusion with regard to how we traverse
our table.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino 83aba69ec0 QDict: Rename 'err_value'
A missing key is not an error.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino 8754c81e11 QError: Enhance QERR_DEVICE_NOT_ACTIVE's user desc
The 'by the guest' part is misleading, it could be disabled by
the host too.

We will likely need more surgery if we care for the distinction,
just dropping the problematic part is good enough for now.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Luiz Capitulino 5af7bbae0c QMP: Fix error reporting in the async API
The current asynchronous command API doesn't return a QMP response
when the async command fails.

This is easy to reproduce with the balloon command (the sole async
command we have so far): run qemu w/o the '-balloon virtio' option
and try to issue the balloon command via QMP: no response will be
sent to the client.

This commit fixes the problem by making qmp_async_cmd_handler()
return the handler's error code and then calling
monitor_protocol_emitter() if the handler has returned an error.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Yoshiaki Tamura 410cbafebc net: delete QemuOpts when net_client_init() fails.
This fixes the following scenario using QMP.

First, put a bogus argument "foo" to "type", which results in an error.
{"execute": "netdev_add", "arguments": { "type": "foo", "id": "netdev1" } }
Then, call it again with correct argument "user".
{"execute": "netdev_add", "arguments": { "type": "user", "id": "netdev1" } }
This results in "DuplicatedId" error.

Because the first command was invalid, it should be able to reuse the
same "id", and the second command should work.

Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Jan Kiszka bbafc7a879 QMP: Fix python helper /wrt long return strings
Remove the arbitrary limitation of 1024 characters per return string and
read complete lines instead. Required for device_show.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Jan Kiszka 8d7e84571b QMP: Teach basic capability negotiation to python example
As sending "qmp_capabilities" on session start became mandatory, both
python examples were broken.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 14:27:13 -03:00
Jan Kiszka 8ac470c1f9 monitor: Establish cmd flags and convert the async tag
As we want to add more flags to monitor commands, convert the only so
far existing one accordingly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 13:58:38 -03:00
Jan Kiszka 3b6dbf2772 monitor: Fix command completion vs. boolean switches
We now have to move forward to the next argument type via next_arg_type.
This patch fixes completion for 'eject' and maybe also other commands.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 13:58:38 -03:00
Jan Kiszka 03a63484a6 monitor: Fix leakage during completion processing
Given too many arguments or an invalid command, we were leaking the
duplicated argument strings.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-07-01 13:58:38 -03:00
Aurelien Jarno 5c13fdfd03 target-mips: split load and store
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-01 07:48:17 +02:00
Kevin Wolf 449041d4db qdev-properties: Fix (u)intXX parsers
scanf calls must not use PRI constants, they have probably the wrong size and
corrupt memory. We could replace them by SCN ones, but strtol is simpler than
scanf here anyway. While at it, also fix the parsers to reject garbage after
the number ("4096xyz" was accepted before).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Richard Henderson <rth@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 22:58:55 +02:00
Shahar Havivi b373a63a2e Return usb device to host on exit
Signed-off-by: Shahar Havivi <shaharh@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 22:51:17 +02:00
Shahar Havivi 00ff227a32 Return usb device to host on usb_del command
Signed-off-by: Shahar Havivi <shaharh@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 22:51:09 +02:00
Amit Shah 03c71553ad net: Fix VM start with '-net none'
Commit 50e32ea8f3 changed the behaviour
for the return type of net_client_init() when a nic type with no init
method was specified. 'none' is one such nic type. Instead of returning
0, which gets interpreted as an index into the nd_table[] array, we
switched to returning -1, which signifies an error as well.

That broke VM start with '-net none'. Testing was only done with the
monitor command 'pci_add', which doesn't fail.

The correct fix would still be to return 0+ values from
net_client_init() only when the return value can be used as an index to
refer to an entry in nd_table[]. With the current code, callers can
erroneously poke into nd_table[0] when -net nic is used, which can lead
to badness.

However, this commit just returns to the previous behaviour before the
offending commit.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 22:35:57 +02:00
Jan Kiszka ab5ea55805 x86: svm: Always clear event_inj on vmexit
We currently only clear SVM_EVTINJ_VALID after successful interrupt
delivery. This apparently does not match real hardware which clears the
whole event_inj field on every vmexit, including unsuccessful interrupt
delivery.

Reported-by: Erik van der Kouwe <vdkouwe@cs.vu.nl>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 20:59:53 +02:00
TeLeMan 6881dd5f19 usb-uhci: fix commit 8e65b7c049 for vmstate
The commit 8e65b7c049 introduced
expire_time of UHCIState. But expire_time is not in vmstate, the
second uhci_frame_timer will not be fired immediately after loadvm.

Signed-off-by: TeLeMan <geleman@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 20:43:54 +02:00
cmchao c1ff227b91 hw/omap : make local function static and remove declaration from header
Signed-off-by: cmchao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 20:41:38 +02:00
cmchao 02d7434111 hw/omap1.c : separate uart module
Signed-off-by: cmchao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 20:41:37 +02:00
cmchao 2c1d9ecb22 hw/omwp2.c : separate l4 interconnect module
Signed-off-by: cmchao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 20:41:37 +02:00
cmchao cc9577cfb7 hw/omap2.c : separate tap module(Test-Chip-level)
Signed-off-by: cmchao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 20:41:37 +02:00
cmchao 2d08cc7c3f hw/omap2.c : separate spi module
Signed-off-by: cmchao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 20:41:37 +02:00