Update to current emulators/qemu package (4.0.0nb1) - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
(HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) changeset 4878f5ab055b8c48748979b3620234f2d5805e12
(DIR) parent 605c0fa14090d61257c1f0b9a2019a2b0887d531
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Thu, 25 Apr 2019 12:13:07
Update to current emulators/qemu package (4.0.0nb1)
XXX: Still untested.
Diffstat:
emulators/qemu/patch-nvmm-support | 63 +++++++++++++++++---------------------
1 files changed, 28 insertions(+), 35 deletions(-)
---
diff -r 605c0fa14090 -r 4878f5ab055b emulators/qemu/patch-nvmm-support
--- a/emulators/qemu/patch-nvmm-support Wed Apr 24 21:27:33 2019 +0200
+++ b/emulators/qemu/patch-nvmm-support Thu Apr 25 12:13:07 2019 +0200
@@ -6,7 +6,7 @@
recognized automatically in the configure (s/nvmm="no"/nvmm=""/).
--- accel/stubs/Makefile.objs 2018-12-11 18:44:34.000000000 +0100
-+++ accel/stubs/Makefile.objs 2019-02-04 09:58:31.612072806 +0100
++++ accel/stubs/Makefile.objs 2019-03-21 20:48:31.764998305 +0100
@@ -1,5 +1,6 @@
obj-$(call lnot,$(CONFIG_HAX)) += hax-stub.o
obj-$(call lnot,$(CONFIG_HVF)) += hvf-stub.o
@@ -15,7 +15,7 @@
obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
obj-$(call lnot,$(CONFIG_TCG)) += tcg-stub.o
--- accel/stubs/nvmm-stub.c 1970-01-01 01:00:00.000000000 +0100
-+++ accel/stubs/nvmm-stub.c 2019-02-04 12:03:40.012081666 +0100
++++ accel/stubs/nvmm-stub.c 2019-03-21 20:48:31.773998305 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018-2019 Maxime Villard, All rights reserved.
@@ -61,7 +61,7 @@
+{
+}
--- configure 2018-12-11 18:44:34.000000000 +0100
-+++ configure 2019-02-04 11:34:28.769555764 +0100
++++ configure 2019-03-21 20:48:31.773998305 +0100
@@ -237,6 +237,17 @@
return 1
}
@@ -155,7 +155,7 @@
echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
fi
--- cpus.c 2018-12-11 18:44:34.000000000 +0100
-+++ cpus.c 2019-02-04 10:03:02.152520882 +0100
++++ cpus.c 2019-03-21 20:48:31.774998305 +0100
@@ -40,6 +40,7 @@
#include "sysemu/hax.h"
#include "sysemu/hvf.h"
@@ -243,7 +243,7 @@
qemu_dummy_start_vcpu(cpu);
}
--- include/sysemu/hw_accel.h 2018-12-11 18:44:34.000000000 +0100
-+++ include/sysemu/hw_accel.h 2019-02-04 10:04:09.887130860 +0100
++++ include/sysemu/hw_accel.h 2019-03-21 20:48:31.774998305 +0100
@@ -15,6 +15,7 @@
#include "sysemu/hax.h"
#include "sysemu/kvm.h"
@@ -293,7 +293,7 @@
#endif /* QEMU_HW_ACCEL_H */
--- include/sysemu/nvmm.h 1970-01-01 01:00:00.000000000 +0100
-+++ include/sysemu/nvmm.h 2019-02-04 12:06:14.967932051 +0100
++++ include/sysemu/nvmm.h 2019-03-21 20:48:31.774998305 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2018-2019 Maxime Villard, All rights reserved.
@@ -331,7 +331,7 @@
+
+#endif /* CONFIG_NVMM */
--- qemu-options.hx 2018-12-11 18:44:34.000000000 +0100
-+++ qemu-options.hx 2019-02-04 10:05:16.697759799 +0100
++++ qemu-options.hx 2019-03-21 20:48:31.774998305 +0100
@@ -66,7 +66,7 @@
@table @option
@item accel=@var{accels1}[:@var{accels2}[:...]]
@@ -358,7 +358,7 @@
fails to initialize.
@table @option
--- target/i386/helper.c 2018-12-11 18:44:34.000000000 +0100
-+++ target/i386/helper.c 2019-02-04 10:05:47.993117568 +0100
++++ target/i386/helper.c 2019-03-21 20:48:31.775998305 +0100
@@ -986,7 +986,7 @@
X86CPU *cpu = x86_env_get_cpu(env);
CPUState *cs = CPU(cpu);
@@ -369,18 +369,18 @@
cpu_interrupt(cs, CPU_INTERRUPT_TPR);
--- target/i386/Makefile.objs 2018-12-11 18:44:34.000000000 +0100
-+++ target/i386/Makefile.objs 2019-02-04 10:06:13.786588242 +0100
++++ target/i386/Makefile.objs 2019-03-21 20:48:31.775998305 +0100
@@ -17,6 +17,7 @@
+ endif
obj-$(CONFIG_HVF) += hvf/
- endif
obj-$(CONFIG_WHPX) += whpx-all.o
+obj-$(CONFIG_NVMM) += nvmm-all.o
endif
obj-$(CONFIG_SEV) += sev.o
obj-$(call lnot,$(CONFIG_SEV)) += sev-stub.o
--- target/i386/nvmm-all.c 1970-01-01 01:00:00.000000000 +0100
-+++ target/i386/nvmm-all.c 2019-02-26 12:41:22.288405702 +0100
-@@ -0,0 +1,1174 @@
++++ target/i386/nvmm-all.c 2019-04-13 15:09:17.551898967 +0200
+@@ -0,0 +1,1167 @@
+/*
+ * Copyright (c) 2018-2019 Maxime Villard, All rights reserved.
+ *
@@ -420,7 +420,7 @@
+ bool int_window_exit;
+ bool nmi_window_exit;
+
-+ /* The guest is an interrupt shadow (POP SS, etc). */
++ /* The guest is in an interrupt shadow (POP SS, etc). */
+ bool int_shadow;
+};
+
@@ -518,6 +518,7 @@
+ state.crs[NVMM_X64_CR_XCR0] = env->xcr0;
+
+ /* Debug registers. */
++ state.drs[NVMM_X64_DR_DR0] = env->dr[0];
+ state.drs[NVMM_X64_DR_DR1] = env->dr[1];
+ state.drs[NVMM_X64_DR_DR2] = env->dr[2];
+ state.drs[NVMM_X64_DR_DR3] = env->dr[3];
@@ -558,6 +559,7 @@
+ state.msrs[NVMM_X64_MSR_SYSENTER_ESP] = env->sysenter_esp;
+ state.msrs[NVMM_X64_MSR_SYSENTER_EIP] = env->sysenter_eip;
+ state.msrs[NVMM_X64_MSR_PAT] = env->pat;
++ state.msrs[NVMM_X64_MSR_TSC] = env->tsc;
+
+ bitmap =
+ NVMM_X64_STATE_SEGS |
@@ -669,6 +671,7 @@
+ env->xcr0 = state.crs[NVMM_X64_CR_XCR0];
+
+ /* Debug registers. */
++ env->dr[0] = state.drs[NVMM_X64_DR_DR0];
+ env->dr[1] = state.drs[NVMM_X64_DR_DR1];
+ env->dr[2] = state.drs[NVMM_X64_DR_DR2];
+ env->dr[3] = state.drs[NVMM_X64_DR_DR3];
@@ -708,6 +711,7 @@
+ env->sysenter_esp = state.msrs[NVMM_X64_MSR_SYSENTER_ESP];
+ env->sysenter_eip = state.msrs[NVMM_X64_MSR_SYSENTER_EIP];
+ env->pat = state.msrs[NVMM_X64_MSR_PAT];
++ env->tsc = state.msrs[NVMM_X64_MSR_TSC];
+
+ x86_update_hflags(env);
+}
@@ -728,10 +732,10 @@
+
+ /* Exit on interrupt window. */
+ nvmm_vcpu_getstate(mach, vcpu->cpuid, &state,
-+ NVMM_X64_STATE_MISC);
-+ state.misc[NVMM_X64_MISC_INT_WINDOW_EXIT] = 1;
++ NVMM_X64_STATE_INTR);
++ state.intr.int_window_exiting = 1;
+ nvmm_vcpu_setstate(mach, vcpu->cpuid, &state,
-+ NVMM_X64_STATE_MISC);
++ NVMM_X64_STATE_INTR);
+
+ return false;
+ }
@@ -1133,9 +1137,8 @@
+ cpu->exception_index = EXCP_INTERRUPT;
+ ret = 1;
+ break;
-+
+ default:
-+ error_report("NVMM: Unexpected VM exit code %lu",
++ error_report("NVMM: Unexpected VM exit code %lx",
+ exit.reason);
+ nvmm_get_registers(cpu);
+ qemu_mutex_lock_iothread();
@@ -1322,12 +1325,14 @@
+ bool add, bool rom, const char *name)
+{
+ struct nvmm_machine *mach = get_nvmm_mach();
-+ int ret;
-+
-+ // TODO rom read-only?
++ int ret, prot;
+
+ if (add) {
-+ ret = nvmm_gpa_map(mach, hva, start_pa, size, 0);
++ prot = PROT_READ | PROT_EXEC;
++ if (!rom) {
++ prot |= PROT_WRITE;
++ }
++ ret = nvmm_gpa_map(mach, hva, start_pa, size, prot);
+ } else {
+ ret = nvmm_gpa_unmap(mach, hva, start_pa, size);
+ }
@@ -1460,21 +1465,9 @@
+ struct nvmm_x86_conf_cpuid cpuid;
+ int ret;
+
-+ /* Delete the Monitor and MTRR bits, set the Hypervisor bit. */
+ memset(&cpuid, 0, sizeof(cpuid));
+ cpuid.leaf = 0x00000001;
-+ cpuid.del.ecx = CPUID_EXT_MONITOR | CPUID_EXT_X2APIC;
+ cpuid.del.edx = CPUID_MCE | CPUID_MCA | CPUID_MTRR;
-+ cpuid.set.ecx = CPUID_EXT_HYPERVISOR;
-+
-+ ret = nvmm_machine_configure(mach, NVMM_X86_CONF_CPUID, &cpuid);
-+ if (ret == -1)
-+ return -1;
-+
-+ /* Delete the OSVW bit. */
-+ memset(&cpuid, 0, sizeof(cpuid));
-+ cpuid.leaf = 0x80000001;
-+ cpuid.del.ecx = CPUID_EXT3_OSVW;
+
+ ret = nvmm_machine_configure(mach, NVMM_X86_CONF_CPUID, &cpuid);
+ if (ret == -1)
@@ -1556,7 +1549,7 @@
+
+type_init(nvmm_type_init);
--- vl.c 2018-12-11 18:44:35.000000000 +0100
-+++ vl.c 2019-02-04 10:07:16.467301929 +0100
++++ vl.c 2019-03-21 20:48:31.776998305 +0100
@@ -3653,7 +3653,8 @@
optarg, true);
optarg = qemu_opt_get(accel_opts, "accel");