qemu
15 years agoThe _exit syscall is used for both thread termination in NPTL applications,
pbrook [Sat, 7 Mar 2009 15:24:59 +0000 (15:24 +0000)]
The _exit syscall is used for both thread termination in NPTL applications,
and process termination in legacy applications.  Try to guess which we want
based on the presence of multiple threads.

Also implement locking when modifying the CPU list.

Signed-off-by: Paul Brook <paul@codesourcery.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6735 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix BSD user
blueswir1 [Sat, 7 Mar 2009 10:51:36 +0000 (10:51 +0000)]
Fix BSD user

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6734 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix sparc64-softmmu breakage from r6711
blueswir1 [Sat, 7 Mar 2009 10:50:46 +0000 (10:50 +0000)]
Fix sparc64-softmmu breakage from r6711

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6733 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agopc-bios/Makefile: add a rule to produce dtb files
aurel32 [Sat, 7 Mar 2009 04:56:06 +0000 (04:56 +0000)]
pc-bios/Makefile: add a rule to produce dtb files

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6732 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAdd more missing files
aliguori [Fri, 6 Mar 2009 23:44:29 +0000 (23:44 +0000)]
Add more missing files

Major FAIL with my checkin scripts.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6731 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAdd missing file from previous commit
aliguori [Fri, 6 Mar 2009 22:47:54 +0000 (22:47 +0000)]
Add missing file from previous commit

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6730 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix race condition on access to env->interrupt_request
aurel32 [Fri, 6 Mar 2009 21:48:00 +0000 (21:48 +0000)]
Fix race condition on access to env->interrupt_request

env->interrupt_request is accessed as the bit level from both main code
and signal handler, making a race condition possible even on CISC CPU.
This causes freeze of QEMU under high load when running the dyntick
clock.

The patch below move the bit corresponding to CPU_INTERRUPT_EXIT in a
separate variable, declared as volatile sig_atomic_t, so it should be
work even on RISC CPU.

We may want to move the cpu_interrupt(env, CPU_INTERRUPT_EXIT) case in
its own function and get rid of CPU_INTERRUPT_EXIT. That can be done
later, I wanted to keep the patch short for easier review.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6728 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoRemove tabs introduced from VNC ACL series
aliguori [Fri, 6 Mar 2009 20:27:40 +0000 (20:27 +0000)]
Remove tabs introduced from VNC ACL series

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6727 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSupport ACLs for controlling VNC access ("Daniel P. Berrange")
aliguori [Fri, 6 Mar 2009 20:27:37 +0000 (20:27 +0000)]
Support ACLs for controlling VNC access ("Daniel P. Berrange")

This patch introduces a generic internal API for access control lists
to be used by network servers in QEMU. It adds support for checking
these ACL in the VNC server, in two places. The first ACL is for the
SASL authentication mechanism, checking the SASL username. This ACL
is called 'vnc.username'. The second is for the TLS authentication
mechanism, when x509 client certificates are turned on, checking against
the Distinguished Name of the client. This ACL is called 'vnc.x509dname'

The internal API provides for an ACL with the following characteristics

 - A unique name, eg  vnc.username, and vnc.x509dname.
 - A default policy, allow or deny
 - An ordered series of match rules, with allow or deny policy

If none of the match rules apply, then the default policy is
used.

There is a monitor API to manipulate the ACLs, which I'll describe via
examples

  (qemu) acl show vnc.username
  policy: allow
  (qemu) acl policy vnc.username denya
  acl: policy set to 'deny'
  (qemu) acl allow vnc.username fred
  acl: added rule at position 1
  (qemu) acl allow vnc.username bob
  acl: added rule at position 2
  (qemu) acl allow vnc.username joe 1
  acl: added rule at position 1
  (qemu) acl show vnc.username
  policy: deny
  0: allow fred
  1: allow joe
  2: allow bob

  (qemu) acl show vnc.x509dname
  policy: allow
  (qemu) acl policy vnc.x509dname deny
  acl: policy set to 'deny'
  (qemu) acl allow vnc.x509dname C=GB,O=ACME,L=London,CN=*
  acl: added rule at position 1
  (qemu) acl allow vnc.x509dname C=GB,O=ACME,L=Boston,CN=bob
  acl: added rule at position 2
  (qemu) acl show vnc.x509dname
  policy: deny
  0: allow C=GB,O=ACME,L=London,CN=*
  1: allow C=GB,O=ACME,L=Boston,CN=bob

By default the VNC server will not use any ACLs, allowing access to
the server if the user successfully authenticates. To enable use of
ACLs to restrict user access, the ',acl' flag should be given when
starting QEMU. The initial ACL activated will be a 'deny all' policy
and should be customized using monitor commands.

eg enable SASL auth and ACLs

    qemu ....  -vnc localhost:1,sasl,acl

The next patch will provide a way to load a pre-defined ACL when
starting up

 Makefile        |    6 +
 b/acl.c         |  185 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 b/acl.h         |   74 ++++++++++++++++++++++
 configure       |   18 +++++
 monitor.c       |   95 ++++++++++++++++++++++++++++
 qemu-doc.texi   |   49 ++++++++++++++
 vnc-auth-sasl.c |   16 +++-
 vnc-auth-sasl.h |    7 ++
 vnc-tls.c       |   19 +++++
 vnc-tls.h       |    3
 vnc.c           |   21 ++++++
 vnc.h           |    3
 12 files changed, 491 insertions(+), 5 deletions(-)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6726 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoInclude auth credentials in 'info vnc' ("Daniel P. Berrange")
aliguori [Fri, 6 Mar 2009 20:27:32 +0000 (20:27 +0000)]
Include auth credentials in 'info vnc' ("Daniel P. Berrange")

This patch extends the 'info vnc' monitor output to include information
about the VNC client authentication credentials.

