]> git.proxmox.com Git - qemu.git/log
qemu.git
13 years agotarget-s390x: Fix duplicate call of tcg_temp_new_i64
Stefan Weil [Fri, 27 May 2011 17:03:26 +0000 (19:03 +0200)]
target-s390x: Fix duplicate call of tcg_temp_new_i64

tmp2 = tcg_temp_new_i64() is already executed unconditionally,
so there is no need to call it a second time for 64 bit hosts.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agotarget-s390x: Fix wrong argument in call of tcg_gen_shl_i64()
Stefan Weil [Fri, 27 May 2011 17:03:25 +0000 (19:03 +0200)]
target-s390x: Fix wrong argument in call of tcg_gen_shl_i64()

tcg_gen_shl_i64 needs a 3rd argument of type TCGv_i64.
Set tmp4 so it can be used here.

v2:
Don't call tcg_const_i64() inside of the loop
because it creates additional code.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agotarget-s390x: Fix build for non-linux hosts
Stefan Weil [Tue, 24 May 2011 17:42:51 +0000 (19:42 +0200)]
target-s390x: Fix build for non-linux hosts

linux/kvm.h is not always available for compilation.

Neither linux/kvm.h nor kvm.h are needed, so remove both
which also fixes the build problem for non-linux hosts.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agos390x: update zipl rom
Alexander Graf [Tue, 24 May 2011 17:52:28 +0000 (19:52 +0200)]
s390x: update zipl rom

The zipl bootloader rom we have has seen some dramatic speedups upstream,
so let's update it to improve the experience when booting a guest image.

This binary is based on commit id 9a0842dd9823d529f721b418d554f17c72e009e3.

Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoPPC: fix mpc8544ds pci default devices
Alexander Graf [Fri, 27 May 2011 01:23:26 +0000 (03:23 +0200)]
PPC: fix mpc8544ds pci default devices

After the Qdev'ification of the MPC8544DS board and PCI bus, the internal
PCI bus name changed from "pci" to "pci.0". Reflect this change in the
search for that bus.

This patch enables networking on e500 guests again.

Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoFix segfault on screendump with -nographic
Alexander Graf [Thu, 26 May 2011 21:50:33 +0000 (23:50 +0200)]
Fix segfault on screendump with -nographic

When running -nographic and calling "screendump" on the monitor, qemu
segfaults. Fix the invalid pointer dereference by checking for NULL.

Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoPPC: install mpc8544ds.dtb
Alexander Graf [Wed, 25 May 2011 21:49:41 +0000 (23:49 +0200)]
PPC: install mpc8544ds.dtb

We don't install mpc8544ds.dtb, which means that -M mpc8544ds doesn't
work when installed. Fix it by installing the file.

Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoPPC: fix sregs usage on booke
Alexander Graf [Wed, 25 May 2011 13:04:42 +0000 (15:04 +0200)]
PPC: fix sregs usage on booke

When compiling qemu with kvm support on BookE PPC machines, I get
the following error:

  cc1: warnings being treated as errors
  /tmp/qemu/target-ppc/kvm.c: In function 'kvm_arch_get_registers':
  /tmp/qemu/target-ppc/kvm.c:188: error: unused variable 'sregs'

This is due to overly ambitious #ifdef'ery introduced in 90dc88.
Fix it by keeping code that doesn't depend on new headers alive
for the compiler, but never executed due to failing capability
checks.

CC: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoppc: Fix compilation for ppc64-softmmu
Stefan Weil [Fri, 20 May 2011 20:30:19 +0000 (22:30 +0200)]
ppc: Fix compilation for ppc64-softmmu

When QEMU was configured with --enable-debug-tcg,
compilation fails in spr_write_booke206_mmucsr0() and in
spr_write_booke_pid(). Similar changes are also needed
in conditional code which is normally unused.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agohw/9pfs: Don't crash when we get a request with not supported 9p operation
Aneesh Kumar K.V [Wed, 1 Jun 2011 07:05:14 +0000 (12:35 +0530)]
hw/9pfs: Don't crash when we get a request with not supported 9p operation

Return EOPNOTSUPP as error

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
13 years ago[virtio-9p] Make rpath thread safe
Venkateswararao Jujjuri (JV) [Wed, 1 Jun 2011 07:05:14 +0000 (12:35 +0530)]
[virtio-9p] Make rpath thread safe

