@@ -28,6 +28,7 @@ const char* cmd_names[] = {
"VM_UNSHARE_ALL",
"VCPU_CREATE",
"VCPU_DESTROY",
+ "VCPU_SET_IPL_PSW",
NULL
};
@@ -124,6 +125,11 @@ int s390_pv_set_sec_parms(uint64_t origin, uint64_t length)
return s390_pv_cmd(KVM_PV_VM_SET_SEC_PARMS, &args);
}
+void s390_pv_set_ipl_psw(CPUState *cs)
+{
+ s390_pv_cmd_vcpu_exit(cs, KVM_PV_VCPU_SET_IPL_PSW, NULL);
+}
+
/*
* Called for each component in the SE type IPL parameter block 0.
*/
@@ -19,6 +19,7 @@ void s390_pv_vm_destroy(void);
void s390_pv_vcpu_destroy(CPUState *cs);
int s390_pv_vcpu_create(CPUState *cs);
int s390_pv_set_sec_parms(uint64_t origin, uint64_t length);
+void s390_pv_set_ipl_psw(CPUState *cs);
int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak);
void s390_pv_perf_clear_reset(void);
int s390_pv_verify(void);
@@ -29,6 +30,7 @@ void s390_pv_vm_destroy(void) {}
void s390_pv_vcpu_destroy(CPUState *cs) {}
int s390_pv_vcpu_create(CPUState *cs) { return 0; }
int s390_pv_set_sec_parms(uint64_t origin, uint64_t length) { return 0; }
+void s390_pv_set_ipl_psw(CPUState *cs) {}
int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak) { return 0: }
void s390_pv_perf_clear_reset(void) {}
int s390_pv_verify(void) { return 0; }
@@ -1503,6 +1503,7 @@ enum pv_cmd_id {
KVM_PV_VM_UNSHARE_ALL,
KVM_PV_VCPU_CREATE,
KVM_PV_VCPU_DESTROY,
+ KVM_PV_VCPU_SET_IPL_PSW,
};
struct kvm_pv_cmd {
@@ -78,16 +78,21 @@ static bool s390_cpu_has_work(CPUState *cs)
static void s390_cpu_load_normal(CPUState *s)
{
S390CPU *cpu = S390_CPU(s);
- uint64_t spsw = ldq_phys(s->as, 0);
-
- cpu->env.psw.mask = spsw & 0xffffffff80000000ULL;
- /*
- * Invert short psw indication, so SIE will report a specification
- * exception if it was not set.
- */
- cpu->env.psw.mask ^= PSW_MASK_SHORTPSW;
- cpu->env.psw.addr = spsw & 0x7fffffffULL;
+ CPUS390XState *env = &cpu->env;
+ uint64_t spsw;
+ if (!env->pv) {
+ spsw = ldq_phys(s->as, 0);
+ cpu->env.psw.mask = spsw & 0xffffffff80000000ULL;
+ /*
+ * Invert short psw indication, so SIE will report a specification
+ * exception if it was not set.
+ */
+ cpu->env.psw.mask ^= PSW_MASK_SHORTPSW;
+ cpu->env.psw.addr = spsw & 0x7fffffffULL;
+ } else {
+ s390_pv_set_ipl_psw(s);
+ }
s390_cpu_set_state(S390_CPU_STATE_OPERATING, cpu);
}
#endif