For clients authenticated using SASL, this will output the username.

For clients authenticated using x509 certificates, this will output
the x509 distinguished name.

Auth can be stacked, so both username & x509 dname may be shown.

    Server:
         address: 0.0.0.0:5902
            auth: vencrypt+x509+sasl
    Client:
         address: 10.33.6.67:38621
      x509 dname: C=GB,O=ACME,L=London,ST=London,CN=localhost
        username: admin
    Client:
         address: 10.33.6.63:38620
      x509 dname: C=GB,O=ACME,L=London,ST=London,CN=localhost
        username: admin

 vnc-tls.c |   17 +++++++++++++++++
 vnc-tls.h |    3 +++
 vnc.c     |   19 +++++++++++++++++--
 3 files changed, 37 insertions(+), 2 deletions(-)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6725 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAdd SASL authentication support ("Daniel P. Berrange")
aliguori [Fri, 6 Mar 2009 20:27:28 +0000 (20:27 +0000)]
Add SASL authentication support ("Daniel P. Berrange")

This patch adds the new SASL authentication protocol to the VNC server.

It is enabled by setting the 'sasl' flag when launching VNC. SASL can
optionally provide encryption via its SSF layer, if a suitable mechanism
is configured (eg, GSSAPI/Kerberos, or Digest-MD5).  If an SSF layer is
not available, then it should be combined with the x509 VNC authentication
protocol which provides encryption.

eg, if using GSSAPI

   qemu -vnc localhost:1,sasl

eg if using  TLS/x509 for encryption

   qemu -vnc localhost:1,sasl,tls,x509

By default the Cyrus SASL library will look for its configuration in
the file /etc/sasl2/qemu.conf.  For non-root users, this can be overridden
by setting the SASL_CONF_PATH environment variable, eg to make it look in
$HOME/.sasl2.  NB unprivileged users may not have access to the full range
of SASL mechanisms, since some of them require some administrative privileges
to configure. The patch includes an example SASL configuration file which
illustrates config for GSSAPI and Digest-MD5, though it should be noted that
the latter is not really considered secure any more.

Most of the SASL authentication code is located in a separate source file,
vnc-auth-sasl.c.  The main vnc.c file only contains minimal integration
glue, specifically parsing of command line flags / setup, and calls to
start the SASL auth process, to do encoding/decoding for data.

There are several possible stacks for reading & writing of data, depending
on the combo of VNC authentication methods in use

 - Clear.    read/write straight to socket
 - TLS.      read/write via GNUTLS helpers
 - SASL.     encode/decode via SASL SSF layer, then read/write to socket
 - SASL+TLS. encode/decode via SASL SSF layer, then read/write via GNUTLS

Hence, the vnc_client_read & vnc_client_write methods have been refactored
a little.

   vnc_client_read:  main entry point for reading, calls either

       - vnc_client_read_plain   reading, with no intermediate decoding
       - vnc_client_read_sasl    reading, with SASL SSF decoding

   These two methods, then call vnc_client_read_buf(). This decides
   whether to write to the socket directly or write via GNUTLS.

The situation is the same for writing data. More extensive comments
have been added in the code / patch. The vnc_client_read_sasl and
vnc_client_write_sasl method implementations live in the separate
vnc-auth-sasl.c file.

The state required for the SASL auth mechanism is kept in a separate
VncStateSASL struct, defined in vnc-auth-sasl.h and included in the
main VncState.

The configure script probes for SASL and automatically enables it
if found, unless --disable-vnc-sasl was given to override it.

 Makefile            |    7
 Makefile.target     |    5
 b/qemu.sasl         |   34 ++
 b/vnc-auth-sasl.c   |  626 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 b/vnc-auth-sasl.h   |   67 +++++
 configure           |   34 ++
 qemu-doc.texi       |   97 ++++++++
 vnc-auth-vencrypt.c |   12
 vnc.c               |  249 ++++++++++++++++++--
 vnc.h               |   31 ++
 10 files changed, 1129 insertions(+), 33 deletions(-)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6724 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMove TLS auth into separate file ("Daniel P. Berrange")
aliguori [Fri, 6 Mar 2009 20:27:23 +0000 (20:27 +0000)]
Move TLS auth into separate file ("Daniel P. Berrange")

This patch refactors the existing TLS code to make the main VNC code
more managable. The code moves to two new files

 - vnc-tls.c: generic helpers for TLS handshake & credential setup
 - vnc-auth-vencrypt.c: the actual VNC TLS authentication mechanism.

The reason for this split is that there are other TLS based auth
mechanisms which we may like to use in the future. These can all
share the same vnc-tls.c routines. In addition this will facilitate
anyone who may want to port the vnc-tls.c file to allow for choice
of GNUTLS & NSS for impl.

The TLS state is moved out of the VncState struct, and into a separate
VncStateTLS struct, defined in vnc-tls.h. This is then referenced from
the main VncState. End size of the struct is the same, but it keeps
things a little more managable.

The vnc.h file gains a bunch more function prototypes, for functions
in vnc.c that were previously static, but now need to be accessed
from the separate auth code files.

The only TLS related code still in the main vl.c is the command line
argument handling / setup, and the low level I/O routines calling
gnutls_send/recv.

 Makefile              |   11
 b/vnc-auth-vencrypt.c |  167 ++++++++++++++
 b/vnc-auth-vencrypt.h |   33 ++
 b/vnc-tls.c           |  414 +++++++++++++++++++++++++++++++++++
 b/vnc-tls.h           |   70 ++++++
 vnc.c                 |  581 +++-----------------------------------------------
 vnc.h                 |   76 ++++--
 7 files changed, 780 insertions(+), 572 deletions(-)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6723 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMove VNC structs into header file ("Daniel P. Berrange")
