[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/10] s390x/css: handle emw correctly for tsch
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PULL 01/10] s390x/css: handle emw correctly for tsch |
Date: |
Tue, 10 Jun 2014 10:08:15 +0200 |
We should not try to store the emw portion of the irb if extended
measurements are not applicable. In particular, we should not surprise
the guest by storing a larger irb if it did not enable extended
measurements.
Cc: address@hidden
Reviewed-by: David Hildenbrand <address@hidden>
Tested-by: Christian Borntraeger <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
hw/s390x/css.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 2678e44..a813b23 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -779,9 +779,11 @@ out:
return ret;
}
-static void copy_irb_to_guest(IRB *dest, const IRB *src)
+static void copy_irb_to_guest(IRB *dest, const IRB *src, PMCW *pmcw)
{
int i;
+ uint16_t stctl = src->scsw.ctrl & SCSW_CTRL_MASK_STCTL;
+ uint16_t actl = src->scsw.ctrl & SCSW_CTRL_MASK_ACTL;
copy_scsw_to_guest(&dest->scsw, &src->scsw);
@@ -791,8 +793,22 @@ static void copy_irb_to_guest(IRB *dest, const IRB *src)
for (i = 0; i < ARRAY_SIZE(dest->ecw); i++) {
dest->ecw[i] = cpu_to_be32(src->ecw[i]);
}
- for (i = 0; i < ARRAY_SIZE(dest->emw); i++) {
- dest->emw[i] = cpu_to_be32(src->emw[i]);
+ /* extended measurements enabled? */
+ if ((src->scsw.flags & SCSW_FLAGS_MASK_ESWF) ||
+ !(pmcw->flags & PMCW_FLAGS_MASK_TF) ||
+ !(pmcw->chars & PMCW_CHARS_MASK_XMWME)) {
+ return;
+ }
+ /* extended measurements pending? */
+ if (!(stctl & SCSW_STCTL_STATUS_PEND)) {
+ return;
+ }
+ if ((stctl & SCSW_STCTL_PRIMARY) ||
+ (stctl == SCSW_STCTL_SECONDARY) ||
+ ((stctl & SCSW_STCTL_INTERMEDIATE) && (actl & SCSW_ACTL_SUSP))) {
+ for (i = 0; i < ARRAY_SIZE(dest->emw); i++) {
+ dest->emw[i] = cpu_to_be32(src->emw[i]);
+ }
}
}
@@ -838,7 +854,7 @@ int css_do_tsch(SubchDev *sch, IRB *target_irb)
}
}
/* Store the irb to the guest. */
- copy_irb_to_guest(target_irb, &irb);
+ copy_irb_to_guest(target_irb, &irb, p);
/* Clear conditions on subchannel, if applicable. */
if (stctl & SCSW_STCTL_STATUS_PEND) {
--
1.7.9.5
- [Qemu-devel] [PULL 00/10] s390 patches, Cornelia Huck, 2014/06/10
- [Qemu-devel] [PULL 02/10] s390x/kvm: make flic play well with old kernels, Cornelia Huck, 2014/06/10
- [Qemu-devel] [PULL 01/10] s390x/css: handle emw correctly for tsch,
Cornelia Huck <=
- [Qemu-devel] [PULL 05/10] s390x/kvm: Log unmanageable program interruptions, Cornelia Huck, 2014/06/10
- [Qemu-devel] [PULL 03/10] s390x/kvm: enable/reset cmma via vm attributes, Cornelia Huck, 2014/06/10
- [Qemu-devel] [PULL 04/10] s390x/kvm: Log unmanageable external interruptions, Cornelia Huck, 2014/06/10
- [Qemu-devel] [PULL 06/10] s390/virtio-ccw: migration support, Cornelia Huck, 2014/06/10
- [Qemu-devel] [PULL 07/10] s390x: consolidate floating interrupts, Cornelia Huck, 2014/06/10
- [Qemu-devel] [PULL 08/10] s390x/kvm: add alternative injection interface, Cornelia Huck, 2014/06/10
- [Qemu-devel] [PULL 10/10] s390x/kvm: inject via flic, Cornelia Huck, 2014/06/10
- [Qemu-devel] [PULL 09/10] s390x: cleanup interrupt injection, Cornelia Huck, 2014/06/10
- Re: [Qemu-devel] [PULL 00/10] s390 patches, Peter Maydell, 2014/06/10