Skip to contentSkip to conversation

s390: fixups for 2.11

GIT PULL Applied Christian Borntraeger 2 participants 6 messages Oct 30, 2017

lore
Share & tools
lore
#0 lore raw

Peter,

The following changes since commit a93ece47fd9edbd4558db24300056c9a57d3bcd4:

Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20171026-tag' into staging (2017-10-27 14:43:02 +0100)

are available in the git repository at:

git://github.com/borntraeger/qemu.git tags/s390x-20171030

for you to fetch changes up to 7a4ec18d117d74eedccdadca882331b928135465:

s390-*.img: update s390 bios with latest fixes (2017-10-30 09:04:25 +0100)

----------------------------------------------------------------
s390x: fixups for 2.11

- missing \r in the BIOS console output
- CPU type name is now "s390x-cpu"
- fixup for the host-model on z14 and older machine versions

----------------------------------------------------------------
Christian Borntraeger (2):
s390x/kvm: use cpu model for gscb on compat machines s390-*.img: update s390 bios with latest fixes

Collin L. Walling (1):
s390-ccw: print carriage return with new lines

David Hildenbrand (1):

      target/s390x: change CPU type name to "s390x-cpu"
 hw/s390x/s390-virtio-ccw.c         |   8 --------
 include/hw/s390x/s390-virtio-ccw.h |   3 ---
 pc-bios/s390-ccw.img               | Bin 26416 -> 30520 bytes
 pc-bios/s390-ccw/sclp.c            |  24 +++++++++++++++++++++---
 pc-bios/s390-netboot.img           | Bin 83864 -> 83864 bytes
 qapi-schema.json                   |   4 ++--
 target/s390x/cpu-qom.h             |   2 +-
 target/s390x/cpu_models.c          |   4 ++--
 target/s390x/kvm.c                 |   2 +-
 target/s390x/machine.c             |   2 +-
 10 files changed, 28 insertions(+), 21 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/4] target/s390x: change CPU type name to "s390x-cpu"

From: David Hildenbrand <[email protected]>

For now, e.g. host-s390-cpu wasn't exposed to the user. cpu-add, -cpu and the CPU model qmp interfaces didn't care about the actual type, as that information was hidden.

This changed with CPU hotplug via device_add. Now the type is visible to the user. Before we get that supported in a stable version, this is our last chance to change it.

So change it from "s390-cpu" to "s390x-cpu", to match the architecture name. Example names are then e.g. z14-s390x-cpu or qemu-s390x-cpu.

Message-Id: <[email protected]>

---
 qapi-schema.json          | 4 ++--
 target/s390x/cpu-qom.h    | 2 +-
 target/s390x/cpu_models.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
qapi-schema.json +2 -2
index a9dd043..1845795 100644
@@ -3159,12 +3159,12 @@
 # -> { "execute": "query-hotpluggable-cpus" }
 # <- {"return": [
 #      {
-#         "type": "qemu-s390-cpu", "vcpus-count": 1,
+#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
 #         "props": { "core-id": 1 }
 #      },
 #      {
 #         "qom-path": "/machine/unattached/device[0]",
-#         "type": "qemu-s390-cpu", "vcpus-count": 1,
+#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
 #         "props": { "core-id": 0 }
 #      }
 #    ]}
target/s390x/cpu-qom.h +1 -1
index 0510c49..b46217d 100644
@@ -22,7 +22,7 @@
 
 #include "qom/cpu.h"
 
-#define TYPE_S390_CPU "s390-cpu"
+#define TYPE_S390_CPU "s390x-cpu"
 
 #define S390_CPU_CLASS(klass) \
     OBJECT_CLASS_CHECK(S390CPUClass, (klass), TYPE_S390_CPU)
target/s390x/cpu_models.c +2 -2
index 9554f19..c4c37b3 100644
@@ -286,7 +286,7 @@ static void s390_print_cpu_model_list_entry(gpointer data, gpointer user_data)
         details = "(migration-safe)";
     }
 
-    /* strip off the -s390-cpu */
+    /* strip off the -s390x-cpu */
     g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
     (*s->cpu_fprintf)(s->file, "s390 %-15s %-35s %s\n", name, scc->desc,
                       details);
@@ -390,7 +390,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
     char *name = g_strdup(object_class_get_name(klass));
     S390CPUClass *scc = S390_CPU_CLASS(klass);
 
