qemu
15 years agoFix regression introduced by r6824
aliguori [Fri, 13 Mar 2009 03:12:03 +0000 (03:12 +0000)]
Fix regression introduced by r6824

The changes introduced by r6824 broke a subtle, and admittedly obscure, aspect
of the block API.  While bdrv_{pread,pwrite} return the number of bytes read
or written upon success, bdrv_{read,write} returns a zero upon success.

When using bdrv_pread for bdrv_read, special care must be taken to handle this
case.

This fixes certain guest images (notably linux-0.2 provided on the qemu
website).

Reported-by: malc <av1474@comtv.ru>
Reported-by: Herve Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

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

15 years agoFrom 67e94ae77f8de4d5d822917f1723cefa7ebfb64d Mon Sep 17 00:00:00 2001
aliguori [Thu, 12 Mar 2009 20:25:12 +0000 (20:25 +0000)]
From 67e94ae77f8de4d5d822917f1723cefa7ebfb64d Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@intel.com>
Date: Tue, 3 Mar 2009 13:33:13 +0800
Subject: [PATCH] Split ioapic logic from the current apic.

Add a new ioapic.c to hold ioapic's logic, and also
make it work for ia64.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
---
 Makefile.target |    2 +-
 hw/apic.c       |  237 +++----------------------------------------------
 hw/ioapic.c     |  263 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/pc.h         |    5 +-
 4 files changed, 281 insertions(+), 226 deletions(-)
 create mode 100644 hw/ioapic.c

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

15 years agomonitor: sync from kvm state before generating output (Jan Kiszka)
aliguori [Thu, 12 Mar 2009 20:12:57 +0000 (20:12 +0000)]
monitor: sync from kvm state before generating output (Jan Kiszka)

Ported from the KVM tree: Synchronize the qemu cpu state with kvm's
before invoking various monitor info commands (like 'info registers').

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@6826 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoGuest debugging support for KVM (Jan Kiszka)
aliguori [Thu, 12 Mar 2009 20:12:48 +0000 (20:12 +0000)]
Guest debugging support for KVM (Jan Kiszka)

This is a backport of the guest debugging support for the KVM
accelerator that is now part of the KVM tree. It implements the reworked
KVM kernel API for guest debugging (KVM_CAP_SET_GUEST_DEBUG) which is
not yet part of any mainline kernel but will probably be 2.6.30 stuff.
So far supported is x86, but PPC is expected to catch up soon.

Core features are:
 - unlimited soft-breakpoints via code patching
 - hardware-assisted x86 breakpoints and watchpoints

Changes in this version:
 - use generic hook cpu_synchronize_state to transfer registers between
   user space and kvm
 - push kvm_sw_breakpoints into KVMState

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@6825 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoDrop internal bdrv_pread()/bdrv_pwrite() APIs (Avi Kivity)
aliguori [Thu, 12 Mar 2009 19:57:16 +0000 (19:57 +0000)]
Drop internal bdrv_pread()/bdrv_pwrite() APIs (Avi Kivity)

Now that scsi generic no longer uses bdrv_pread() and bdrv_pwrite(), we can
drop the corresponding internal APIs, which overlap bdrv_read()/bdrv_write()
and, being byte oriented, are unnatural for a block device.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

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

15 years agoAdd internal scsi generic block API (Avi Kivity)
aliguori [Thu, 12 Mar 2009 19:57:12 +0000 (19:57 +0000)]
Add internal scsi generic block API (Avi Kivity)

Add an internal API for the generic block layer to send scsi generic commands
to block format driver.  This means block format drivers no longer need
to consider overloaded nb_sectors parameters.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

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

15 years agoAdd specialized block driver scsi generic API (Avi Kivity)
aliguori [Thu, 12 Mar 2009 19:57:08 +0000 (19:57 +0000)]
Add specialized block driver scsi generic API (Avi Kivity)

