Skip to contentSkip to conversation

Enable SIGP Initial Reset

PATCH Applied Alexander Graf 2 participants 2 messages May 14, 2010 – May 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Enable SIGP Initial Reset

For SMP to work with KVM, we need to properly emulate the SIGP Initial Reset Command. Recent (2.6.32) kernels issue that before the SIGP Reset command that actually wakes up the vcpu.

This patch makes -smp work on S390x.

---
 target-s390x/kvm.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
target-s390x/kvm.c +14 -3
index a2d7741..9bf6abb 100644
@@ -344,9 +344,20 @@ static int s390_store_status(CPUState *env, uint32_t parameter)
 
 static int s390_cpu_initial_reset(CPUState *env)
 {
-    /* XXX */
-    fprintf(stderr, "XXX SIGP init\n");
-    return -1;
+    int i;
+
+    if (kvm_vcpu_ioctl(env, KVM_S390_INITIAL_RESET, NULL) < 0) {
+        perror("cannot init reset vcpu");
+    }
+
+    /* Manually zero out all registers */
+    cpu_synchronize_state(env);
+    for (i = 0; i < 16; i++) {
+        env->regs[i] = 0;
+    }
+
+    dprintf("DONE: SIGP initial reset: %p\n", env);
+    return 0;
 }
 
 static int handle_sigp(CPUState *env, struct kvm_run *run, uint8_t ipa1)
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 7 lines · Alexander Graf

For SMP to work with KVM, we need to properly emulate the SIGP Initial Reset Command. Recent (2.6.32) kernels issue that before the SIGP Reset command that actually wakes up the vcpu.

This patch makes -smp work on S390x.

Thanks, applied.

Quoted 37 lines
---
 target-s390x/kvm.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
target-s390x/kvm.c +14 -3
index a2d7741..9bf6abb 100644
@@ -344,9 +344,20 @@ static int s390_store_status(CPUState *env, uint32_t parameter)
 
 static int s390_cpu_initial_reset(CPUState *env)
 {
-    /* XXX */
-    fprintf(stderr, "XXX SIGP init\n");
-    return -1;
+    int i;
+
+    if (kvm_vcpu_ioctl(env, KVM_S390_INITIAL_RESET, NULL) < 0) {
+        perror("cannot init reset vcpu");
+    }
+
+    /* Manually zero out all registers */
+    cpu_synchronize_state(env);
+    for (i = 0; i < 16; i++) {
+        env->regs[i] = 0;
+    }
+
+    dprintf("DONE: SIGP initial reset: %p\n", env);
+    return 0;
 }
 
 static int handle_sigp(CPUState *env, struct kvm_run *run, uint8_t ipa1)
Signature · 1 line
1.6.0.2
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net