26ba25
From db20a3f422ca948784aa74375d1977b7d0a1c7ed Mon Sep 17 00:00:00 2001
26ba25
From: Cornelia Huck <cohuck@redhat.com>
26ba25
Date: Tue, 15 May 2018 07:33:45 +0000
26ba25
Subject: s390x/css: disabled subchannels cannot be status pending
26ba25
26ba25
The 3270 code will try to post an attention interrupt when the
26ba25
3270 emulator (e.g. x3270) attaches. If the guest has not yet
26ba25
enabled the subchannel for the 3270 device, we will present a spurious
26ba25
cc 1 (status pending) when it uses msch on it later on, e.g. when
26ba25
trying to enable the subchannel.
26ba25
26ba25
To fix this, just don't do anything in css_conditional_io_interrupt()
26ba25
if the subchannel is not enabled. The 3270 code will work fine with
26ba25
that, and the other user of this function (virtio-ccw) never
26ba25
attempts to post an interrupt for a disabled device to begin with.
26ba25
26ba25
CC: qemu-stable@nongnu.org
26ba25
Reported-by: Thomas Huth <thuth@redhat.com>
26ba25
Tested-by: Thomas Huth <thuth@redhat.com>
26ba25
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
26ba25
Acked-by: Halil Pasic <pasic@linux.ibm.com>
26ba25
Reviewed-by: David Hildenbrand <david@redhat.com>
26ba25
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
26ba25
(cherry picked from commit 6e9c893ecd00afd5344c35d0d0ded50eaa0938f6)
26ba25
---
26ba25
 hw/s390x/css.c | 8 ++++++++
26ba25
 1 file changed, 8 insertions(+)
26ba25
26ba25
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
26ba25
index 301bf17..56c3fa8 100644
26ba25
--- a/hw/s390x/css.c
26ba25
+++ b/hw/s390x/css.c
26ba25
@@ -617,6 +617,14 @@ void css_inject_io_interrupt(SubchDev *sch)
26ba25
 void css_conditional_io_interrupt(SubchDev *sch)
26ba25
 {
26ba25
     /*
26ba25
+     * If the subchannel is not enabled, it is not made status pending
26ba25
+     * (see PoP p. 16-17, "Status Control").
26ba25
+     */
26ba25
+    if (!(sch->curr_status.pmcw.flags & PMCW_FLAGS_MASK_ENA)) {
26ba25
+        return;
26ba25
+    }
26ba25
+
26ba25
+    /*
26ba25
      * If the subchannel is not currently status pending, make it pending
26ba25
      * with alert status.
26ba25
      */
26ba25
-- 
26ba25
1.8.3.1
26ba25