When a scsi device is backed by a scsi generic device instead of an
ordinary host block device, the block API is abused in a couple of annoying
ways:

 - nb_sectors is negative, and specifies a byte count instead of a sector count
 - offset is ignored, since scsi-generic is essentially a packet protocol

This overloading makes hacking the block layer difficult.  Remove it by
introducing a new explicit API for scsi-generic devices.  The new API
is still backed by the old implementation, but at least the users are
insulated.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

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

15 years agoRevert r6404
aliguori [Wed, 11 Mar 2009 20:05:37 +0000 (20:05 +0000)]
Revert r6404

This series is broken by design as it requires expensive IO operations at
open time causing very long delays when starting a virtual machine for the
first time.

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

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

15 years agoRevert r6405
aliguori [Wed, 11 Mar 2009 20:05:33 +0000 (20:05 +0000)]
Revert r6405

This series is broken by design as it requires expensive IO operations at
open time causing very long delays when starting a virtual machine for the
first time.

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

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

15 years agoRevert r6406
aliguori [Wed, 11 Mar 2009 20:05:29 +0000 (20:05 +0000)]
Revert r6406

This series is broken by design as it requires expensive IO operations at
open time causing very long delays when starting a virtual machine for the
first time.

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

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

15 years agoRevert r6407
aliguori [Wed, 11 Mar 2009 20:05:25 +0000 (20:05 +0000)]
Revert r6407

This series is broken by design as it requires expensive IO operations at
open time causing very long delays when starting a virtual machine for the
first time.

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

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

15 years agoRevert r6408
aliguori [Wed, 11 Mar 2009 20:05:20 +0000 (20:05 +0000)]
Revert r6408

This series is broken by design as it requires expensive IO operations at
open time causing very long delays when starting a virtual machine for the
first time.

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

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

15 years agotcg: move {not,neg}_i{32,64} definitions at the right place
aurel32 [Wed, 11 Mar 2009 11:00:49 +0000 (11:00 +0000)]
tcg: move {not,neg}_i{32,64} definitions at the right place

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

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

15 years agotcg: fix commit r6805
aurel32 [Wed, 11 Mar 2009 02:57:30 +0000 (02:57 +0000)]
tcg: fix commit r6805

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

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

15 years agoClean build: Add bt-host.h
aurel32 [Tue, 10 Mar 2009 21:43:35 +0000 (21:43 +0000)]
Clean build: Add bt-host.h

Silence compiler warning by providing proper CONFIG_BLUEZ-independent
header for the bt-host API.

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@6809 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotcg-arm: fix qemu_ld64
aurel32 [Tue, 10 Mar 2009 21:43:25 +0000 (21:43 +0000)]
tcg-arm: fix qemu_ld64

Emulating fldl on arm doesn't seem to work too well. It's the way
qemu_ld64 is translated to arm instructions.

        tcg_out_ld32_12(s, COND_AL, data_reg, addr_reg, 0);
        tcg_out_ld32_12(s, COND_AL, data_reg2, addr_reg, 4);

Consider case where data_reg==0, data_reg2==1, and addr_reg==0. First load
overwrited addr_reg. So let's put an if (data_ref==addr_reg).

(Pablo Virolainen)

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

15 years agotcg: update TODO
aurel32 [Tue, 10 Mar 2009 19:37:56 +0000 (19:37 +0000)]
tcg: update TODO

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

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

15 years agotcg/x86: add not/neg/extu/bswap/rot i32 ops
aurel32 [Tue, 10 Mar 2009 19:37:46 +0000 (19:37 +0000)]
tcg/x86: add not/neg/extu/bswap/rot i32 ops

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

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

15 years agotcg: optimize logical operations
aurel32 [Tue, 10 Mar 2009 19:37:39 +0000 (19:37 +0000)]
tcg: optimize logical operations

Simplify nand/nor/eqv and move their optimizations to and/or/xor

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

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

15 years agotarget-ppc: fix commit r6789
aurel32 [Tue, 10 Mar 2009 19:37:28 +0000 (19:37 +0000)]
target-ppc: fix commit r6789

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

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

