Commit Graph

14950 Commits

Author SHA1 Message Date
Stefan Hajnoczi 37628f11c6 QMP: add server mode to QEMUMonitorProtocol
QEMU supports socket chardevs that establish connections like a server
or a client.  The QEMUMonitorProtocol class only supports connecting as
a client.  It is not possible to connect race-free when launching QEMU
since trying to connect before QEMU has bound and is listening on the
socket results in failure.

Add the QEMUMonitorProtocol(server=True) argument to bind and listen on
the socket.  The QEMU process can then be launched and connects to the
already existing QMP socket without a race condition:

  qmp = qmp.QEMUMonitorProtocol(monitor_path, server=True)
  popen = subprocess.Popen(args)
  qmp.accept()

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-06-01 11:43:18 -03:00
Stefan Hajnoczi 91b8eddf41 QMP: add get_events(wait=True) option
The get_events() function polls for new QMP events and then returns.  It
can be useful to wait for the next QMP event so add the boolean 'wait'
keyword argument.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-06-01 11:43:18 -03:00
Luiz Capitulino e9b4b432e7 HMP: Use QMP inject nmi implementation
This **CHANGES** the human monitor "nmi" command behavior.

Currently it accepts an CPU argument which, when provided, will send
the NMI to the specified CPU. This feature is of discussable value
though and HMP shouldn't have more features than QMP, so let's use
QMP's instead (it's also simpler).

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-06-01 11:42:25 -03:00
Lai Jiangshan a404666457 QMP: add inject-nmi qmp command
inject-nmi command injects an NMI on all CPUs of guest.
It is only supported for x86 guest currently, it will
returns "Unsupported" error for non-x86 guest.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-06-01 11:42:25 -03:00
Lai Jiangshan 4c5a1e4db7 QMP: QError: New QERR_UNSUPPORTED
New QERR_UNSUPPORTED for unsupported commands or requests.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-06-01 11:42:25 -03:00
Juha Riihim?ki 578c7b2ca8 audio: fix integer overflow expression
Fix an integer overflow that can happen for signed 32 bit types
when using FLOAT_MIXENG. (Note that at the moment this is only true
when using the MacOSX coreaudio audio driver.)

Signed-off-by: Juha Riihim?ki <juha.riihimaki@nokia.com>
[Peter Maydell: Removed unnecessary casts]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: malc <av1474@comtv.ru>
2011-06-01 00:14:07 +04:00
Richard Henderson 3b4fefd6e6 target-alpha: Implement TLB flush primitives.
Expose these via MTPR, more or less like the real HW does.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson e5214853ea target-alpha: Use a fixed frequency for the RPCC in system mode.
Also include the PCC_OFS in the return value.  For user mode we
can pretend the PCC_OFS value is always zero.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson 5b4504079a target-alpha: Trap for unassigned and unaligned addresses.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson fa6e0a6354 target-alpha: Remap PIO space for 43-bit KSEG for EV6.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson a3b9af1624 target-alpha: Implement cpu_alpha_handle_mmu_fault for system mode.
Reads the page table how PALcode would, except that the virtual
page table base register is not used.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson 2ace7e55a2 target-alpha: Implement more CALL_PAL values inline.
In particular, SWPIPL is used quite a lot by the Linux kernel.
Doing this inline makes it significantly easier to step through
without the debugger getting confused by the mode switch.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson 6a80e088c7 target-alpha: Disable interrupts properly.
Interrupts are disabled in PALmode, and when the PS IL is high enough.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson a18ad89351 target-alpha: All ISA checks to use TB->FLAGS.
We had two different methods in use, both of which referenced ENV,
and neither of which indicated to the generic code when different
compilation modes are not compatible.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 21d2beaaef target-alpha: Swap shadow registers moving to/from PALmode.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 3a6fa678bf target-alpha: Implement do_interrupt for system mode.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 26b4609447 target-alpha: Add IPRs to be used by the emulation PALcode.
These aren't actually used yet, but we can at least access
them via the HW_MFPR and HW_MTPR instructions.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson bba9bdcee8 target-alpha: Use kernel mmu_idx for pal_mode.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson ea879fc719 target-alpha: Add various symbolic constants.
The EXC_M_* constants were being set for the EV6, not as set for
the Unix kernel entry point.

Use PS_USER_MODE instead of hard-coding access to the PS register.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 2d9671d391 target-alpha: Use do_restore_state for arithmetic exceptions.
This gets the PC right after an arithmetic exception.  Also tidies
the code in the TLB fault handlers to use common code.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson b5f1aa6444 target-alpha: Tidy up arithmetic exceptions.
Introduce and use arith_excp, filling in the trap_arg[01] IPRs.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 07b6c13b09 target-alpha: Tidy exception constants.
There's no need to attempt to match EXCP_* values with PALcode entry
point offsets.  Instead, compress all the values to make for more
efficient switch statements within QEMU.

We will be doing TLB fill within QEMU proper, not within the PALcode,
so all of the ITB/DTB miss, double fault, and access exceptions can
be compressed to EXCP_MMFAULT.

Compress all of the EXCP_CALL_PAL exceptions into one.
Use env->error_code to store the specific entry point.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson b758aca1f6 target-alpha: Enable the alpha-softmmu target.
With all of the pre-existing code that would not compile gone,
this is the earliest point at which the target can be enabled.

