[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 12/17] s390x: protvirt: Set guest IPL PSW
From: |
Janosch Frank |
Subject: |
[PATCH v3 12/17] s390x: protvirt: Set guest IPL PSW |
Date: |
Fri, 14 Feb 2020 10:16:31 -0500 |
Handling of CPU reset and setting of the IPL psw from guest storage at
offset 0 is done by a Ultravisor call. Let's only fetch it if
necessary.
Signed-off-by: Janosch Frank <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
---
hw/s390x/pv.c | 6 ++++++
hw/s390x/pv.h | 2 ++
linux-headers/linux/kvm.h | 1 +
target/s390x/cpu.c | 23 ++++++++++++++---------
4 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
index 5b6a26cba9..845764859c 100644
--- a/hw/s390x/pv.c
+++ b/hw/s390x/pv.c
@@ -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.
*/
diff --git a/hw/s390x/pv.h b/hw/s390x/pv.h
index 7d20bdd12e..3d37af01ad 100644
--- a/hw/s390x/pv.h
+++ b/hw/s390x/pv.h
@@ -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; }
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index c6f0d04115..85094bf443 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -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 {
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 1dbd84b9d7..24bb0d83ae 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -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
--
2.20.1
- [PATCH v3 07/17] s390x: protvirt: Handle diag 308 subcodes 0,1,3,4, (continued)
[PATCH v3 09/17] s390: protvirt: Move STSI data over SIDAD, Janosch Frank, 2020/02/14
[PATCH v3 10/17] s390x: Add SIDA memory ops, Janosch Frank, 2020/02/14
[PATCH v3 12/17] s390x: protvirt: Set guest IPL PSW,
Janosch Frank <=
[PATCH v3 14/17] s390x: protvirt: Disable address checks for PV guest IO emulation, Janosch Frank, 2020/02/14
[PATCH v3 15/17] s390x: protvirt: Move IO control structures over SIDA, Janosch Frank, 2020/02/14
[PATCH v3 13/17] s390x: protvirt: Move diag 308 data over SIDAD, Janosch Frank, 2020/02/14
[PATCH v3 17/17] s390x: For now add unpack feature to GA1, Janosch Frank, 2020/02/14
[PATCH v3 11/17] s390x: protvirt: SCLP interpretation, Janosch Frank, 2020/02/14
[PATCH v3 16/17] s390x: protvirt: Handle SIGP store status correctly, Janosch Frank, 2020/02/14