Commit graph

5766 commits

Author SHA1 Message Date
aliguori 56f3a5d01e Main loop fixes/cleanup
Tidy up win32 main loop bits, allow timeout >= 1s, and force timeout to 0 if
there is a pending bottom half.



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5577 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-31 18:07:17 +00:00
aliguori 80d3580b29 Clarify qemu_bh_schedule_idle() usage
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5576 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-31 17:42:00 +00:00
aliguori 5ccfae10a7 Implement "info chardev" command. (Gerd Hoffmann)
This patch makes qemu keep track of the character devices in use and
implements a "info chardev" monitor command to print a list.

qemu_chr_open() sticks the devices into a linked list now.  It got a new
argument (label), so there is a name for each device.  It also assigns a
filename to each character device.  By default it just copyes the
filename passed in.  Individual drivers can fill in something else
though.  qemu_chr_open_pty() sets the filename to name of the pseudo tty
allocated.

Output looks like this:

  (qemu) info chardev
  monitor: filename=unix:/tmp/run.sh-26827/monitor,server,nowait
  serial0: filename=unix:/tmp/run.sh-26827/console,server
  serial1: filename=pty:/dev/pts/5
  parallel0: filename=vc:640x480

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5575 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-31 17:31:29 +00:00
aliguori 1490791f61 fix bdrv_aio_read API breakage in qcow2 (Andrea Arcangeli)
I noticed the qemu_aio_flush was doing nothing at all. And a flood of
cmd_writeb commands leading to a noop-invocation of qemu_aio_flush
were executed.

In short all 'memset;goto redo' places must be fixed to use the bh and
not to call the callback in the context of bdrv_aio_read or the
bdrv_aio_read model falls apart. Reading from qcow2 holes is possible
with phyisical readahead (kind of breada in linux buffer cache).

This is needed at least for scsi, ide is lucky (or it has been
band-aided against this API breakage by fixing the symptom and not the
real bug).

Same bug exists in qcow of course, can be fixed later as it's less
urgent.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5574 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-31 17:28:00 +00:00
aliguori 492c30af25 Make DMA bottom-half driven (v2)
The current DMA routines are driven by a call in main_loop_wait() after every
select.

This patch converts the DMA code to be driven by a constantly rescheduled
bottom half.  The advantage of using a scheduled bottom half is that we can
stop scheduling the bottom half when there no DMA channels are runnable.  This
means we can potentially detect this case and sleep longer in the main loop.

The only two architectures implementing DMA_run() are cris and i386.  For cris,
I converted it to a simple repeating bottom half.  I've only compile tested
this as cris does not seem to work on a 64-bit host.  It should be functionally
identical to the previous implementation so I expect it to work.

For x86, I've made sure to only fire the DMA bottom half if there is a DMA
channel that is runnable.  The effect of this is that unless you're using sb16
or a floppy disk, the DMA bottom half never fires.

You probably should test this malc.  My own benchmarks actually show slight
improvement by it's possible the change in timing could affect your demos.

Since v1, I've changed the code to use a BH instead of a timer.  cris at least
seems to depend on faster than 10ms polling.

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



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5573 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-31 17:25:56 +00:00
aliguori 1b435b1032 Make bottom halves more robust
Bottom halves are supposed to not complete until the next iteration of the main
loop.  This is very important to ensure that guests can not cause stack
overflows in the block driver code.  Right now, if you attempt to schedule a
bottom half within a bottom half callback, you will enter an infinite loop.

This patch uses the same logic that we use for the IOHandler loop to make the
bottom half processing robust in list manipulation while in a callback.

This patch also introduces idle scheduling for bottom halves.  qemu_bh_poll()
returns an indication of whether any bottom halves were successfully executed.
qemu_aio_wait() uses this to immediately return if a bottom half was executed
instead of waiting for a completion notification.

qemu_bh_schedule_idle() works around this by not reporting the callback has
run in the qemu_bh_poll loop.  qemu_aio_wait() probably needs some refactoring
but that would require a larger code audit.  idle scheduling seems like a good
compromise.

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




