From: yucheng yu Date: Mon, 22 Sep 2014 18:25:48 +0000 (-0700) Subject: Added Haxm SMP support for Mac OS. X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~639 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6acf9f4959ea2b6cc367e71366aaf342a0ef0f54;p=sdk%2Femulator%2Fqemu.git Added Haxm SMP support for Mac OS. Change-Id: Ic2301aa5addd2175a457a4d152b734012ed1b26c --- diff --git a/cpus.c b/cpus.c index 9f0926c141..24b72c8c27 100644 --- 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)) { diff --git a/target-i386/hax-all.c b/target-i386/hax-all.c index 2f80974074..af4bb50263 100644 --- a/target-i386/hax-all.c +++ b/target-i386/hax-all.c @@ -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"); diff --git a/target-i386/hax-darwin.c b/target-i386/hax-darwin.c index be889cd674..7b9b8db134 100644 --- a/target-i386/hax-darwin.c +++ b/target-i386/hax-darwin.c @@ -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 */ diff --git a/target-i386/hax-darwin.h b/target-i386/hax-darwin.h index 1a20cc9b71..203b01e40e 100644 --- a/target-i386/hax-darwin.h +++ b/target-i386/hax-darwin.h @@ -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)