aliguori [Fri, 6 Mar 2009 20:27:13 +0000 (20:27 +0000)]
Move VNC structs into header file ("Daniel P. Berrange")

This patch moves the definitions of VncState and VncDisplay structs
out into a vnc.h header file. This is to allow the code for TLS
and SASL auth mechanisms to be moved out of the main vnc.c file.

 vnc.c |  109 ------------------------------------------------
 vnc.h |  149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 148 insertions(+), 110 deletions(-)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6722 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoRefactor keymap code to avoid duplication ("Daniel P. Berrange")
aliguori [Fri, 6 Mar 2009 20:27:10 +0000 (20:27 +0000)]
Refactor keymap code to avoid duplication ("Daniel P. Berrange")

Each of the graphical frontends #include a .c file, for keymap code
resulting in duplicated definitions & duplicated compiled code. A
couple of small changes allowed this to be sanitized, so instead of
doing a #include "keymaps.c", duplicating all code, we can have a
shared keymaps.h file, and only compile code once. This allows the
next patch to move the VncState struct out into a header file without
causing clashing definitions.

 Makefile      |    9 +++++---
 b/keymaps.h   |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 curses.c      |    3 --
 curses_keys.h |    9 +++-----
 keymaps.c     |   45 ++++++++++++++++---------------------------
 sdl.c         |    3 --
 sdl_keysym.h  |    7 ++----
 vnc.c         |    5 +---
 vnc_keysym.h  |    7 ++----
 9 files changed, 97 insertions(+), 51 deletions(-)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6721 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoEnhance 'info vnc' monitor output ("Daniel P. Berrange")
aliguori [Fri, 6 Mar 2009 20:27:05 +0000 (20:27 +0000)]
Enhance 'info vnc' monitor output ("Daniel P. Berrange")

The current 'info vnc' monitor output just displays the VNC server address
as provided by the -vnc command line flag. This isn't particularly useful
since it doesn't tell you what VNC is actually listening on. eg, if you
use '-vnc :1' it is useful to know whether this translated to '0.0.0.0:5901'
or chose IPv6 ':::5901'.  It is also useful to know the address of the
client that is currently connected. It is also useful to know the active
authentication (if any).

This patch tweaks the monitor output to look like:

   (qemu) info vnc
    Server:
         address: 0.0.0.0:5902
            auth: vencrypt+x509
    Client: none

And when 2 clients are connected

   (qemu) info vnc
    Server:
         address: 0.0.0.0:5902
            auth: vencrypt+x509
    Client:
         address: 10.33.6.67:38621
    Client:
         address: 10.33.6.63:38620

More data will be added to this later in the patch series...

The 'addr_to_string' helper method in this patch is overly generic
for the needs of this patch alone. This is because it will be re-used
by the later SASL patches in this series, where the flexibility is
important.

 vnc.c |  137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 127 insertions(+), 10 deletions(-)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6720 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix bug in TLS authentication ("Daniel P. Berrange")
aliguori [Fri, 6 Mar 2009 20:27:02 +0000 (20:27 +0000)]
Fix bug in TLS authentication ("Daniel P. Berrange")

This patch was previously posted here:

  http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00820.html

In the case where the TLS handshake does *not* block on I/O, QEMU
sends the next 'start sub-auth' message twice. This seriously confuses
the VNC client :-) Fortunately the chances of the handshake not blocking
are close to zero for a TCP socket, which is why it has not been noticed
thus far. Even with both client & server on localhost, I can only hit the
bug 1 time in 20.

NB, the diff context here is not too informative. If you look at the
full code you'll see that a few lines early we called vnc_start_tls()
which called vnc_continue_handshake() which called the method
start_auth_vencrypt_subauth(). Hence, fixing the bug, just involves
removing the 2nd bogus call to start_auth_vencrypt_subauth() as per
this patch.

 vnc.c |    8 --------
 1 file changed, 8 deletions(-)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6719 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Pass-through for gdbstub (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:55 +0000 (23:01 +0000)]
monitor: Pass-through for gdbstub (Jan Kiszka)

Create a monitor terminal and pass it through the gdbstub. This allows
to use gdb's monitor command to access the QEMU monitor. Works for all
commands except for non-detached migration and password retrieval (user
will receive error messages instead).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6718 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Introduce MONITOR_USE_READLINE flag (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:51 +0000 (23:01 +0000)]
monitor: Introduce MONITOR_USE_READLINE flag (Jan Kiszka)

This allows to create monitor terminals that do not make use of the
interactive readline back-end but rather send complete commands. The
pass-through monitor interface of the gdbstub will be an example.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6717 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Improve mux'ed console experience (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:47 +0000 (23:01 +0000)]
monitor: Improve mux'ed console experience (Jan Kiszka)

Up to now, you never really knew if you already switched the console
after pressing CTRL-A C or if you mistyped it again. This patch
clarifies the situation by providing a prompt in a new line and
injecting a linebreak when switching away again. For this purpose, the
two events CHR_EVENT_MUX_IN and CHR_EVENT_MUX_OUT are introduced and
distributed on focus switches.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6716 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Decouple terminals (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:42 +0000 (23:01 +0000)]
monitor: Decouple terminals (Jan Kiszka)

Currently all registered (and activate) monitor terminals work in
broadcast mode: Everyone sees what someone else types on some other
terminal and what the monitor reports back. This model is broken when
you have a management monitor terminal that is automatically operated
and some other terminal used for independent guest inspection. Such
additional terminals can be multiplexed device channels or a gdb
frontend connected to QEMU's stub.

Therefore, this patch decouples the buffers and states of all monitor
terminals, allowing the user to operate them independently. It finally
starts to use the 'mon' parameter that was introduced earlier with the
API rework. It also defines the default monitor: the first instantance
that has the MONITOR_IS_DEFAULT flag set, and that is the monitor
created via the "-monitor" command line switch (or "vc" if none is
given).

