sim-card
/
qemu
Archived
10
0
Fork 0
Commit Graph

939 Commits

Author SHA1 Message Date
Blue Swirl 9b164805a3 Fix mingw32 build
mkdir() only takes path argument on mingw32:

  CC    i386-softmmu/vl.o
/src/qemu/vl.c: In function 'qmp_add_default':
/src/qemu/vl.c:3763: error: too many arguments to function 'mkdir'
/src/qemu/vl.c:3769: error: too many arguments to function 'mkdir'

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-20 08:26:27 +00:00
Anthony Liguori 3290c4aac5 Introduce a default qmp session
Basically, -qmp unix:%{home}/.qemu/qmp/%{uuid}.sock,server,nowait

%{uuid} will be -uuid if it's specified, otherwise, if libuuid is available,
we generate a uuid.  If it's not available, we don't create one.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-19 15:27:39 -05:00
Anthony Liguori d49f626ed0 qmp: don't make -qmp disable the default monitor
Instead, we introduce a default_qmp flag.  We don't use it yet, but will in the
next patch.

This has a user-visible impact as specifying just -qmp will now also show a
monitor on the 'vc'.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-19 15:27:39 -05:00
Anthony Liguori d7234f4d7e Convert atexit users to exit_notifier
All of these users have global state so we really don't see a benefit from
exit_notifier.  However, using exit_notifier means that there's one less
justification for having global state in the first place.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-19 15:27:38 -05:00
Anthony Liguori 3b6304f706 Add exit notifiers
Like atexit() but with state

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-19 15:27:38 -05:00
Juan Quintela 4bed983730 Handle deleted IOHandlers in a single buffer
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-19 15:27:27 -05:00
Juan Quintela 7b27a769f1 rename IOCanRWHandler to IOCanReadHandler
It was always only used for reads

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-19 15:27:27 -05:00
Juan Quintela 31d4ee6cf6 Convert io handlers to QLIST
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-19 15:27:27 -05:00
Paolo Bonzini db1a49726c split out qemu-timer.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:16:15 -05:00
Paolo Bonzini d6f4ade214 disentangle tcg and deadline calculation
Just tell main_loop_wait whether to be blocking or nonblocking, so that
there is no need to call qemu_cpus_have_work from the timer subsystem.
Instead, tcg_cpu_exec can say "we want the main loop not to block because
we have stuff to do".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:54 -05:00
Paolo Bonzini 16b151c393 place together more #ifdef CONFIG_IOTHREAD blocks
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:54 -05:00
Paolo Bonzini 1b48824fa0 move vmstate registration of vmstate_timers earlier
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini a2aaa079df new function qemu_icount_delta
Tweaking the rounding in qemu_next_deadline ensures that there's
no change whatsoever.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini 6325504302 add qemu_alarm_pending
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini e2a7bb4b15 add qemu_icount_round
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini 4e3de9e954 centralize handling of -icount
A simple patch to place together all handling of -icount.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini 972abbe03b introduce and use qemu_clock_enable
By adding the possibility to turn on/off a clock, yet another
incestuous relationship between timers and CPUs can be disentangled.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini 8c04ba55f9 change qemu_run_timers interface
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini b696482754 extract timer handling out of main_loop_wait
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini 3a720b14b9 remove qemu_rearm_alarm_timer from main loop
Make the timer subsystem register its own callback instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini 1db89e9123 tweak qemu_notify_event
Instead of testing specially next_cpu in host_alarm_handler, just do
that in qemu_notify_event.  The idea is, if we are not running (or
not yet running) target CPU code, prepare things so that the execution
loop is exited asap; just make that clear.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini 7a5e583811 do not use qemu_event_increment outside qemu_notify_event
qemu_notify_event in the non-iothread case is only stopping the current
CPU.  However, if the CPU is idle and the main loop is in the select
call then a call to qemu_event_increment is needed too (as done in
host_alarm_handler).  Since in general one doesn't know whether the CPU
is executing or not, it is a safe bet to always do qemu_event_increment.

