summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-02-13 13:40:59 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-02-13 13:40:59 +0000
commit81f49abaaac2b88062bd1b07f451d9527ed1c9ce (patch)
treefcfbe2c6aaad9ea3d4dffd941567f2a48e6f14f6
parent7ce9ce89930ce260af839fb3e3e5f9101f5c69a0 (diff)
parentbe02cda3afde60d219786e23c3f8edb53aec8e17 (diff)
downloadqemu-81f49abaaac2b88062bd1b07f451d9527ed1c9ce.zip
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* various small fixes and cleanups * fixes for the ucode revision patch from the previous pull request # gpg: Signature made Wed 12 Feb 2020 15:30:24 GMT # gpg: using RSA key BFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: target/i386: enable monitor and ucode revision with -cpu max target/i386: check for availability of MSR_IA32_UCODE_REV as an emulated MSR target/i386: fix TCG UCODE_REV access build: move TARGET_GPROF to config-host.mak exec: do not define use_icount for user-mode emulation minikconf: accept alnum identifiers Remove support for CLOCK_MONOTONIC not being defined seqlock: fix seqlock_write_unlock_impl function vl: Don't mismatch g_strsplit()/g_free() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--bsd-user/syscall.c6
-rwxr-xr-xconfigure4
-rw-r--r--exec.c8
-rw-r--r--include/qemu/seqlock.h4
-rw-r--r--include/qemu/timer.h5
-rw-r--r--linux-user/exit.c4
-rw-r--r--linux-user/signal.c2
-rwxr-xr-xscripts/minikconf.py2
-rw-r--r--target/i386/cpu.c2
-rw-r--r--target/i386/kvm.c7
-rw-r--r--target/i386/misc_helper.c8
-rwxr-xr-xtests/check-block.sh2
-rw-r--r--util/qemu-timer-common.c11
-rw-r--r--vl.c2
14 files changed, 34 insertions, 33 deletions
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
index 0d45b654bb..d38ec7a162 100644
--- a/bsd-user/syscall.c
+++ b/bsd-user/syscall.c
@@ -330,7 +330,7 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1,
switch(num) {
case TARGET_FREEBSD_NR_exit:
-#ifdef TARGET_GPROF
+#ifdef CONFIG_GPROF
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
@@ -432,7 +432,7 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1,
switch(num) {
case TARGET_NETBSD_NR_exit:
-#ifdef TARGET_GPROF
+#ifdef CONFIG_GPROF
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
@@ -511,7 +511,7 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1,
switch(num) {
case TARGET_OPENBSD_NR_exit:
-#ifdef TARGET_GPROF
+#ifdef CONFIG_GPROF
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
diff --git a/configure b/configure
index 115dc38085..16f94cd96b 100755
--- a/configure
+++ b/configure
@@ -6771,6 +6771,9 @@ fi
if test "$l2tpv3" = "yes" ; then
echo "CONFIG_L2TPV3=y" >> $config_host_mak
fi
+if test "$gprof" = "yes" ; then
+ echo "CONFIG_GPROF=y" >> $config_host_mak
+fi
if test "$cap_ng" = "yes" ; then
echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak
fi
@@ -7951,7 +7954,6 @@ alpha)
esac
if test "$gprof" = "yes" ; then
- echo "TARGET_GPROF=y" >> $config_target_mak
if test "$target_linux_user" = "yes" ; then
cflags="-p $cflags"
ldflags="-p $ldflags"
diff --git a/exec.c b/exec.c
index 67e520d18e..5fc3746053 100644
--- a/exec.c
+++ b/exec.c
@@ -98,15 +98,15 @@ CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
/* current CPU in the current thread. It is only valid inside
cpu_exec() */
__thread CPUState *current_cpu;
-/* 0 = Do not count executed instructions.
- 1 = Precise instruction counting.
- 2 = Adaptive rate instruction counting. */
-int use_icount;
uintptr_t qemu_host_page_size;
intptr_t qemu_host_page_mask;
#if !defined(CONFIG_USER_ONLY)
+/* 0 = Do not count executed instructions.
+ 1 = Precise instruction counting.
+ 2 = Adaptive rate instruction counting. */
+int use_icount;
typedef struct PhysPageEntry PhysPageEntry;
diff --git a/include/qemu/seqlock.h b/include/qemu/seqlock.h
index fd408b7ec5..8b6b4ee4bb 100644
--- a/include/qemu/seqlock.h
+++ b/include/qemu/seqlock.h
@@ -55,11 +55,11 @@ static inline void seqlock_write_lock_impl(QemuSeqLock *sl, QemuLockable *lock)
#define seqlock_write_lock(sl, lock) \
seqlock_write_lock_impl(sl, QEMU_MAKE_LOCKABLE(lock))
-/* Lock out other writers and update the count. */
+/* Update the count and release the lock. */
static inline void seqlock_write_unlock_impl(QemuSeqLock *sl, QemuLockable *lock)
{
+ seqlock_write_end(sl);
qemu_lockable_unlock(lock);
- seqlock_write_begin(sl);
}
#define seqlock_write_unlock(sl, lock) \
seqlock_write_unlock_impl(sl, QEMU_MAKE_LOCKABLE(lock))
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 85bc6eb00b..6a8b48b5a9 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -838,14 +838,11 @@ extern int use_rt_clock;
static inline int64_t get_clock(void)
{
-#ifdef CLOCK_MONOTONIC
if (use_rt_clock) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000000000LL + ts.tv_nsec;
- } else
-#endif
- {
+ } else {
/* XXX: using gettimeofday leads to problems if the date
changes, so it should be avoided. */
return get_clock_realtime();
diff --git a/linux-user/exit.c b/linux-user/exit.c
index a362ef67d2..1594015444 100644
--- a/linux-user/exit.c
+++ b/linux-user/exit.c
@@ -18,7 +18,7 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
-#ifdef TARGET_GPROF
+#ifdef CONFIG_GPROF
#include <sys/gmon.h>
#endif
@@ -28,7 +28,7 @@ extern void __gcov_dump(void);
void preexit_cleanup(CPUArchState *env, int code)
{
-#ifdef TARGET_GPROF
+#ifdef CONFIG_GPROF
_mcleanup();
#endif
#ifdef CONFIG_GCOV
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 5ca6d62b15..02f860ecb9 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -509,7 +509,7 @@ void signal_init(void)
act.sa_flags = SA_SIGINFO;
act.sa_sigaction = host_signal_handler;
for(i = 1; i <= TARGET_NSIG; i++) {
-#ifdef TARGET_GPROF
+#ifdef CONFIG_GPROF
if (i == SIGPROF) {
continue;
}
diff --git a/scripts/minikconf.py b/scripts/minikconf.py
index 2f9647d0fa..90b99517c1 100755
--- a/scripts/minikconf.py
+++ b/scripts/minikconf.py
@@ -645,7 +645,7 @@ class KconfigParser:
self.cursor = self.src.find('\n', self.cursor)
self.val = self.src[start:self.cursor]
return TOK_SOURCE
- elif self.tok.isalpha():
+ elif self.tok.isalnum():
# identifier
while self.src[self.cursor].isalnum() or self.src[self.cursor] == '_':
self.cursor += 1
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 32efa46852..92fafa2659 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6414,7 +6414,9 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
error_setg(&local_err, "CPU model '%s' requires KVM", name);
goto out;
}
+ }
+ if (cpu->max_features && accel_uses_host_cpuid()) {
if (enable_cpu_pm) {
host_cpuid(5, 0, &cpu->mwait.eax, &cpu->mwait.ebx,
&cpu->mwait.ecx, &cpu->mwait.edx);
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 6ef291d580..69eb43d796 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -105,6 +105,7 @@ static bool has_msr_smi_count;
static bool has_msr_arch_capabs;
static bool has_msr_core_capabs;
static bool has_msr_vmx_vmfunc;
+static bool has_msr_ucode_rev;
static uint32_t has_architectural_pmu_version;
static uint32_t num_architectural_pmu_gp_counters;
@@ -2056,6 +2057,9 @@ static int kvm_get_supported_msrs(KVMState *s)
case MSR_IA32_VMX_VMFUNC:
has_msr_vmx_vmfunc = true;
break;
+ case MSR_IA32_UCODE_REV:
+ has_msr_ucode_rev = true;
+ break;
}
}
}
@@ -2696,8 +2700,7 @@ static void kvm_init_msrs(X86CPU *cpu)
env->features[FEAT_CORE_CAPABILITY]);
}
- if (kvm_arch_get_supported_msr_feature(kvm_state,
- MSR_IA32_UCODE_REV)) {
+ if (has_msr_ucode_rev) {
kvm_msr_entry_add(cpu, MSR_IA32_UCODE_REV, cpu->ucode_rev);
}
diff --git a/target/i386/misc_helper.c b/target/i386/misc_helper.c
index aed16fe3f0..7d61221024 100644
--- a/target/i386/misc_helper.c
+++ b/target/i386/misc_helper.c
@@ -229,7 +229,6 @@ void helper_rdmsr(CPUX86State *env)
#else
void helper_wrmsr(CPUX86State *env)
{
- X86CPU *x86_cpu = env_archcpu(env);
uint64_t val;
cpu_svm_check_intercept_param(env, SVM_EXIT_MSR, 1, GETPC());
@@ -372,9 +371,6 @@ void helper_wrmsr(CPUX86State *env)
env->msr_bndcfgs = val;
cpu_sync_bndcs_hflags(env);
break;
- case MSR_IA32_UCODE_REV:
- val = x86_cpu->ucode_rev;
- break;
default:
if ((uint32_t)env->regs[R_ECX] >= MSR_MC0_CTL
&& (uint32_t)env->regs[R_ECX] < MSR_MC0_CTL +
@@ -393,6 +389,7 @@ void helper_wrmsr(CPUX86State *env)
void helper_rdmsr(CPUX86State *env)
{
+ X86CPU *x86_cpu = env_archcpu(env);
uint64_t val;
cpu_svm_check_intercept_param(env, SVM_EXIT_MSR, 0, GETPC());
@@ -526,6 +523,9 @@ void helper_rdmsr(CPUX86State *env)
case MSR_IA32_BNDCFGS:
val = env->msr_bndcfgs;
break;
+ case MSR_IA32_UCODE_REV:
+ val = x86_cpu->ucode_rev;
+ break;
default:
if ((uint32_t)env->regs[R_ECX] >= MSR_MC0_CTL
&& (uint32_t)env->regs[R_ECX] < MSR_MC0_CTL +
diff --git a/tests/check-block.sh b/tests/check-block.sh
index 679aedec50..ad320c21ba 100755
--- a/tests/check-block.sh
+++ b/tests/check-block.sh
@@ -16,7 +16,7 @@ if [ "$#" -ne 0 ]; then
format_list="$@"
fi
-if grep -q "TARGET_GPROF=y" *-softmmu/config-target.mak 2>/dev/null ; then
+if grep -q "CONFIG_GPROF=y" config-host.mak 2>/dev/null ; then
echo "GPROF is enabled ==> Not running the qemu-iotests."
exit 0
fi
diff --git a/util/qemu-timer-common.c b/util/qemu-timer-common.c
index 06d084d364..baf3317f74 100644
--- a/util/qemu-timer-common.c
+++ b/util/qemu-timer-common.c
@@ -49,14 +49,11 @@ int use_rt_clock;
static void __attribute__((constructor)) init_get_clock(void)
{
+ struct timespec ts;
+
use_rt_clock = 0;
-#ifdef CLOCK_MONOTONIC
- {
- struct timespec ts;
- if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
- use_rt_clock = 1;
- }
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
+ use_rt_clock = 1;
}
-#endif
}
#endif
diff --git a/vl.c b/vl.c
index 001be469c2..b0ee318f99 100644
--- a/vl.c
+++ b/vl.c
@@ -3510,7 +3510,7 @@ int main(int argc, char **argv, char **envp)
gchar **optname = g_strsplit(typename,
ACCEL_CLASS_SUFFIX, 0);
printf("%s\n", optname[0]);
- g_free(optname);
+ g_strfreev(optname);
}
g_free(typename);
}