diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-07-10 17:37:16 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-07-10 17:37:16 +0100 |
commit | 74aeb37de06083ab130bf0da7c264043887c6c04 (patch) | |
tree | e1e4b6280492334ac7953acf0e29ab3285e83f39 | |
parent | 9e99c5fd7060267a0331d900e73fdb36047bfe0c (diff) | |
parent | 0a58991a5f7efd6eb8a66643f4fd894b9c6874b7 (diff) | |
download | hqemu-74aeb37de06083ab130bf0da7c264043887c6c04.zip hqemu-74aeb37de06083ab130bf0da7c264043887c6c04.tar.gz |
Merge remote-tracking branch 'remotes/kvm/uq/master' into staging
* remotes/kvm/uq/master:
qtest: fix vhost-user-test compilation with old GLib
mc146818rtc: register the clock reset notifier on the right clock
oslib-posix: Fix new compiler error with -Wclobbered
target-i386: Add "kvmclock-stable-bit" feature bit name
Enforce stack protector usage
watchdog: fix deadlock with -watchdog-action pause
mips_malta: Catch kernels linked at wrong address
mips_malta: Remove incorrect KVM T&E references
mips/kvm: Disable FPU on reset with KVM
mips/kvm: Init EBase to correct KSEG0
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rwxr-xr-x | configure | 9 | ||||
-rw-r--r-- | hw/mips/mips_malta.c | 20 | ||||
-rw-r--r-- | hw/timer/mc146818rtc.c | 2 | ||||
-rw-r--r-- | hw/watchdog/watchdog.c | 6 | ||||
-rw-r--r-- | target-i386/cpu.c | 2 | ||||
-rw-r--r-- | target-mips/kvm.c | 7 | ||||
-rw-r--r-- | target-mips/translate.c | 8 | ||||
-rw-r--r-- | tests/vhost-user-test.c | 4 | ||||
-rw-r--r-- | util/oslib-posix.c | 30 |
9 files changed, 66 insertions, 22 deletions
@@ -1489,8 +1489,9 @@ for flag in $gcc_flags; do fi done -if test "$stack_protector" != "no" ; then +if test "$stack_protector" != "no"; then gcc_flags="-fstack-protector-strong -fstack-protector-all" + sp_on=0 for flag in $gcc_flags; do # We need to check both a compile and a link, since some compiler # setups fail only on a .c->.o compile and some only at link time @@ -1498,9 +1499,15 @@ if test "$stack_protector" != "no" ; then compile_prog "-Werror $flag" ""; then QEMU_CFLAGS="$QEMU_CFLAGS $flag" LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag" + sp_on=1 break fi done + if test "$stack_protector" = yes; then + if test $sp_on = 0; then + error_exit "Stack protector not supported" + fi + fi fi # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 2868ee5..cfb60af 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -792,9 +792,23 @@ static int64_t load_kernel (void) loaderparams.kernel_filename); exit(1); } + + /* Sanity check where the kernel has been linked */ if (kvm_enabled()) { + if (kernel_entry & 0x80000000ll) { + error_report("KVM guest kernels must be linked in useg. " + "Did you forget to enable CONFIG_KVM_GUEST?"); + exit(1); + } + xlate_to_kseg0 = cpu_mips_kvm_um_phys_to_kseg0; } else { + if (!(kernel_entry & 0x80000000ll)) { + error_report("KVM guest kernels aren't supported with TCG. " + "Did you unintentionally enable CONFIG_KVM_GUEST?"); + exit(1); + } + xlate_to_kseg0 = cpu_mips_phys_to_kseg0; } @@ -1028,7 +1042,7 @@ void mips_malta_init(MachineState *machine) fl_idx++; if (kernel_filename) { ram_low_size = MIN(ram_size, 256 << 20); - /* For KVM T&E we reserve 1MB of RAM for running bootloader */ + /* For KVM we reserve 1MB of RAM for running bootloader */ if (kvm_enabled()) { ram_low_size -= 0x100000; bootloader_run_addr = 0x40000000 + ram_low_size; @@ -1052,10 +1066,10 @@ void mips_malta_init(MachineState *machine) bootloader_run_addr, kernel_entry); } } else { - /* The flash region isn't executable from a KVM T&E guest */ + /* The flash region isn't executable from a KVM guest */ if (kvm_enabled()) { error_report("KVM enabled but no -kernel argument was specified. " - "Booting from flash is not supported with KVM T&E."); + "Booting from flash is not supported with KVM."); exit(1); } /* Load firmware from flash. */ diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 9d817ca..233fc70 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -895,7 +895,7 @@ static void rtc_realizefn(DeviceState *dev, Error **errp) check_update_timer(s); s->clock_reset_notifier.notify = rtc_notify_clock_reset; - qemu_clock_register_reset_notifier(QEMU_CLOCK_REALTIME, + qemu_clock_register_reset_notifier(rtc_clock, &s->clock_reset_notifier); s->suspend_notifier.notify = rtc_notify_suspend; diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c index 9f607d4..c307f9b 100644 --- a/hw/watchdog/watchdog.c +++ b/hw/watchdog/watchdog.c @@ -122,8 +122,12 @@ void watchdog_perform_action(void) exit(0); case WDT_PAUSE: /* same as 'stop' command in monitor */ + /* In a timer callback, when vm_stop calls qemu_clock_enable + * you would get a deadlock. Bypass the problem. + */ + qemu_system_vmstop_request_prepare(); qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_PAUSE, &error_abort); - vm_stop(RUN_STATE_WATCHDOG); + qemu_system_vmstop_request(RUN_STATE_WATCHDOG); break; case WDT_DEBUG: diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 45c662d..6d008ab 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -241,7 +241,7 @@ static const char *kvm_feature_name[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + "kvmclock-stable-bit", NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; diff --git a/target-mips/kvm.c b/target-mips/kvm.c index 844e5bb..97fd51a 100644 --- a/target-mips/kvm.c +++ b/target-mips/kvm.c @@ -61,6 +61,13 @@ int kvm_arch_init_vcpu(CPUState *cs) void kvm_mips_reset_vcpu(MIPSCPU *cpu) { + CPUMIPSState *env = &cpu->env; + + if (env->CP0_Config1 & (1 << CP0C1_FP)) { + fprintf(stderr, "Warning: FPU not supported with KVM, disabling\n"); + env->CP0_Config1 &= ~(1 << CP0C1_FP); + } + DPRINTF("%s\n", __func__); } diff --git a/target-mips/translate.c b/target-mips/translate.c index 2f91959..d7b8c4d 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -28,6 +28,7 @@ #include "exec/helper-proto.h" #include "exec/helper-gen.h" +#include "sysemu/kvm.h" #define MIPS_DEBUG_DISAS 0 //#define MIPS_DEBUG_SIGN_EXTENSIONS @@ -16076,7 +16077,12 @@ void cpu_state_reset(CPUMIPSState *env) env->CP0_Random = env->tlb->nb_tlb - 1; env->tlb->tlb_in_use = env->tlb->nb_tlb; env->CP0_Wired = 0; - env->CP0_EBase = 0x80000000 | (cs->cpu_index & 0x3FF); + env->CP0_EBase = (cs->cpu_index & 0x3FF); + if (kvm_enabled()) { + env->CP0_EBase |= 0x40000000; + } else { + env->CP0_EBase |= 0x80000000; + } env->CP0_Status = (1 << CP0St_BEV) | (1 << CP0St_ERL); /* vectored interrupts not implemented, timer on int 7, no performance counters. */ diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 2af2381..406ba70 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -22,6 +22,10 @@ #include <qemu/sockets.h> /* GLIB version compatibility flags */ +#if !GLIB_CHECK_VERSION(2, 26, 0) +#define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT(1000000)) +#endif + #if GLIB_CHECK_VERSION(2, 28, 0) #define HAVE_MONOTONIC_TIME #endif diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 1524ead..cdbfb2e 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -366,10 +366,9 @@ static size_t fd_getpagesize(int fd) void os_mem_prealloc(int fd, char *area, size_t memory) { - int ret, i; + int ret; struct sigaction act, oldact; sigset_t set, oldset; - size_t hpagesize = fd_getpagesize(fd); memset(&act, 0, sizeof(act)); act.sa_handler = &sigbus_handler; @@ -389,19 +388,22 @@ void os_mem_prealloc(int fd, char *area, size_t memory) if (sigsetjmp(sigjump, 1)) { fprintf(stderr, "os_mem_prealloc: failed to preallocate pages\n"); exit(1); - } + } else { + int i; + size_t hpagesize = fd_getpagesize(fd); - /* MAP_POPULATE silently ignores failures */ - memory = (memory + hpagesize - 1) & -hpagesize; - for (i = 0; i < (memory/hpagesize); i++) { - memset(area + (hpagesize*i), 0, 1); - } + /* MAP_POPULATE silently ignores failures */ + memory = (memory + hpagesize - 1) & -hpagesize; + for (i = 0; i < (memory / hpagesize); i++) { + memset(area + (hpagesize * i), 0, 1); + } - ret = sigaction(SIGBUS, &oldact, NULL); - if (ret) { - perror("os_mem_prealloc: failed to reinstall signal handler"); - exit(1); - } + ret = sigaction(SIGBUS, &oldact, NULL); + if (ret) { + perror("os_mem_prealloc: failed to reinstall signal handler"); + exit(1); + } - pthread_sigmask(SIG_SETMASK, &oldset, NULL); + pthread_sigmask(SIG_SETMASK, &oldset, NULL); + } } |