Current rpath inline function is heavily used in all system calls.
This function has a static buffer making it a non-thread safe function.
This patch introduces new thread-safe routine and makes use of it.

Signed-off-by: Venkateswararao Jujjuri "<jvrao@linux.vnet.ibm.com>
13 years agovirtio-9p: Use relative includes for files in hw
Stefan Weil [Wed, 1 Jun 2011 07:05:14 +0000 (12:35 +0530)]
virtio-9p: Use relative includes for files in hw

Commit 353ac78d495ef976242abd868f68d78420861c2c moved the files
without fixing the include paths. It used a modified CFLAGS
to add hw to the include search path, but this breaks builds
where the user wants to set special CFLAGS. Long include paths
also increase compilation time.

Therefore this patch removes the special CFLAGS for virtio
and fixes the include statements by using relative include paths.

v2: Remove special CFLAGS.
v3: Update needed for latest QEMU.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
13 years agovirtio-9p: Move device specific code to virtio-9p-device
Aneesh Kumar K.V [Wed, 1 Jun 2011 07:05:13 +0000 (12:35 +0530)]
virtio-9p: Move device specific code to virtio-9p-device

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
13 years agovirtio-9p: Move 9p device registration into virtio-9p.c
Aneesh Kumar K.V [Wed, 1 Jun 2011 07:05:13 +0000 (12:35 +0530)]
virtio-9p: Move 9p device registration into virtio-9p.c

This patch move the 9p device registration into its own file

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
13 years agovirtio-9p: Don't link to 9p if virtio is not enabled
Aneesh Kumar K.V [Wed, 1 Jun 2011 07:05:13 +0000 (12:35 +0530)]
virtio-9p: Don't link to 9p if virtio is not enabled

If virtio is not enabled then we should not pull in
virtfs files

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
13 years ago[virtio-9p] Stop renaming files with similar name!
Malahal Naineni [Wed, 1 Jun 2011 07:05:11 +0000 (12:35 +0530)]
[virtio-9p] Stop renaming files with similar name!

v9fs_complete_rename() mistakenly renames files with similar name
as we don't check if the matched name is really an offspring.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
13 years agoQMP: add server mode to QEMUMonitorProtocol
Stefan Hajnoczi [Wed, 25 May 2011 18:48:01 +0000 (19:48 +0100)]
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>
13 years agoQMP: add get_events(wait=True) option
Stefan Hajnoczi [Wed, 25 May 2011 18:48:00 +0000 (19:48 +0100)]
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>
13 years agoHMP: Use QMP inject nmi implementation
Luiz Capitulino [Fri, 29 Apr 2011 15:11:50 +0000 (12:11 -0300)]
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>
13 years agoQMP: add inject-nmi qmp command
Lai Jiangshan [Mon, 7 Mar 2011 09:05:15 +0000 (17:05 +0800)]
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>
13 years agoQMP: QError: New QERR_UNSUPPORTED
Lai Jiangshan [Mon, 7 Mar 2011 09:05:04 +0000 (17:05 +0800)]
QMP: QError: New QERR_UNSUPPORTED

New QERR_UNSUPPORTED for unsupported commands or requests.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agoaudio: fix integer overflow expression
Juha Riihim?ki [Tue, 31 May 2011 18:40:21 +0000 (19:40 +0100)]
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>
13 years agotarget-alpha: Implement TLB flush primitives.
Richard Henderson [Tue, 19 Apr 2011 03:01:20 +0000 (20:01 -0700)]
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>
13 years agotarget-alpha: Use a fixed frequency for the RPCC in system mode.
Richard Henderson [Tue, 19 Apr 2011 02:53:31 +0000 (19:53 -0700)]
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>
13 years agotarget-alpha: Trap for unassigned and unaligned addresses.
Richard Henderson [Mon, 18 Apr 2011 23:13:12 +0000 (16:13 -0700)]
target-alpha: Trap for unassigned and unaligned addresses.

Signed-off-by: Richard Henderson <rth@twiddle.net>
13 years agotarget-alpha: Remap PIO space for 43-bit KSEG for EV6.
Richard Henderson [Wed, 27 Apr 2011 16:22:18 +0000 (09:22 -0700)]
target-alpha: Remap PIO space for 43-bit KSEG for EV6.

