pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/emulators/haxm



Module Name:    pkgsrc
Committed By:   kamil
Date:           Wed Feb 13 05:20:15 UTC 2019

Added Files:
        pkgsrc/emulators/haxm: DESCR Makefile PLIST distinfo
        pkgsrc/emulators/haxm/files: haxm-mknod haxm-modload.in haxm-modunload
        pkgsrc/emulators/haxm/patches: patch-core_ia32.c
            patch-core_ia32__ops.asm patch-core_include_ia32.h
            patch-core_include_vcpu.h patch-core_vcpu.c

Log Message:
emulators/haxm: import haxm-0.c072ad9b68e1d558a9fb791511468d10a1a9b319

HAXM is a cross-platform hardware-assisted virtualization engine (hypervisor),
widely used as an accelerator for Android Emulator and QEMU. It has always
supported running on Windows and macOS, and has been ported to other host
operating systems as well, such as Linux and NetBSD.

HAXM runs as a kernel-mode driver on the host operating system, and provides a
KVM-like interface to user space, thereby enabling applications like QEMU to
utilize the hardware virtualization capabilities built into modern Intel CPUs,
namely Intel Virtualization Technology.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/emulators/haxm/DESCR \
    pkgsrc/emulators/haxm/Makefile pkgsrc/emulators/haxm/PLIST \
    pkgsrc/emulators/haxm/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/emulators/haxm/files/haxm-mknod \
    pkgsrc/emulators/haxm/files/haxm-modload.in \
    pkgsrc/emulators/haxm/files/haxm-modunload
cvs rdiff -u -r0 -r1.1 pkgsrc/emulators/haxm/patches/patch-core_ia32.c \
    pkgsrc/emulators/haxm/patches/patch-core_ia32__ops.asm \
    pkgsrc/emulators/haxm/patches/patch-core_include_ia32.h \
    pkgsrc/emulators/haxm/patches/patch-core_include_vcpu.h \
    pkgsrc/emulators/haxm/patches/patch-core_vcpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/emulators/haxm/DESCR