As the patch requires to rework the monitor suspension interface, it
also takes the freedom to make it "truely" suspending (so far suspending
meant suppressing the prompt, but inputs were still processed).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6715 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Introduce ReadLineState (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:37 +0000 (23:01 +0000)]
monitor: Introduce ReadLineState (Jan Kiszka)

As another step towards decoupled monitor terminals encapsulate the
state of the readline processor in a separate data structure called
ReadLineState and adapt all interfaces appropriately. For now the
monitor continues to instantiate just a single readline state.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6714 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Drop banner hiding (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:33 +0000 (23:01 +0000)]
monitor: Drop banner hiding (Jan Kiszka)

There is no use for the hide/show banner option, and it is applied
inconsistently anyway (or what makes the difference between
 -serial mon:stdio and -nographic for the monitor?). So drop this mode.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6713 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Rework terminal management (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:29 +0000 (23:01 +0000)]
monitor: Rework terminal management (Jan Kiszka)

Remove the static MAX_MON limit by managing monitor terminals in a
linked list.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6712 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Rework API (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:23 +0000 (23:01 +0000)]
monitor: Rework API (Jan Kiszka)

Refactor the monitor API and prepare it for decoupled terminals:
term_print functions are renamed to monitor_* and all monitor services
gain a new parameter (mon) that will once refer to the monitor instance
the output is supposed to appear on. However, the argument remains
unused for now. All monitor command callbacks are also extended by a mon
parameter so that command handlers are able to pass an appropriate
reference to monitor output services.

For the case that monitor outputs so far happen without clearly
identifiable context, the global variable cur_mon is introduced that
shall once provide a pointer either to the current active monitor (while
processing commands) or to the default one. On the mid or long term,
those use case will be obsoleted so that this variable can be removed
again.

Due to the broad usage of the monitor interface, this patch mostly deals
with converting users of the monitor API. A few of them are already
extended to pass 'mon' from the command handler further down to internal
functions that invoke monitor_printf.

At this chance, monitor-related prototypes are moved from console.h to
a new monitor.h. The same is done for the readline API.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6711 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Rework modal password input (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:15 +0000 (23:01 +0000)]
monitor: Rework modal password input (Jan Kiszka)

Currently, waiting for the user to type in some password blocks the
whole VM because monitor_readline starts its own I/O loop. And this loop
also screws up reading passwords from virtual console.

Patch below fixes the shortcomings by using normal I/O processing also
for waiting on a password. To keep to modal property for the monitor
terminal, the command handler is temporarily replaced by a password
handler and a callback infrastructure is established to process the
result before switching back to command mode.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6710 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Break out readline_show_prompt (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:10 +0000 (23:01 +0000)]
monitor: Break out readline_show_prompt (Jan Kiszka)

Break readline_show_prompt out of readline_start so that (re-)printing
the prompt can be controlled in a more fine-grained way.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6709 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Simplify password input mode (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:05 +0000 (23:01 +0000)]
monitor: Simplify password input mode (Jan Kiszka)

Drop the hack to query passwords on all monitor terminals now that they
are requested when the user initially enters 'continue'.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6708 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Rework early disk password inquiry (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:01:01 +0000 (23:01 +0000)]
monitor: Rework early disk password inquiry (Jan Kiszka)

Reading the passwords for encrypted hard disks during early startup is
broken (I guess for quiet a while now):
 - No monitor terminal is ready for input at this point
 - Forcing all mux'ed terminals into monitor mode can confuse other
   users of that channels

To overcome these issues and to lay the ground for a clean decoupling of
monitor terminals, this patch changes the initial password inquiry as
follows:
 - Prevent autostart if there is some encrypted disk
 - Once the user tries to resume the VM, prompt for all missing
   passwords
 - Only resume if all passwords were accepted

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6707 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Report encrypted disks in snapshot mode (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:00:57 +0000 (23:00 +0000)]
monitor: Report encrypted disks in snapshot mode (Jan Kiszka)

If the backing file is encrypted, 'info block' currently does not report
the disk as encrypted. Fix this by using the standard API to check disk
encryption mode. Moreover, switch to a canonical output format.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6706 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agomonitor: Use reasonable default virtual console size (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:00:53 +0000 (23:00 +0000)]
monitor: Use reasonable default virtual console size (Jan Kiszka)

If a target uses a tiny display (like the MusicPal), the default monitor
is currently set to the same size. Fix this by applying the same
defaults like already used serial and virtio consoles.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6705 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoblock: Introduce bdrv_get_encrypted_filename (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:00:48 +0000 (23:00 +0000)]
block: Introduce bdrv_get_encrypted_filename (Jan Kiszka)

Introduce bdrv_get_encrypted_filename service to allow more informative
password prompting.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6704 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoblock: Improve bdrv_iterate (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:00:43 +0000 (23:00 +0000)]
block: Improve bdrv_iterate (Jan Kiszka)

Make bdrv_iterate more useful by passing the BlockDriverState to the
iterator instead of the device name.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6703 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoblock: Polish error handling of brdv_open2 (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:00:29 +0000 (23:00 +0000)]
block: Polish error handling of brdv_open2 (Jan Kiszka)

Make sure that we always delete temporary disk images on error, remove
obsolete malloc error checks and return proper error codes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6702 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agochar-mux: Use separate input buffers (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 23:00:02 +0000 (23:00 +0000)]
char-mux: Use separate input buffers (Jan Kiszka)

Currently, the intermediate input buffer of mux'ed character devices
records data across all sub-devices. This has the side effect that we
easily leak data recorded over one sub-devices to another once we switch
the focus. Avoid data loss and confusion by defining exclusive buffers.