There is no machine defined yet, so this will crash on startup.
Enable the target anyway, to make sure that further compilation
problems do not creep back in.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 129d8aa575 target-alpha: Rationalize internal processor registers.
Delete all the code that tried to emulate the real IPRs of some
unnamed CPU.  Replace those with just 3 slots that we can use to
communicate trap information between the helper functions that
signal exceptions and the OS trap handler.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 508b43eaf3 target-alpha: Merge HW_REI and HW_RET implementations.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 8417845ee9 target-alpha: Cleanup MMU modes.
Don't bother including executive and supervisor modes.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson e52458fe29 target-alpha: Fix system store_conditional
This code contained typos, as it had never been compiled.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 2374e73eda target-alpha: Fix translation of PALmode memory insns.
All of the "raw" memory accesses should be "phys" instead.  Fix
some confusion about argument ordering of the store routines.
Fix the implementation of store-conditional.

Delete the "alt-mode" helpers.  Because we only implement two
mmu modes, let /a imply user-mode unconditionally.

Leave some combinations of virt access without permission
checks as unimplemented.  There are too many hoops through
which to jump, and these insns will not be needed in the
emulation palcode.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:04 -07:00
Richard Henderson 352e48b0f4 target-alpha: Remove partial support for palcode emulation.
This code does not work, and will be replaced by a bios image.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:04 -07:00
Richard Henderson bf1b03fe18 target-alpha: Single-step properly across branches.
We were failing to generate EXC_DEBUG in the EXIT_PC_UPDATED path.
This caused us not to stop at the instruction after a branch, but
on the instruction afterward.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:04 -07:00
Richard Henderson b9bec751c8 target-alpha: Disassemble EV6 PALcode instructions.
The QEMU emulation PALcode will use EV6 PALcode insns regardless
of the "real" cpu instruction set being emulated.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:04 -07:00
Richard Henderson 8d6df264f1 target-alpha: Claim ownership.
I've been maintaining this port for a while now.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:04 -07:00
Anthony Liguori b1d7d2b93a Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-05-31 08:23:11 -05:00
Anthony Liguori ede77d297f Merge remote-tracking branch 'amit/for-anthony' into staging 2011-05-31 08:22:03 -05:00
Anthony Liguori ed7ec84007 Merge remote-tracking branch 'bonzini/scsi.2' into staging
Conflicts:
	hw/usb-msd.c
2011-05-31 08:20:56 -05:00
Anthony Liguori f590f4c4b6 Merge remote-tracking branch 'kraxel/usb.14.pull' into staging 2011-05-31 08:17:15 -05:00
Stefan Weil 06ea77bc50 Fix spelling in comment (additon -> addition)
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-29 11:58:28 +01:00
Stefan Weil b9055c3cca pflash_cfi02: Fix a typo in debug code (TARGET_FMT_pld -> TARGET_FMT_plx)
Thanks to Tobias Hoffmann <th55@gmx.de> for this patch.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-29 11:58:28 +01:00
Marcus Comstedt 2eb9f24182 bitbang_i2c: Fix spurious slave read after NACK
After NACKing a read operation, a raising SCL should not trigger a new
read from the slave.  Introduce a new state which just waits for a stop
or start condition after NACK.

Signed-off-by: Marcus Comstedt <marcus@mc.pp.se>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-05-28 16:20:43 +02:00
Blue Swirl 42a623c7db Move user emulator stuff from cpu-exec.c to user-exec.c
Simplify cpu-exec.c by refactoring.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-05-28 06:26:00 +00:00
Blue Swirl 9eff14f3d5 cpu-exec: prepare for user and softmmu split
There is little in common with user and softmmu versions of cpu_resume_signal(),
split them.

Fix coding style for the user emulator part.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-05-28 06:25:55 +00:00
Markus Armbruster 7edfe65246 virtio-console: Simplify init callbacks
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27 15:50:56 +05:30
Markus Armbruster a15bb0d6a9 virtio-serial: Drop redundant VirtIOSerialPort member info
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27 15:50:56 +05:30
Markus Armbruster 31d0f80f17 virtio-serial: Drop useless property is_console
All you could ever achieve with it is break stuff, so removing it
should be safe.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27 15:50:56 +05:30
Markus Armbruster 2a3d57ce42 virtio-serial: Clean up virtconsole detection
virtio-serial-bus needs to treat "virtconsole" devices specially.  It
uses VirtIOSerialPort member is_console to recognize them.  It gets
its value via property initialization.  Cute hack, except it lets
users mess with it: "-device virtconsole,is_console=0" isn't plugged
into port 0 as it should.

Move the flag to VirtIOSerialPortInfo.  Keep the property for backward
compatibility; its value has no effect.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27 15:50:56 +05:30
Markus Armbruster 5e52e5f903 virtio-serial: Plug memory leak on qdev exit()
virtio_serial_init() allocates the VirtIOSerialBus dynamically, but
virtio_serial_exit() doesn't free it.

Fix by getting rid of the allocation.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27 15:50:55 +05:30
Alon Levy 199646d815 virtio-serial-bus: use bh for unthrottling
Instead of calling flush_queued_data when unthrottling, schedule
a bh. That way we can return immediately to the caller, and the
flush uses the same call path as a have_data for callbackee.

No migration change is required because bh are called from vm_stop.

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27 15:50:55 +05:30
Paolo Bonzini 1455084ea2 scsi: ignore LUN field in the CDB
The LUN field in the CDB is a historical relic.  Ignore it as reserved,
which is what modern SCSI specifications actually say.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26 12:14:17 +02:00
Paolo Bonzini aba1f02363 scsi: rename arguments to the new callbacks
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
2011-05-26 12:14:17 +02:00
Paolo Bonzini c6df7102f5 scsi: split command_complete callback in two
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
2011-05-26 12:14:17 +02:00