Skip to contentSkip to conversation

First set of s390x patches for 2.8

GIT PULL Applied Cornelia Huck 2 participants 3 messages Sep 6, 2016

lore
Share & tools
lore
#0 lore raw

The following changes since commit e87d397e5ef66276ccc49b829527d605ca07d0ad:

Open 2.8 development tree (2016-09-05 11:38:54 +0100)

are available in the git repository at:

git://github.com/cohuck/qemu tags/s390x-20160906-v2

for you to fetch changes up to f1a47d08effc4f2a33c667942e394c6f32a4f7d6:

s390x/cpumodel: implement QMP interface "query-cpu-model-baseline" (2016-09-06 17:06:51 +0200)

----------------------------------------------------------------
First (big) chunk of s390x updates:
- cpumodel support for s390x
- various fixes and improvements

----------------------------------------------------------------

Changes v1->v2:
- fix self-assignment in s390_cpu_list (patch 11)

Christian Borntraeger (1):
s390/sclp: cache the sclp device

Cornelia Huck (5):
s390x: add compat machine for 2.8
s390x: wrap flic savevm calls into vmstate
s390x/ioinst: advertise fcs facility
s390x/css: handle cssid 255 correctly
linux-headers: update

David Hildenbrand (28):
s390x/kvm: 2 byte software breakpoint support
qmp: details about CPU definitions in query-cpu-definitions s390x/cpumodel: "host" and "qemu" as CPU subclasses s390x/cpumodel: expose CPU class properties s390x/cpumodel: generate CPU feature group lists s390x/cpumodel: introduce CPU feature group definitions s390x/cpumodel: register defined CPU models as subclasses s390x/cpumodel: store the CPU model in the CPU instance s390x/cpumodel: expose features and feature groups as properties s390x/cpumodel: let the CPU model handle feature checks s390x/cpumodel: check and apply the CPU model
s390x/sclp: factor out preparation of cpu entries s390x/sclp: introduce sclp feature blocks
s390x/sclp: indicate sclp features
s390x/sclp: propagate the ibc val (lowest and unblocked ibc) s390x/sclp: propagate the mha via sclp
s390x/sclp: propagate hmfai
s390x/kvm: allow runtime-instrumentation for "none" machine s390x/kvm: implement CPU model support
s390x/kvm: disable host model for problematic compat machines s390x/kvm: let the CPU model control CMM(A)
s390x/kvm: don't enable key wrapping if msa3 is disabled
qmp: add QMP interface "query-cpu-model-expansion"
qmp: add QMP interface "query-cpu-model-comparison"
qmp: add QMP interface "query-cpu-model-baseline" s390x/cpumodel: implement QMP interface "query-cpu-model-expansion" s390x/cpumodel: implement QMP interface "query-cpu-model-comparison" s390x/cpumodel: implement QMP interface "query-cpu-model-baseline"

Michael Mueller (2):
s390x/cpumodel: introduce CPU features s390x/cpumodel: generate CPU feature lists for CPU models

Yi Min Zhao (2):
s390x/pci: return directly if create zpci failed s390x/pci: assert zpci always existing

 Makefile.target                                    |    2 +-
 hw/intc/s390_flic_kvm.c                            |   42 +-
 hw/s390x/css.c                                     |    8 +-
 hw/s390x/s390-pci-bus.c                            |    7 +-
 hw/s390x/s390-virtio-ccw.c                         |   23 +-
 hw/s390x/s390-virtio.c                             |    6 +-
 hw/s390x/sclp.c                                    |   42 +-
 include/hw/compat.h                                |    3 +
 include/hw/s390x/css.h                             |    2 +-
 include/hw/s390x/sclp.h                            |   17 +-
 include/standard-headers/linux/input-event-codes.h |   32 +
 include/standard-headers/linux/input.h             |    1 +
 include/standard-headers/linux/virtio_config.h     |   10 +-
 include/standard-headers/linux/virtio_ids.h        |    1 +
 include/standard-headers/linux/virtio_net.h        |    3 +
 include/standard-headers/linux/virtio_vsock.h      |   94 ++
 include/sysemu/arch_init.h                         |    9 +
 linux-headers/asm-arm/kvm.h                        |    4 +-
 linux-headers/asm-arm64/kvm.h                      |    2 +
 linux-headers/asm-s390/kvm.h                       |   41 +
 linux-headers/asm-x86/unistd_x32.h                 |    4 +-
 linux-headers/linux/kvm.h                          |   18 +-
 linux-headers/linux/vhost.h                        |   33 +
 qapi-schema.json                                   |  246 ++++-
 qmp-commands.hx                                    |   18 +
 qmp.c                                              |   21 +
 rules.mak                                          |    1 +
 stubs/Makefile.objs                                |    3 +
 stubs/arch-query-cpu-model-baseline.c              |   12 +
 stubs/arch-query-cpu-model-comparison.c            |   12 +
 stubs/arch-query-cpu-model-expansion.c             |   12 +
 target-s390x/Makefile.objs                         |   22 +-
 target-s390x/cpu-qom.h                             |    6 +
 target-s390x/cpu.c                                 |   35 +-
 target-s390x/cpu.h                                 |    7 +
 target-s390x/cpu_features.c                        |  404 +++++++
 target-s390x/cpu_features.h                        |   93 ++
 target-s390x/cpu_features_def.h                    |  231 ++++
 target-s390x/cpu_models.c                          | 1100 ++++++++++++++++++++
 target-s390x/cpu_models.h                          |  119 +++
 target-s390x/gen-features.c                        |  592 +++++++++++
 target-s390x/helper.c                              |   33 +-
 target-s390x/ioinst.c                              |    2 +-
 target-s390x/kvm.c                                 |  406 +++++++-
 target-s390x/machine.c                             |   14 +-
 45 files changed, 3672 insertions(+), 121 deletions(-)
 create mode 100644 include/standard-headers/linux/virtio_vsock.h
 create mode 100644 stubs/arch-query-cpu-model-baseline.c
 create mode 100644 stubs/arch-query-cpu-model-comparison.c
 create mode 100644 stubs/arch-query-cpu-model-expansion.c
 create mode 100644 target-s390x/cpu_features.c
 create mode 100644 target-s390x/cpu_features.h
 create mode 100644 target-s390x/cpu_features_def.h
 create mode 100644 target-s390x/cpu_models.c
 create mode 100644 target-s390x/cpu_models.h
 create mode 100644 target-s390x/gen-features.c