Signed-off-by: Richard Henderson <rth@twiddle.net>
13 years agotarget-alpha: Implement cpu_alpha_handle_mmu_fault for system mode.
Richard Henderson [Mon, 18 Apr 2011 22:59:21 +0000 (15:59 -0700)]
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>
13 years agotarget-alpha: Implement more CALL_PAL values inline.
Richard Henderson [Mon, 23 May 2011 20:09:00 +0000 (13:09 -0700)]
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>
13 years agotarget-alpha: Disable interrupts properly.
Richard Henderson [Mon, 18 Apr 2011 22:09:09 +0000 (15:09 -0700)]
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>
13 years agotarget-alpha: All ISA checks to use TB->FLAGS.
Richard Henderson [Mon, 23 May 2011 19:30:22 +0000 (12:30 -0700)]
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>
13 years agotarget-alpha: Swap shadow registers moving to/from PALmode.
Richard Henderson [Mon, 18 Apr 2011 21:07:59 +0000 (14:07 -0700)]
target-alpha: Swap shadow registers moving to/from PALmode.

Signed-off-by: Richard Henderson <rth@twiddle.net>
13 years agotarget-alpha: Implement do_interrupt for system mode.
Richard Henderson [Mon, 18 Apr 2011 21:05:35 +0000 (14:05 -0700)]
target-alpha: Implement do_interrupt for system mode.

Signed-off-by: Richard Henderson <rth@twiddle.net>
13 years agotarget-alpha: Add IPRs to be used by the emulation PALcode.
Richard Henderson [Mon, 23 May 2011 19:12:29 +0000 (12:12 -0700)]
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>
13 years agotarget-alpha: Use kernel mmu_idx for pal_mode.
Richard Henderson [Fri, 20 May 2011 21:14:44 +0000 (14:14 -0700)]
target-alpha: Use kernel mmu_idx for pal_mode.

Signed-off-by: Richard Henderson <rth@twiddle.net>
13 years agotarget-alpha: Add various symbolic constants.
Richard Henderson [Mon, 18 Apr 2011 21:19:17 +0000 (14:19 -0700)]
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>
13 years agotarget-alpha: Use do_restore_state for arithmetic exceptions.
Richard Henderson [Mon, 25 Apr 2011 19:20:27 +0000 (12:20 -0700)]
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>
13 years agotarget-alpha: Tidy up arithmetic exceptions.
Richard Henderson [Mon, 18 Apr 2011 20:19:28 +0000 (13:19 -0700)]
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>
13 years agotarget-alpha: Tidy exception constants.
Richard Henderson [Fri, 20 May 2011 21:04:57 +0000 (14:04 -0700)]
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>
13 years agotarget-alpha: Enable the alpha-softmmu target.
Richard Henderson [Fri, 20 May 2011 21:02:28 +0000 (14:02 -0700)]
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>
13 years agotarget-alpha: Rationalize internal processor registers.
Richard Henderson [Fri, 20 May 2011 20:30:00 +0000 (13:30 -0700)]
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>
13 years agotarget-alpha: Merge HW_REI and HW_RET implementations.
Richard Henderson [Fri, 20 May 2011 20:21:15 +0000 (13:21 -0700)]
target-alpha: Merge HW_REI and HW_RET implementations.

Signed-off-by: Richard Henderson <rth@twiddle.net>
13 years agotarget-alpha: Cleanup MMU modes.
Richard Henderson [Fri, 20 May 2011 20:11:25 +0000 (13:11 -0700)]
target-alpha: Cleanup MMU modes.

Don't bother including executive and supervisor modes.

Signed-off-by: Richard Henderson <rth@twiddle.net>
13 years agotarget-alpha: Fix system store_conditional
Richard Henderson [Fri, 20 May 2011 20:07:25 +0000 (13:07 -0700)]
target-alpha: Fix system store_conditional

This code contained typos, as it had never been compiled.