15 years agomusicpal: Reorganize IO memory handling (Jan Kiszka)
malc [Tue, 10 Mar 2009 19:25:13 +0000 (19:25 +0000)]
musicpal: Reorganize IO memory handling (Jan Kiszka)

The new MMIO interface requires non-overlapping slots. Reorganize the
musicpal accordingly, fixing a regression for the Ethernet emulation.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>

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

15 years agoFix tcg after commit 6800
aurel32 [Tue, 10 Mar 2009 10:29:45 +0000 (10:29 +0000)]
Fix tcg after commit 6800

The introduction of TCGV_EQUAL and not op is slightly broken.
The definition of DEBUG_TCGV shows that.

Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

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

15 years agotarget-mips: use nor instead of or + not
aurel32 [Tue, 10 Mar 2009 09:03:18 +0000 (09:03 +0000)]
target-mips: use nor instead of or + not

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

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

15 years agotcg: use TCGV_EQUAL_I{32,64}
aurel32 [Tue, 10 Mar 2009 08:57:16 +0000 (08:57 +0000)]
tcg: use TCGV_EQUAL_I{32,64}

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

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

15 years agotcg: define TCGV_EQUAL_I{32,64}
aurel32 [Tue, 10 Mar 2009 08:56:30 +0000 (08:56 +0000)]
tcg: define TCGV_EQUAL_I{32,64}

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

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

15 years agotcg: optimize nor(X, Y, Y), used on PPC for not(X, Y)
aurel32 [Mon, 9 Mar 2009 22:35:22 +0000 (22:35 +0000)]
tcg: optimize nor(X, Y, Y), used on PPC for not(X, Y)

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

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

15 years agoImplement TCG not ops for x86-64
aurel32 [Mon, 9 Mar 2009 22:35:13 +0000 (22:35 +0000)]
Implement TCG not ops for x86-64

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

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

15 years agotcg: don't define TCG rotation ops if they are not supported
aurel32 [Mon, 9 Mar 2009 21:58:46 +0000 (21:58 +0000)]
tcg: don't define TCG rotation ops if they are not supported

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

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

15 years agoImplement TCG rotation ops for x86-64
aurel32 [Mon, 9 Mar 2009 18:50:53 +0000 (18:50 +0000)]
Implement TCG rotation ops for x86-64

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

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

15 years agotarget-mips: optimize mflo and mfhi
aurel32 [Mon, 9 Mar 2009 18:50:43 +0000 (18:50 +0000)]
target-mips: optimize mflo and mfhi

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

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

15 years agotarge-ppc: optimize mfcr and mtcrf
aurel32 [Mon, 9 Mar 2009 18:50:24 +0000 (18:50 +0000)]
targe-ppc: optimize mfcr and mtcrf

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

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

15 years agofread_targphys(): Do not cut off the tail.
blueswir1 [Mon, 9 Mar 2009 18:08:56 +0000 (18:08 +0000)]
fread_targphys(): Do not cut off the tail.

loader.c:fread_targphys() read file by 4096 byte chunks and store them to
memory. But did not store the last chunk if its size was not 4096.

Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>

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

15 years agoconfigure sensitive to user locale
blueswir1 [Mon, 9 Mar 2009 17:36:50 +0000 (17:36 +0000)]
configure sensitive to user locale

On German Fedora 9, no KVM errors are displayed.
This is because configure greps for "error:", which is locale-sensitive.

Use LANG=C for configure to find and display errors as expected.

Signed-off-by: Andreas Faerber <andreas.faerber@web.de>

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

15 years agotarget-ppc: free a tcg temp variable
aurel32 [Mon, 9 Mar 2009 06:27:24 +0000 (06:27 +0000)]
target-ppc: free a tcg temp variable

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

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

15 years agotarget-ppc: add support for reading/writing spefscr
aurel32 [Mon, 9 Mar 2009 06:27:14 +0000 (06:27 +0000)]
target-ppc: add support for reading/writing spefscr

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

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

