sdk/emulator/qemu.git
13 years agoaudio: consolidate audio_init()
Isaku Yamahata [Fri, 21 Jan 2011 10:53:45 +0000 (19:53 +0900)]
audio: consolidate audio_init()

consolidate audio_init() and remove references to shoundhw.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: fix index of address read error exception
Alexandre Courbot [Tue, 25 Jan 2011 05:00:14 +0000 (14:00 +0900)]
target-sh4: fix index of address read error exception

Exception index of address read error should be 0x0e0.

Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: fix TLB invalidation code
Alexandre Courbot [Tue, 25 Jan 2011 06:32:01 +0000 (15:32 +0900)]
target-sh4: fix TLB invalidation code

In cpu_sh4_invalidate_tlb, the UTLB was invalidated twice and the
ITLB left unchaged, probably because of some unfortunate copy/paste.

Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoMerge remote branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 24 Jan 2011 21:16:56 +0000 (15:16 -0600)]
Merge remote branch 'kwolf/for-anthony' into staging

13 years agoSPARC: Add asr17 register support
Fabien Chouteau [Mon, 24 Jan 2011 11:56:56 +0000 (12:56 +0100)]
SPARC: Add asr17 register support

This register is activated by CPU_FEATURE_ASR17 in the feature field.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC: Emulation of Leon3
Fabien Chouteau [Mon, 24 Jan 2011 11:56:55 +0000 (12:56 +0100)]
SPARC: Emulation of Leon3