Signature · 1 line
2.9.3
#1 lore raw

[Qemu-devel] [PULL v2 11/38] s390x/cpumodel: "host" and "qemu" as CPU subclasses

From: David Hildenbrand <[email protected]>

This patch introduces two CPU models, "host" and "qemu". "qemu" is used as default when running under TCG. "host" is used as default when running under KVM. "host" cannot be used without KVM. "host" is not migration-safe. They both inherit from the base s390x CPU, which is turned into an abstract class.

This patch also changes CPU creation to take care of the passed CPU string and reuses common code parse_features() function for that purpose. Unknown CPU definitions are now reported. The "-cpu ?" and "query-cpu-definition" commands are changed to list all CPU subclasses automatically, including migration-safety and whether static.

Message-Id: <[email protected]>

[CH: fix up self-assignments in s390_cpu_list, as spotted by clang]
---
 hw/s390x/s390-virtio.c     |   6 +-
 target-s390x/Makefile.objs |   2 +-
 target-s390x/cpu-qom.h     |   4 +
 target-s390x/cpu.c         |  33 ++-------
 target-s390x/cpu.h         |   2 +
 target-s390x/cpu_models.c  | 177 +++++++++++++++++++++++++++++++++++++++++++++
 target-s390x/helper.c      |  33 ++++++++-
 7 files changed, 229 insertions(+), 28 deletions(-)
 create mode 100644 target-s390x/cpu_models.c
hw/s390x/s390-virtio.c +5 -1
index 544c616..0a96347 100644
@@ -101,7 +101,11 @@ void s390_init_cpus(MachineState *machine)
     gchar *name;
 
     if (machine->cpu_model == NULL) {
-        machine->cpu_model = "host";
+        if (kvm_enabled()) {
+            machine->cpu_model = "host";
+        } else {
+            machine->cpu_model = "qemu";
+        }
     }
 
     cpu_states = g_new0(S390CPU *, max_cpus);
target-s390x/Makefile.objs +1 -1
index dd62cbd..34bd693 100644
@@ -1,5 +1,5 @@
 obj-y += translate.o helper.o cpu.o interrupt.o
 obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o
-obj-y += gdbstub.o
+obj-y += gdbstub.o cpu_models.o
 obj-$(CONFIG_SOFTMMU) += machine.o ioinst.o arch_dump.o mmu_helper.o
 obj-$(CONFIG_KVM) += kvm.o