git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5572 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-31 17:24:21 +00:00
pbrook 474ad834d2 Use qemu_gettimeofday.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5571 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-29 14:37:18 +00:00
aliguori e5ceb24447 Fix restore of older snapshots for target-i386 on big endian hosts
A target_ulong may be 64-bit.  Passing it to a function expecting a 32-bit
pointer is wrong and unfortunately happens to work for x86.  It won't work on
big endian hosts though.  Change the code to work properly on all hosts.

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



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5570 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-29 14:16:31 +00:00
pbrook e41b39105b Use locally defined structure.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5569 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 18:22:59 +00:00
blueswir1 1572a18cc6 Sun4c cleanups (Robert Reif)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5568 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 17:55:32 +00:00
aliguori 9b8114a8ef fix off-by-one generating vmdk backing files (Avi Kivity)
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@5567 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 14:08:49 +00:00
balrog 3d878caab9 Set default max_cpus to one.
Clean-up machine definitions.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5566 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 10:59:59 +00:00
balrog d4354694e9 Fix return value printing for shmat (Lauro Ramos Venancio).
The shmat syscall returns an address, so we must use the
print_syscall_ret_addr function.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5565 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 10:39:39 +00:00
balrog 6de645c7d1 Recvmsg must return the number of bytes received (Lauro Ramos Venancio).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5564 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 10:26:29 +00:00
balrog 55f280c90e page_check_range: fix wrap around test (Lauro Ramos Venancio).
Move up the warp around test because line
'end = TARGET_PAGE_ALIGN(start+len);'
can interfere with it.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5563 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 10:24:11 +00:00
balrog d732dcb442 Fix iovec for the case with invalid elements (Lauro Ramos Venancio).
We must call the writev even if an iovec element is invalid. For
example, if the second element is invalid, the linux process the first
one.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5562 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 10:21:03 +00:00
balrog a2f86d8e08 Use the host exit syscall for exiting (Lauro Ramos Venancio).
We can't call the libc _exit function because it calls the exit_group
host syscall. We must call directly the exit host syscall.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5561 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 10:18:28 +00:00
edgar_igl 44696296d5 CRIS: Plug more temp leaks.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5560 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 00:13:15 +00:00
balrog 81d7087514 Control + i and [tab] share keycode in curses, simulate [tab].
Spotted by Blue Swirl.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5559 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 00:11:06 +00:00
balrog 853f6931db Fix cpuid ext_features value for Atom N270 (Blue Swirl).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5558 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-28 00:03:28 +00:00
aurel32 ea36369470 target-ppc: use consistent names for variables
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5557 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 22:50:39 +00:00
aurel32 312179c419 target-ppc: indentation fixes
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5556 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 22:50:31 +00:00
aurel32 d03ef5116b target-ppc: convert rotation instructions to TCG
Also fix rlwimi and rldimi for corner cases.

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

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5555 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 22:50:22 +00:00
edgar_igl f4b147f670 CRIS: Plug a few temp leaks.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5554 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 21:10:26 +00:00
edgar_igl c968ef8df5 ETRAX-FS: Process outgoing DMA channels until EOL.
For outgoing DMA channels, keep processing descriptors until hitting end
of list.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5553 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 20:44:27 +00:00
edgar_igl 31c18d8761 CRIS: Remove cpu_T.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5552 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 20:24:59 +00:00
blueswir1 780e264fa4 Ansify to please sparse
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5551 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 19:49:12 +00:00
edgar_igl fb48f71b3d CRIS: Avoid more cpu_T usage.
* Explicit operand passing to prep_alu_r.
* Avoid some more cpu_T[] usage.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5550 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 16:46:29 +00:00
blueswir1 8137cde8f9 Move sun4c to its own hwdef (Robert Reif)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5549 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 15:56:56 +00:00
edgar_igl 43d7ac4e74 CRIS: Avoid cpu_T[1] for move_r.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5548 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 13:55:28 +00:00
edgar_igl c5631f487d CRIS: Avoid using cpu_T[0] for testing condition codes.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5547 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 13:52:44 +00:00
edgar_igl 7dcfb0897b CRIS: Add branch-free versions of abs, lsl, lsr and asr.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5546 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-27 12:39:30 +00:00
edgar_igl 4f9cc92764 CRIS: Correct tcg globals allocation for 64bit hosts.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5545 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26 23:18:06 +00:00
blueswir1 84778508d7 Preliminary BSD user emulator support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5544 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26 20:33:16 +00:00
blueswir1 46f42f2940 Update from binutils 2.17
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5543 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26 19:13:20 +00:00
blueswir1 d4abd56763 Document the binutils source files used in constructing sparc-dis.c
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5542 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26 19:10:38 +00:00
blueswir1 968467e304 Add "const"
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5541 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26 16:40:27 +00:00
blueswir1 36bae8dd95 Fix inline use warnings from sparse
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5540 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26 15:26:09 +00:00
blueswir1 b1d8e52e63 Fix undeclared symbol warnings from sparse
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5539 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26 13:43:07 +00:00
blueswir1 51a0f568c5 Fix incorrect use of pstrcpy (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5538 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26 10:22:11 +00:00
blueswir1 1b52da581d Fix undefined pthread_sigmask warning on FreeBSD (Juergen Lock)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5537 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26 09:54:50 +00:00
blueswir1 653a07b222 Change freeing method because the allocation function was changed in r5532
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5536 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25 13:48:59 +00:00
blueswir1 5be8e1f258 Silence warnings about unused variables
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5535 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25 11:47:20 +00:00
blueswir1 40ea94a5d4 Suppress a GCC warning about unused function
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5534 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25 11:26:41 +00:00
blueswir1 4761a48bcd Fix GCC 4 signedness warning
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5533 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25 11:25:48 +00:00
blueswir1 2bd7318c1a Replace uses of strndup (a GNU extension) with Qemu pstrdup
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5532 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25 11:23:27 +00:00
blueswir1 be15b141e0 Replace uses of strncpy (a GNU extension) with Qemu pstrcpy
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5531 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25 11:21:28 +00:00
blueswir1 9b4c14c35b Fix undefined pthread_sigmask warning on OpenBSD
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5530 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25 11:19:14 +00:00
blueswir1 5b3715bfda Use snprintf to please OpenBSD linker
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5529 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25 11:18:12 +00:00
balrog fbc190d82a Fix a bad memcpy length (Bruce Rogers).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5528 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25 00:10:20 +00:00