Note: In contrast to the original author's claim, the buffering concept
still breaks down when the fifo of the currently active sub-device is
full. As we cannot accept futher data from this point on without risking
to loose it, we will also miss escape sequences, just like without all
that buffering. In short: There is no reliable escape sequence handling
without infinite buffers or the risk of loosing some data.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6701 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agochar: Fix initial reset (Jan Kiszka)
aliguori [Thu, 5 Mar 2009 22:59:58 +0000 (22:59 +0000)]
char: Fix initial reset (Jan Kiszka)

Recent changes to the graphical console initialization broke the initial
CHR_EVENT_RESET distribution. The reset BHs generated on char device
initialization are now already consumed during machine init (ide init
... -> qemu_aio_wait -> qemu_bh_poll). Therefore, this patch moves the
initial qemu_chr_reset calls into a separate funtion which is called
after machine init.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6700 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix cpuid KVM crash on i386 (Lubomir Rintel)
aliguori [Thu, 5 Mar 2009 19:01:28 +0000 (19:01 +0000)]
Fix cpuid KVM crash on i386 (Lubomir Rintel)

Cpuid should return into vec, not overwrite past address in count.
Changeset 6565 broke this.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6689 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agolsi: add ISTAT1 register read (Ryan Harper)
aliguori [Thu, 5 Mar 2009 19:01:21 +0000 (19:01 +0000)]
lsi: add ISTAT1 register read (Ryan Harper)

SLES10 SP2 installer complains when probing a scsi disk and exits qemu
when failing to read one of the registers.

lsi_scsi: error: readb 0x15

--
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh@us.ibm.com

diffstat output:
 lsi53c895a.c |    2 ++
 1 files changed, 2 insertions(+)

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
---
Subject: [PATCH] lsi: add ISTAT1 register read
From: Ryan Harper <ryanh@us.ibm.com>
Cc: kvm@vger.kernel.org

SLES10 SP2 installer complains when probing a scsi disk and exits qemu when
failing to read one of the registers.

lsi_scsi: error: readb 0x15

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6688 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAdd version information for 0.10.0 release.
aliguori [Wed, 4 Mar 2009 22:47:59 +0000 (22:47 +0000)]
Add version information for 0.10.0 release.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6685 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix "info registers" under kvm.
balrog [Wed, 4 Mar 2009 21:00:07 +0000 (21:00 +0000)]
Fix "info registers" under kvm.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6684 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoUpdate cocoa.m to match new DisplayState code (Samuel Benson)
aliguori [Wed, 4 Mar 2009 19:25:22 +0000 (19:25 +0000)]
Update cocoa.m to match new DisplayState code (Samuel Benson)

Version 2 does as follows:

[1]: Corrects endianness on issues by using native BGR to RGB conversion
[2]: Uses DisplayState accessors for obtaining graphics context information,
     which
[3]: Removes now unused variables, and
[4]: Allows reading of varying color modes (32bit/24/16), and converting to
     native colorspace
[5]: Attempts to keep itself centered on screen (as opposed to bottom right,
     which immediately goes off screen after bios load) on context changes
    (window resizes)

Testing working on i386 (gentoo, Windows 2000) and PPC (debian) guests on PPC
and x86 Macs.

In regards to [4], Windows 2000 displays fine on quick tests, but on the lowest
setting I could test, 16bit color depth at 4bpp, colors are slightly off. I
used gentoo install-x86-minimal-2008.0 in framebuffer mode to test above
setting; the usual grey text is now blue, and Tux appears to be BGR shifted. I
do not know if previous code worked at such a low color setting.

Signed-off-by: Samuel Benson <qemu_ml@digitalescape.info>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6683 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoThe different VFP variants will never occur at the same time, and giving them
pbrook [Wed, 4 Mar 2009 12:18:15 +0000 (12:18 +0000)]
The different VFP variants will never occur at the same time, and giving them
different names confuses GDB, so use org.gnu.gdb.arm.vfp for all of them.

Signed-off-by: Paul Brook <paul@codesourcery.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6682 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoDB-DMA IDE asynchronous I/O
aurel32 [Wed, 4 Mar 2009 07:20:40 +0000 (07:20 +0000)]
DB-DMA IDE asynchronous I/O

Signed-off-by: Laurent Vivier <Laurent@vivier.eu>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6681 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix slavio_intctl.c compile errors (Robert Reif)
blueswir1 [Tue, 3 Mar 2009 20:11:43 +0000 (20:11 +0000)]
Fix slavio_intctl.c compile errors (Robert Reif)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6680 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCRIS: Avoid endless loops for unstested CRIS cpu-state load/save.
edgar_igl [Tue, 3 Mar 2009 18:07:11 +0000 (18:07 +0000)]
CRIS: Avoid endless loops for unstested CRIS cpu-state load/save.

Fix several endless loops.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6679 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix SDL on evdev hosts (Anthony Liguori)
aliguori [Tue, 3 Mar 2009 17:37:21 +0000 (17:37 +0000)]
Fix SDL on evdev hosts (Anthony Liguori)

This patch corrects SDL support on X11 hosts using evdev.  It's losely based
on the previous patch by Dustin Kirkland and the evdev support code in gtk-vnc
written by Daniel Berrange.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6678 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix CVE-2008-0928 - insufficient block device address range checking (Anthony Liguori)
aliguori [Tue, 3 Mar 2009 17:37:16 +0000 (17:37 +0000)]
Fix CVE-2008-0928 - insufficient block device address range checking (Anthony Liguori)

Introduce a growable flag that's set by bdrv_file_open().  Block devices should
never be growable, only files that are being used by block devices.

I went through Fabrice's early comments about the patch that was first applied.
While I disagree with that patch, I also disagree with Fabrice's suggestion.