Another way to see it: after this patch qemu_event_increment is the
"common part" of qemu_notify_event for both the CONFIG_IOTHREAD and
!CONFIG_IOTHREAD cases, which makes sense.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini 1828be316f more alarm timer cleanup
The timer_alarm_pending variable is related to the alarm timer but not
placed in the struct.  Also, in qemu_mod_timer the wrong flag was being
tested: the timer is rearmed in the alarm timer "bottom half", so the
right flag to test there is the "pending" flag.

Finally, I hoisted the NULL checks from alarm_has_dynticks to
host_alarm_handler.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini cd48d7e8f3 only one flag is needed for alarm_timer
The ALARM_FLAG_DYNTICKS can be testing simply by checking if there is
a rearm function.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:53 -05:00
Paolo Bonzini 291defbcda fix error in win32_rearm_timer
The TIME_ONESHOT and TIME_PERIODIC flags are mutually exclusive.
The code after the patch matches the flags used in win32_start_timer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:52 -05:00
Paolo Bonzini 9aea10297f avoid dubiously clever code in win32_start_timer
The code is initializing an unsigned int to UINT_MAX using "-1", so that
the following always-true comparison seems to be always-false at a
first look.  Since alarm timer initializations are never nested, it is
simpler to unconditionally store the result of timeGetDevCaps into
data->period.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:14:52 -05:00
Anthony Liguori 4a39943bd1 Merge remote branch 'markus/qerror' into staging 2010-03-17 09:44:37 -05:00
Markus Armbruster 8212c64f0e qemu-option: Move the implied first name into QemuOptsList
We sometimes permit omitting the first option name, for example
-device foo is short for -device driver=foo.  The name to use
("driver" in the example) is passed as argument to qemu_opts_parse().
For each QemuOptsList, we use at most one such name.

Move the name into QemuOptsList, and pass whether to permit the
abbreviation.  This ensures continued consistency, and simplifies the
commit after next in this series.
2010-03-16 17:45:34 +01:00
Markus Armbruster 0f0bc3f1d5 error: Track locations on command line
New LOC_CMDLINE.  Use it for tracking option with argument in
lookup_opt().  We now report errors like this

    qemu: -device smbus-eeprom: Did not find I2C bus for smbus-eeprom
2010-03-16 16:58:32 +01:00
Markus Armbruster cf5a65aaaf error: Track locations in configuration files
New LOC_FILE.  Use it for tracking file name and line number in
qemu_config_parse().  We now report errors like

    qemu:foo.conf:42: Did not find I2C bus for smbus-eeprom

In particular, gems like this message:

    -device: no driver specified

become almost nice now:

    qemu:foo.conf:44: -device: no driver specified

(A later commit will get rid of the bogus -device:)
2010-03-16 16:58:32 +01:00
Markus Armbruster 65abca0a34 error: Include the program name in error messages to stderr 2010-03-16 16:58:32 +01:00
Markus Armbruster 1ecda02b24 error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline.  Strip it it
from its arguments.

This fixes a few error messages lacking a newline:
net_handle_fd_param()'s "No file descriptor named %s found", and
tap_open()'s "vnet_hdr=1 requested, but no kernel support for
IFF_VNET_HDR available" (all three versions).

There's one place that passes arguments without newlines
intentionally: load_vmstate().  Fix it up.
2010-03-16 16:58:32 +01:00
Markus Armbruster 6e4f984cb9 error: Simplify error sink setup
qemu_error_sink can either point to a monitor or a file.  In practice,
it always points to the current monitor if we have one, else to
stderr.  Simply route errors to the current monitor or else to stderr,
and remove qemu_error_sink along with the functions to control it.

Actually, the old code switches the sink slightly later, in
handle_user_command() and handle_qmp_command(), than it gets switched
now, implicitly, by setting the current monitor in monitor_read() and
monitor_control_read().  Likewise, it switches back slightly earlier
(same places).  Doesn't make a difference, because there are no calls
of qemu_error() in between.
2010-03-16 16:55:05 +01:00
Markus Armbruster 03cd4655cb savevm: Fix -loadvm to report errors to stderr, not the monitor
A monitor may not even exist.