diff -u /dev/null pkgsrc/emulators/haxm/DESCR:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/DESCR Wed Feb 13 05:20:15 2019
@@ -0,0 +1,9 @@
+HAXM is a cross-platform hardware-assisted virtualization engine (hypervisor),
+widely used as an accelerator for Android Emulator and QEMU. It has always
+supported running on Windows and macOS, and has been ported to other host
+operating systems as well, such as Linux and NetBSD.
+
+HAXM runs as a kernel-mode driver on the host operating system, and provides a
+KVM-like interface to user space, thereby enabling applications like QEMU to
+utilize the hardware virtualization capabilities built into modern Intel CPUs,
+namely Intel Virtualization Technology.
Index: pkgsrc/emulators/haxm/Makefile
diff -u /dev/null pkgsrc/emulators/haxm/Makefile:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/Makefile      Wed Feb 13 05:20:15 2019
@@ -0,0 +1,58 @@
+# $NetBSD: Makefile,v 1.1 2019/02/13 05:20:15 kamil Exp $
+
+GITHUB_PROJECT=        haxm
+GITHUB_TAG=    c072ad9b68e1d558a9fb791511468d10a1a9b319
+DISTNAME=      haxm-0.${GITHUB_TAG}
+CATEGORIES=    emulators
+MASTER_SITES=  ${MASTER_SITE_GITHUB:=intel/}
+
+MAINTAINER=    kamil%NetBSD.org@localhost
+HOMEPAGE=      https://github.com/intel/haxm/
+COMMENT=       Intel Hardware Accelerated Execution Manager
+LICENSE=       modified-bsd
+
+WRKSRC=                ${WRKDIR}/haxm-${GITHUB_TAG}
+
+ONLY_FOR_PLATFORM=     NetBSD-*-x86_64
+OSVERSION_SPECIFIC=    YES
+
+BUILD_DIRS=    platforms/netbsd
+
+BUILDLINK_PASSTHRU_DIRS+=      ${BSDSRCDIR}/sys
+
+BUILD_DEFS+=   BSDSRCDIR
+
+.include "../../mk/compiler.mk"
+
+.if !empty(PKGSRC_COMPILER:Mclang)
+CFLAGS+=       -Wno-error=address-of-packed-member
+.endif
+
+KMOD=          haxm.kmod
+KMODULEDIR=    stand/${MACHINE}/${OS_VERSION}/modules
+
+INSTALLATION_DIRS+=    sbin            # auxiliary scripts
+INSTALLATION_DIRS+=    ${KMODULEDIR}
+
+PLIST_SUBST+=  MACHINE=${MACHINE}
+
+pre-configure:
+.for file in haxm-mknod haxm-modunload
+       ${CP} ${FILESDIR}/${file} ${WRKSRC}
+.endfor
+       ${SED} \
+               -e 's|@PREFIX@|${PREFIX}|g' \
+               -e 's|@MACHINE@|${MACHINE}|g' \
+               -e 's|@OS_VERSION@|${OS_VERSION}|g' \
+               ${FILESDIR}/haxm-modload.in > ${WRKSRC}/haxm-modload
+
+do-install:
+       ${RUN} cd ${WRKSRC}/platforms/netbsd && \
+               ${INSTALL_PROGRAM} ${KMOD} ${DESTDIR}${PREFIX}/${KMODULEDIR}
+.for file in haxm-modload haxm-modunload haxm-mknod
+       ${RUN} cd ${WRKSRC} && \
+               ${INSTALL_SCRIPT} ${file} ${DESTDIR}${PREFIX}/sbin
+.endfor
+
+
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/emulators/haxm/PLIST
diff -u /dev/null pkgsrc/emulators/haxm/PLIST:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/PLIST Wed Feb 13 05:20:15 2019
@@ -0,0 +1,5 @@
+@comment $NetBSD: PLIST,v 1.1 2019/02/13 05:20:15 kamil Exp $
+sbin/haxm-mknod
+sbin/haxm-modload
+sbin/haxm-modunload
+stand/${MACHINE}/${OS_VERSION}/modules/haxm.kmod
Index: pkgsrc/emulators/haxm/distinfo
diff -u /dev/null pkgsrc/emulators/haxm/distinfo:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/distinfo      Wed Feb 13 05:20:15 2019
@@ -0,0 +1,11 @@
+$NetBSD: distinfo,v 1.1 2019/02/13 05:20:15 kamil Exp $
+
+SHA1 (haxm-0.c072ad9b68e1d558a9fb791511468d10a1a9b319-c072ad9b68e1d558a9fb791511468d10a1a9b319.tar.gz) = da6fe9b8c98292e8c4ca5f62ad6aa9a4a65c6bb1
+RMD160 (haxm-0.c072ad9b68e1d558a9fb791511468d10a1a9b319-c072ad9b68e1d558a9fb791511468d10a1a9b319.tar.gz) = 6c1248be0b9ee775c9879627bf60d20eb3a94368
+SHA512 (haxm-0.c072ad9b68e1d558a9fb791511468d10a1a9b319-c072ad9b68e1d558a9fb791511468d10a1a9b319.tar.gz) = 
df8e8b634fea18faa05ae57648dee6500a5b0d93fa081172835e1991ab3ae2b6ad0ad1a99d91d695f0a6656e79744445ff6f6f42947b311bb8245640dd8cff23
+Size (haxm-0.c072ad9b68e1d558a9fb791511468d10a1a9b319-c072ad9b68e1d558a9fb791511468d10a1a9b319.tar.gz) = 233043 bytes
+SHA1 (patch-core_ia32.c) = 6252b1b49d5198a9c16aa206cbfc1981c43c9b70
+SHA1 (patch-core_ia32__ops.asm) = ca208e579a39a15f5c62322dcad595b4b0ac4a34
+SHA1 (patch-core_include_ia32.h) = 3195558c44d1d196a7ac89aaa9b1931790395acc
+SHA1 (patch-core_include_vcpu.h) = 9b9e020d4e15f9e310ef5d22fa41b2289813394f
+SHA1 (patch-core_vcpu.c) = 068a20bf96c797cfd5f4629ce0e5cbb0104995a8