There's no good reason to do the checks in the block drivers themselves.  It
just increases the possibility that this bug could show up again.  Since we're
calling bdrv_getlength() to determine the length, we're giving the block drivers
a chance to chime in and let us know what range is valid.

Basically, this patch makes the BlockDriver API guarantee that all requests are
within 0..bdrv_getlength() which to me seems like a Good Thing.

What do others think?

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6677 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoDB-DMA cleanup
aurel32 [Tue, 3 Mar 2009 09:14:10 +0000 (09:14 +0000)]
DB-DMA cleanup

Signed-off-by: Laurent Vivier <Laurent@vivier.eu>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6676 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSH4: Fixed last UTLB unused and URB/URC management
aurel32 [Tue, 3 Mar 2009 09:14:01 +0000 (09:14 +0000)]
SH4: Fixed last UTLB unused and URB/URC management

Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6675 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agofix SIGSEGV when USE_KQEMU is defined
aurel32 [Tue, 3 Mar 2009 06:28:26 +0000 (06:28 +0000)]
fix SIGSEGV when USE_KQEMU is defined

Signed-off-by: Alex Ivanov <void@aleksoft.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6674 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agosh4: r2d fix no ide/net case
aurel32 [Tue, 3 Mar 2009 06:23:17 +0000 (06:23 +0000)]
sh4: r2d fix no ide/net case

Fix invalid access/crash when there is no IDE device or NET device.

Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
Tested-by: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6673 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSH4: Fixed last UTLB unused
aurel32 [Tue, 3 Mar 2009 06:14:43 +0000 (06:14 +0000)]
SH4: Fixed last UTLB unused

Version 2 of the patch.

Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6672 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSH4: Fixed last UTLB unused
aurel32 [Tue, 3 Mar 2009 06:12:34 +0000 (06:12 +0000)]
SH4: Fixed last UTLB unused

With my previous patch (the one monitoring tlb), I found that the last
TLB entry was never use. Here a little fix.

Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6671 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSH4: Added monitoring of TLBs
aurel32 [Tue, 3 Mar 2009 06:12:22 +0000 (06:12 +0000)]
SH4: Added monitoring of TLBs

This patch might interest some people trying (as I try to do) to fix
some tlbs for kernel/user space data sharing.

Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6670 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: improve mfcr/mtcrf
aurel32 [Tue, 3 Mar 2009 06:12:14 +0000 (06:12 +0000)]
target-ppc: improve mfcr/mtcrf

- use ctz32 instead of ffs - 1
- small optimisation of mtcrf
- add the name of both opcodes

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6669 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoclean build: Fix remaining sh4 warnings
aurel32 [Tue, 3 Mar 2009 06:12:03 +0000 (06:12 +0000)]
clean build: Fix remaining sh4 warnings

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6668 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix mtcrf/mfcr
malc [Mon, 2 Mar 2009 22:39:39 +0000 (22:39 +0000)]
Fix mtcrf/mfcr

Noticed by Alexander Graf

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6667 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSH: Implement MOVCO.L and MOVLI.L
aurel32 [Mon, 2 Mar 2009 17:13:21 +0000 (17:13 +0000)]
SH: Implement MOVCO.L and MOVLI.L

* target-sh4/cpu.h (struct CPUSH4State): New field ldst.
* target-sh4/translate.c (cpu_ldst): New.
  (sh4_translate_init): Initialize cpu_ldst.
  (_decode_opc): Support MOVCO.L and MOVLI.L.

(Vladimir Prus)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6666 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSet mime-type of pc-bios/mpc8544ds.dtb to application/octet-stream
aurel32 [Mon, 2 Mar 2009 17:10:47 +0000 (17:10 +0000)]
Set mime-type of pc-bios/mpc8544ds.dtb to application/octet-stream

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6665 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agokvm/powerpc: flat device tree files for MPC8544DS
aurel32 [Mon, 2 Mar 2009 16:42:49 +0000 (16:42 +0000)]
kvm/powerpc: flat device tree files for MPC8544DS

mpc8544ds.dts is copied from kerenl.
Non-supported devices has been removed.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6664 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agokvm/powerpc: Add MPC8544DS board support
aurel32 [Mon, 2 Mar 2009 16:42:42 +0000 (16:42 +0000)]
kvm/powerpc: Add MPC8544DS board support

This patch add an emulation of MPC8544DS board.
It can work on All E500 platforms.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6663 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agokvm/powerpc: Add irq support for E500 core
aurel32 [Mon, 2 Mar 2009 16:42:32 +0000 (16:42 +0000)]
kvm/powerpc: Add irq support for E500 core

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6662 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agokvm/powerpc: Add freescale pci controller's support
aurel32 [Mon, 2 Mar 2009 16:42:23 +0000 (16:42 +0000)]
kvm/powerpc: Add freescale pci controller's support

This patch add the emulation of freescale's pci controller for MPC85xx platform.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6661 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agohw/openpic: define list in mpic_init() const
aurel32 [Mon, 2 Mar 2009 16:42:14 +0000 (16:42 +0000)]
hw/openpic: define list in mpic_init() const

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6660 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agokvm/powerpc: Enable MPIC for E500 platform.
aurel32 [Mon, 2 Mar 2009 16:42:04 +0000 (16:42 +0000)]
kvm/powerpc: Enable MPIC for E500 platform.

MPIC and OpenPIC have very similar design.
So a lot of code can be reused.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6659 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoUpdate to OpenBIOS 1.0
blueswir1 [Sun, 1 Mar 2009 20:18:09 +0000 (20:18 +0000)]
Update to OpenBIOS 1.0

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6658 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFlush stdout after printing usage()
blueswir1 [Sat, 28 Feb 2009 20:14:00 +0000 (20:14 +0000)]
Flush stdout after printing usage()