-    /* strip off the -s390-cpu */
+    /* strip off the -s390x-cpu */
     g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
     info = g_new0(CpuDefinitionInfo, 1);
     info->name = name;
Signature · 1 line
2.9.4
#2 lore raw

[Qemu-devel] [PULL 2/4] s390x/kvm: use cpu model for gscb on compat machines

In reply to Christian Borntraeger

Starting a guest with
<os>

    <type arch='s390x' machine='s390-ccw-virtio-2.9'>hvm</type>

</os>
<cpu mode='host-model'/>

on an IBM z14 results in

"qemu-system-s390x: Some features requested in the CPU model are not available in the configuration: gs"

This is because guarded storage is fenced for compat machines that did not have guarded storage support. While this prevents future migration abort (by not starting the guest at all), not being able to start a "host-model" guest is very much unexpected. As it turns out, even if we would modify libvirt to not expand the cpu model to contain "gs" for compat machines, it cannot guarantee that a migration will succeed. For example if the kernel changes its features (or the user has nested=1 on one host but not on the other) the migration will fail nevertheless. So instead of fencing "gs" for machines <= 2.9 lets allow it for all machine types that support the CPU model. This will make "host-model" runnable all the time, while relying on the CPU model to reject invalid migration attempts. We also need to change the migration for guarded storage.
Additional discussions about host-model are still pending but are out of scope of this patch.

---
 hw/s390x/s390-virtio-ccw.c         | 8 --------
 include/hw/s390x/s390-virtio-ccw.h | 3 ---
 target/s390x/kvm.c                 | 2 +-
 target/s390x/machine.c             | 2 +-
 4 files changed, 2 insertions(+), 13 deletions(-)
hw/s390x/s390-virtio-ccw.c +0 -8
index baeafdc..6a57f94 100644
@@ -432,7 +432,6 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data)
     s390mc->ri_allowed = true;
     s390mc->cpu_model_allowed = true;
     s390mc->css_migration_enabled = true;
-    s390mc->gs_allowed = true;
     mc->init = ccw_init;
     mc->reset = s390_machine_reset;
     mc->hot_add_cpu = s390_hot_add_cpu;
@@ -513,12 +512,6 @@ bool cpu_model_allowed(void)
     return get_machine_class()->cpu_model_allowed;
 }
 
-bool gs_allowed(void)
-{
-    /* for "none" machine this results in true */
-    return get_machine_class()->gs_allowed;
-}
-
 static char *machine_get_loadparm(Object *obj, Error **errp)
 {
     S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
@@ -758,7 +751,6 @@ static void ccw_machine_2_9_class_options(MachineClass *mc)
 {
     S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);
 
-    s390mc->gs_allowed = false;
     ccw_machine_2_10_class_options(mc);
     SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_9);
     s390mc->css_migration_enabled = false;
include/hw/s390x/s390-virtio-ccw.h +0 -3
index a9a90c2..ac896e3 100644
@@ -40,15 +40,12 @@ typedef struct S390CcwMachineClass {
     bool ri_allowed;
     bool cpu_model_allowed;
     bool css_migration_enabled;
-    bool gs_allowed;
 } S390CcwMachineClass;
 
 /* runtime-instrumentation allowed by the machine */
 bool ri_allowed(void);
 /* cpu model allowed by the machine */
 bool cpu_model_allowed(void);