Signed-off-by: Richard Henderson <rth@twiddle.net>
13 years agotarget-alpha: Fix translation of PALmode memory insns.
Richard Henderson [Fri, 20 May 2011 20:04:35 +0000 (13:04 -0700)]
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>
13 years agotarget-alpha: Remove partial support for palcode emulation.
Richard Henderson [Mon, 18 Apr 2011 19:17:02 +0000 (12:17 -0700)]
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>
13 years agotarget-alpha: Single-step properly across branches.
Richard Henderson [Mon, 25 Apr 2011 19:52:57 +0000 (12:52 -0700)]
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>
13 years agotarget-alpha: Disassemble EV6 PALcode instructions.
Richard Henderson [Sun, 10 Apr 2011 17:31:20 +0000 (10:31 -0700)]
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>
13 years agotarget-alpha: Claim ownership.
Richard Henderson [Fri, 20 May 2011 19:23:18 +0000 (12:23 -0700)]
target-alpha: Claim ownership.

I've been maintaining this port for a while now.

Signed-off-by: Richard Henderson <rth@twiddle.net>
13 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Tue, 31 May 2011 13:23:11 +0000 (08:23 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

13 years agoMerge remote-tracking branch 'amit/for-anthony' into staging
Anthony Liguori [Tue, 31 May 2011 13:22:03 +0000 (08:22 -0500)]
Merge remote-tracking branch 'amit/for-anthony' into staging

13 years agoMerge remote-tracking branch 'bonzini/scsi.2' into staging
Anthony Liguori [Tue, 31 May 2011 13:20:56 +0000 (08:20 -0500)]
Merge remote-tracking branch 'bonzini/scsi.2' into staging

Conflicts:
hw/usb-msd.c

13 years agoMerge remote-tracking branch 'kraxel/usb.14.pull' into staging
Anthony Liguori [Tue, 31 May 2011 13:17:15 +0000 (08:17 -0500)]
Merge remote-tracking branch 'kraxel/usb.14.pull' into staging

13 years agoFix spelling in comment (additon -> addition)
Stefan Weil [Sun, 22 May 2011 12:02:40 +0000 (14:02 +0200)]
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>
13 years agopflash_cfi02: Fix a typo in debug code (TARGET_FMT_pld -> TARGET_FMT_plx)
Stefan Weil [Sun, 22 May 2011 12:02:39 +0000 (14:02 +0200)]
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>
13 years agobitbang_i2c: Fix spurious slave read after NACK
Marcus Comstedt [Sat, 28 May 2011 14:55:52 +0000 (16:55 +0200)]
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>
13 years agoMove user emulator stuff from cpu-exec.c to user-exec.c
Blue Swirl [Sun, 8 May 2011 11:22:38 +0000 (11:22 +0000)]
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>
13 years agocpu-exec: prepare for user and softmmu split
Blue Swirl [Sat, 21 May 2011 08:42:35 +0000 (08:42 +0000)]
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>
13 years agovirtio-console: Simplify init callbacks
Markus Armbruster [Wed, 25 May 2011 12:21:14 +0000 (14:21 +0200)]
virtio-console: Simplify init callbacks

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
13 years agovirtio-serial: Drop redundant VirtIOSerialPort member info
Markus Armbruster [Wed, 25 May 2011 12:21:13 +0000 (14:21 +0200)]
virtio-serial: Drop redundant VirtIOSerialPort member info

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
13 years agovirtio-serial: Drop useless property is_console
Markus Armbruster [Wed, 25 May 2011 12:21:12 +0000 (14:21 +0200)]
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>
13 years agovirtio-serial: Clean up virtconsole detection
Markus Armbruster [Wed, 25 May 2011 12:21:11 +0000 (14:21 +0200)]
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>
13 years agovirtio-serial: Plug memory leak on qdev exit()
Markus Armbruster [Wed, 25 May 2011 12:21:10 +0000 (14:21 +0200)]
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>
13 years agovirtio-serial-bus: use bh for unthrottling
Alon Levy [Fri, 29 Apr 2011 11:25:06 +0000 (14:25 +0300)]
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>
13 years agoscsi: ignore LUN field in the CDB
Paolo Bonzini [Thu, 19 May 2011 14:47:28 +0000 (16:47 +0200)]
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>
13 years agoscsi: rename arguments to the new callbacks
Paolo Bonzini [Fri, 20 May 2011 18:18:07 +0000 (20:18 +0200)]
scsi: rename arguments to the new callbacks

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
13 years agoscsi: split command_complete callback in two
Paolo Bonzini [Fri, 22 Apr 2011 10:27:30 +0000 (12:27 +0200)]
scsi: split command_complete callback in two

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
13 years agoesp: rename sense to status
Paolo Bonzini [Fri, 20 May 2011 18:10:02 +0000 (20:10 +0200)]
esp: rename sense to status

This mirrors the LSI patch that was recently committed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
13 years agoscsi-generic: Handle queue full
Paolo Bonzini [Mon, 18 Apr 2011 12:29:16 +0000 (14:29 +0200)]
scsi-generic: Handle queue full

The sg driver currently has a hardcoded limit of commands it
can handle simultaneously. When this limit is reached the
driver will return -EDOM. So we need to capture this to
enable proper return values here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: make write_data return void
Paolo Bonzini [Fri, 22 Apr 2011 07:39:16 +0000 (09:39 +0200)]
scsi: make write_data return void

The return value is unused anyway.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi-disk: add data direction checking
Hannes Reinecke [Mon, 18 Apr 2011 10:57:22 +0000 (12:57 +0200)]
scsi-disk: add data direction checking

scsi_req_parse() already provides for a data direction setting,
so we should be using it to check for correct direction.
And we should return the sense code 'INVALID FIELD IN CDB'
in these cases.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: Implement 'get_sense' callback
Hannes Reinecke [Mon, 18 Apr 2011 11:36:02 +0000 (13:36 +0200)]
scsi: Implement 'get_sense' callback

The get_sense callback copies existing sense information into
the provided buffer. This is required if sense information
should be transferred together with the command response.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: introduce scsi_req_get_buf
Paolo Bonzini [Thu, 21 Apr 2011 11:21:02 +0000 (13:21 +0200)]
scsi: introduce scsi_req_get_buf

... and remove some SCSIDevice variables or fields that now become unused.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: introduce scsi_req_continue
Paolo Bonzini [Mon, 18 Apr 2011 13:28:11 +0000 (15:28 +0200)]
scsi: introduce scsi_req_continue

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
13 years agoscsi: introduce scsi_req_new
Paolo Bonzini [Mon, 18 Apr 2011 17:09:55 +0000 (19:09 +0200)]
scsi: introduce scsi_req_new

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: do not call send_command directly
Paolo Bonzini [Mon, 18 Apr 2011 17:07:23 +0000 (19:07 +0200)]
scsi: do not call send_command directly

Move the common part of scsi-disk.c and scsi-generic.c to the SCSI layer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: Update sense code handling
Hannes Reinecke [Mon, 18 Apr 2011 10:53:14 +0000 (12:53 +0200)]
scsi: Update sense code handling

The SCSI spec has a quite detailed list of sense codes available.
It even mandates the use of specific ones for some failure cases.
The current implementation just has one type of generic error
which is actually a violation of the spec in certain cases.
This patch introduces various predefined sense codes to have the
sense code reporting more in line with the spec.

On top of Hannes's patch I fixed the reply to REQUEST SENSE commands
with DESC=0 and a small (<18) length.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: use scsi_req_complete
Paolo Bonzini [Mon, 18 Apr 2011 15:06:17 +0000 (17:06 +0200)]
scsi: use scsi_req_complete

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: introduce scsi_req_cancel
Paolo Bonzini [Mon, 18 Apr 2011 20:53:08 +0000 (22:53 +0200)]
scsi: introduce scsi_req_cancel

This is for when the request must be dropped in the void,
but still memory should be freed.  To this end, the devices
register a second callback in SCSIBusOps.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: introduce scsi_req_abort
Paolo Bonzini [Mon, 18 Apr 2011 15:14:51 +0000 (17:14 +0200)]
scsi: introduce scsi_req_abort

This covers the case of canceling a request's I/O and still
completing it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: commonize purging requests
Paolo Bonzini [Mon, 18 Apr 2011 16:47:12 +0000 (18:47 +0200)]
scsi: commonize purging requests

The code for canceling requests upon reset is already the same.  Clean
it up and move it to scsi-bus.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: Use 'SCSIRequest' directly
Hannes Reinecke [Mon, 18 Apr 2011 10:35:39 +0000 (12:35 +0200)]
scsi: Use 'SCSIRequest' directly

Currently the SCSIRequest structure is abstracted away and cannot accessed
directly from the driver. This requires the handler to do a lookup on
an abstract 'tag' which identifies the SCSIRequest structure.

With this patch the SCSIRequest structure is exposed to the driver. This
allows use to use it directly as an argument to the SCSIDeviceInfo
callback functions and remove the lookup.

A new callback function 'alloc_req' is introduced matching 'free
req'; unref'ing to free up resources after use is moved into the
scsi_command_complete callbacks.

This temporarily introduces a leak of requests that are cancelled,
when they are removed from the queue and not from the driver.  This
is fixed later by introducing scsi_req_cancel.  That patch in turn
depends on this one, because the argument to scsi_req_cancel is a
SCSIRequest.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agolsi: extract lsi_find_by_tag
Paolo Bonzini [Mon, 18 Apr 2011 10:01:45 +0000 (12:01 +0200)]
lsi: extract lsi_find_by_tag

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: reference-count requests
Paolo Bonzini [Mon, 18 Apr 2011 14:01:56 +0000 (16:01 +0200)]
scsi: reference-count requests

With the next patch, a device may hold SCSIRequest for an indefinite
time.  Split a rather big patch, and protect against access errors,
by reference counting them.

There is some ugliness in scsi_send_command implementation due to
the need to unref the request when it fails.  This will go away
with the next patches, which move the unref'ing to the devices.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
13 years agoscsi-generic: do not use a stale aiocb
Paolo Bonzini [Wed, 25 May 2011 14:53:46 +0000 (16:53 +0200)]
scsi-generic: do not use a stale aiocb

If a request is canceled after it has been completed, scsi_cancel_io
would pass a stale aiocb to bdrv_aio_cancel.  Avoid this.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
13 years agoscsi: introduce SCSIBusOps
Paolo Bonzini [Mon, 18 Apr 2011 15:11:14 +0000 (17:11 +0200)]
scsi: introduce SCSIBusOps

There are more operations than a SCSI bus can handle, besides completing
commands.  One example, which this series will introduce, is cleaning up
after a request is cancelled.

More long term, a "SCSI bus" can represent the LUNs attached to a
target; in this case, while all commands will ultimately reach a logical
unit, it is the target who is in charge of answering REPORT LUNs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
13 years agoscsi: introduce scsi_req_data
Paolo Bonzini [Mon, 18 Apr 2011 12:59:13 +0000 (14:59 +0200)]
scsi: introduce scsi_req_data

This abstracts calling the command_complete callback, reducing churn
in the following patches.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi-generic: Remove bogus double complete
Paolo Bonzini [Tue, 3 May 2011 12:15:59 +0000 (14:15 +0200)]
scsi-generic: Remove bogus double complete

scsi-generic scsi_read_complete() should not -both- call the client
complete callback with SCSI_REASON_DATA -and- call
scsi_command_complete().  The former will cause the client to queue a
new read or write request, while the later will free the request data
structure, thus causing the new read or write request to use a
freed/stale structure when it completes.

This patch fixes the bug, fixing a crash with scsi-generic & RHEL5.5
installer.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoscsi: add tracing of scsi requests
Paolo Bonzini [Fri, 15 Apr 2011 09:51:13 +0000 (11:51 +0200)]
scsi: add tracing of scsi requests

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agousb: add ehci adapter
Gerd Hoffmann [Fri, 3 Dec 2010 15:17:28 +0000 (16:17 +0100)]
usb: add ehci adapter

This patch finally merges the EHCI host adapter aka USB 2.0 support.

Based on the ehci bits collected @ git://git.kiszka.org/qemu.git ehci

EHCI has a long out-of-tree history.  Project was started by Mark
Burkley, with contributions by Niels de Vos.  David S. Ahern continued
working on it.  Kevin Wolf, Jan Kiszka and Vincent Palatin contributed
bugfixes.

/me (Gerd Hoffmann) picked it up where it left off, prepared the code
for merge, fixed a few bugs and added basic user docs.

Cc: David S. Ahern <daahern@cisco.com>
Cc: Jan Kiszka <jan.kiszka@web.de>
Cc: Kevin Wolf <mail@kevin-wolf.de>
Cc: Vincent Palatin <vincent.palatin_qemu@m4x.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: move cancel callback to USBDeviceInfo
Gerd Hoffmann [Mon, 16 May 2011 08:34:53 +0000 (10:34 +0200)]
usb: move cancel callback to USBDeviceInfo

Remove the cancel callback from the USBPacket struct, move it over
to USBDeviceInfo.  Zap usb_defer_packet() which is obsolete now.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: keep track of packet owner.
Gerd Hoffmann [Thu, 12 May 2011 11:48:13 +0000 (13:48 +0200)]
usb: keep track of packet owner.

Keep track of the device which owns the usb packet for async processing.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: add usb_handle_packet
Gerd Hoffmann [Thu, 12 May 2011 11:20:39 +0000 (13:20 +0200)]
usb: add usb_handle_packet

Add a usb_handle_packet function, put it into use everywhere.
Right now it just calls dev->info->handle_packet(), that will
change in future patches though.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-storage: don't call usb_packet_complete twice
Gerd Hoffmann [Mon, 16 May 2011 12:25:59 +0000 (14:25 +0200)]
usb-storage: don't call usb_packet_complete twice

usb_msd_copy_data() may cause a recursive call to
usb_msd_command_complete() which in turn may complete
the packet, setting s->packet to NULL in case it does.
Recheck s->packet before calling usb_packet_complete()
to fix the double call.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-linux: fix max_packet_size for highspeed.
Gerd Hoffmann [Mon, 16 May 2011 09:30:57 +0000 (11:30 +0200)]
usb-linux: fix max_packet_size for highspeed.

Calculate the max packet size correctly.  Only bits 0..11 specify the size,
bits 11+12 specify the number of (highspeed) microframes the endpoint wants
to use.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-linux: split large xfers
Gerd Hoffmann [Mon, 16 May 2011 08:21:51 +0000 (10:21 +0200)]
usb-linux: split large xfers

Add support for splitting large transfers into multiple smaller ones.
This is needed for the upcoming EHCI emulation which allows guests
to submit requests up to 20k in size.  The linux kernel allows 16k
max size though.

Based on a patch from David Ahern, see
http://www.mail-archive.com/qemu-devel@nongnu.org/msg30337.html

Cc: David Ahern <daahern@cisco.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-linux: walk async urb list in cancel
Gerd Hoffmann [Mon, 16 May 2011 07:20:06 +0000 (09:20 +0200)]
usb-linux: walk async urb list in cancel

Lookup async urbs which are to be canceled using the linked list
instead of the direct opaque pointer.  There are two reasons we
are doing that:  First, to avoid the opaque poiner to the callback,
which is needed for upcoming cleanups.  Second, because we might
need multiple urbs per request for highspeed support, so a single
opaque pointer doesn't cut it any more anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-linux: track aurbs in list
Gerd Hoffmann [Mon, 16 May 2011 07:13:05 +0000 (09:13 +0200)]
usb-linux: track aurbs in list

This patch adds code to track all async urbs in a linked list,
so we can find them without having to pass around a opaque
pointer to them.  Prerequisite for the cleanups.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-linux: add hostport property
Gerd Hoffmann [Tue, 10 May 2011 10:07:42 +0000 (12:07 +0200)]
usb-linux: add hostport property

This patch adds a hostport property which allows to specify the host usb
devices to pass through by bus number and physical port.  This means you
can basically hand over one (or more) of the usb plugs on your host to
the guest and whatever device is plugged in there will show up in the
guest.

Usage:

  -device usb-host,hostbus=1,hostport=1

You can figure the port numbers by plugging in some usb device, then
find it in "info usbhost" and pick bus and port specified there.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-linux: fix device path aka physical port handling
Gerd Hoffmann [Tue, 10 May 2011 09:43:57 +0000 (11:43 +0200)]
usb-linux: fix device path aka physical port handling

The device path isn't just a number.  It specifies the physical port
the device is connected to and in case the device is connected via
usb hub you'll have two numbers there, like this: "5.1".  The first
specifies the root port where the hub is plugged into, the second
specifies the port number of the hub where the device is plugged in.
With multiple hubs chained the string can become longer.

This patch renames devpath to port and makes it a string.   It also
adapts the sysfs parsing code accordingly.  The parser code is also more
strict now and skips the root hubs (which can't be assigned anyway).

The "info usbhost" monitor command now prints bus number, (os-assigned)
device address and physical port for each device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-linux: use usb_generic_handle_packet()
Hans de Goede [Wed, 2 Feb 2011 16:36:29 +0000 (17:36 +0100)]
usb-linux: use usb_generic_handle_packet()

Make the linux usb host passthrough code use the usb_generic_handle_packet()
function, rather then the curent DYI code. This removes 200 lines of almost
identical code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>