Skip to contentSkip to conversation

s390x: two bugfixes

PATCH New Cornelia Huck 1 participant 4 messages Jul 7, 2014

lore
Share & tools
lore
#0 lore raw

cover s390x: two bugfixes

Here are two s390x patches (+ a binary update) for 2.1:

We neglected to store some vital information which may be used by the guest (but fortunately wasn't missed up to now): The subsystem id may be used to determine the boot device, and the channel-program address is useful for determining channel program execution. Most importantly, setting these fields is mandated by the architecture.

Will send a pull request tomorrow, unless there are objections.

Christian Borntraeger (1):
pc-bios/s390-ccw: store proper subsystem information word

Cornelia Huck (2):
pc-bios/s390-ccw: update binary
s390x/css: reflect cpa in scsw

 hw/s390x/css.c              |    9 +++++++++
 pc-bios/s390-ccw.img        |  Bin 17624 -> 17752 bytes
 pc-bios/s390-ccw/bootmap.c  |    2 ++
 pc-bios/s390-ccw/main.c     |   17 ++++++++++++++++-
 pc-bios/s390-ccw/s390-ccw.h |    1 +
 5 files changed, 28 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/3 pc-bios/s390-ccw: update binary

---
 pc-bios/s390-ccw.img |  Bin 17624 -> 17752 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/s390-ccw.img binary +0 -0
index 603e19e003d574b24bb3b97bacda2bf38077e8fd..e3ea0d5664f01ff472d3531980941fb5f163ff02 100644
GIT binary patch
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/3 s390x/css: reflect cpa in scsw

In reply to Cornelia Huck

We neglected to update the the channel-program-address field of the scsw after completion of the start or the halt function: Fortunately, Linux didn't miss it so far. Let's update it for the cases where the cpa is expected to be valid; in some cases, the cpa is 'unpredictable', so we leave it untouched.

---
 hw/s390x/css.c |    9 +++++++++
 1 file changed, 9 insertions(+)
hw/s390x/css.c +9 -0
index e758890..49c2aaf 100644
@@ -200,6 +200,7 @@ static void sch_handle_halt_func(SubchDev *sch)
 
     PMCW *p = &sch->curr_status.pmcw;
     SCSW *s = &sch->curr_status.scsw;
+    hwaddr curr_ccw = sch->channel_prog;
     int path;
 
     /* Path management: In our simple css, we always choose the only path. */
@@ -216,6 +217,10 @@ static void sch_handle_halt_func(SubchDev *sch)
           (s->ctrl & SCSW_ACTL_SUSP))) {
         s->dstat = SCSW_DSTAT_DEVICE_END;
     }
+    if ((s->ctrl & (SCSW_ACTL_SUBCH_ACTIVE | SCSW_ACTL_DEVICE_ACTIVE)) ||
+        (s->ctrl & SCSW_ACTL_SUSP)) {
+        s->cpa = curr_ccw + 8;
+    }
     s->cstat = 0;
     p->lpum = path;
 
@@ -398,6 +403,7 @@ static void sch_handle_start_func(SubchDev *sch, ORB *orb)
             s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |
                     SCSW_STCTL_STATUS_PEND;
             s->dstat = SCSW_DSTAT_CHANNEL_END | SCSW_DSTAT_DEVICE_END;
+            s->cpa = sch->channel_prog + 8;
             break;
         case -ENOSYS:
             /* unsupported command, generate unit check (command reject) */
@@ -408,6 +414,7 @@ static void sch_handle_start_func(SubchDev *sch, ORB *orb)
             s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
             s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |
                     SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
+            s->cpa = sch->channel_prog + 8;
             break;
         case -EFAULT:
             /* memory problem, generate channel data check */
@@ -416,6 +423,7 @@ static void sch_handle_start_func(SubchDev *sch, ORB *orb)
             s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
             s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |
                     SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
+            s->cpa = sch->channel_prog + 8;
             break;
         case -EBUSY:
             /* subchannel busy, generate deferred cc 1 */
@@ -436,6 +444,7 @@ static void sch_handle_start_func(SubchDev *sch, ORB *orb)
             s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
             s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |
                     SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
+            s->cpa = sch->channel_prog + 8;
             break;
         }
     } while (ret == -EAGAIN);
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/3 pc-bios/s390-ccw: store proper subsystem information word

In reply to Cornelia Huck

From: Christian Borntraeger <[email protected]>

POP chapter 17 requires to store a subsystem information word at 184 during IPL. Furthermore bytes 188-191 should be zero. The bootmap might contain data blocks that are written to the first page. We have to write these values after we processed the bootmap and before the final IPL.

---
 pc-bios/s390-ccw/bootmap.c  |    2 ++
 pc-bios/s390-ccw/main.c     |   17 ++++++++++++++++-
 pc-bios/s390-ccw/s390-ccw.h |    1 +
 3 files changed, 19 insertions(+), 1 deletion(-)
pc-bios/s390-ccw/bootmap.c +2 -0
index fa54abb..f175679 100644
@@ -51,6 +51,8 @@ static void jump_to_IPL_2(void)
 
 static void jump_to_IPL_code(uint64_t address)
 {
+    /* store the subsystem information _after_ the bootmap was loaded */
+    write_subsystem_identification();
     /*
      * The IPL PSW is at address 0. We also must not overwrite the
      * content of non-BIOS memory after we loaded the guest, so we
pc-bios/s390-ccw/main.c +16 -1
index dbfb40e..f9ec215 100644
@@ -13,6 +13,22 @@
 
 char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
 uint64_t boot_value;
+struct subchannel_id blk_schid = { .one = 1 };
+
+/*
+ * Priniciples of Operations (SA22-7832-09) chapter 17 requires that
+ * a subsystem-identification is at 184-187 and bytes 188-191 are zero
+ * after list-directed-IPL and ccw-IPL.
+ */
+void write_subsystem_identification(void)
+{
+    struct subchannel_id *schid = (struct subchannel_id *) 184;
+    uint32_t *zeroes = (uint32_t *) 188;
+
+    *schid = blk_schid;
+    *zeroes = 0;
+}
+
 
 void virtio_panic(const char *string)
 {
@@ -23,7 +39,6 @@ void virtio_panic(const char *string)
 
 static void virtio_setup(uint64_t dev_info)
 {
-    struct subchannel_id blk_schid = { .one = 1 };
     struct schib schib;
     int i;
     int r;
pc-bios/s390-ccw/s390-ccw.h +1 -0
index 959aed0..2b773de 100644
@@ -50,6 +50,7 @@ void disabled_wait(void);
 
 /* main.c */
 void virtio_panic(const char *string);
+void write_subsystem_identification(void);
 
 /* sclp-ascii.c */
 void sclp_print(const char *string);
Signature · 1 line
1.7.9.5