Change load_vmstate() to use qemu_error() instead of monitor_printf().
Parameter mon is now unused, remove it.
2010-03-16 16:55:05 +01:00
Jan Kiszka 18141ed67f Don't set default monitor when there is a mux'ed one
This fixes eg. "-nographic -serial mon:stdio [-serial ...]".

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-14 22:43:35 +01:00
Luiz Capitulino 81d9b784df QMP: Really move the RESET event to qemu_system_reset()
Something bad has happened in the merge of commit 0ee44250, as
the log message says it's supposed to be in qemu_system_reset()
but it is do_vm_stop().

Possibly, it was a problem with the conflict resolution with
ea375f9a (which has been merged first).

This commit moves (again) the RESET event into qemu_system_reset().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-10 09:06:55 -06:00
Luiz Capitulino 80cd34787f QMP: Introduce RTC_CHANGE event
Emitted whenever the RTC time changes.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-08 11:30:09 -06:00
Luiz Capitulino 51a3bd71b3 QMP: Drop DEBUG event
This event has been introduced in the first round of QMP commits,
turns out that it's based on the usage of the EXCP_DEBUG macro,
which has discussable semantics when exposed through QMP.

As libvirt doesn't use this, let's just drop it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-08 11:30:08 -06:00
Luiz Capitulino 0ee442502b QMP: Move RESET event into qemu_system_reset()
Nothing will change as that function is currently only called by
the main loop code, but it's the right place for the RESET event,
as it's where the reset is actually performed.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-08 11:30:08 -06:00
Luiz Capitulino 6b8f8fff78 QMP: Move STOP event into do_vm_stop()
I've introduced the STOP event in the main loop, this is wrong
as it will be only emitted if the io thread is enabled.

This fixes that by moving the STOP event to do_vm_stop().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-08 11:30:01 -06:00
Jan Kiszka ea375f9ab8 KVM: Rework VCPU state writeback API
This grand cleanup drops all reset and vmsave/load related
synchronization points in favor of four(!) generic hooks:

- cpu_synchronize_all_states in qemu_savevm_state_complete
  (initial sync from kernel before vmsave)
- cpu_synchronize_all_post_init in qemu_loadvm_state
  (writeback after vmload)
- cpu_synchronize_all_post_init in main after machine init
- cpu_synchronize_all_post_reset in qemu_system_reset
  (writeback after system reset)

These writeback points + the existing one of VCPU exec after
cpu_synchronize_state map on three levels of writeback:

- KVM_PUT_RUNTIME_STATE (during runtime, other VCPUs continue to run)
- KVM_PUT_RESET_STATE   (on synchronous system reset, all VCPUs stopped)
- KVM_PUT_FULL_STATE    (on init or vmload, all VCPUs stopped as well)

This level is passed to the arch-specific VCPU state writing function
that will decide which concrete substates need to be written. That way,
no writer of load, save or reset functions that interact with in-kernel
KVM states will ever have to worry about synchronization again. That
also means that a lot of reasons for races, segfaults and deadlocks are
eliminated.

cpu_synchronize_state remains untouched, just as Anthony suggested. We
continue to need it before reading or writing of VCPU states that are
also tracked by in-kernel KVM subsystems.

Consequently, this patch removes many cpu_synchronize_state calls that
are now redundant, just like remaining explicit register syncs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-03-04 00:29:28 -03:00
Marcelo Tosatti c902760fb2 Add option to use file backed guest memory
Port qemu-kvm's -mem-path and -mem-prealloc options. These are useful
for backing guest memory with huge pages via hugetlbfs.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
CC: john cooper <john.cooper@redhat.com>
2010-03-04 00:28:47 -03:00
Anthony Liguori 724c689357 Merge remote branch 'qemu-kvm/uq/master' into staging 2010-02-22 16:16:22 -06:00
john cooper b5ec5ce0e3 Add cpu model configuration support..
This is a reimplementation of prior versions which adds
the ability to define cpu models for contemporary processors.
The added models are likewise selected via -cpu <name>,
and are intended to displace the existing convention
of "-cpu qemu64" augmented with a series of feature flags.

A primary motivation was determination of a least common
denominator within a given processor class to simplify guest
migration.  It is still possible to modify an arbitrary model
via additional feature flags however the goal here was to
make doing so unnecessary in typical usage.  The other
consideration was providing models names reflective of
current processors.  Both AMD and Intel have reviewed the
models in terms of balancing generality of migration vs.
excessive feature downgrade relative to released silicon.