Fixes qemu-arm|grep cpu - with _exit() getting output from qemu --help
is a bit random. Since no atexit() handlers are registered for user mode
emulation, just use exit() instead.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6657 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoImplement HIOR
blueswir1 [Sat, 28 Feb 2009 18:39:42 +0000 (18:39 +0000)]
Implement HIOR

A real 970 CPU starts up with HIOR=0xfff00000 and triggers a reset
exception, basically ending up at IP 0xfff001000.

Later on this HIOR has to be set to 0 by the firmware in order to
enable the OS to handle interrupts on its own.

This patch maps HIOR to exec_prefix, which does the same thing
internally in qemu already.

It replaces the previous patch that changed the 970 initialization
constants, as this is the clean solution to the same problem.

Signed-off-by: Alexander Graf <alex@csgraf.de>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6656 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoChange default werror semantics from "report" to "enospc"
aliguori [Sat, 28 Feb 2009 16:51:01 +0000 (16:51 +0000)]
Change default werror semantics from "report" to "enospc"

Practically speaking, "report" causes a lot of issues when encountering a host
ENOSPC error.  Switch to "enospc" as the default werror semantics.  All host
errors other than ENOSPC will be reported to the guest.  ENOSPC will cause the
VM to stop.  Asynchronous notifications are needed to inform management tools
that some action should be taken but stopping the VM is at least better than
undefined behavior in the guest.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6655 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix typo in gen_qemu_ld32s
blueswir1 [Sat, 28 Feb 2009 08:25:29 +0000 (08:25 +0000)]
Fix typo in gen_qemu_ld32s

When the CPU is in little endian mode, it should load values from RAM
in byte swapped manner. This check is in all the ld and st functions,
but misspelled in gen_qemu_ld32s.

This patch fixes the misspelling and makes ppc64 Linux happier.

Signed-off-by: Alexander Graf <alex@csgraf.de>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6654 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoRemove some warnings and fix windows build.
aliguori [Fri, 27 Feb 2009 22:16:47 +0000 (22:16 +0000)]
Remove some warnings and fix windows build.

Initialize some variables to make GCC happy and switch from using index to
strchr.  index is not available on Windows.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6653 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agochroot and change user support (Nolan)
aliguori [Fri, 27 Feb 2009 22:09:45 +0000 (22:09 +0000)]
chroot and change user support (Nolan)

Resent with fixed formatting.

This patch adds two new command line options:
 -chroot <dir>
 -runas <user>

This is useful for running qemu as an unprivileged user in a chroot
jail.  To avoid having to populate the jail, chrooting happens right
before the start of guest execution.

Signed-off-by: Nolan Leake <nolan@sigbus.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6652 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoUnify default parallel console size (Jan Kiszka)
aliguori [Fri, 27 Feb 2009 20:14:29 +0000 (20:14 +0000)]
Unify default parallel console size (Jan Kiszka)

Serial and virtio consoles already use 80x24 characters as default size,
apply the same to the parallel port consoles.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6651 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAllow additions of ACPI tables from command line (Gleb Natapov)
aliguori [Fri, 27 Feb 2009 20:12:36 +0000 (20:12 +0000)]
Allow additions of ACPI tables from command line (Gleb Natapov)

This is needed to dynamically add SLIC tables with Windows
activation keys.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6650 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agox86: use qemu_log_mask on triple faults (Chris Wright)
aliguori [Fri, 27 Feb 2009 20:05:13 +0000 (20:05 +0000)]
x86: use qemu_log_mask on triple faults (Chris Wright)

replace open coded qemu_log_mask with proper macro

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6649 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoDo not enable a default virtio console
aliguori [Fri, 27 Feb 2009 20:01:39 +0000 (20:01 +0000)]
Do not enable a default virtio console

This upsets Windows installs and right now, virtio console isn't very useful
as a default device.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6648 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agonet socket verify packet size (Dustin Kirkland)
aliguori [Fri, 27 Feb 2009 19:54:01 +0000 (19:54 +0000)]
net socket verify packet size (Dustin Kirkland)

net socket oversized packet

This is a patch being carried by Ubuntu against kvm/qemu.

Verify packet size before performing memcpy().

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6647 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMissing cirrus_invalidate_region() in cirrus_do_copy() (Brian Kress)
aliguori [Fri, 27 Feb 2009 19:53:57 +0000 (19:53 +0000)]
Missing cirrus_invalidate_region() in cirrus_do_copy() (Brian Kress)

After doing a video to video copy, cirrus_do_copy() in cirrus_vga.c does a
conditional call to cirrus_invalidate_region() with an "if (!notify)" test.
However at this point the blt has already been done so it seems like this call
should be made unconditionally.  The patch below fixes some display update
problems when dragging windows under both X (fedora 10 guest) and a Windows XP
guest.

Signed-off-by: Brian Kress <kressb@moose.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6646 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agofix pci net hot-remove (Marcelo Tosatti)
aliguori [Thu, 26 Feb 2009 16:40:31 +0000 (16:40 +0000)]
fix pci net hot-remove (Marcelo Tosatti)

Missing brackets, doh.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6645 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agofix raw_aio_remove (Stefano Stabellini)
aliguori [Thu, 26 Feb 2009 16:40:19 +0000 (16:40 +0000)]
fix raw_aio_remove (Stefano Stabellini)

Hi all,
this small patch fixes a bug in the list iteration of raw_aio_remove.
Cheers,

Stefano

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6644 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix ColdFire fmovem. Free the temporary we just allocated rather than some
pbrook [Tue, 24 Feb 2009 22:17:35 +0000 (22:17 +0000)]
Fix ColdFire fmovem.  Free the temporary we just allocated rather than some
other arbitrary value (e.g. A7).