15 years agoqemu-img: fix help message
aurel32 [Sun, 8 Mar 2009 19:49:51 +0000 (19:49 +0000)]
qemu-img: fix help message

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

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

15 years agoqemu-img: accept sizes with decimal values
aurel32 [Sun, 8 Mar 2009 19:49:44 +0000 (19:49 +0000)]
qemu-img: accept sizes with decimal values

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

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

15 years agoCall Perl directly instead of relying on shebang
blueswir1 [Sun, 8 Mar 2009 19:26:53 +0000 (19:26 +0000)]
Call Perl directly instead of relying on shebang

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

15 years agoMulti-key completion for sendkey
blueswir1 [Sun, 8 Mar 2009 17:42:02 +0000 (17:42 +0000)]
Multi-key completion for sendkey

Allow completion of concatenated key strings for the sendkey command.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

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

15 years agoFix windows build and clean up use of <windows.h>
aliguori [Sun, 8 Mar 2009 16:26:59 +0000 (16:26 +0000)]
Fix windows build and clean up use of <windows.h>

We want to globally define WIN_LEAN_AND_MEAN and WINVER to particular values so
let's do it in OS_CFLAGS.

Then, we can pepper in windows.h includes where using #includes that require it.

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

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

15 years agoRename one more _BSD to HOST_BSD (spotted by Hasso Tepper)
blueswir1 [Sun, 8 Mar 2009 15:58:00 +0000 (15:58 +0000)]
Rename one more _BSD to HOST_BSD (spotted by Hasso Tepper)

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

15 years agoRemove unnecessary prefix on SDL_syswm.h. This fixes the build for certain
aliguori [Sun, 8 Mar 2009 15:04:07 +0000 (15:04 +0000)]
Remove unnecessary prefix on SDL_syswm.h.  This fixes the build for certain
installs of SDL.

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

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

15 years agoPrune unused TCG_AREGs
blueswir1 [Sun, 8 Mar 2009 14:45:45 +0000 (14:45 +0000)]
Prune unused TCG_AREGs

Remove definitions for TCG_AREGs corresponding to AREG definitions
removed in r6778.

Signed-off-by: Stuart Brady <stuart.brady@gmail.com>

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

15 years agoPrune unused AREGs
blueswir1 [Sun, 8 Mar 2009 12:41:36 +0000 (12:41 +0000)]
Prune unused AREGs

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

15 years agoUse firmware configuration instead of NVRAM (initial patch by Aurelien Jarno)
blueswir1 [Sun, 8 Mar 2009 09:51:29 +0000 (09:51 +0000)]
Use firmware configuration instead of NVRAM (initial patch by Aurelien Jarno)

Use firmware configuration device for boot device, kernel, initrd and
kernel command line parameters on PPC, Sparc32 and Sparc64.

Update OpenBIOS images to r479 which supports the change.

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

15 years agoAdd new entries to firmware configuration device
blueswir1 [Sun, 8 Mar 2009 09:34:26 +0000 (09:34 +0000)]
Add new entries to firmware configuration device

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

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

15 years agoRename _BSD to HOST_BSD so that it's more obvious that it's defined by configure
blueswir1 [Sun, 8 Mar 2009 08:23:32 +0000 (08:23 +0000)]
Rename _BSD to HOST_BSD so that it's more obvious that it's defined by configure

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

15 years agotarget-mips: remove dead code
aurel32 [Sun, 8 Mar 2009 00:06:10 +0000 (00:06 +0000)]
target-mips: remove dead code

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

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

15 years agotarget-mips: rename helpers from do_ to helper_
aurel32 [Sun, 8 Mar 2009 00:06:01 +0000 (00:06 +0000)]
target-mips: rename helpers from do_ to helper_

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

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

15 years agodo not pretend to support low voltage operation
aurel32 [Sat, 7 Mar 2009 22:10:40 +0000 (22:10 +0000)]
do not pretend to support low voltage operation