target-s390x/cpu-qom.h +4 -0
index 66b5d18..bb993d4 100644
@@ -45,6 +45,10 @@ typedef struct S390CPUClass {
     /*< private >*/
     CPUClass parent_class;
     /*< public >*/
+    bool kvm_required;
+    bool is_static;
+    bool is_migration_safe;
+    const char *desc;
 
     int64_t next_cpu_id;
 
target-s390x/cpu.c +8 -25
index e43e2d6..44e53ec 100644
@@ -44,30 +44,6 @@
 #define CR0_RESET       0xE0UL
 #define CR14_RESET      0xC2000000UL;
 
-/* generate CPU information for cpu -? */
-void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf)
-{
-#ifdef CONFIG_KVM
-    (*cpu_fprintf)(f, "s390 %16s\n", "host");
-#endif
-}
-
-#ifndef CONFIG_USER_ONLY
-CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
-{
-    CpuDefinitionInfoList *entry;
-    CpuDefinitionInfo *info;
-
-    info = g_malloc0(sizeof(*info));
-    info->name = g_strdup("host");
-
-    entry = g_malloc0(sizeof(*entry));
-    entry->value = info;
-
-    return entry;
-}
-#endif
-
 static void s390_cpu_set_pc(CPUState *cs, vaddr value)
 {
     S390CPU *cpu = S390_CPU(cs);
@@ -206,6 +182,12 @@ static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
     CPUS390XState *env = &cpu->env;
     Error *err = NULL;
 
+    /* the model has to be realized before qemu_init_vcpu() due to kvm */
+    s390_realize_cpu_model(cs, &err);
+    if (err) {
+        goto out;
+    }
+
 #if !defined(CONFIG_USER_ONLY)
     if (cpu->id >= max_cpus) {
         error_setg(&err, "Unable to add CPU: %" PRIi64
@@ -435,6 +417,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
     scc->cpu_reset = s390_cpu_reset;
     scc->initial_cpu_reset = s390_cpu_initial_reset;
     cc->reset = s390_cpu_full_reset;
+    cc->class_by_name = s390_cpu_class_by_name,
     cc->has_work = s390_cpu_has_work;
     cc->do_interrupt = s390_cpu_do_interrupt;
     cc->dump_state = s390_cpu_dump_state;
@@ -470,7 +453,7 @@ static const TypeInfo s390_cpu_type_info = {
     .instance_size = sizeof(S390CPU),
     .instance_init = s390_cpu_initfn,
     .instance_finalize = s390_cpu_finalize,
-    .abstract = false,
+    .abstract = true,
     .class_size = sizeof(S390CPUClass),
     .class_init = s390_cpu_class_init,
 };
target-s390x/cpu.h +2 -0
index eeff1b0..0ea9321 100644
@@ -633,6 +633,8 @@ extern void subsystem_reset(void);
 
 void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf);
 #define cpu_list s390_cpu_list
+void s390_realize_cpu_model(CPUState *cs, Error **errp);
+ObjectClass *s390_cpu_class_by_name(const char *name);
 
 #define EXCP_EXT 1 /* external interrupt */
 #define EXCP_SVC 2 /* supervisor call (syscall) */
target-s390x/cpu_models.c new file +177 -0

177 lines not on this page · raw message

target-s390x/helper.c +32 -1
index 54a5177..68bd2f9 100644
@@ -70,7 +70,38 @@ void s390x_cpu_timer(void *opaque)
 
 S390CPU *cpu_s390x_create(const char *cpu_model, Error **errp)
 {
-    return S390_CPU(object_new(TYPE_S390_CPU));
+    static bool features_parsed;
+    char *name, *features;
+    const char *typename;
+    ObjectClass *oc;
+    CPUClass *cc;
+
+    name = g_strdup(cpu_model);
+    features = strchr(name, ',');
+    if (features) {
+        features[0] = 0;
+        features++;
+    }
+
+    oc = cpu_class_by_name(TYPE_S390_CPU, name);
+    if (!oc) {
+        error_setg(errp, "Unknown CPU definition \'%s\'", name);
+        g_free(name);
+        return NULL;
+    }
+    typename = object_class_get_name(oc);
+
+    if (!features_parsed) {
+        features_parsed = true;
+        cc = CPU_CLASS(oc);
+        cc->parse_features(typename, features, errp);
+    }
+    g_free(name);
+
+    if (*errp) {
+        return NULL;
+    }
+    return S390_CPU(CPU(object_new(typename)));
 }
 
 S390CPU *s390x_new_cpu(const char *cpu_model, int64_t id, Error **errp)
Signature · 1 line
2.9.3
#2 lore raw
In reply to Cornelia Huck
Quoted 8 lines · Cornelia Huck

The following changes since commit e87d397e5ef66276ccc49b829527d605ca07d0ad:

Open 2.8 development tree (2016-09-05 11:38:54 +0100)

are available in the git repository at:

git://github.com/cohuck/qemu tags/s390x-20160906-v2

Quoted 9 lines

for you to fetch changes up to f1a47d08effc4f2a33c667942e394c6f32a4f7d6:

s390x/cpumodel: implement QMP interface "query-cpu-model-baseline" (2016-09-06 17:06:51 +0200)

----------------------------------------------------------------
First (big) chunk of s390x updates:
- cpumodel support for s390x
- various fixes and improvements

Applied, thanks.

-- PMM