qemu-e2k/hw/s390x
Halil Pasic 1a8242f7c3 virtio-ccw: fix virtio_set_ind_atomic
The atomic_cmpxchg() loop is broken because we occasionally end up with
old and _old having different values (a legit compiler can generate code
that accessed *ind_addr again to pick up a value for _old instead of
using the value of old that was already fetched according to the
rules of the abstract machine). This means the underlying CS instruction
may use a different old (_old) than the one we intended to use if
atomic_cmpxchg() performed the xchg part.

Let us use volatile to force the rules of the abstract machine for
accesses to *ind_addr. Let us also rewrite the loop so, we that the
new old is used to compute the new desired value if the xchg part
is not performed.

Fixes: 7e7494627f ("s390x/virtio-ccw: Adapter interrupt support.")
Reported-by: Andre Wild <Andre.Wild1@ibm.com>
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20200616045035.51641-2-pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2020-07-03 11:15:59 +02:00
..
3270-ccw.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
ap-bridge.c qdev: Drop qbus_set_hotplug_handler() parameter @errp 2020-07-02 06:25:29 +02:00
ap-device.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
ccw-device.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
ccw-device.h
css-bridge.c qdev: Drop qbus_set_hotplug_handler() parameter @errp 2020-07-02 06:25:29 +02:00
css.c s390x/css: Refactor the css_queue_crw() routine 2020-06-18 12:13:54 +02:00
event-facility.c s390x/event-facility: Simplify creation of SCLP event devices 2020-06-15 22:06:04 +02:00
ipl.c s390x: protvirt: Support unpack facility 2020-04-29 14:30:54 +02:00
ipl.h s390x/s390-virtio-ccw: Fix build on systems without KVM 2020-04-29 14:36:19 +02:00
Kconfig
Makefile.objs s390x: protvirt: Support unpack facility 2020-04-29 14:30:54 +02:00
pv.c s390x: pv: Fix KVM_PV_PREP_RESET command wrapper name 2020-06-05 17:13:11 +02:00
s390-ccw.c vfio-ccw: Add support for the schib region 2020-06-18 12:13:54 +02:00
s390-pci-bus.c qdev: Drop qbus_set_hotplug_handler() parameter @errp 2020-07-02 06:25:29 +02:00
s390-pci-bus.h
s390-pci-inst.c add device_legacy_reset function to prepare for reset api change 2020-01-30 16:02:03 +00:00
s390-pci-inst.h
s390-skeys-kvm.c
s390-skeys.c qdev: Convert bus-less devices to qdev_realize() with Coccinelle 2020-06-15 22:06:04 +02:00
s390-stattrib-kvm.c vl/s390x: fixup ram sizes for compat machines 2020-04-02 17:10:09 +02:00
s390-stattrib.c qdev: Convert bus-less devices to qdev_realize() with Coccinelle 2020-06-15 22:06:04 +02:00
s390-virtio-ccw.c qdev: Convert bus-less devices to qdev_realize() with Coccinelle 2020-06-15 22:06:04 +02:00
s390-virtio-hcall.c
s390-virtio-hcall.h
sclp.c qdev: Convert bus-less devices to qdev_realize() with Coccinelle 2020-06-15 22:06:04 +02:00
sclpcpu.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
sclpquiesce.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
tod-kvm.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
tod-qemu.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
tod.c qdev: Convert bus-less devices to qdev_realize() with Coccinelle 2020-06-15 22:06:04 +02:00
trace-events
vhost-vsock-ccw.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw-9p.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw-balloon.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw-blk.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw-crypto.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw-gpu.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw-input.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw-net.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw-rng.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw-scsi.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw-serial.c qdev: Convert uses of qdev_set_parent_bus() with Coccinelle 2020-06-15 22:05:08 +02:00
virtio-ccw.c virtio-ccw: fix virtio_set_ind_atomic 2020-07-03 11:15:59 +02:00
virtio-ccw.h qdev: Unrealize must not fail 2020-05-15 07:08:14 +02:00