Signed-off-by: Paul Brook <paul@codesourcery.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6643 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoReally fix ColdFire fdmoved address decoding.
pbrook [Mon, 23 Feb 2009 15:19:34 +0000 (15:19 +0000)]
Really fix ColdFire fdmoved address decoding.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6642 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix ColdFire fdmoved address decoding.
pbrook [Mon, 23 Feb 2009 14:17:33 +0000 (14:17 +0000)]
Fix ColdFire fdmoved address decoding.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6641 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoDarwin: Check for x86_64 only on i386
malc [Mon, 23 Feb 2009 14:11:10 +0000 (14:11 +0000)]
Darwin: Check for x86_64 only on i386

The sysctl variable if we're 64-bit capable only exists on i386. So we should only check it if we're on i386.

This suppresses a warning on PowerPC spotted by Andreas Faerber.

Signed-off-by: Alexander Graf <alex@csgraf.de>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6640 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix unassigned region offsets.
pbrook [Mon, 23 Feb 2009 13:16:07 +0000 (13:16 +0000)]
Fix unassigned region offsets.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6639 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCRIS: Fix remaining build warnings.
edgar_igl [Sun, 22 Feb 2009 11:59:59 +0000 (11:59 +0000)]
CRIS: Fix remaining build warnings.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6638 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoTurn MMU off on reset
blueswir1 [Sat, 21 Feb 2009 17:29:14 +0000 (17:29 +0000)]
Turn MMU off on reset

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6637 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoTurn MMUs and caches off on reset
blueswir1 [Sat, 21 Feb 2009 11:13:51 +0000 (11:13 +0000)]
Turn MMUs and caches off on reset

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6636 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoReload ptimers on reset
blueswir1 [Sat, 21 Feb 2009 11:13:10 +0000 (11:13 +0000)]
Reload ptimers on reset

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6635 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoProperly handle pthread_cond_timedwait timing out
malc [Sat, 21 Feb 2009 05:48:19 +0000 (05:48 +0000)]
Properly handle pthread_cond_timedwait timing out

pthread_cond_timedwait is allowed to both consume the signal and
return with the value indicating the timeout, hence predicate should
always be (re)checked before taking an action

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6634 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCosmetics
malc [Sat, 21 Feb 2009 05:48:17 +0000 (05:48 +0000)]
Cosmetics

Avoid repeated creation/initalization/destruction of attr and calls to
getpid

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6633 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAvoid thundering herd problem
malc [Sat, 21 Feb 2009 05:48:15 +0000 (05:48 +0000)]
Avoid thundering herd problem

Broadcast was used so that the I/O threads would wakeup, reset their
ts values and all but one go to sleep, in other words an optimization
to prevent threads from exiting in presence of continuing I/O
activity. Spurious wakeups make the looping around cond_timedwait with
ever reinitialized ts potentially unsafe and as such ts in no longer
reinitilized inside the loop, hence switch to signal is warranted and
this benefits of this particlaur optimization are lost.

(It's worth noting that timed variants of pthread calls use realtime
clock by default, and therefore can hang "forever" should the host
time be changed. Unfortunatelly not all host systems QEMU runs on
support CLOCK_MONOTONIC and/or pthread_condattr_setclock with this
value)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6632 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAvoid infinite loop around timed condition variable
malc [Sat, 21 Feb 2009 05:48:13 +0000 (05:48 +0000)]
Avoid infinite loop around timed condition variable

This can happen due to spurious wakeups

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6631 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoError checking
malc [Sat, 21 Feb 2009 05:48:11 +0000 (05:48 +0000)]
Error checking

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6630 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix branch debugging
blueswir1 [Thu, 19 Feb 2009 20:17:09 +0000 (20:17 +0000)]
Fix branch debugging

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6629 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix cpu_physical_memory_rw() for 64-bit I/O accesses
aurel32 [Wed, 18 Feb 2009 21:37:17 +0000 (21:37 +0000)]
Fix cpu_physical_memory_rw() for 64-bit I/O accesses

KVM uses cpu_physical_memory_rw() to access the I/O devices. When a
read or write with a length of 8-byte is requested, it is split into 2
4-byte accesses.

This has been broken in revision 5849. After this revision, only the
first 4 bytes are actually read/write to the device, as the target
address is changed, so on the next iteration of the loop the next 4
bytes are actually read/written elsewhere (in the RAM for the graphic
card).

This patch fixes screen corruption (and most probably data corruption)
with FreeBSD/amd64. Bug #2556746 in KVM bugzilla.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6628 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAvoid running audio ctl's when vm is not running
malc [Wed, 18 Feb 2009 20:44:04 +0000 (20:44 +0000)]
Avoid running audio ctl's when vm is not running

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6627 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agovirtio: Remove malloc failure checks (Jan Kiszka)
aliguori [Mon, 16 Feb 2009 15:47:27 +0000 (15:47 +0000)]
virtio: Remove malloc failure checks (Jan Kiszka)

No need to check for failing qemu_malloc anymore.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6626 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoGenerate PCI hotplug interrupt only if corespondent EN bit is set. (Gleb Natapov)
aliguori [Mon, 16 Feb 2009 15:36:08 +0000 (15:36 +0000)]
Generate PCI hotplug interrupt only if corespondent EN bit is set. (Gleb Natapov)

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6625 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix GPE registers read/write handling. (Gleb Natapov)
aliguori [Mon, 16 Feb 2009 15:36:03 +0000 (15:36 +0000)]
Fix GPE registers read/write handling. (Gleb Natapov)

For STS register bit are cleared by writing 1 into it.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6624 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agospecify vmchannel as a net option (Gleb Natapov)
aliguori [Mon, 16 Feb 2009 15:34:18 +0000 (15:34 +0000)]
specify vmchannel as a net option (Gleb Natapov)

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6623 c046a42c-6fe2-441c-8c8c-71466251a162