Index: pkgsrc/emulators/haxm/files/haxm-mknod
diff -u /dev/null pkgsrc/emulators/haxm/files/haxm-mknod:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/files/haxm-mknod      Wed Feb 13 05:20:15 2019
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+if [ -e /dev/HAX ]; then
+       echo "ERR: HAXM devices have been already created"
+       exit 1
+fi
+
+echo "*** Creating HAX devices ***"
+mknod /dev/HAX c 220 0
+mkdir /dev/hax_vm
+for i in `seq 0 7`; do mkdir /dev/hax_vm0$i; done
+for i in `seq 0 7`; do mknod /dev/hax_vm/vm0$i c 222 $i; done
+
+echo "*** Creating VCPU Nodes ***"
+i=0
+while [ $i -lt 128 ]; do
+        vm=$(echo "$i/16"|bc)
+        vcpu=$(echo "$i%16"|bc)
+        echo "i=$i vm=$vm vcpu=$vcpu"
+        cmd=$(printf "mknod /dev/hax_vm%02d/vcpu%02d c 221 %d" $vm $vcpu $i)
+        $cmd
+        let "i+=1"
+done
+
+echo "*** Done ****"
Index: pkgsrc/emulators/haxm/files/haxm-modload.in
diff -u /dev/null pkgsrc/emulators/haxm/files/haxm-modload.in:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/files/haxm-modload.in Wed Feb 13 05:20:15 2019
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+modload @PREFIX@/stand/@MACHINE@/@OS_VERSION@/modules/haxm.kmod
Index: pkgsrc/emulators/haxm/files/haxm-modunload
diff -u /dev/null pkgsrc/emulators/haxm/files/haxm-modunload:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/files/haxm-modunload  Wed Feb 13 05:20:15 2019
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+modunload haxm

