yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
a83cc2
From a987dfced200adf1e4c2d3c39f0b5da0fb7e6ead Mon Sep 17 00:00:00 2001
a83cc2
From: Eric Farman <farman@linux.ibm.com>
a83cc2
Date: Thu, 24 Jun 2021 14:15:14 -0400
a83cc2
Subject: [PATCH 02/43] s390x/css: Split out the IRB sense data
a83cc2
a83cc2
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
a83cc2
RH-Bugzilla: 1957194
a83cc2
a83cc2
Let's move this logic into its own routine,
a83cc2
so it can be reused later.
a83cc2
a83cc2
Signed-off-by: Eric Farman <farman@linux.ibm.com>
a83cc2
Reviewed-by: Thomas Huth <thuth@redhat.com>
a83cc2
Message-Id: <20210617232537.1337506-3-farman@linux.ibm.com>
a83cc2
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
a83cc2
(cherry picked from commit 1b01dedaed41c2ca6129475c22b7b778b109fae8)
a83cc2
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
a83cc2
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
a83cc2
---
a83cc2
 hw/s390x/css.c | 19 ++++++++++++-------
a83cc2
 1 file changed, 12 insertions(+), 7 deletions(-)
a83cc2
a83cc2
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
a83cc2
index bd3172a688..fac7d5b39d 100644
a83cc2
--- a/hw/s390x/css.c
a83cc2
+++ b/hw/s390x/css.c
a83cc2
@@ -1640,6 +1640,17 @@ static void copy_irb_to_guest(IRB *dest, const IRB *src, const PMCW *pmcw,
a83cc2
     *irb_len = sizeof(*dest);
a83cc2
 }
a83cc2
 
a83cc2
+static void build_irb_sense_data(SubchDev *sch, IRB *irb)
a83cc2
+{
a83cc2
+    int i;
a83cc2
+
a83cc2
+    /* Attention: sense_data is already BE! */
a83cc2
+    memcpy(irb->ecw, sch->sense_data, sizeof(sch->sense_data));
a83cc2
+    for (i = 0; i < ARRAY_SIZE(irb->ecw); i++) {
a83cc2
+        irb->ecw[i] = be32_to_cpu(irb->ecw[i]);
a83cc2
+    }
a83cc2
+}
a83cc2
+
a83cc2
 int css_do_tsch_get_irb(SubchDev *sch, IRB *target_irb, int *irb_len)
a83cc2
 {
a83cc2
     SCHIB *schib = &sch->curr_status;
a83cc2
@@ -1670,14 +1681,8 @@ int css_do_tsch_get_irb(SubchDev *sch, IRB *target_irb, int *irb_len)
a83cc2
         /* If a unit check is pending, copy sense data. */
a83cc2
         if ((schib->scsw.dstat & SCSW_DSTAT_UNIT_CHECK) &&
a83cc2
             (schib->pmcw.chars & PMCW_CHARS_MASK_CSENSE)) {
a83cc2
-            int i;
a83cc2
-
a83cc2
             irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF | SCSW_FLAGS_MASK_ECTL;
a83cc2
-            /* Attention: sense_data is already BE! */
a83cc2
-            memcpy(irb.ecw, sch->sense_data, sizeof(sch->sense_data));
a83cc2
-            for (i = 0; i < ARRAY_SIZE(irb.ecw); i++) {
a83cc2
-                irb.ecw[i] = be32_to_cpu(irb.ecw[i]);
a83cc2
-            }
a83cc2
+            build_irb_sense_data(sch, &irb);
a83cc2
             irb.esw.erw = ESW_ERW_SENSE | (sizeof(sch->sense_data) << 8);
a83cc2
         }
a83cc2
     }
a83cc2
-- 
a83cc2
2.27.0
a83cc2