* [Qemu-devel] [PATCH v1 1/5] MAINTAINERS: use KVM s390x maintainers for kvm-stubs.c and kvm_s390x.h
2017-09-28 13:46 [Qemu-devel] [PATCH v1 0/5] s390x: CPU related cleanups and one fix David Hildenbrand
@ 2017-09-28 13:46 ` David Hildenbrand
2017-09-28 13:52 ` Christian Borntraeger
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 2/5] s390x: raise CPU hotplug irq after really hotplugged David Hildenbrand
` (4 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: David Hildenbrand @ 2017-09-28 13:46 UTC (permalink / raw)
To: qemu-devel
Cc: thuth, cohuck, Christian Borntraeger, Alexander Graf,
Richard Henderson, David Hildenbrand
Forgot it when factoring code out into these files. This is 100% s390x
KVM material.
Signed-off-by: David Hildenbrand <david@redhat.com>
---
MAINTAINERS | 2 ++
1 file changed, 2 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 932443df41..772ac209e1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -299,6 +299,8 @@ M: Cornelia Huck <cohuck@redhat.com>
M: Alexander Graf <agraf@suse.de>
S: Maintained
F: target/s390x/kvm.c
+F: target/s390x/kvm_s390x.h
+F: target/s390x/kvm-stub.c
F: target/s390x/ioinst.[ch]
F: target/s390x/machine.c
F: hw/intc/s390_flic.c
--
2.13.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v1 1/5] MAINTAINERS: use KVM s390x maintainers for kvm-stubs.c and kvm_s390x.h
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 1/5] MAINTAINERS: use KVM s390x maintainers for kvm-stubs.c and kvm_s390x.h David Hildenbrand
@ 2017-09-28 13:52 ` Christian Borntraeger
0 siblings, 0 replies; 8+ messages in thread
From: Christian Borntraeger @ 2017-09-28 13:52 UTC (permalink / raw)
To: David Hildenbrand, qemu-devel
Cc: thuth, cohuck, Alexander Graf, Richard Henderson
On 09/28/2017 03:46 PM, David Hildenbrand wrote:
> Forgot it when factoring code out into these files. This is 100% s390x
> KVM material.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> MAINTAINERS | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 932443df41..772ac209e1 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -299,6 +299,8 @@ M: Cornelia Huck <cohuck@redhat.com>
> M: Alexander Graf <agraf@suse.de>
> S: Maintained
> F: target/s390x/kvm.c
> +F: target/s390x/kvm_s390x.h
> +F: target/s390x/kvm-stub.c
> F: target/s390x/ioinst.[ch]
> F: target/s390x/machine.c
> F: hw/intc/s390_flic.c
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v1 2/5] s390x: raise CPU hotplug irq after really hotplugged
2017-09-28 13:46 [Qemu-devel] [PATCH v1 0/5] s390x: CPU related cleanups and one fix David Hildenbrand
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 1/5] MAINTAINERS: use KVM s390x maintainers for kvm-stubs.c and kvm_s390x.h David Hildenbrand
@ 2017-09-28 13:46 ` David Hildenbrand
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 3/5] s390x/cpumodel: fix max STFL(E) bit number David Hildenbrand
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: David Hildenbrand @ 2017-09-28 13:46 UTC (permalink / raw)
To: qemu-devel
Cc: thuth, cohuck, Christian Borntraeger, Alexander Graf,
Richard Henderson, David Hildenbrand
Let's move it into the machine, so we trigger the IRQ after setting
ms->possible_cpus (which SCLP uses to construct the list of
online CPUs).
This also fixes a problem reported by Thomas Huth, whereby qemu can be
crashed using the none machine
qemu-s390x-softmmu -M none -monitor stdio
-> device_add qemu-s390-cpu
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
hw/s390x/s390-virtio-ccw.c | 4 ++++
target/s390x/cpu.c | 8 --------
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 1bcb7000ab..ab234247f6 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -305,6 +305,10 @@ static void s390_cpu_plug(HotplugHandler *hotplug_dev,
g_assert(!ms->possible_cpus->cpus[cpu->env.core_id].cpu);
ms->possible_cpus->cpus[cpu->env.core_id].cpu = OBJECT(dev);
+
+ if (dev->hotplugged) {
+ raise_irq_cpu_hotplug();
+ }
}
static void s390_machine_reset(void)
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 34538c3ab9..4920da3625 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -41,7 +41,6 @@
#include "hw/hw.h"
#include "sysemu/arch_init.h"
#include "sysemu/sysemu.h"
-#include "hw/s390x/sclp.h"
#endif
#define CR0_RESET 0xE0UL
@@ -227,13 +226,6 @@ static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
#endif
scc->parent_realize(dev, &err);
-
-#if !defined(CONFIG_USER_ONLY)
- if (dev->hotplugged) {
- raise_irq_cpu_hotplug();
- }
-#endif
-
out:
error_propagate(errp, err);
}
--
2.13.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v1 3/5] s390x/cpumodel: fix max STFL(E) bit number
2017-09-28 13:46 [Qemu-devel] [PATCH v1 0/5] s390x: CPU related cleanups and one fix David Hildenbrand
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 1/5] MAINTAINERS: use KVM s390x maintainers for kvm-stubs.c and kvm_s390x.h David Hildenbrand
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 2/5] s390x: raise CPU hotplug irq after really hotplugged David Hildenbrand
@ 2017-09-28 13:46 ` David Hildenbrand
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 4/5] target/s390x: get rid of next_core_id David Hildenbrand
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: David Hildenbrand @ 2017-09-28 13:46 UTC (permalink / raw)
To: qemu-devel
Cc: thuth, cohuck, Christian Borntraeger, Alexander Graf,
Richard Henderson, David Hildenbrand
Not that it would matter in the near future, but it is actually 2048
bytes, therefore 16384 possible bits.
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
target/s390x/cpu_features.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
index 1d3a036393..31a4676f05 100644
--- a/target/s390x/cpu_features.c
+++ b/target/s390x/cpu_features.c
@@ -381,7 +381,7 @@ void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,
switch (type) {
case S390_FEAT_TYPE_STFL:
- nr_bits = 2048;
+ nr_bits = 16384;
break;
case S390_FEAT_TYPE_PLO:
nr_bits = 256;
--
2.13.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v1 4/5] target/s390x: get rid of next_core_id
2017-09-28 13:46 [Qemu-devel] [PATCH v1 0/5] s390x: CPU related cleanups and one fix David Hildenbrand
` (2 preceding siblings ...)
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 3/5] s390x/cpumodel: fix max STFL(E) bit number David Hildenbrand
@ 2017-09-28 13:46 ` David Hildenbrand
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 5/5] s390x: introduce and use S390_MAX_CPUS David Hildenbrand
2017-09-29 9:13 ` [Qemu-devel] [PATCH v1 0/5] s390x: CPU related cleanups and one fix Cornelia Huck
5 siblings, 0 replies; 8+ messages in thread
From: David Hildenbrand @ 2017-09-28 13:46 UTC (permalink / raw)
To: qemu-devel
Cc: thuth, cohuck, Christian Borntraeger, Alexander Graf,
Richard Henderson, David Hildenbrand
core_id is not needed by linux-user, as the core_id a.k.a. CPU address
is only accessible from kernel space.
Therefore, drop next_core_id and make cpu_index get autoassigned again
for linux-user.
While at it, shield core_id and cpuid completely from linux-user. cpuid
can also only be queried from kernel space.
Suggested-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
target/s390x/cpu-qom.h | 2 --
target/s390x/cpu.c | 14 +++++++-------
target/s390x/cpu.h | 2 ++
target/s390x/cpu_models.c | 2 ++
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/target/s390x/cpu-qom.h b/target/s390x/cpu-qom.h
index 2e446fab51..0510c49e07 100644
--- a/target/s390x/cpu-qom.h
+++ b/target/s390x/cpu-qom.h
@@ -54,8 +54,6 @@ typedef struct S390CPUClass {
bool is_migration_safe;
const char *desc;
- uint32_t next_core_id;
-
DeviceRealize parent_realize;
void (*parent_reset)(CPUState *cpu);
void (*load_normal)(CPUState *cpu);
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 4920da3625..f42e28ea25 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -178,8 +178,9 @@ static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
{
CPUState *cs = CPU(dev);
S390CPUClass *scc = S390_CPU_GET_CLASS(dev);
+#if !defined(CONFIG_USER_ONLY)
S390CPU *cpu = S390_CPU(dev);
- CPUS390XState *env = &cpu->env;
+#endif
Error *err = NULL;
/* the model has to be realized before qemu_init_vcpu() due to kvm */
@@ -195,11 +196,6 @@ static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
max_cpus - 1);
goto out;
}
-#else
- /* implicitly set for linux-user only */
- cpu->env.core_id = scc->next_core_id;
- scc->next_core_id++;
-#endif
if (cpu_exists(cpu->env.core_id)) {
error_setg(&err, "Unable to add CPU with core-id: %" PRIu32
@@ -208,7 +204,9 @@ static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
}
/* sync cs->cpu_index and env->core_id. The latter is needed for TCG. */
- cs->cpu_index = env->core_id;
+ cs->cpu_index = cpu->env.core_id;
+#endif
+
cpu_exec_realizefn(cs, &err);
if (err != NULL) {
goto out;
@@ -440,7 +438,9 @@ static gchar *s390_gdb_arch_name(CPUState *cs)
}
static Property s390x_cpu_properties[] = {
+#if !defined(CONFIG_USER_ONLY)
DEFINE_PROP_UINT32("core-id", S390CPU, env.core_id, 0),
+#endif
DEFINE_PROP_END_OF_LIST()
};
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index c57ef71f6d..ff3cc59c02 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -151,8 +151,10 @@ struct CPUS390XState {
CPU_COMMON
+#if !defined(CONFIG_USER_ONLY)
uint32_t core_id; /* PoP "CPU address", same as cpu_index */
uint64_t cpuid;
+#endif
uint64_t tod_offset;
uint64_t tod_basetime;
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 48dd7beddd..07ef8a3b6e 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -945,11 +945,13 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp)
apply_cpu_model(cpu->model, errp);
+#if !defined(CONFIG_USER_ONLY)
cpu->env.cpuid = s390_cpuid_from_cpu_model(cpu->model);
if (tcg_enabled()) {
/* basic mode, write the cpu address into the first 4 bit of the ID */
cpu->env.cpuid = deposit64(cpu->env.cpuid, 54, 4, cpu->env.core_id);
}
+#endif
}
static void get_feature(Object *obj, Visitor *v, const char *name,
--
2.13.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v1 5/5] s390x: introduce and use S390_MAX_CPUS
2017-09-28 13:46 [Qemu-devel] [PATCH v1 0/5] s390x: CPU related cleanups and one fix David Hildenbrand
` (3 preceding siblings ...)
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 4/5] target/s390x: get rid of next_core_id David Hildenbrand
@ 2017-09-28 13:46 ` David Hildenbrand
2017-09-29 9:13 ` [Qemu-devel] [PATCH v1 0/5] s390x: CPU related cleanups and one fix Cornelia Huck
5 siblings, 0 replies; 8+ messages in thread
From: David Hildenbrand @ 2017-09-28 13:46 UTC (permalink / raw)
To: qemu-devel
Cc: thuth, cohuck, Christian Borntraeger, Alexander Graf,
Richard Henderson, David Hildenbrand
Will be handy in the future.
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
hw/s390x/s390-virtio-ccw.c | 2 +-
target/s390x/cpu.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index ab234247f6..dfc107b400 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -421,7 +421,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data)
mc->no_parallel = 1;
mc->no_sdcard = 1;
mc->use_sclp = 1;
- mc->max_cpus = 248;
+ mc->max_cpus = S390_MAX_CPUS;
mc->has_hotpluggable_cpus = true;
mc->get_hotplug_handler = s390_get_hotplug_handler;
mc->cpu_index_to_instance_props = s390_cpu_index_to_props;
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index ff3cc59c02..7e864c8478 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -60,6 +60,8 @@
#define PSW_MCHK_MASK 0x0004000000000000
#define PSW_IO_MASK 0x0200000000000000
+#define S390_MAX_CPUS 248
+
typedef struct PSW {
uint64_t mask;
uint64_t addr;
--
2.13.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v1 0/5] s390x: CPU related cleanups and one fix
2017-09-28 13:46 [Qemu-devel] [PATCH v1 0/5] s390x: CPU related cleanups and one fix David Hildenbrand
` (4 preceding siblings ...)
2017-09-28 13:46 ` [Qemu-devel] [PATCH v1 5/5] s390x: introduce and use S390_MAX_CPUS David Hildenbrand
@ 2017-09-29 9:13 ` Cornelia Huck
5 siblings, 0 replies; 8+ messages in thread
From: Cornelia Huck @ 2017-09-29 9:13 UTC (permalink / raw)
To: David Hildenbrand
Cc: qemu-devel, thuth, Christian Borntraeger, Alexander Graf,
Richard Henderson
On Thu, 28 Sep 2017 15:46:04 +0200
David Hildenbrand <david@redhat.com> wrote:
> Patch 2-5 are split out from the series "[PATCH v1 00/27] s390x: SMP for
> TCG (+ cleanups)"
>
> They make sense even without the SMP TCG changes, which could still take
> a while.
>
> David Hildenbrand (5):
> MAINTAINERS: use KVM s390x maintainers for kvm-stubs.c and kvm_s390x.h
> s390x: raise CPU hotplug irq after really hotplugged
> s390x/cpumodel: fix max STFL(E) bit number
> target/s390x: get rid of next_core_id
> s390x: introduce and use S390_MAX_CPUS
>
> MAINTAINERS | 2 ++
> hw/s390x/s390-virtio-ccw.c | 6 +++++-
> target/s390x/cpu-qom.h | 2 --
> target/s390x/cpu.c | 22 +++++++---------------
> target/s390x/cpu.h | 4 ++++
> target/s390x/cpu_features.c | 2 +-
> target/s390x/cpu_models.c | 2 ++
> 7 files changed, 21 insertions(+), 19 deletions(-)
>
Thanks, applied.
^ permalink raw reply [flat|nested] 8+ messages in thread