Eliminate "mmc0: SD card claims to support the incompletely defined 'low voltage
range'. This will be ignored." warning. Qemu says the card is a SD card, and SD
spec doesn't define low-voltage cards, so do now pretend to be one.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

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

15 years agoFix correct reset value for ARM CP15 c1 auxiliary control register
aurel32 [Sat, 7 Mar 2009 22:10:28 +0000 (22:10 +0000)]
Fix correct reset value for ARM CP15 c1 auxiliary control register

According to ARM Cortex A8 Technical Reference Manual, the reset value for CP15 c1 auxiliary control
register is 2, not zero (page 3.12).

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Acked-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

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

15 years agoWork around QEMU GDB stub suboptimality
aurel32 [Sat, 7 Mar 2009 22:00:56 +0000 (22:00 +0000)]
Work around QEMU GDB stub suboptimality

The current XML files claim, on floating point-supporting Power chips,
that $f0 is register 70.  This would be fine, except that register 70
for non-XML-aware GDB is FPSCR.  More importantly, 70 is less than
NUM_CORE_REGS (71) for Power, so a request for register 70 goes to the
"core" register reading routines, rather than the floating-point
register read routine we registered with gdb_register_coprocessor.

Therefore, when we are talking to an XML-aware GDB, we claim that
register has zero width, which causes the rest of QEMU's GDB stub to
send an error back to GDB, which causes GDB to be unable to read the
floating-point registers.  (The problem is also present for SPE
registers and occurs in a slightly different way for Altivec registers.)

The best way to fix this is to have the "core register" XML files for
PPC32 and PPC64 claim that there is a 4-byte register 70, which causes
$f0 to be register 71, and everything works just fine from that point
forward.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

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

15 years agoFix off-by-one errors for Altivec and SPE registers
aurel32 [Sat, 7 Mar 2009 22:00:49 +0000 (22:00 +0000)]
Fix off-by-one errors for Altivec and SPE registers

Altivec and SPE both have 34 registers in their register sets, not 35
with a missing register 32.

GDB would ask for register 32 of the Altivec (resp. SPE) registers and
the code would claim it had zero width.  The QEMU GDB stub code would
then return an E14 to GDB, which would complain about not being sure
whether p packets were supported or not.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

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

15 years agoUse C99 initializers for BlockDriver methods
aurel32 [Sat, 7 Mar 2009 22:00:29 +0000 (22:00 +0000)]
Use C99 initializers for BlockDriver methods

Consistently use the C99 named initializer format for the BlockDriver
methods to make the method table more readable and more easily
extensible.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

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

15 years agoclean build: Fix remaining m68k warnings
aurel32 [Sat, 7 Mar 2009 21:48:08 +0000 (21:48 +0000)]
clean build: Fix remaining m68k 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@6767 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoclean build: Fix arm build warnings
aurel32 [Sat, 7 Mar 2009 21:48:00 +0000 (21:48 +0000)]
clean build: Fix arm build warnings

Fix remaining arm warnings - except for the mess in the NetWinder FP
emulator.

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@6766 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoarm: Fix gic_irq_state.level bitfield type
aurel32 [Sat, 7 Mar 2009 21:47:53 +0000 (21:47 +0000)]
arm: Fix gic_irq_state.level bitfield type

Found while cleaning up compiler warnings: GIC_*_LEVEL macros strongly
suggest that gic_irq_state.level is intended to be per-CPU and not just
a single, global bit. I'm unable to test the effect, but it seems to be
the most reasonable fix for the apparent brokenness.

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@6765 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: move the CD-ROM drive to the second IDE
aurel32 [Sat, 7 Mar 2009 21:35:27 +0000 (21:35 +0000)]
target-ppc: move the CD-ROM drive to the second IDE

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

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

15 years agoppc_oldworld: swap the MACIO and CMD646 IDE controllers
aurel32 [Sat, 7 Mar 2009 21:35:21 +0000 (21:35 +0000)]
ppc_oldworld: swap the MACIO and CMD646 IDE controllers

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

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

