Skip to contentSkip to conversation

Make kvm_run more arch friendly

PATCH Applied Jerone Young 2 participants 2 messages Nov 12, 2007 – Nov 14, 2007 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make kvm_run more arch friendly

# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194887893 21600
# Node ID 41925cedf395c050fb31083eeda8a08bad609169
# Parent a40de75e2bf823c092a20009c7646bf4c026a260
Make kvm_run more arch friendly

This patch creates hook kvm_arch_run in kvm_run function. This is to handle cases that are architecture specific on a run exit. Currently there is only one case that is handled that is obvious. Others have at least some similarity on all archs.

Though really these return codes will need to be worked out in the kernel kvm module. But here is a start.

libkvm/kvm-common.h +2 -0
@@ -71,6 +71,8 @@ int kvm_arch_create_default_phys_mem(kvm
 int kvm_arch_create_default_phys_mem(kvm_context_t kvm,
                                        unsigned long phys_mem_bytes,
                                        void **vm_mem);
+int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu);
+
 
 void kvm_show_code(kvm_context_t kvm, int vcpu);
 int kvm_run_abi10(kvm_context_t kvm, int vcpu);
libkvm/libkvm-x86.c +17 -0
@@ -156,6 +156,23 @@ int kvm_arch_create(kvm_context_t kvm, u
 		return r;
 
 	return 0;
+}
+
+int kvm_arch_run(struct kvm_run *run,kvm_context_t kvm, int vcpu)
+{
+	int r = 0;
+	
+	switch (run->exit_reason) {
+#ifdef KVM_EXIT_SET_TPR
+		case KVM_EXIT_SET_TPR:
+			break;
+#endif
+		default:
+			r = 1;
+			break;
+	}
+	
+	return r;
 }
 
 void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start,
libkvm/libkvm.c +6 -7
@@ -954,14 +954,13 @@ again:
 		case KVM_EXIT_SHUTDOWN:
 			r = handle_shutdown(kvm, vcpu);
 			break;
-#ifdef KVM_EXIT_SET_TPR
-		case KVM_EXIT_SET_TPR:
-			break;
-#endif
 		default:
-			fprintf(stderr, "unhandled vm exit: 0x%x\n", run->exit_reason);
-			kvm_show_regs(kvm, vcpu);
-			abort();
+			if (kvm_arch_run(run, kvm, vcpu)) {
+				fprintf(stderr, "unhandled vm exit: 0x%x\n", 
+							run->exit_reason);
+				kvm_show_regs(kvm, vcpu);
+				abort();
+			}
 			break;
 		}
 	}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

Applied
#1 lore raw
Quoted 7 lines · Jerone Young

# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194887893 21600
# Node ID 41925cedf395c050fb31083eeda8a08bad609169
# Parent a40de75e2bf823c092a20009c7646bf4c026a260
Make kvm_run more arch friendly

Quoted 8 lines

This patch creates hook kvm_arch_run in kvm_run function. This is to handle cases that are architecture specific on a run exit. Currently there is only one case that is handled that is obvious. Others have at least some similarity on all archs.

Though really these return codes will need to be worked out in the kernel kvm module. But here is a start.

Applied, thanks.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/