Added Haxm SMP support for Mac OS. 11/27911/1
authoryucheng yu <yu-cheng.yu@intel.com>
Mon, 22 Sep 2014 18:25:48 +0000 (11:25 -0700)
committeryucheng yu <yu-cheng.yu@intel.com>
Mon, 22 Sep 2014 18:27:52 +0000 (11:27 -0700)
Change-Id: Ic2301aa5addd2175a457a4d152b734012ed1b26c

cpus.c
target-i386/hax-all.c
target-i386/hax-darwin.c
target-i386/hax-darwin.h

diff --git a/cpus.c b/cpus.c
index 9f0926c..24b72c8 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -1015,9 +1015,12 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
 /* The cpu thread cannot catch it reliably when shutdown the guest on Mac.
  * We can double check it and resend it
  */
+
 #ifdef CONFIG_DARWIN
     if (!exit_request)
         cpu_signal(0);
+
+    cpu->exit_request = 1;
 #endif
 #else /* _WIN32 */
     if (!qemu_cpu_is_self(cpu)) {
index 2f80974..af4bb50 100644 (file)
@@ -726,6 +726,9 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
         hax_ret = hax_vcpu_run(vcpu);
         qemu_mutex_lock_iothread();
 
+#ifdef CONFIG_DARWIN
+        current_cpu = cpu;
+#endif
         /* Simply continue the vcpu_run if system call interrupted */
         if (hax_ret == -EINTR || hax_ret == -EAGAIN) {
             dprint("io window interrupted\n");
index be889cd..7b9b8db 100644 (file)
@@ -196,6 +196,22 @@ hax_fd hax_host_open_vm(struct hax_state *hax, int vm_id)
     return fd;
 }
 
+int hax_notify_qemu_version(hax_fd vm_fd, struct hax_qemu_version *qversion)
+{
+    int ret;
+
+    if (hax_invalid_fd(vm_fd))
+        return -EINVAL;
+
+    ret = ioctl(vm_fd, HAX_VM_IOCTL_NOTIFY_QEMU_VERSION, qversion);
+
+    if (ret < 0)
+    {
+        dprint("Failed to notify qemu API version\n");
+        return ret;
+    }
+    return 0;
+}
 /* Simply assume the size should be bigger than the hax_tunnel,
  * since the hax_tunnel can be extended later with compatibility considered
  */
index 1a20cc9..203b01e 100644 (file)
@@ -38,14 +38,15 @@ static inline void hax_close_fd(hax_fd fd)
 
 /* HAX model level ioctl */
 #define HAX_IOCTL_VERSION _IOWR(0, 0x20, struct hax_module_version)
-#define HAX_IOCTL_CREATE_VM _IOWR(0, 0x21, int)
-#define HAX_IOCTL_DESTROY_VM _IOW(0, 0x22, int)
+#define HAX_IOCTL_CREATE_VM _IOWR(0, 0x21, uint32_t)
+#define HAX_IOCTL_DESTROY_VM _IOW(0, 0x22, uint32_t)
 #define HAX_IOCTL_CAPABILITY _IOR(0, 0x23, struct hax_capabilityinfo)
 
-#define HAX_VM_IOCTL_VCPU_CREATE    _IOR(0, 0x80, int)
+#define HAX_VM_IOCTL_VCPU_CREATE _IOWR(0, 0x80, uint32_t)
 #define HAX_VM_IOCTL_ALLOC_RAM _IOWR(0, 0x81, struct hax_alloc_ram_info)
 #define HAX_VM_IOCTL_SET_RAM _IOWR(0, 0x82, struct hax_set_ram_info)
-#define HAX_VM_IOCTL_VCPU_DESTROY    _IOR(0, 0x83, int)
+#define HAX_VM_IOCTL_VCPU_DESTROY _IOW(0, 0x83, uint32_t)
+#define HAX_VM_IOCTL_NOTIFY_QEMU_VERSION _IOW(0, 0x84, struct hax_qemu_version)
 
 #define HAX_VCPU_IOCTL_RUN  _IO(0, 0xc0)
 #define HAX_VCPU_IOCTL_SET_MSRS _IOWR(0, 0xc1, struct hax_msr_data)