[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 03/18] s390x: protvirt: Support unpack facility
From: |
Christian Borntraeger |
Subject: |
Re: [PATCH v6 03/18] s390x: protvirt: Support unpack facility |
Date: |
Fri, 6 Mar 2020 12:48:30 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
On 04.03.20 12:42, Janosch Frank wrote:
[...]
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 3dd396e870..69b1cc5dfc 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -37,6 +37,8 @@
> #include "sysemu/hw_accel.h"
> #include "hw/qdev-properties.h"
> #ifndef CONFIG_USER_ONLY
> +#include "hw/s390x/s390-virtio-ccw.h"
> +#include "hw/s390x/pv.h"
> #include "hw/boards.h"
> #include "sysemu/arch_init.h"
> #include "sysemu/sysemu.h"
> @@ -191,6 +193,7 @@ static void s390_cpu_realizefn(DeviceState *dev, Error
> **errp)
>
> #if !defined(CONFIG_USER_ONLY)
> MachineState *ms = MACHINE(qdev_get_machine());
> + S390CcwMachineState *ccw = S390_CCW_MACHINE(ms);
> unsigned int max_cpus = ms->smp.max_cpus;
> if (cpu->env.core_id >= max_cpus) {
> error_setg(&err, "Unable to add CPU with core-id: %" PRIu32
I messed this up and this can break for the none machine.
Something like this on top:
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 7840e784f1..1b42b0fa25 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -181,6 +181,18 @@ static void s390_cpu_disas_set_info(CPUState *cpu,
disassemble_info *info)
info->print_insn = print_insn_s390;
}
+static bool machine_is_pv(MachineState *ms)
+{
+ Object *obj;
+
+ /* we have to bail out for the "none" machine */
+ obj = object_dynamic_cast(OBJECT(ms), TYPE_S390_CCW_MACHINE);
+ if (!obj) {
+ return false;
+ }
+ return S390_CCW_MACHINE(obj)->pv;
+}
+
static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
{
CPUState *cs = CPU(dev);
@@ -198,7 +210,6 @@ static void s390_cpu_realizefn(DeviceState *dev, Error
**errp)
#if !defined(CONFIG_USER_ONLY)
MachineState *ms = MACHINE(qdev_get_machine());
- S390CcwMachineState *ccw = S390_CCW_MACHINE(ms);
unsigned int max_cpus = ms->smp.max_cpus;
if (cpu->env.core_id >= max_cpus) {
error_setg(&err, "Unable to add CPU with core-id: %" PRIu32
@@ -213,7 +224,7 @@ static void s390_cpu_realizefn(DeviceState *dev, Error
**errp)
goto out;
}
- cpu->env.pv = ccw->pv;
+ cpu->env.pv = machine_is_pv(ms);
/* sync cs->cpu_index and env->core_id. The latter is needed for TCG. */
cs->cpu_index = cpu->env.core_id;
#endif
- Re: [PATCH v6 04/18] s390x: protvirt: Add migration blocker, (continued)
- [PATCH v6 03/18] s390x: protvirt: Support unpack facility, Janosch Frank, 2020/03/04
- Re: [PATCH v6 03/18] s390x: protvirt: Support unpack facility, David Hildenbrand, 2020/03/05
- Re: [PATCH v6 03/18] s390x: protvirt: Support unpack facility, Janosch Frank, 2020/03/05
- Re: [PATCH v6 03/18] s390x: protvirt: Support unpack facility, David Hildenbrand, 2020/03/05
- Re: [PATCH v6 03/18] s390x: protvirt: Support unpack facility, Janosch Frank, 2020/03/05
- Re: [PATCH v6 03/18] s390x: protvirt: Support unpack facility, David Hildenbrand, 2020/03/05
- Re: [PATCH v6 03/18] s390x: protvirt: Support unpack facility, Janosch Frank, 2020/03/05
Re: [PATCH v6 03/18] s390x: protvirt: Support unpack facility, David Hildenbrand, 2020/03/05
Re: [PATCH v6 03/18] s390x: protvirt: Support unpack facility,
Christian Borntraeger <=
[PATCH v6 06/18] s390x: protvirt: Inhibit balloon when switching to protected mode, Janosch Frank, 2020/03/04
[PATCH v6 07/18] s390x: protvirt: KVM intercept changes, Janosch Frank, 2020/03/04
[PATCH v6 05/18] s390x: protvirt: Handle diag 308 subcodes 0,1,3,4, Janosch Frank, 2020/03/04
[PATCH v6 08/18] s390x: Add SIDA memory ops, Janosch Frank, 2020/03/04
[PATCH v6 15/18] s390x: protvirt: Handle SIGP store status correctly, Janosch Frank, 2020/03/04