15 years agoUse a dedicated function to request exit from execution loop
aurel32 [Sat, 7 Mar 2009 21:28:24 +0000 (21:28 +0000)]
Use a dedicated function to request exit from execution loop

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

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

15 years agoFix texinfo syntax errors.
aurel32 [Sat, 7 Mar 2009 21:28:14 +0000 (21:28 +0000)]
Fix texinfo syntax errors.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

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

15 years agoDisable BAT for 970
blueswir1 [Sat, 7 Mar 2009 20:58:30 +0000 (20:58 +0000)]
Disable BAT for 970

The 970 doesn't know BAT, so let's not search BATs there.
This was only in as a hack for OpenHackWare so it would
work on PPC64.

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

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

15 years agoFix mfcr on ppc64-softmmu
aurel32 [Sat, 7 Mar 2009 20:57:47 +0000 (20:57 +0000)]
Fix mfcr on ppc64-softmmu

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

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

15 years agoKeep SLB in-CPU
blueswir1 [Sat, 7 Mar 2009 20:57:42 +0000 (20:57 +0000)]
Keep SLB in-CPU

Real 970 CPUs have the SLB not memory backed, but inside the CPU.
This breaks bridge mode for 970 for now, but at least keeps us from
overwriting physical addresses 0x0 - 0x300, rendering our interrupt
handlers useless.

I put in a stub for bridge mode operation that could be enabled
easily, but for now it's safer to leave that off I guess (970fx doesn't
have bridge mode AFAIK).

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

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

15 years agoClear CPU_INTERRUPT_EXIT on VM load
aurel32 [Sat, 7 Mar 2009 20:57:31 +0000 (20:57 +0000)]
Clear CPU_INTERRUPT_EXIT on VM load

CPU_INTERRUPT_EXIT is not set anymore in env->interrupt_request since
revision 6728. Make sure the bit is cleared on VM load.

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

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

15 years agoFix NX bit
blueswir1 [Sat, 7 Mar 2009 20:57:01 +0000 (20:57 +0000)]
Fix NX bit

ctx->nx only got ORed, but never reset. So when one page in the
lifetime of the VM was ever NX, all later pages were too.

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

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

15 years agoFix RFI(d)
blueswir1 [Sat, 7 Mar 2009 20:56:21 +0000 (20:56 +0000)]
Fix RFI(d)

The current implementation masks some MSR bits from SRR1 as it is
given on rfi(d). This looks pretty wrong and breaks Altivec.

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

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

15 years agoImplement mtfsf.L encoding
blueswir1 [Sat, 7 Mar 2009 20:55:31 +0000 (20:55 +0000)]
Implement mtfsf.L encoding

Mtfsf can have the L bit set, so all the register contents get stored
in FPSCR. Linux uses it, so let's implement it.

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

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

15 years agoEnable 64bit mode on interrupts
blueswir1 [Sat, 7 Mar 2009 20:54:59 +0000 (20:54 +0000)]
Enable 64bit mode on interrupts

Real 970s enable MSR_SF on all interrupts. The current code didn't do
this until now, so let's activate it!

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

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

15 years agoNop some SPRs on 970fx
blueswir1 [Sat, 7 Mar 2009 20:54:03 +0000 (20:54 +0000)]
Nop some SPRs on 970fx

Linux tries to access some SPRs on PPC64 boot. Let's just ignore those
for the 970fx for now to make it happy.

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

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

15 years agoActivate uninorth AGP bridge
blueswir1 [Sat, 7 Mar 2009 20:53:18 +0000 (20:53 +0000)]
Activate uninorth AGP bridge

Linux tries to poke the AGP bridge port and is pretty sad when it can't,
so let's activate the old code again and throw out the bit modifications,
as we don't really do anything with the values anyways.

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

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