Index: pkgsrc/emulators/haxm/patches/patch-core_ia32.c
diff -u /dev/null pkgsrc/emulators/haxm/patches/patch-core_ia32.c:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/patches/patch-core_ia32.c     Wed Feb 13 05:20:15 2019
@@ -0,0 +1,20 @@
+$NetBSD: patch-core_ia32.c,v 1.1 2019/02/13 05:20:15 kamil Exp $
+
+Cherry-pick from upstream review:
+ - Fix FPU DNA exception on NetBSD
+   https://github.com/intel/haxm/pull/168
+
+--- core/ia32.c.orig   2019-02-12 09:24:47.000000000 +0000
++++ core/ia32.c
+@@ -81,6 +81,11 @@ uint64_t ia32_rdtsc(void)
+ #endif
+ }
+ 
++void hax_clts(void)
++{
++    asm_clts();
++}
++
+ void hax_fxinit(void)
+ {
+     asm_fxinit();
Index: pkgsrc/emulators/haxm/patches/patch-core_ia32__ops.asm
diff -u /dev/null pkgsrc/emulators/haxm/patches/patch-core_ia32__ops.asm:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/patches/patch-core_ia32__ops.asm      Wed Feb 13 05:20:15 2019
@@ -0,0 +1,19 @@
+$NetBSD: patch-core_ia32__ops.asm,v 1.1 2019/02/13 05:20:15 kamil Exp $
+
+Cherry-pick from upstream review:
+ - Fix FPU DNA exception on NetBSD
+   https://github.com/intel/haxm/pull/168
+
+--- core/ia32_ops.asm.orig     2019-02-12 09:24:47.000000000 +0000
++++ core/ia32_ops.asm
+@@ -213,6 +213,10 @@ function asm_enable_irq, 0
+     sti
+     ret
+ 
++function asm_clts, 0
++    clts
++    ret
++
+ function asm_fxinit, 0
+     finit
+     ret
Index: pkgsrc/emulators/haxm/patches/patch-core_include_ia32.h
diff -u /dev/null pkgsrc/emulators/haxm/patches/patch-core_include_ia32.h:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/patches/patch-core_include_ia32.h     Wed Feb 13 05:20:15 2019
@@ -0,0 +1,25 @@
+$NetBSD: patch-core_include_ia32.h,v 1.1 2019/02/13 05:20:15 kamil Exp $
+
+Cherry-pick from upstream review:
+ - Fix FPU DNA exception on NetBSD
+   https://github.com/intel/haxm/pull/168
+
+--- core/include/ia32.h.orig   2019-02-12 09:24:47.000000000 +0000
++++ core/include/ia32.h
+@@ -72,6 +72,7 @@ void ASMCALL set_kernel_fs(uint16_t val)
+ 
+ void ASMCALL asm_btr(uint8_t *addr, uint bit);
+ void ASMCALL asm_bts(uint8_t *addr, uint bit);
++void ASMCALL asm_clts(void);
+ void ASMCALL asm_fxinit(void);
+ void ASMCALL asm_fxsave(mword *addr);
+ void ASMCALL asm_fxrstor(mword *addr);
+@@ -85,6 +86,8 @@ void ia32_wrmsr(uint32_t reg, uint64_t v
+ 
+ uint64_t ia32_rdtsc(void);
+ 
++void hax_clts(void);
++
+ void hax_fxinit(void);
+ void hax_fxsave(mword *addr);
+ void hax_fxrstor(mword *addr);
Index: pkgsrc/emulators/haxm/patches/patch-core_include_vcpu.h
diff -u /dev/null pkgsrc/emulators/haxm/patches/patch-core_include_vcpu.h:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/patches/patch-core_include_vcpu.h     Wed Feb 13 05:20:15 2019
@@ -0,0 +1,16 @@
+$NetBSD: patch-core_include_vcpu.h,v 1.1 2019/02/13 05:20:15 kamil Exp $
+
+Cherry-pick from upstream review:
+ - Fix FPU DNA exception on NetBSD
+   https://github.com/intel/haxm/pull/168
+
+--- core/include/vcpu.h.orig   2019-02-12 09:24:47.000000000 +0000
++++ core/include/vcpu.h
+@@ -238,6 +238,7 @@ struct vcpu_t {
+ #ifdef CONFIG_HAX_EPT2
+     struct mmio_fetch_cache mmio_fetch;
+ #endif  // CONFIG_HAX_EPT2
++    int cr0_ts;
+ };
+ 
+ #define vmx(v, field) v->vmx.field
Index: pkgsrc/emulators/haxm/patches/patch-core_vcpu.c
diff -u /dev/null pkgsrc/emulators/haxm/patches/patch-core_vcpu.c:1.1
--- /dev/null   Wed Feb 13 05:20:15 2019
+++ pkgsrc/emulators/haxm/patches/patch-core_vcpu.c     Wed Feb 13 05:20:15 2019
@@ -0,0 +1,34 @@
+$NetBSD: patch-core_vcpu.c,v 1.1 2019/02/13 05:20:15 kamil Exp $
+
+Cherry-pick from upstream review:
+ - Fix FPU DNA exception on NetBSD
+   https://github.com/intel/haxm/pull/168
+
+--- core/vcpu.c.orig   2019-02-12 09:24:47.000000000 +0000
++++ core/vcpu.c
+@@ -2041,6 +2041,10 @@ static void vcpu_enter_fpu_state(struct 
+     struct fx_layout *hfx = (struct fx_layout *)hax_page_va(hstate->hfxpage);
+     struct fx_layout *gfx = (struct fx_layout *)hax_page_va(gstate->gfxpage);
+ 
++    vcpu->cr0_ts = !!(get_cr0() & CR0_TS);
++
++    hax_clts();
++
+     hax_fxsave((mword *)hfx);
+     hax_fxrstor((mword *)gfx);
+ }
+@@ -2052,8 +2056,14 @@ static void vcpu_exit_fpu_state(struct v
+     struct fx_layout *hfx = (struct fx_layout *)hax_page_va(hstate->hfxpage);
+     struct fx_layout *gfx = (struct fx_layout *)hax_page_va(gstate->gfxpage);
+ 
++    hax_clts();
++
+     hax_fxsave((mword *)gfx);
+     hax_fxrstor((mword *)hfx);
++
++    if (vcpu->cr0_ts) {
++        set_cr0(get_cr0() | CR0_TS);
++    }
+ }
+ 
+ // Instructions are never longer than 15 bytes:



Home | Main Index | Thread Index | Old Index