Leon3 is an open-source VHDL System-On-Chip, well known in space industry (more
information on http://www.gaisler.com).

Leon3 is made of multiple components available in the GrLib VHDL library.
Three devices are implemented: uart, timers and IRQ manager.
You can find code for these peripherals in the grlib_* files.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC: Emulation of GRLIB APB UART
Fabien Chouteau [Mon, 24 Jan 2011 11:56:54 +0000 (12:56 +0100)]
SPARC: Emulation of GRLIB APB UART

This device exposes one parameter:
 - chardev (ptr) : Pointer to a qemu character device

Emulation of GrLib devices is base on the GRLIB IP Core User's Manual:
http://www.gaisler.com/products/grlib/grip.pdf

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC: Emulation of GRLIB IRQMP
Fabien Chouteau [Mon, 24 Jan 2011 11:56:53 +0000 (12:56 +0100)]
SPARC: Emulation of GRLIB IRQMP

This device exposes two parameters:
 - set_pil_in        (ptr) : A function to set the pil_in of the SPARC CPU
 - set_pil_in_opaque (ptr) : Opaque argument of the set_pil_in function

Emulation of GrLib devices is base on the GRLIB IP Core User's Manual:
http://www.gaisler.com/products/grlib/grip.pdf

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC: Emulation of GRLIB GPTimer
Fabien Chouteau [Mon, 24 Jan 2011 11:56:52 +0000 (12:56 +0100)]
SPARC: Emulation of GRLIB GPTimer

This device exposes three parameters:
 - frequency (uint32) : The system frequency
 - irq-line  (uint32) : IRQ line number for the first timer
                        (others use irq-line + 1, irq-line + 2...)
 - nr-timers (uint32) : Number of timers

Emulation of GrLib devices is base on the GRLIB IP Core User's Manual:
http://www.gaisler.com/products/grlib/grip.pdf

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agodocs: Document scsi-disk and usb-storage removable parameter
Stefan Hajnoczi [Mon, 24 Jan 2011 15:35:01 +0000 (15:35 +0000)]
docs: Document scsi-disk and usb-storage removable parameter

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agousb-msd: Propagate removable bit to SCSI device
Stefan Hajnoczi [Mon, 24 Jan 2011 15:35:00 +0000 (15:35 +0000)]
usb-msd: Propagate removable bit to SCSI device

USB Mass Storage Devices sometimes have the RMB (removable) bit set in
the SCSI INQUIRY response.  Thumbdrives tend to have the bit set whereas
hard disks do not.

Operating systems differentiate between removable devices and fixed
devices.  Under Linux, the anaconda installer looks for removable
devices.  Under Windows, only fixed devices may have more than one
partition and AutoRun is also affected by the removable bit.

For these reasons, allow USB Mass Storage Devices to override the
removable bit:

qemu -usb
     -drive if=none,file=test.img,cache=none,id=disk0
     -device usb-storage,drive=disk0,removable=on

The default is off.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi: Allow scsi_bus_legacy_add_drive() to set removable bit
Stefan Hajnoczi [Mon, 24 Jan 2011 15:34:59 +0000 (15:34 +0000)]
scsi: Allow scsi_bus_legacy_add_drive() to set removable bit

scsi-disk devices may wish to override the removable bit.  Add support
for a qdev property on SCSI devices.  This is will be used by usb-msd.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi-disk: Allow overriding SCSI INQUIRY removable bit
Stefan Hajnoczi [Mon, 24 Jan 2011 15:34:58 +0000 (15:34 +0000)]
scsi-disk: Allow overriding SCSI INQUIRY removable bit

Provide the "removable" qdev property bit to override the SCSI INQUIRY
removable (RMB) bit for non-CDROM devices.  This will be used by USB
Mass Storage Devices, which sometimes have this guest-visible bit set
and sometimes do not.  They therefore requires a means for user
configuration.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agotarget-mips: fix save_cpu_state() calls
Aurelien Jarno [Mon, 17 Jan 2011 18:29:34 +0000 (19:29 +0100)]
target-mips: fix save_cpu_state() calls

The rule is:
- don't save PC if the exception is only triggered by softmmu.
- save PC if the exception can be triggered by an helper.

Fix a 64-bit kernel crash when loading modules.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoblock: Use backing format driver during image creation
Stefan Hajnoczi [Mon, 24 Jan 2011 09:32:20 +0000 (09:32 +0000)]
block: Use backing format driver during image creation

The backing format should be honored during image creation.  For some
reason we currently use the image format to open the backing file.  This
fails when the backing file has a different format than the image being
created.  Keep the image and backing format drivers completely separate.

Also print the backing filename if there is an error opening the backing
file instead of the image filename.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblockdev: Fix drive_del not to crash when drive is not in use
Markus Armbruster [Mon, 17 Jan 2011 18:31:29 +0000 (19:31 +0100)]
blockdev: Fix drive_del not to crash when drive is not in use

Watch this:

    (qemu) drive_add 0 if=none,file=tmp.img
    OK
    (qemu) info block
    none0: type=hd removable=0 file=tmp.img ro=0 drv=raw encrypted=0
    (qemu) drive_del none0
    Segmentation fault (core dumped)

do_drive_del()'s code to clean up the pointer from a qdev using the
drive back to the drive needs to check whether such a device exists.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblockdev: Make drive_init() use error_report()
Markus Armbruster [Mon, 17 Jan 2011 18:31:27 +0000 (19:31 +0100)]
blockdev: Make drive_init() use error_report()

This makes the errors point to the error location, and fixes drive_add
to report errors in the monitor instead of stderr.

While there, tweak a few error messages for consistency.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblockdev: Fix error message for invalid -drive CHS
Markus Armbruster [Mon, 17 Jan 2011 18:31:26 +0000 (19:31 +0100)]
blockdev: Fix error message for invalid -drive CHS

When cyls, heads or secs are out of range, the error message prints
buf, which points to the value of option "if".  Bogus, may even be
null.  Drop that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoFix block migration when the device size is not a multiple of 1 MB
Pierre Riteau [Fri, 21 Jan 2011 11:42:30 +0000 (12:42 +0100)]
Fix block migration when the device size is not a multiple of 1 MB

b02bea3a85cc939f09aa674a3f1e4f36d418c007 added a check on the return
value of bdrv_write and aborts migration when it fails. However, if the
size of the block device to migrate is not a multiple of BLOCK_SIZE
(currently 1 MB), the last bdrv_write will fail with -EIO.

Fixed by calling bdrv_write with the correct size of the last block.

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqed: Refuse to create images on block devices
Stefan Hajnoczi [Fri, 14 Jan 2011 22:44:33 +0000 (22:44 +0000)]
qed: Refuse to create images on block devices

QED relies on the underlying filesystem to extend the file and maintain
its size.  Check that images are not created on a block device.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoDocumentation: Add qemu-img check/rebase
Kevin Wolf [Mon, 17 Jan 2011 14:35:28 +0000 (15:35 +0100)]
Documentation: Add qemu-img check/rebase

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: Remove unneeded null pointer check
Stefan Weil [Sat, 15 Jan 2011 18:01:03 +0000 (19:01 +0100)]
ide: Remove unneeded null pointer check

With bm == NULL, other code in the same function would crash.

This bug was reported by cppcheck:
hw/ide/pci.c:280: error: Possible null pointer dereference: bm

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow2: Batch flushes for COW
Kevin Wolf [Fri, 14 Jan 2011 14:55:38 +0000 (15:55 +0100)]
qcow2: Batch flushes for COW

qcow2 calls bdrv_flush() after performing COW in order to ensure that the
L2 table change is never written before the copy is safe on disk. Now that the
L2 table is cached, we can wait with flushing until we write out the next L2
table.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow2: Use QcowCache
Kevin Wolf [Mon, 10 Jan 2011 16:17:28 +0000 (17:17 +0100)]
qcow2: Use QcowCache

Use the new functions of qcow2-cache.c for everything that works on refcount
block and L2 tables.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow2: Add QcowCache
Kevin Wolf [Mon, 10 Jan 2011 16:15:10 +0000 (17:15 +0100)]
qcow2: Add QcowCache

This adds some new cache functions to qcow2 which can be used for caching
refcount blocks and L2 tables. When used with cache=writethrough they work
like the old caching code which is spread all over qcow2, so for this case we
have merely a cleanup.

The interesting case is with writeback caching (this includes cache=none) where
data isn't written to disk immediately but only kept in cache initially. This
leads to some form of metadata write batching which avoids the current "write
to refcount block, flush, write to L2 table" pattern for each single request
when a lot of cluster allocations happen. Instead, cache entries are only
written out if its required to maintain the right order. In the pure cluster
allocation case this means that all metadata updates for requests are done in
memory initially and on sync, first the refcount blocks are written to disk,
then fsync, then L2 tables.

This improves performance of scenarios with lots of cluster allocations
noticably (e.g. installation or after taking a snapshot).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: kill ide_dma_submit_check
Christoph Hellwig [Mon, 20 Dec 2010 12:46:09 +0000 (13:46 +0100)]
ide: kill ide_dma_submit_check

Merge ide_dma_submit_check into it's only caller.  Also use tail recursion
using a goto instead of a real recursion - this avoid overflowing the
stack in the pathological situation of an recurring error that is ignored.
We'll still be busy looping in ide_dma_cb, but at least won't eat up
all stack space after this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: also reset io_buffer_index for writes
Christoph Hellwig [Mon, 20 Dec 2010 12:45:58 +0000 (13:45 +0100)]
ide: also reset io_buffer_index for writes

Currenly the code only resets the io_buffer_index field for reads,
but the code seems to expect this for all types of I/O.  I guess
we simply don't hit large enough transfers that would require this
often enough.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: factor dma handling helpers
Christoph Hellwig [Mon, 20 Dec 2010 12:45:48 +0000 (13:45 +0100)]
ide: factor dma handling helpers

Factor the DMA I/O path that is duplicated between read and write
commands, into common helpers using the s->is_read flag added for
the macio ATA controller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoAvoid divide by zero when there is no block device to migrate
Pierre Riteau [Wed, 12 Jan 2011 13:41:00 +0000 (14:41 +0100)]
Avoid divide by zero when there is no block device to migrate

When block migration is requested and no read-write block device is
present, a divide by zero exception is triggered because
total_sector_sum equals zero.

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoMake strtosz() return int64_t instead of ssize_t
Jes Sorensen [Wed, 5 Jan 2011 10:41:02 +0000 (11:41 +0100)]
Make strtosz() return int64_t instead of ssize_t

strtosz() needs to return a 64 bit type even on 32 bit
architectures. Otherwise qemu-img will fail to create disk
images >= 2GB

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agodo_snapshot_blkdev() error on missing snapshot_file argument
Jes Sorensen [Thu, 6 Jan 2011 16:02:23 +0000 (17:02 +0100)]
do_snapshot_blkdev() error on missing snapshot_file argument

Current code does not support snapshot internally to the running
image. Error in case no snapshot_file is specified.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-img snapshot: Use writeback caching
Kevin Wolf [Mon, 10 Jan 2011 11:33:02 +0000 (12:33 +0100)]
qemu-img snapshot: Use writeback caching

None of the other qemu-img subcommands uses writethrough, and there's no reason
why snapshot should be special.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoqcow2: fix unaligned access
Aurelien Jarno [Sat, 1 Jan 2011 20:50:34 +0000 (21:50 +0100)]
qcow2: fix unaligned access

cpu_to_be64w() is called with an obviously non-aligned pointer. Use
cpu_to_be64wu() instead. It fixes unaligned accesses errors on IA64
hosts.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agomultiboot: Fix upper memory size in multiboot info
Kevin Wolf [Tue, 4 Jan 2011 13:03:30 +0000 (14:03 +0100)]
multiboot: Fix upper memory size in multiboot info

The upper memory size field should exclude the first MB of RAM.

Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoDelete useless 'extern' qualifiers for functions
Blue Swirl [Sun, 23 Jan 2011 16:21:20 +0000 (16:21 +0000)]
Delete useless 'extern' qualifiers for functions

'extern' qualifier is useless for function declarations. Delete
them.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agogdbstub-xml: avoid a warning from sparse
Blue Swirl [Sun, 23 Jan 2011 11:43:25 +0000 (11:43 +0000)]
gdbstub-xml: avoid a warning from sparse

Include a header to get the declaration for xml_builtin. This
avoids a warning from sparse:
  CC    m68k-softmmu/gdbstub-xml.o
gdbstub-xml.c:244:12: warning: symbol 'xml_builtin' was not declared. Should it be static?

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAvoid deadlock whith iothread and icount
Edgar E. Iglesias [Sun, 23 Jan 2011 03:44:51 +0000 (04:44 +0100)]
Avoid deadlock whith iothread and icount

When using the iothread together with icount, make sure the
qemu_icount counter makes forward progress when the vcpu is
idle to avoid deadlocks.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: cleanup helper_addkc
Edgar E. Iglesias [Sun, 23 Jan 2011 02:52:20 +0000 (03:52 +0100)]
microblaze: cleanup helper_addkc

Remove unused addition and rename to helper_carry.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Improve subkc
Edgar E. Iglesias [Sat, 22 Jan 2011 11:39:16 +0000 (12:39 +0100)]
microblaze: Improve subkc

Move code from the helper into the translator. The remaining
helper parts can reuse helper_addkc, making it possible to
remove helper_subkc entirely.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Fix 3rd addkc arg when rd is r0
Edgar E. Iglesias [Sat, 22 Jan 2011 11:35:48 +0000 (12:35 +0100)]
microblaze: Fix 3rd addkc arg when rd is r0

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Improve addkc
Edgar E. Iglesias [Sat, 22 Jan 2011 11:02:53 +0000 (12:02 +0100)]
microblaze: Improve addkc

* Optimize handling when carry is not updated.
* Optimize handling for adds with nop semantics.
* Move code from helper_addkc to the translator making
  helper_addkc PURE and CONST.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Remove debug leftovers.
Edgar E. Iglesias [Sat, 22 Jan 2011 11:00:12 +0000 (12:00 +0100)]
microblaze: Remove debug leftovers.

No functional changes.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Reorganize for future patches
Edgar E. Iglesias [Sat, 22 Jan 2011 10:57:19 +0000 (11:57 +0100)]
microblaze: Reorganize for future patches

No functional changes.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoppc: Correct BookE tlb reads
Edgar E. Iglesias [Fri, 21 Jan 2011 22:12:42 +0000 (23:12 +0100)]
ppc: Correct BookE tlb reads

Call the tlb read helper (and not the write helper) for tlb
reads.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agocheckpatch: Fix bracing false positives on #else
Jan Kiszka [Fri, 21 Jan 2011 17:19:40 +0000 (18:19 +0100)]
checkpatch: Fix bracing false positives on #else

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge branch 'usb.4' of git://anongit.freedesktop.org/spice/qemu
Aurelien Jarno [Fri, 21 Jan 2011 16:56:50 +0000 (17:56 +0100)]
Merge branch 'usb.4' of git://anongit.freedesktop.org/spice/qemu

* 'usb.4' of git://anongit.freedesktop.org/spice/qemu: (32 commits)
  usb: zap pdev from usbport
  usb: rewrite fw path, fix numbering
  usb: add port property.
  usb: keep track of physical port address.
  usb storage: handle long responses
  usb storage: fix status reporting
  usb storage: high speed support
  usb: add device qualifier support
  usb: add usb_desc_attach
  usb: add attach callback
  usb: add speed mask to ports
  usb: hid: change serial number to "42".
  usb: hid: remote wakeup support.
  usb: hub: remote wakeup support.
  usb: uhci: remote wakeup support.
  usb: add usb_wakeup() + wakeup callback to port ops
  usb: rework attach/detach workflow
  usb: create USBPortOps, move attach there.
  usb: move remote wakeup handling to common code
  usb: move USB_REQ_{GET,SET}_CONFIGURATION handling to common code
  ...

13 years agosm501: fix screen redraw
Aurelien Jarno [Fri, 21 Jan 2011 16:56:32 +0000 (17:56 +0100)]
sm501: fix screen redraw

Due to signed/unsigned comparison, the dirty bits are never reset, and
the screen redrawn each time. Fix that by only using ram_addr_t types,
and looking for page_min != addr_max instead.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agocheckpatch: adjust to QEMUisms
Blue Swirl [Thu, 20 Jan 2011 20:58:56 +0000 (20:58 +0000)]
checkpatch: adjust to QEMUisms

Change checkpatch.pl for QEMU use:
 - Root directory detection
 - Forbid tabs
 - Indent at 4 spaces
 - Allow typedefs
 - Enforce brace use even for single statement blocks
 - Don't suggest nonexistent cleanup tools

Mention the script in CODING_STYLE.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAdd checkpatch.pl from Linux kernel
Blue Swirl [Thu, 20 Jan 2011 20:54:26 +0000 (20:54 +0000)]
Add checkpatch.pl from Linux kernel

Unchanged import from
http://www.kernel.org/pub/linux/kernel/people/apw/checkpatch/checkpatch.pl-0.31

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAdd scripts directory
Blue Swirl [Thu, 20 Jan 2011 20:54:21 +0000 (20:54 +0000)]
Add scripts directory

Move build and user scripts into scripts directory.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agogt64xxx: set isa_mem_base during registration
Aurelien Jarno [Thu, 20 Jan 2011 20:40:53 +0000 (21:40 +0100)]
gt64xxx: set isa_mem_base during registration

isa_mem_base is computed from registers during reset, but due to QEMU
limitations some devices (e.g. VGA card) need to know it earlier when
they are registered.

Workaround this by setting the value during registration instead of
reset.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agohw/pl190.c: Fix writing of default vector address
Peter Maydell [Thu, 20 Jan 2011 16:04:52 +0000 (16:04 +0000)]
hw/pl190.c: Fix writing of default vector address

The PL190 implementation keeps the default vector address
in vect_addr[16], but we weren't using this for writes to
the DEFVECTADDR register. As a result of this fix the
default_addr structure member is unused and we can delete it.

Reported-by: Himanshu Chauhan <hschauhan@nulltrace.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoMerge remote branch 'mst/for_anthony' into staging
Anthony Liguori [Thu, 20 Jan 2011 15:05:37 +0000 (09:05 -0600)]
Merge remote branch 'mst/for_anthony' into staging

13 years agotarget-ppc: fix wrong NaN tests
Aurelien Jarno [Mon, 17 Jan 2011 18:29:33 +0000 (19:29 +0100)]
target-ppc: fix wrong NaN tests

Some tests in FPU emulation code were wrongly using float64_is_nan()
before commit 185698715dfb18c82ad2a5dbc169908602d43e81, and wrongly
using float64_is_quiet_nan() after. Fix them by using float64_is_any_nan()
instead.

Reviewed-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-ppc: fix sNaN propagation
Aurelien Jarno [Mon, 17 Jan 2011 18:29:33 +0000 (19:29 +0100)]
target-ppc: fix sNaN propagation

The current FPU code returns 0.0 if one of the operand is a
signaling NaN and the VXSNAN exception is disabled.

fload_invalid_op_excp() doesn't return a qNaN in case of a VXSNAN
exception as the operand should be propagated instead of a new
qNaN to be generated. Fix that by calling fload_invalid_op_excp()
only for the exception generation (if enabled), and use the softfloat
code to correctly compute the result.

Reviewed-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agopci: use qemu_malloc() in pcibus_get_dev_path()
Isaku Yamahata [Thu, 20 Jan 2011 06:57:49 +0000 (15:57 +0900)]
pci: use qemu_malloc() in pcibus_get_dev_path()

use qemu_malloc() instead of direct use of malloc().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agomsix: simplify write config
Isaku Yamahata [Thu, 20 Jan 2011 07:21:40 +0000 (16:21 +0900)]
msix: simplify write config

use pci_device_deassert_intx().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agomsi: simplify write config a bit.
Isaku Yamahata [Thu, 20 Jan 2011 07:21:39 +0000 (16:21 +0900)]
msi: simplify write config a bit.

use pci_device_deassert_intx().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopci: deassert intx on reset.
Isaku Yamahata [Thu, 20 Jan 2011 07:21:38 +0000 (16:21 +0900)]
pci: deassert intx on reset.

deassert intx on device reset.
So far pci_device_reset() is used for system reset.
In that case, interrupt controller is reset at the same time so that
all irq is are deasserted.
But now pci bus reset/flr is supported, and in that case irq needs to be
disabled explicitly.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopxa2xx_lcd: restore updating of display
Dmitry Eremin-Solenikov [Tue, 18 Jan 2011 16:11:33 +0000 (19:11 +0300)]
pxa2xx_lcd: restore updating of display

Recently PXA2xx lcd have stopped to be updated incrementally (picture
frozen). This patch fixes that by passing non min/max x/y, but rather
(correctly) x/y and w/h.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agopxa2xx: fix vmstate_pxa2xx_i2c
Dmitry Eremin-Solenikov [Thu, 13 Jan 2011 15:37:12 +0000 (18:37 +0300)]
pxa2xx: fix vmstate_pxa2xx_i2c

vmstate_pxa2xx_i2c incorrectly recursed to itself instead of going
to store slave device. Fix that stop stop qemu from segfaulting
during savevm for pxa2xx-based devices.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoscoop: fix access to registers from second instance
Dmitry Eremin-Solenikov [Thu, 13 Jan 2011 15:37:11 +0000 (18:37 +0300)]
scoop: fix access to registers from second instance

Second instance of scoop contains registers shifted to 0x40 from the start
of the page. Instead of messing with register mapping, just limit register
address to 0x00..0x3f.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agomainstone: fix name of the allocated memory for roms
Dmitry Eremin-Solenikov [Thu, 13 Jan 2011 15:37:10 +0000 (18:37 +0300)]
mainstone: fix name of the allocated memory for roms

Mainstone board has two flash chips (emulated by two ram regions), however
currently code tries to allocate them with the same name, which fails.
Fix that to make mainstone emulation work again.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoadd bepo (french dvorak) keyboard layout
Fred Boiteux [Sun, 9 Jan 2011 13:24:59 +0000 (14:24 +0100)]
add bepo (french dvorak) keyboard layout

I'm using the Qemu program with VNC I/O, and I had some problems with
my keyboard layout, so I've prepared a definition to be included in
Qemu, built from Xorg description.

Signed-off-by: Frédéric Boiteux <fboiteux@free.fr>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agostc91c111: Implement save/restore
Peter Maydell [Thu, 23 Dec 2010 17:19:58 +0000 (17:19 +0000)]
stc91c111: Implement save/restore

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agopl080: Implement save/restore
Peter Maydell [Thu, 23 Dec 2010 17:19:57 +0000 (17:19 +0000)]
pl080: Implement save/restore

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agopl110: Implement save/restore
Peter Maydell [Thu, 23 Dec 2010 17:19:56 +0000 (17:19 +0000)]
pl110: Implement save/restore

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agopl031: Implement save/restore
Peter Maydell [Thu, 23 Dec 2010 17:19:55 +0000 (17:19 +0000)]
pl031: Implement save/restore

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agopl050: Implement save/restore
Peter Maydell [Thu, 23 Dec 2010 17:19:54 +0000 (17:19 +0000)]
pl050: Implement save/restore

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoarm_sysctl: Implement save/restore
Peter Maydell [Thu, 23 Dec 2010 17:19:53 +0000 (17:19 +0000)]
arm_sysctl: Implement save/restore

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agovpb_sic: Implement save/restore
Peter Maydell [Thu, 23 Dec 2010 17:19:52 +0000 (17:19 +0000)]
vpb_sic: Implement save/restore

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agopl190: Implement save/restore
Peter Maydell [Thu, 23 Dec 2010 17:19:51 +0000 (17:19 +0000)]
pl190: Implement save/restore

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agogt64xxx: qdev conversion
Aurelien Jarno [Wed, 19 Jan 2011 22:10:40 +0000 (23:10 +0100)]
gt64xxx: qdev conversion

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosh_pci: qdev conversion
Aurelien Jarno [Wed, 19 Jan 2011 17:23:59 +0000 (18:23 +0100)]
sh_pci: qdev conversion

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosh_serial: process all received characters
Aurelien Jarno [Wed, 19 Jan 2011 10:38:36 +0000 (11:38 +0100)]
sh_serial: process all received characters

When operating on the SCIF, process all the received characters, as long
as the FIFO can handle them.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosh_serial: remove one level of indirection
Aurelien Jarno [Wed, 19 Jan 2011 10:35:02 +0000 (11:35 +0100)]
sh_serial: remove one level of indirection

The indirection functions are empty since commit
8da3ff180974732fc4272cb4433fef85c1822961.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agousb-hid: modifiers should generate an event
Aurelien Jarno [Mon, 17 Jan 2011 18:29:34 +0000 (19:29 +0100)]
usb-hid: modifiers should generate an event

When a modifier key is pressed or released, the USB HID keyboard still
answers NAK, unless another key is also pressed or released.

The patch fixes that by calling usb_hid_changed() when a modifier key
is pressed or released.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: fix floatx80_is_{quiet,signaling}_nan()
Aurelien Jarno [Mon, 17 Jan 2011 18:29:33 +0000 (19:29 +0100)]
softfloat: fix floatx80_is_{quiet,signaling}_nan()

floatx80_is_{quiet,signaling}_nan() functions are incorrectly detecting
the type of NaN, depending on SNAN_BIT_IS_ONE, one of the two is
returning the correct value, and the other true for any kind of NaN.

This patch fixes that by applying the same kind of comparison as for
other float formats, but taking into account the explicit bit.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotcg: README, name deposit second argument len/LEN
Edgar E. Iglesias [Thu, 20 Jan 2011 11:16:57 +0000 (12:16 +0100)]
tcg: README, name deposit second argument len/LEN

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agotarget-i386: Use deposit operation.
Richard Henderson [Tue, 11 Jan 2011 03:23:47 +0000 (19:23 -0800)]
target-i386: Use deposit operation.

Use this for assignment to the low byte or low word of a register.

Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agotcg: Define "deposit" as an optional operation.
Richard Henderson [Tue, 11 Jan 2011 03:23:42 +0000 (19:23 -0800)]
tcg: Define "deposit" as an optional operation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Add support for load/store reversed
Edgar E. Iglesias [Wed, 19 Jan 2011 22:18:00 +0000 (23:18 +0100)]
microblaze: Add support for load/store reversed

Load/store reversed (lwr/swr) are insns that endian translate
the sub-word part of the address and byteswap the data lanes.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
13 years agomicroblaze: Tweak comment, fast cases -> common cases
Edgar E. Iglesias [Wed, 19 Jan 2011 21:48:07 +0000 (22:48 +0100)]
microblaze: Tweak comment, fast cases -> common cases

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agopci: fix device paths
Michael S. Tsirkin [Wed, 19 Jan 2011 19:18:19 +0000 (21:18 +0200)]
pci: fix device paths

Patch a6a7005d14b3c32d4864a718fb1cb19c789f58a5 generated
broken device paths. We snprintf with a length shorter
than the output, so the last character is discarded and replaced
by the null byte. Fix it up by snprintf to a buffer
which is larger by 1 byte and then memcpy the data (without
the null byte) to where we need it.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agosparc: fix NaN handling
Blue Swirl [Tue, 18 Jan 2011 21:34:51 +0000 (21:34 +0000)]
sparc: fix NaN handling

Fix several bugs in NaN handling:
 * e in fcmpe* only changes qNaN handling
 * FCC is unchanged if an exception is raised
 * clear previous FTT before setting it

Reported-by: Mateusz Loskot <mateusz@loskot.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-arm: Log instruction start in TCG code
Peter Maydell [Tue, 18 Jan 2011 13:08:40 +0000 (13:08 +0000)]
target-arm: Log instruction start in TCG code

Add support for logging the start of instructions in TCG
code debug dumps for ARM targets.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Break TBs after mfc0_count
Edgar E. Iglesias [Mon, 17 Jan 2011 22:00:08 +0000 (23:00 +0100)]
mips: Break TBs after mfc0_count

Break the TB after reading the count register. This makes it
possible to take timer interrupts immediately after a read of
a possibly expired timer.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Expire late timers when reading cp0_count
Edgar E. Iglesias [Mon, 17 Jan 2011 23:12:22 +0000 (00:12 +0100)]
mips: Expire late timers when reading cp0_count

When reading cp0_count from a timer with a late trigger that should
already have expired, expire it and raise the timer irq.

This makes it possible for guest code (e.g, Linux) that first read
cp0_count, then compare it with cp0_compare and check for raised
timer interrupt lines to run reliably.

Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Break out cpu_mips_timer_expire
Edgar E. Iglesias [Mon, 17 Jan 2011 23:07:49 +0000 (00:07 +0100)]
mips: Break out cpu_mips_timer_expire

Reorganize for future patches, no functional change.

Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoReplace 'extern inline' with 'static inline'
Blue Swirl [Mon, 17 Jan 2011 20:26:30 +0000 (20:26 +0000)]
Replace 'extern inline' with 'static inline'

Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agobsd-user: Fix possible memory leaks and wrong realloc call
Stefan Weil [Sun, 16 Jan 2011 15:28:20 +0000 (16:28 +0100)]
bsd-user: Fix possible memory leaks and wrong realloc call

These errors were reported by cppcheck:

[bsd-user/elfload.c:1108]: (error) Common realloc mistake: "syms" nulled but not freed upon failure
[bsd-user/elfload.c:1076]: (error) Memory leak: s
[bsd-user/elfload.c:1079]: (error) Memory leak: syms

v2:
* The previous fix for memory leaks was incomplete (thanks to Peter Maydell for te hint).
* Fix wrong realloc usage, too.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agosm501: add 2D engine copyrect support
Aurelien Jarno [Mon, 17 Jan 2011 18:29:33 +0000 (19:29 +0100)]
sm501: add 2D engine copyrect support

Linux kernel started to use the SM501 2D engine for the console, and
especially the copyrect operation.

Implement this operation so that recent kernels can be used with QEMU.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosavevm: Fix no_migrate
Alex Williamson [Tue, 11 Jan 2011 21:39:43 +0000 (14:39 -0700)]
savevm: Fix no_migrate

The no_migrate save state flag is currently only checked in the
last phase of migration.  This means that we potentially waste
a lot of time and bandwidth with the live state handlers before
we ever check the no_migrate flags.  The error message printed
when we catch a non-migratable device doesn't get printed for
a detached migration.  And, no_migrate does nothing to prevent
an incoming migration to a target that includes a non-migratable
device.  This attempts to fix all of these.

One notable difference in behavior is that an outgoing migration
now checks for non-migratable devices before ever connecting to
the target system.  This means the target will remain listening
rather than exit from failure.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoMerge remote branch 'mst/for_anthony' into staging
Anthony Liguori [Mon, 17 Jan 2011 15:49:38 +0000 (09:49 -0600)]
Merge remote branch 'mst/for_anthony' into staging

13 years agoacpi_piix4: expose no_hotplug attribute via i/o port
Marcelo Tosatti [Tue, 11 Jan 2011 16:20:39 +0000 (14:20 -0200)]
acpi_piix4: expose no_hotplug attribute via i/o port

Expose no_hotplug attribute via I/O port, so ACPI BIOS can indicate
removability status to guest OS.

An updated seabios is required to make use of this feature (seabios.git
commit ID 3c241edf3d7ef29c21).

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Tested-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agodocument QEMU<->ACPIBIOS PCI hotplug interface
Marcelo Tosatti [Tue, 11 Jan 2011 16:20:38 +0000 (14:20 -0200)]
document QEMU<->ACPIBIOS PCI hotplug interface

Document how QEMU communicates with ACPI BIOS for PCI hotplug.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agom48t59: Fix a wrong opaque passed to nvram read and write routines
Hervé Poussineau [Sun, 2 Jan 2011 18:44:49 +0000 (19:44 +0100)]
m48t59: Fix a wrong opaque passed to nvram read and write routines

This fixes boot on PPC prep.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agogdbstub: Close connection in gdb_exit
Fabien Chouteau [Thu, 13 Jan 2011 11:46:57 +0000 (12:46 +0100)]
gdbstub: Close connection in gdb_exit

On Windows, this is required to flush the remaining data in the IO stream,
otherwise Gdb do not receive the last packet.

Version 2:
   Fix linux-user build error.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
13 years agoUSB keyboard emulation key mapping error
Michael Tokarev [Mon, 18 Oct 2010 12:55:25 +0000 (16:55 +0400)]
USB keyboard emulation key mapping error

The USB keyboard emulation's translation table in hw/usb-hid.c doesn't
match the codes actually sent for the Logo (a.k.a. "Windows") or Menu
keys. This results in the guest OS not being able to receive these keys
at all when the USB keyboard emulation is being used.

In particular, both the keymap in /usr/share/kvm/keymaps/modifiers and
the evdev table in x_keymap.c map these keys to 0xdb, 0xdc, and 0xdd,
while usb_hid_usage_keys[] seems to be expecting them to be mapped to
0x7d, 0x7e, and 0x7f.

The attached patch seems to fix the problem, at least in my (limited)
testing.

http://bugs.debian.org/578846
http://bugs.debian.org/600593 (cloned from the above against different pkg)
https://bugs.launchpad.net/qemu/+bug/584139

Signed-Off-By: Brad Jorsch <anomie@users.sourceforge.net>
Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: implement negc using TCG
Aurelien Jarno [Thu, 13 Jan 2011 07:20:39 +0000 (08:20 +0100)]
target-sh4: implement negc using TCG

Using setcond it's now possible to generate a relatively short negc
instruction in TCG.

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