diff options
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | MAINTAINERS | 4 | ||||
-rw-r--r-- | Makefile | 15 | ||||
-rw-r--r-- | Makefile.objs | 64 | ||||
-rwxr-xr-x | configure | 18 | ||||
-rw-r--r-- | hw/i2c.h | 3 | ||||
-rw-r--r-- | hw/tmp105.c | 17 | ||||
-rw-r--r-- | hw/tmp105.h | 67 | ||||
-rw-r--r-- | qemu-char.c | 8 | ||||
-rw-r--r-- | qemu-thread-win32.c | 24 | ||||
-rw-r--r-- | scripts/tracetool/backend/dtrace.py | 2 | ||||
-rw-r--r-- | scripts/tracetool/format/h.py | 6 | ||||
-rw-r--r-- | target-i386/cpu.c | 6 | ||||
-rw-r--r-- | target-unicore32/helper.c | 2 | ||||
-rw-r--r-- | trace.h | 6 | ||||
-rw-r--r-- | trace/Makefile.objs | 70 |
16 files changed, 210 insertions, 110 deletions
diff --git a/.gitignore b/.gitignore index 3a417656e2..0e3816918c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,10 @@ config-all-devices.* config-all-disas.* config-host.* config-target.* -trace.h -trace.c -trace-dtrace.h -trace-dtrace.dtrace +trace/generated-tracers.h +trace/generated-tracers.c +trace/generated-tracers-dtrace.h +trace/generated-tracers-dtrace.dtrace *-timestamp *-softmmu *-darwin-user diff --git a/MAINTAINERS b/MAINTAINERS index ba0a8cd148..cf39e5a00a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -132,7 +132,7 @@ Guest CPU Cores (KVM): ---------------------- Overall -M: Avi Kivity <avi@redhat.com> +M: Gleb Natapov <gleb@redhat.com> M: Marcelo Tosatti <mtosatti@redhat.com> L: kvm@vger.kernel.org S: Supported @@ -150,7 +150,7 @@ S: Maintained F: target-s390x/kvm.c X86 -M: Avi Kivity <avi@redhat.com> +M: Gleb Natapov <gleb@redhat.com> M: Marcelo Tosatti <mtosatti@redhat.com> L: kvm@vger.kernel.org S: Supported @@ -31,12 +31,15 @@ ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) endif endif -GENERATED_HEADERS = config-host.h trace.h qemu-options.def +GENERATED_HEADERS = config-host.h qemu-options.def +GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h +GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c + +GENERATED_HEADERS += trace/generated-tracers.h ifeq ($(TRACE_BACKEND),dtrace) -GENERATED_HEADERS += trace-dtrace.h +GENERATED_HEADERS += trace/generated-tracers-dtrace.h endif -GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h -GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace.c +GENERATED_SOURCES += trace/generated-tracers.c # Don't try to regenerate Makefile or configure # We don't generate any of them @@ -233,9 +236,9 @@ clean: rm -f *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~ rm -Rf .libs rm -f qemu-img-cmds.h - rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp @# May not be present in GENERATED_HEADERS - rm -f trace-dtrace.h trace-dtrace.h-timestamp + rm -f trace/generated-tracers-dtrace.dtrace* + rm -f trace/generated-tracers-dtrace.h* rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp) rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp) rm -rf qapi-generated diff --git a/Makefile.objs b/Makefile.objs index 4ef0a718d2..3a3a4028c5 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -133,66 +133,7 @@ universal-obj-y += disas/ ###################################################################### # trace -ifeq ($(TRACE_BACKEND),dtrace) -TRACE_H_EXTRA_DEPS=trace-dtrace.h -endif -trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS) -trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak - $(call quiet-command,$(TRACETOOL) \ - --format=h \ - --backend=$(TRACE_BACKEND) \ - < $< > $@," GEN trace.h") - @cmp -s $@ trace.h || cp $@ trace.h - -trace.c: trace.c-timestamp -trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak - $(call quiet-command,$(TRACETOOL) \ - --format=c \ - --backend=$(TRACE_BACKEND) \ - < $< > $@," GEN trace.c") - @cmp -s $@ trace.c || cp $@ trace.c - -trace.o: trace.c $(GENERATED_HEADERS) - -trace-dtrace.h: trace-dtrace.dtrace - $(call quiet-command,dtrace -o $@ -h -s $<, " GEN trace-dtrace.h") - -# Normal practice is to name DTrace probe file with a '.d' extension -# but that gets picked up by QEMU's Makefile as an external dependency -# rule file. So we use '.dtrace' instead -trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp -trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak - $(call quiet-command,$(TRACETOOL) \ - --format=d \ - --backend=$(TRACE_BACKEND) \ - < $< > $@," GEN trace-dtrace.dtrace") - @cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace - -trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS) - $(call quiet-command,dtrace -o $@ -G -s $<, " GEN trace-dtrace.o") - -ifeq ($(LIBTOOL),) -trace-dtrace.lo: trace-dtrace.dtrace - @echo "missing libtool. please install and rerun configure."; exit 1 -else -trace-dtrace.lo: trace-dtrace.dtrace - $(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC dtrace -o $@ -G -s $<, " lt GEN trace-dtrace.o") -endif - -trace/simple.o: trace/simple.c $(GENERATED_HEADERS) - -trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o -ifneq ($(TRACE_BACKEND),dtrace) -trace-obj-y = trace.o -endif - -trace-obj-$(CONFIG_TRACE_DEFAULT) += trace/default.o -trace-obj-$(CONFIG_TRACE_SIMPLE) += trace/simple.o -trace-obj-$(CONFIG_TRACE_SIMPLE) += qemu-timer-common.o -trace-obj-$(CONFIG_TRACE_STDERR) += trace/stderr.o -trace-obj-y += trace/control.o - -$(trace-obj-y): $(GENERATED_HEADERS) +trace-obj-y += trace/ universal-obj-y += $(trace-obj-y) @@ -239,5 +180,6 @@ nested-vars += \ user-obj-y \ common-obj-y \ universal-obj-y \ - extra-obj-y + extra-obj-y \ + trace-obj-y dummy := $(call unnest-vars) @@ -656,6 +656,8 @@ for opt do ;; --without-system-pixman) pixman="internal" ;; + --without-pixman) pixman="none" + ;; --disable-sdl) sdl="no" ;; --enable-sdl) sdl="yes" @@ -2130,13 +2132,25 @@ fi # pixman support probe if test "$pixman" = ""; then - if $pkg_config pixman-1 > /dev/null 2>&1; then + if test "$want_tools" = "no" -a "$softmmu" = "no"; then + pixman="none" + elif $pkg_config pixman-1 > /dev/null 2>&1; then pixman="system" else pixman="internal" fi fi -if test "$pixman" = "system"; then +if test "$pixman" = "none"; then + if test "$want_tools" != "no" -o "$softmmu" != "no"; then + echo "ERROR: pixman disabled but system emulation or tools build" + echo " enabled. You can turn off pixman only if you also" + echo " disable all system emulation targets and the tools" + echo " build with '--disable-tools --disable-system'." + exit 1 + fi + pixman_cflags= + pixman_libs= +elif test "$pixman" = "system"; then pixman_cflags=`$pkg_config --cflags pixman-1 2>/dev/null` pixman_libs=`$pkg_config --libs pixman-1 2>/dev/null` else @@ -73,9 +73,6 @@ void *wm8750_dac_buffer(void *opaque, int samples); void wm8750_dac_commit(void *opaque); void wm8750_set_bclk_in(void *opaque, int new_hz); -/* tmp105.c */ -void tmp105_set(I2CSlave *i2c, int temp); - /* lm832x.c */ void lm832x_key_event(DeviceState *dev, int key, int state); diff --git a/hw/tmp105.c b/hw/tmp105.c index 8e8dbd94eb..9c67e644dd 100644 --- a/hw/tmp105.c +++ b/hw/tmp105.c @@ -20,6 +20,7 @@ #include "hw.h" #include "i2c.h" +#include "tmp105.h" typedef struct { I2CSlave i2c; @@ -92,22 +93,22 @@ static void tmp105_read(TMP105State *s) } switch (s->pointer & 3) { - case 0: /* Temperature */ + case TMP105_REG_TEMPERATURE: s->buf[s->len ++] = (((uint16_t) s->temperature) >> 8); s->buf[s->len ++] = (((uint16_t) s->temperature) >> 0) & (0xf0 << ((~s->config >> 5) & 3)); /* R */ break; - case 1: /* Configuration */ + case TMP105_REG_CONFIG: s->buf[s->len ++] = s->config; break; - case 2: /* T_LOW */ + case TMP105_REG_T_LOW: s->buf[s->len ++] = ((uint16_t) s->limit[0]) >> 8; s->buf[s->len ++] = ((uint16_t) s->limit[0]) >> 0; break; - case 3: /* T_HIGH */ + case TMP105_REG_T_HIGH: s->buf[s->len ++] = ((uint16_t) s->limit[1]) >> 8; s->buf[s->len ++] = ((uint16_t) s->limit[1]) >> 0; break; @@ -117,10 +118,10 @@ static void tmp105_read(TMP105State *s) static void tmp105_write(TMP105State *s) { switch (s->pointer & 3) { - case 0: /* Temperature */ + case TMP105_REG_TEMPERATURE: break; - case 1: /* Configuration */ + case TMP105_REG_CONFIG: if (s->buf[0] & ~s->config & (1 << 0)) /* SD */ printf("%s: TMP105 shutdown\n", __FUNCTION__); s->config = s->buf[0]; @@ -128,8 +129,8 @@ static void tmp105_write(TMP105State *s) tmp105_alarm_update(s); break; - case 2: /* T_LOW */ - case 3: /* T_HIGH */ + case TMP105_REG_T_LOW: + case TMP105_REG_T_HIGH: if (s->len >= 3) s->limit[s->pointer & 1] = (int16_t) ((((uint16_t) s->buf[0]) << 8) | s->buf[1]); diff --git a/hw/tmp105.h b/hw/tmp105.h new file mode 100644 index 0000000000..51eff4be1c --- /dev/null +++ b/hw/tmp105.h @@ -0,0 +1,67 @@ +/* + * Texas Instruments TMP105 Temperature Sensor + * + * Browse the data sheet: + * + * http://www.ti.com/lit/gpn/tmp105 + * + * Copyright (C) 2012 Alex Horn <alex.horn@cs.ox.ac.uk> + * Copyright (C) 2008-2012 Andrzej Zaborowski <balrogg@gmail.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ +#ifndef QEMU_TMP105_H +#define QEMU_TMP105_H + +#include "i2c.h" + +/** + * TMP105Reg: + * @TMP105_REG_TEMPERATURE: Temperature register + * @TMP105_REG_CONFIG: Configuration register + * @TMP105_REG_T_LOW: Low temperature register (also known as T_hyst) + * @TMP105_REG_T_HIGH: High temperature register (also known as T_OS) + * + * The following temperature sensors are + * compatible with the TMP105 registers: + * - adt75 + * - ds1775 + * - ds75 + * - lm75 + * - lm75a + * - max6625 + * - max6626 + * - mcp980x + * - stds75 + * - tcn75 + * - tmp100 + * - tmp101 + * - tmp105 + * - tmp175 + * - tmp275 + * - tmp75 + **/ +typedef enum TMP105Reg { + TMP105_REG_TEMPERATURE = 0, + TMP105_REG_CONFIG, + TMP105_REG_T_LOW, + TMP105_REG_T_HIGH, +} TMP105Reg; + +/** + * tmp105_set: + * @i2c: dispatcher to TMP105 hardware model + * @temp: temperature with 0.001 centigrades units in the range -40 C to +125 C + * + * Sets the temperature of the TMP105 hardware model. + * + * Bits 5 and 6 (value 32 and 64) in the register indexed by TMP105_REG_CONFIG + * determine the precision of the temperature. See Table 8 in the data sheet. + * + * @see_also: I2C_SLAVE macro + * @see_also: http://www.ti.com/lit/gpn/tmp105 + */ +void tmp105_set(I2CSlave *i2c, int temp); + +#endif diff --git a/qemu-char.c b/qemu-char.c index 6113d0ab60..c6382a93f5 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -980,6 +980,7 @@ static CharDriverState *qemu_chr_open_pty(QemuOpts *opts) CharDriverState *chr; PtyCharDriver *s; struct termios tty; + const char *label; int master_fd, slave_fd, len; #if defined(__OpenBSD__) || defined(__DragonFly__) char pty_name[PATH_MAX]; @@ -1005,7 +1006,12 @@ static CharDriverState *qemu_chr_open_pty(QemuOpts *opts) chr->filename = g_malloc(len); snprintf(chr->filename, len, "pty:%s", q_ptsname(master_fd)); qemu_opt_set(opts, "path", q_ptsname(master_fd)); - fprintf(stderr, "char device redirected to %s\n", q_ptsname(master_fd)); + + label = qemu_opts_id(opts); + fprintf(stderr, "char device%s%s redirected to %s\n", + label ? " " : "", + label ?: "", + q_ptsname(master_fd)); s = g_malloc0(sizeof(PtyCharDriver)); chr->opaque = s; diff --git a/qemu-thread-win32.c b/qemu-thread-win32.c index 8037b39045..517878dcc1 100644 --- a/qemu-thread-win32.c +++ b/qemu-thread-win32.c @@ -239,7 +239,7 @@ struct QemuThreadData { CRITICAL_SECTION cs; }; -static int qemu_thread_tls_index = TLS_OUT_OF_INDEXES; +static __thread QemuThreadData *qemu_thread_data; static unsigned __stdcall win32_start_routine(void *arg) { @@ -251,14 +251,15 @@ static unsigned __stdcall win32_start_routine(void *arg) g_free(data); data = NULL; } - TlsSetValue(qemu_thread_tls_index, data); + qemu_thread_data = data; qemu_thread_exit(start_routine(thread_arg)); abort(); } void qemu_thread_exit(void *arg) { - QemuThreadData *data = TlsGetValue(qemu_thread_tls_index); + QemuThreadData *data = qemu_thread_data; + if (data) { assert(data->mode != QEMU_THREAD_DETACHED); data->ret = arg; @@ -298,25 +299,13 @@ void *qemu_thread_join(QemuThread *thread) return ret; } -static inline void qemu_thread_init(void) -{ - if (qemu_thread_tls_index == TLS_OUT_OF_INDEXES) { - qemu_thread_tls_index = TlsAlloc(); - if (qemu_thread_tls_index == TLS_OUT_OF_INDEXES) { - error_exit(ERROR_NO_SYSTEM_RESOURCES, __func__); - } - } -} - - void qemu_thread_create(QemuThread *thread, void *(*start_routine)(void *), void *arg, int mode) { HANDLE hThread; - struct QemuThreadData *data; - qemu_thread_init(); + data = g_malloc(sizeof *data); data->start_routine = start_routine; data->arg = arg; @@ -338,8 +327,7 @@ void qemu_thread_create(QemuThread *thread, void qemu_thread_get_self(QemuThread *thread) { - qemu_thread_init(); - thread->data = TlsGetValue(qemu_thread_tls_index); + thread->data = qemu_thread_data; thread->tid = GetCurrentThreadId(); } diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py index 23c43e2772..ad5eb3b0ab 100644 --- a/scripts/tracetool/backend/dtrace.py +++ b/scripts/tracetool/backend/dtrace.py @@ -37,7 +37,7 @@ def c(events): def h(events): - out('#include "trace-dtrace.h"', + out('#include "trace/generated-tracers-dtrace.h"', '') for e in events: diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py index 6ffb3c2f4e..9a58de1331 100644 --- a/scripts/tracetool/format/h.py +++ b/scripts/tracetool/format/h.py @@ -19,8 +19,8 @@ from tracetool import out def begin(events): out('/* This file is autogenerated by tracetool, do not edit. */', '', - '#ifndef TRACE_H', - '#define TRACE_H', + '#ifndef TRACE__GENERATED_TRACERS_H', + '#define TRACE__GENERATED_TRACERS_H', '', '#include "qemu-common.h"') @@ -32,7 +32,7 @@ def end(events): enabled = 1 out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled)) out('', - '#endif /* TRACE_H */') + '#endif /* TRACE__GENERATED_TRACERS_H */') def nop(events): for e in events: diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 2b6fe3090e..82685dc3f5 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1651,7 +1651,11 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, index = env->cpuid_xlevel; } } else { - index = env->cpuid_xlevel; + /* Intel documentation states that invalid EAX input will + * return the same information as EAX=cpuid_level + * (Intel SDM Vol. 2A - Instruction Set Reference - CPUID) + */ + index = env->cpuid_level; } } } else { diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c index ff4f628404..5359538ea5 100644 --- a/target-unicore32/helper.c +++ b/target-unicore32/helper.c @@ -13,7 +13,9 @@ #include "exec/gdbstub.h" #include "helper.h" #include "qemu/host-utils.h" +#ifndef CONFIG_USER_ONLY #include "ui/console.h" +#endif #undef DEBUG_UC32 diff --git a/trace.h b/trace.h new file mode 100644 index 0000000000..c15f498128 --- /dev/null +++ b/trace.h @@ -0,0 +1,6 @@ +#ifndef TRACE_H +#define TRACE_H + +#include "trace/generated-tracers.h" + +#endif /* TRACE_H */ diff --git a/trace/Makefile.objs b/trace/Makefile.objs new file mode 100644 index 0000000000..b791723696 --- /dev/null +++ b/trace/Makefile.objs @@ -0,0 +1,70 @@ +# -*- mode: makefile -*- + +###################################################################### +# Auto-generated tracing routines + +ifeq ($(TRACE_BACKEND),dtrace) +TRACE_H_EXTRA_DEPS=$(obj)/generated-tracers-dtrace.h +endif +$(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp $(TRACE_H_EXTRA_DEPS) +$(obj)/generated-tracers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak + $(call quiet-command,$(TRACETOOL) \ + --format=h \ + --backend=$(TRACE_BACKEND) \ + < $< > $@," GEN $(patsubst %-timestamp,%,$@)") + @cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@) + +$(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp +$(obj)/generated-tracers.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak + $(call quiet-command,$(TRACETOOL) \ + --format=c \ + --backend=$(TRACE_BACKEND) \ + < $< > $@," GEN $(patsubst %-timestamp,%,$@)") + @cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@) + +$(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h + +ifneq ($(TRACE_BACKEND),dtrace) +trace-obj-y += generated-tracers.o +endif + + +###################################################################### +# Auto-generated DTrace code + +# Normal practice is to name DTrace probe file with a '.d' extension +# but that gets picked up by QEMU's Makefile as an external dependency +# rule file. So we use '.dtrace' instead +$(obj)/generated-tracers-dtrace.dtrace: $(obj)/generated-tracers-dtrace.dtrace-timestamp +$(obj)/generated-tracers-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak + $(call quiet-command,$(TRACETOOL) \ + --format=d \ + --backend=$(TRACE_BACKEND) \ + < $< > $@," GEN $(patsubst %-timestamp,%,$@)") + @cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@) + +$(obj)/generated-tracers-dtrace.h: trace/generated-tracers-dtrace.dtrace + $(call quiet-command,dtrace -o $@ -h -s $<, " GEN $@") + +$(obj)/generated-tracers-dtrace.o: trace/generated-tracers-dtrace.dtrace + $(call quiet-command,dtrace -o $@ -G -s $<, " GEN $@") + +trace-obj-$(CONFIG_TRACE_DTRACE) += generated-tracers-dtrace.o + + +ifeq ($(LIBTOOL),) +$(obj)/generated-tracers-dtrace.lo: $(obj)/generated-tracers-dtrace.dtrace + @echo "missing libtool. please install and rerun configure."; exit 1 +else +$(obj)/generated-tracers-dtrace.lo: $(obj)/generated-tracers-dtrace.dtrace + $(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC dtrace -o $@ -G -s $<, " lt GEN $@") +endif + + +###################################################################### +# Backend code + +trace-obj-$(CONFIG_TRACE_DEFAULT) += default.o +trace-obj-$(CONFIG_TRACE_SIMPLE) += simple.o +trace-obj-$(CONFIG_TRACE_STDERR) += stderr.o +trace-obj-y += control.o |