15 years agoImplment tlbiel
blueswir1 [Sat, 7 Mar 2009 20:52:22 +0000 (20:52 +0000)]
Implment tlbiel

Linux uses tlbiel to flush TLB entries in PPC64 mode. This special TLB
flush opcode only flushes an entry for the CPU it runs on, not across
all CPUs in the system.

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

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

15 years agoImplement large pages
blueswir1 [Sat, 7 Mar 2009 20:51:18 +0000 (20:51 +0000)]
Implement large pages

The current SLB/PTE code does not support large pages, which are
required by Linux, as it boots up with the kernel regions up as large.

This patch implements large page support, so we can run Linux.

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

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

15 years agoImplement slbmte
blueswir1 [Sat, 7 Mar 2009 20:50:01 +0000 (20:50 +0000)]
Implement slbmte

In order to modify SLB entries on recent PPC64 machines, the slbmte
instruction is used.

This patch implements the slbmte instruction and makes the "bridge"
mode code use the slb set functions, so we can move the SLB into
the CPU struct later.

This is required for Linux to run on PPC64.

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

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

15 years agoSupport for DragonFly BSD (Hasso Tepper)
blueswir1 [Sat, 7 Mar 2009 20:06:23 +0000 (20:06 +0000)]
Support for DragonFly BSD (Hasso Tepper)

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

15 years agoFix BSD user: there is no NPTL
blueswir1 [Sat, 7 Mar 2009 18:59:05 +0000 (18:59 +0000)]
Fix BSD user: there is no NPTL

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

15 years agoUpdate i386-dis.c from commits before GPLv3 switch
blueswir1 [Sat, 7 Mar 2009 16:57:53 +0000 (16:57 +0000)]
Update i386-dis.c from commits before GPLv3 switch

Update i386-dis.c again using binutils files from CVS:
include/opcode/i386.h r1.78 and opcodes/i386-dis.c r1.126.

These are the last versions using GPL v2+.

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

15 years agoUpdate i386-dis.c from binutils 2.17
blueswir1 [Sat, 7 Mar 2009 16:53:57 +0000 (16:53 +0000)]
Update i386-dis.c from binutils 2.17

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

15 years agoFix BSD breakage from r6736
blueswir1 [Sat, 7 Mar 2009 16:52:02 +0000 (16:52 +0000)]
Fix BSD breakage from r6736

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

15 years agoSparse fixes: dubious mixing of bitwise and logical operations
blueswir1 [Sat, 7 Mar 2009 16:03:05 +0000 (16:03 +0000)]
Sparse fixes: dubious mixing of bitwise and logical operations

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

15 years agoSparse fixes: add extern to ELF opcode tables to avoid warnings
blueswir1 [Sat, 7 Mar 2009 15:59:09 +0000 (15:59 +0000)]
Sparse fixes: add extern to ELF opcode tables to avoid warnings

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

15 years agoSparse fixes: remove duplicate entry
blueswir1 [Sat, 7 Mar 2009 15:53:15 +0000 (15:53 +0000)]
Sparse fixes: remove duplicate entry

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

15 years agoSparse fixes: move ACPI table definitions to pc.h
blueswir1 [Sat, 7 Mar 2009 15:50:18 +0000 (15:50 +0000)]
Sparse fixes: move ACPI table definitions to pc.h

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

15 years agoSparse fixes: truncation by cast
blueswir1 [Sat, 7 Mar 2009 15:46:23 +0000 (15:46 +0000)]
Sparse fixes: truncation by cast

Fix Sparse warnings about constant truncation caused by cast

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

15 years agoSparse fixes: NULL use, header order, ANSI prototypes, static
blueswir1 [Sat, 7 Mar 2009 15:32:56 +0000 (15:32 +0000)]
Sparse fixes: NULL use, header order, ANSI prototypes, static

Fix Sparse warnings:
 * use NULL instead of plain 0
 * rearrange header include order to avoid redefining types accidentally
 * ANSIfy SLIRP
 * avoid "restrict" keyword
 * add static

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

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