This version of the patch replaces the prior hard wired
definitions with a configuration file approach for new
models.  Existing models are thus far left as-is but may
easily be transitioned to (or may be overridden by) the
configuration file representation.

Proposed new model definitions are provided here for current
AMD and Intel processors.  Each model consists of a name
used to select it on the command line (-cpu <name>), and a
model_id which corresponds to a least common denominator
commercial instance of the processor class.

A table of names/model_ids may be queried via "-cpu ?model":

        :
    x86       Opteron_G3  AMD Opteron 23xx (Gen 3 Class Opteron)
    x86       Opteron_G2  AMD Opteron 22xx (Gen 2 Class Opteron)
    x86       Opteron_G1  AMD Opteron 240 (Gen 1 Class Opteron)
    x86          Nehalem  Intel Core i7 9xx (Nehalem Class Core i7)
    x86           Penryn  Intel Core 2 Duo P9xxx (Penryn Class Core 2)
    x86           Conroe  Intel Celeron_4x0 (Conroe/Merom Class Core 2)
        :

Also added is "-cpu ?dump" which exhaustively outputs all config
data for all defined models, and "-cpu ?cpuid" which enumerates
all qemu recognized CPUID feature flags.

The pseudo cpuid flag 'check' when added to the feature flag list
will warn when feature flags (either implicit in a cpu model or
explicit on the command line) would have otherwise been quietly
unavailable to a guest:

    # qemu-system-x86_64 ... -cpu Nehalem,check
    warning: host cpuid 0000_0001 lacks requested flag 'sse4.2|sse4_2' [0x00100000]
    warning: host cpuid 0000_0001 lacks requested flag 'popcnt' [0x00800000]

A similar 'enforce' pseudo flag exists which in addition
to the above causes qemu to error exit if requested flags are
unavailable.

Configuration data for a cpu model resides in the target config
file which by default will be installed as:

    /usr/local/etc/qemu/target-<arch>.conf

The format of this file should be self explanatory given the
definitions for the above six models and essentially mimics
the structure of the static x86_def_t x86_defs.

Encoding of cpuid flags names now allows aliases for both the
configuration file and the command line which reconciles some
Intel/AMD/Linux/Qemu naming differences.

This patch was tested relative to qemu.git.

Signed-off-by: john cooper <john.cooper@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-22 16:16:17 -06:00
Marcelo Tosatti cc84de9570 kvm: consume internal signal with sigtimedwait
Change the way the internal qemu signal, used for communication between
iothread and vcpus, is handled.

Block and consume it with sigtimedwait on the outer vcpu loop, which
allows more precise timing control.

Change from standard signal (SIGUSR1) to real-time one, so multiple
signals are not collapsed.

Set the signal number on KVM's in-kernel allowed sigmask.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-02-22 10:58:33 +02:00
Marcelo Tosatti fed6c3444c kvm specific wait_io_event
In KVM mode the global mutex is released when vcpus are executing,
which means acquiring the fairness mutex is not required.

Also for KVM there is one thread per vcpu, so tcg_has_work is meaningless.

Add a new qemu_wait_io_event_common function to hold common code
between TCG/KVM.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-02-22 10:58:33 +02:00
Marcelo Tosatti adc8c965c4 block SIGCHLD in vcpu thread(s)
Otherwise a vcpu thread can run the sigchild handler causing
waitpid() from iothread to fail.

Signed-off-by: Marcelo Tosatti <mtosa...@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-02-22 10:58:33 +02:00
Paolo Bonzini 98b5008081 move default allocator to console.c
Moving stuff in console.c to avoid the need for prototypes makes
this patch a bit bigger, but there's no change in the code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:18:16 -06:00
Paolo Bonzini 9441987446 remove knowledge of defaultallocator_free_displaysurface from sdl.c
Let register_displayallocator hand over the old width/height to the new
allocator.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:18:16 -06:00
Paolo Bonzini b473df6e6a use lazy initialization for display_state
Ensure initialization of a dumb display, if needed, by making
all accesses go through get_displaystate.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:18:16 -06:00