[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-2.5 01/15] s390x/css: sense data endianness
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PATCH for-2.5 01/15] s390x/css: sense data endianness |
Date: |
Mon, 9 Nov 2015 16:56:18 +0100 |
We keep the device's sense data in a byte array (following the
architecture), but the ecws are an array of 32 bit values. If we
just blindly copy the values, the sense data will change from
de-facto BE data to de-facto cpu-endian data, which means we end
up doing an incorrect conversion on LE hosts.
Let's just explicitly convert to cpu-endianness while assembling
the irb.
Reported-by: Andy Lutomirski <address@hidden>
Tested-by: Andy Lutomirski <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
Reviewed-by: Christian Borntraeger <address@hidden>
---
hw/s390x/css.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index c033612..19851ce 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -892,8 +892,14 @@ int css_do_tsch_get_irb(SubchDev *sch, IRB *target_irb,
int *irb_len)
/* If a unit check is pending, copy sense data. */
if ((s->dstat & SCSW_DSTAT_UNIT_CHECK) &&
(p->chars & PMCW_CHARS_MASK_CSENSE)) {
+ int i;
+
irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF | SCSW_FLAGS_MASK_ECTL;
+ /* Attention: sense_data is already BE! */
memcpy(irb.ecw, sch->sense_data, sizeof(sch->sense_data));
+ for (i = 0; i < ARRAY_SIZE(irb.ecw); i++) {
+ irb.ecw[i] = be32_to_cpu(irb.ecw[i]);
+ }
irb.esw[1] = 0x01000000 | (sizeof(sch->sense_data) << 8);
}
}
--
2.6.3
- [Qemu-devel] [PATCH for-2.5 00/15] s390x patches for 2.5, Cornelia Huck, 2015/11/09
- [Qemu-devel] [PATCH for-2.5 01/15] s390x/css: sense data endianness,
Cornelia Huck <=
- [Qemu-devel] [PATCH for-2.5 02/15] s390x/pci : fix up s390 pci iommu translation function, Cornelia Huck, 2015/11/09
- [Qemu-devel] [PATCH for-2.5 12/15] qdev: provide qdev_reset_all_fn(), Cornelia Huck, 2015/11/09
- [Qemu-devel] [PATCH for-2.5 07/15] pc-bios/s390-ccw: Always adjust virtio sector count, Cornelia Huck, 2015/11/09
- [Qemu-devel] [PATCH for-2.5 11/15] pc-bios/s390-ccw: rebuild image, Cornelia Huck, 2015/11/09
- [Qemu-devel] [PATCH for-2.5 04/15] MAINTAINERS: update virtio-ccw/s390 git tree, Cornelia Huck, 2015/11/09
- [Qemu-devel] [PATCH for-2.5 10/15] pc-bios/s390-ccw: El Torito 16-bit boot image size field workaround, Cornelia Huck, 2015/11/09
- [Qemu-devel] [PATCH for-2.5 09/15] pc-bios/s390-ccw: El Torito s390x boot entry check, Cornelia Huck, 2015/11/09
- [Qemu-devel] [PATCH for-2.5 15/15] s390: deprecate the non-ccw machine in 2.5, Cornelia Huck, 2015/11/09
- [Qemu-devel] [PATCH for-2.5 03/15] MAINTAINERS: update s390 file patterns, Cornelia Huck, 2015/11/09
- [Qemu-devel] [PATCH for-2.5 05/15] s390x: switch to memory_region_allocate_system_memory, Cornelia Huck, 2015/11/09