-/* guarded-storage allowed by the machine */
-bool gs_allowed(void);
 
 /**
  * Returns true if (vmstate based) migration of the channel subsystem
target/s390x/kvm.c +1 -1
index 88f27d7..b03f583 100644
@@ -306,7 +306,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
             cap_ri = 1;
         }
     }
-    if (gs_allowed()) {
+    if (cpu_model_allowed()) {
         if (kvm_vm_enable_cap(s, KVM_CAP_S390_GS, 0) == 0) {
             cap_gs = 1;
         }
target/s390x/machine.c +1 -1
index e1b7015..b78f326 100644
@@ -180,7 +180,7 @@ const VMStateDescription vmstate_exval = {
 
 static bool gscb_needed(void *opaque)
 {
-    return kvm_s390_get_gs();
+    return s390_has_feat(S390_FEAT_GUARDED_STORAGE);
 }
 
 const VMStateDescription vmstate_gscb = {
Signature · 1 line
2.9.4
#3 lore raw

[Qemu-devel] [PULL 3/4] s390-ccw: print carriage return with new lines

In reply to Christian Borntraeger

From: "Collin L. Walling" <[email protected]>

The sclp console in the s390 bios writes raw data, leading console emulators (such as virsh console) to treat a new line ('\n') as just a new line instead of as a Unix line feed. Because of this, output appears in a "stair case" pattern.

Let's print \r\n on every occurrence of a new line in the string passed to write to amend this issue.

This is in sync with the guest Linux code in drivers/s390/char/sclp_vt220.c which also does a line feed conversion in the console part of the driver.

This fixes the s390-ccw and s390-netboot output like

$ virsh start test --console
Domain test started
Connected to domain test
Escape character is ^]
Network boot starting...
                          Using MAC address: 02:01:02:03:04:05
                                                                Requesting information via DHCP:  010

Message-Id: <[email protected]>

---
 pc-bios/s390-ccw/sclp.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
pc-bios/s390-ccw/sclp.c +21 -3
index b1fc8ff..90d1bc3 100644
@@ -76,17 +76,35 @@ static int _strlen(const char *str)
 long write(int fd, const void *str, size_t len)
 {
     WriteEventData *sccb = (void *)_sccb;
+    const char *p = str;
+    size_t data_len = 0;
+    size_t i;
 
     if (fd != 1 && fd != 2) {
         return -EIO;
     }
 
-    sccb->h.length = sizeof(WriteEventData) + len;
+    for (i = 0; i < len; i++) {
+        if ((data_len + 1) >= SCCB_DATA_LEN) {
+            /* We would overflow the sccb buffer, abort early */
+            len = i;
+            break;
+        }
+
+        if (*p == '\n') {
+            /* Terminal emulators might need \r\n, so generate it */
+            sccb->data[data_len++] = '\r';
+        }
+
+        sccb->data[data_len++] = *p;
+        p++;
+    }
+
+    sccb->h.length = sizeof(WriteEventData) + data_len;
     sccb->h.function_code = SCLP_FC_NORMAL_WRITE;
-    sccb->ebh.length = sizeof(EventBufferHeader) + len;
+    sccb->ebh.length = sizeof(EventBufferHeader) + data_len;
     sccb->ebh.type = SCLP_EVENT_ASCII_CONSOLE_DATA;
     sccb->ebh.flags = 0;
-    memcpy(sccb->data, str, len);
 
     sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb);
 
Signature · 1 line
2.9.4
#4 lore raw

[Qemu-devel] [PULL 4/4] s390-*.img: update s390 bios with latest fixes

In reply to Christian Borntraeger

includes
7618c0aefed1 ("s390-ccw: print carriage return with new lines") a8fbbf1db7a3 ("s390: set DHCP client architecure id for netboot")

---
 pc-bios/s390-ccw.img     | Bin 26416 -> 30520 bytes
 pc-bios/s390-netboot.img | Bin 83864 -> 83864 bytes
 2 files changed, 0 insertions(+), 0 deletions(-)
pc-bios/s390-ccw.img binary +0 -0
index 0b039291a57b8fe463679e5f462920a95e2437b4..75b604e3ce8a6001de313a0691d6738926c03624 100644
GIT binary patch
pc-bios/s390-netboot.img binary +0 -0
index 295ddfcf6a37e7bd7b537410a78b499d56b2e924..24f40feae6fa02b8b930f75879a4ec9b8fcc39aa 100755
GIT binary patch
Signature · 1 line
2.9.4
#5 lore raw
In reply to Christian Borntraeger
Quoted 12 lines · Christian Borntraeger

Peter,

The following changes since commit a93ece47fd9edbd4558db24300056c9a57d3bcd4:

Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20171026-tag' into staging (2017-10-27 14:43:02 +0100)

are available in the git repository at:

git://github.com/borntraeger/qemu.git tags/s390x-20171030

for you to fetch changes up to 7a4ec18d117d74eedccdadca882331b928135465:

Quoted 8 lines

s390-*.img: update s390 bios with latest fixes (2017-10-30 09:04:25 +0100)

----------------------------------------------------------------
s390x: fixups for 2.11

- missing \r in the BIOS console output
- CPU type name is now "s390x-cpu"
- fixup for the host-model on z14 and older machine versions

Applied, thanks.

-- PMM