qemu-patch-raspberry4/hw
Greg Kurz 661e32fb3c virtio-scsi: convert virtio_scsi_bad_req() to use virtio_error()
The virtio_scsi_bad_req() function is called when a guest sends a
request with missing or ill-sized headers. This generally happens
when the virtio_scsi_parse_req() function returns an error.

With this patch, virtio_scsi_bad_req() will mark the device as broken,
detach the request from the virtqueue and free it, instead of forcing
QEMU to exit.

In nearly all locations where virtio_scsi_bad_req() is called, the only
thing to do next is to return to the caller.

The virtio_scsi_handle_cmd_req_prepare() function is an exception though.

It is called in a loop by virtio_scsi_handle_cmd_vq() and passed requests
freshly popped from a cmd virtqueue; virtio_scsi_handle_cmd_req_prepare()
does some sanity checks on the request and returns a boolean flag to
indicate whether the request should be queued or not. In the latter case,
virtio_scsi_handle_cmd_req_prepare() has detected a non-fatal error and
sent a response back to the guest.

We have now a new condition to take into account: the device is broken
and should stop all processing.

The return value of virtio_scsi_handle_cmd_req_prepare() is hence changed
to an int. A return value of zero means that the request should be queued.
Other non-fatal error cases where the request shoudn't be queued  return
a negative errno (values are vaguely inspired by the error condition, but
the only goal here is to discriminate the case we're interested in).

And finally, if virtio_scsi_bad_req() was called, -EINVAL is returned. In
this case, virtio_scsi_handle_cmd_vq() detaches and frees already queued
requests, instead of submitting them.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-10-10 01:16:59 +03:00
..
9pfs virtio-9p: handle handle_9p_output() error 2016-10-10 01:16:59 +03:00
acpi acpi: provide _PXM method for CPU devices if QEMU is started numa enabled 2016-10-10 01:16:57 +03:00
adc STM32F2xx: Add the ADC device 2016-10-04 13:28:07 +01:00
alpha trace-events: fix first line comment in trace-events 2016-08-12 10:36:01 +01:00
arm numa: reduce code duplication by adding helper numa_get_node_for_cpu() 2016-10-10 01:16:57 +03:00
audio pcspk: adding vmstate for save/restore 2016-09-15 15:10:06 +02:00
block virtio-blk: handle virtio_blk_handle_request() errors 2016-10-10 01:16:59 +03:00
bt hw/bt/hci: spelling fix: endianness 2016-09-13 18:12:34 +03:00
char virtio-serial: add missing virtio_detach_element() call 2016-10-10 01:16:58 +03:00
core generic-loader: Add a generic loader 2016-10-04 13:28:09 +01:00
cpu cpu: Abstract CPU core type 2016-06-17 16:33:48 +10:00
cris cris: Fix broken header guard in hw/cris/boot.h 2016-07-12 16:20:46 +02:00
display vmstateify ssd0323 display 2016-09-22 18:13:08 +01:00
dma hw/dma: vmstateify rc4030 2016-09-29 12:07:51 +01:00
gpio hw/gpio: QOM'ify zaurus.c 2016-06-14 15:59:13 +01:00
i2c i2c: fix migration regression introduced by broadcast support 2016-08-03 18:44:56 +02:00
i386 numa: reduce code duplication by adding helper numa_get_node_for_cpu() 2016-10-10 01:16:57 +03:00
ide Block layer patches 2016-10-04 14:25:08 +01:00
input vmstateify tsc210x 2016-10-04 13:28:08 +01:00
intc hw/intc/arm_gicv3_its: Implement support for in-kernel ITS emulation 2016-10-04 13:28:09 +01:00
ipack ipack: Update e-mail address 2016-05-18 15:04:27 +03:00
ipmi vl: Switch qemu_uuid to QemuUUID 2016-09-23 11:42:52 +08:00
isa portio: keep references on portio 2016-09-08 18:05:21 +04:00
lm32 Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
m68k hw/ptimer: Introduce timer policy feature 2016-09-22 18:13:06 +01:00
mem trace: move hw/mem/pc-dimm.c trace points into correct file 2016-09-28 19:17:54 +01:00
microblaze Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
mips error: Strip trailing '\n' from error string arguments (again) 2016-08-08 09:00:44 +02:00
misc imx: Use 'const char', not 'char const' 2016-09-22 18:13:09 +01:00
moxie hw: explicitly include qemu-common.h and cpu.h 2016-03-22 22:20:17 +01:00
net virtio-net: handle virtio_net_flush_tx() errors 2016-10-10 01:16:59 +03:00
nvram vl: Switch qemu_uuid to QemuUUID 2016-09-23 11:42:52 +08:00
openrisc hw: explicitly include qemu-common.h and cpu.h 2016-03-22 22:20:17 +01:00
pci trace-events: fix first line comment in trace-events 2016-08-12 10:36:01 +01:00
pci-bridge hw/pci-bridge: Convert pxb initialization functions to Error 2016-07-29 00:07:09 +03:00
pci-host apb: convert init to realize 2016-07-29 00:07:09 +03:00
pcmcia hw: Clean up includes 2016-01-29 15:07:25 +00:00
ppc numa: reduce code duplication by adding helper numa_get_node_for_cpu() 2016-10-10 01:16:57 +03:00
s390x s390x/css: {c,h,t,r,x}sch: require enable AND device number valid 2016-09-28 13:24:51 +02:00
scsi virtio-scsi: convert virtio_scsi_bad_req() to use virtio_error() 2016-10-10 01:16:59 +03:00
sd vmstateify ssi-sd 2016-09-22 18:13:08 +01:00
sh4 sh4: fix broken link to documentation 2016-09-15 15:32:22 +03:00
smbios smbios: fix uuid copy 2016-09-29 11:43:22 +08:00
sparc trace-events: fix first line comment in trace-events 2016-08-12 10:36:01 +01:00
sparc64 util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
ssi STM32F2xx: Add the SPI device 2016-10-04 13:28:07 +01:00
timer STM32F2xx: Display PWM duty cycle from timer 2016-10-04 13:28:07 +01:00
tpm Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
tricore tricore: remove useless cast 2016-09-15 15:32:22 +03:00
unicore32 hw: explicitly include qemu-common.h and cpu.h 2016-03-22 22:20:17 +01:00
usb usb-mtp: add support for files larger than 4g (gsoc) 2016-09-15 14:56:36 +01:00
vfio memory: introduce IOMMUNotifier and its caps 2016-09-27 08:59:16 +02:00
virtio virtio: add virtio_detach_element() 2016-10-10 01:16:58 +03:00
watchdog nmi: remove x86 specific nmi handling 2016-05-23 16:53:46 +02:00
xen Xen: fix converity warning of xen_pt_config_init() 2016-08-12 16:38:18 -07:00
xenpv xenpv: Fix qemu_uuid compiling error 2016-09-29 11:43:17 +08:00
xtensa target-xtensa: xtfpga: fix FLASH interface width 2016-07-14 13:59:44 +03:00
Makefile.objs STM32F2xx: Add the ADC device 2016-10-04 13:28:07 +01:00