All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro)
@ 2011-09-21 15:42 Lluís Vilanova
  2011-09-21 15:42 ` [Qemu-devel] [PATCH 2/3] trace: Add "vcpu_init" event Lluís Vilanova
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lluís Vilanova @ 2011-09-21 15:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka, Stefan Hajnoczi

Implementation with 'CONFIG_USER_ONLY' is moved into new file 'cpus-user.c'.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 Makefile.objs |    1 +
 cpus-user.c   |    8 ++++++++
 qemu-common.h |    4 ----
 3 files changed, 9 insertions(+), 4 deletions(-)
 create mode 100644 cpus-user.c

diff --git a/Makefile.objs b/Makefile.objs
index 1c65087..c94abd9 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -177,6 +177,7 @@ user-obj-y =
 user-obj-y += envlist.o path.o
 user-obj-y += tcg-runtime.o host-utils.o
 user-obj-y += cutils.o cache-utils.o
+user-obj-y += cpus-user.o
 user-obj-y += $(trace-obj-y)
 
 ######################################################################
diff --git a/cpus-user.c b/cpus-user.c
new file mode 100644
index 0000000..c1e5e58
--- /dev/null
+++ b/cpus-user.c
@@ -0,0 +1,8 @@
+/* Implementation of routines in "cpus.c" when compiling for CONFIG_USER_ONLY */
+
+#include "qemu-common.h"
+
+
+void qemu_init_vcpu(void *env)
+{
+}
diff --git a/qemu-common.h b/qemu-common.h
index 404c421..7cda162 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -296,11 +296,7 @@ struct qemu_work_item {
     int done;
 };
 
-#ifdef CONFIG_USER_ONLY
-#define qemu_init_vcpu(env) do { } while (0)
-#else
 void qemu_init_vcpu(void *env);
-#endif
 
 typedef struct QEMUIOVector {
     struct iovec *iov;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 2/3] trace: Add "vcpu_init" event
  2011-09-21 15:42 [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro) Lluís Vilanova
@ 2011-09-21 15:42 ` Lluís Vilanova
  2011-09-21 15:42 ` [Qemu-devel] [PATCH 3/3] trace: Add "vcpu_reset" event Lluís Vilanova
  2011-09-23 16:20 ` [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro) Anthony Liguori
  2 siblings, 0 replies; 6+ messages in thread
From: Lluís Vilanova @ 2011-09-21 15:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka, Stefan Hajnoczi

Signals the creation of a new vCPU (CPUState structure).

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 cpus-user.c  |    2 ++
 cpus.c       |    2 ++
 trace-events |    7 +++++++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/cpus-user.c b/cpus-user.c
index c1e5e58..5db48d2 100644
--- a/cpus-user.c
+++ b/cpus-user.c
@@ -1,8 +1,10 @@
 /* Implementation of routines in "cpus.c" when compiling for CONFIG_USER_ONLY */
 
 #include "qemu-common.h"
+#include "trace.h"
 
 
 void qemu_init_vcpu(void *env)
 {
+    trace_vcpu_init(env);
 }
diff --git a/cpus.c b/cpus.c
index 8978779..00679ad 100644
--- a/cpus.c
+++ b/cpus.c
@@ -33,6 +33,7 @@
 
 #include "qemu-thread.h"
 #include "cpus.h"
+#include "trace.h"
 
 #ifndef _WIN32
 #include "compatfd.h"
@@ -856,6 +857,7 @@ void qemu_init_vcpu(void *_env)
     } else {
         qemu_tcg_init_vcpu(env);
     }
+    trace_vcpu_init(env);
 }
 
 void qemu_notify_event(void)
diff --git a/trace-events b/trace-events
index 658f0bc..cc59149 100644
--- a/trace-events
+++ b/trace-events
@@ -502,3 +502,10 @@ escc_sunkbd_event_in(int ch) "Untranslated keycode %2.2x"
 escc_sunkbd_event_out(int ch) "Translated keycode %2.2x"
 escc_kbd_command(int val) "Command %d"
 escc_sunmouse_event(int dx, int dy, int buttons_state) "dx=%d dy=%d buttons=%01x"
+
+### Abstract events (not specific to a file; keep at bottom)
+
+## vCPU
+
+# Create a new vCPU (CPUState structure)
+vcpu_init(void *vcpu) "%p"

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 3/3] trace: Add "vcpu_reset" event
  2011-09-21 15:42 [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro) Lluís Vilanova
  2011-09-21 15:42 ` [Qemu-devel] [PATCH 2/3] trace: Add "vcpu_init" event Lluís Vilanova
@ 2011-09-21 15:42 ` Lluís Vilanova
  2011-09-23 16:20 ` [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro) Anthony Liguori
  2 siblings, 0 replies; 6+ messages in thread
From: Lluís Vilanova @ 2011-09-21 15:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka, Stefan Hajnoczi

Signals the reset of the state a vCPU (CPUState structure).

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 target-arm/helper.c           |    3 +++
 target-cris/translate.c       |    3 +++
 target-i386/helper.c          |    3 +++
 target-lm32/helper.c          |    3 +++
 target-m68k/helper.c          |    3 +++
 target-microblaze/translate.c |    3 +++
 target-mips/translate.c       |    3 +++
 target-ppc/helper.c           |    3 +++
 target-s390x/helper.c         |    3 +++
 target-sh4/translate.c        |    3 +++
 target-sparc/helper.c         |    3 +++
 trace-events                  |    2 ++
 12 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/target-arm/helper.c b/target-arm/helper.c
index d3a3ba2..c7f80b1 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -10,6 +10,7 @@
 #if !defined(CONFIG_USER_ONLY)
 #include "hw/loader.h"
 #endif
+#include "trace.h"
 
 static uint32_t cortexa9_cp15_c0_c1[8] =
 { 0x1031, 0x11, 0x000, 0, 0x00100103, 0x20000000, 0x01230000, 0x00002111 };
@@ -321,6 +322,8 @@ void cpu_reset(CPUARMState *env)
     set_float_detect_tininess(float_tininess_before_rounding,
                               &env->vfp.standard_fp_status);
     tlb_flush(env, 1);
+
+    trace_vcpu_reset(env);
 }
 
 static int vfp_gdb_get_reg(CPUState *env, uint8_t *buf, int reg)
diff --git a/target-cris/translate.c b/target-cris/translate.c
index 70abf8a..a871e7f 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -36,6 +36,7 @@
 #include "mmu.h"
 #include "crisv32-decode.h"
 #include "qemu-common.h"
+#include "trace.h"
 
 #define GEN_HELPER 1
 #include "helper.h"
@@ -3601,6 +3602,8 @@ void cpu_reset (CPUCRISState *env)
 	cris_mmu_init(env);
 	env->pregs[PR_CCS] = 0;
 #endif
+
+    trace_vcpu_reset(env);
 }
 
 void restore_state_to_opc(CPUState *env, TranslationBlock *tb, int pc_pos)
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 5df40d4..d8a92e1 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -29,6 +29,7 @@
 #include "sysemu.h"
 #include "monitor.h"
 #endif
+#include "trace.h"
 
 //#define DEBUG_MMU
 
@@ -104,6 +105,8 @@ void cpu_reset(CPUX86State *env)
     env->dr[7] = DR7_FIXED_1;
     cpu_breakpoint_remove_all(env, BP_CPU);
     cpu_watchpoint_remove_all(env, BP_CPU);
+
+    trace_vcpu_reset(env);
 }
 
 void cpu_x86_close(CPUX86State *env)
diff --git a/target-lm32/helper.c b/target-lm32/helper.c
index 014fd8d..6104bb8 100644
--- a/target-lm32/helper.c
+++ b/target-lm32/helper.c
@@ -24,6 +24,7 @@
 #include "config.h"
 #include "cpu.h"
 #include "host-utils.h"
+#include "trace.h"
 
 int cpu_lm32_handle_mmu_fault(CPUState *env, target_ulong address, int rw,
                               int mmu_idx)
@@ -250,5 +251,7 @@ void cpu_reset(CPUState *env)
 
     /* reset cpu state */
     memset(env, 0, offsetof(CPULM32State, breakpoints));
+
+    trace_vcpu_reset(env);
 }
 
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 123e1d9..3a89f29 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -25,6 +25,7 @@
 #include "cpu.h"
 #include "qemu-common.h"
 #include "gdbstub.h"
+#include "trace.h"
 
 #include "helper.h"
 
@@ -165,6 +166,8 @@ void cpu_reset(CPUM68KState *env)
     /* TODO: We should set PC from the interrupt vector.  */
     env->pc = 0;
     tlb_flush(env, 1);
+
+    trace_vcpu_reset(env);
 }
 
 CPUM68KState *cpu_m68k_init(const char *cpu_model)
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index 366fd3e..f976311 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -30,6 +30,7 @@
 #include "helper.h"
 #include "microblaze-decode.h"
 #include "qemu-common.h"
+#include "trace.h"
 
 #define GEN_HELPER 1
 #include "helper.h"
@@ -1943,6 +1944,8 @@ void cpu_reset (CPUState *env)
     env->mmu.c_mmu_tlb_access = 3;
     env->mmu.c_mmu_zones = 16;
 #endif
+
+    trace_vcpu_reset(env);
 }
 
 void restore_state_to_opc(CPUState *env, TranslationBlock *tb, int pc_pos)
diff --git a/target-mips/translate.c b/target-mips/translate.c
index d5b1c76..73c4c5e 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -30,6 +30,7 @@
 #include "disas.h"
 #include "tcg-op.h"
 #include "qemu-common.h"
+#include "trace.h"
 
 #include "helper.h"
 #define GEN_HELPER 1
@@ -12846,6 +12847,8 @@ void cpu_reset (CPUMIPSState *env)
     }
 #endif
     env->exception_index = EXCP_NONE;
+
+    trace_vcpu_reset(env);
 }
 
 void restore_state_to_opc(CPUState *env, TranslationBlock *tb, int pc_pos)
diff --git a/target-ppc/helper.c b/target-ppc/helper.c
index 96ea464..81bc200 100644
--- a/target-ppc/helper.c
+++ b/target-ppc/helper.c
@@ -26,6 +26,7 @@
 #include "helper_regs.h"
 #include "qemu-common.h"
 #include "kvm.h"
+#include "trace.h"
 
 //#define DEBUG_MMU
 //#define DEBUG_BATS
@@ -3084,6 +3085,8 @@ void cpu_reset(CPUPPCState *env)
     env->error_code = 0;
     /* Flush all TLBs */
     tlb_flush(env, 1);
+
+    trace_vcpu_reset(env);
 }
 
 CPUPPCState *cpu_ppc_init (const char *cpu_model)
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index 96dd867..9cfa9ef 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -26,6 +26,7 @@
 #include "gdbstub.h"
 #include "qemu-common.h"
 #include "qemu-timer.h"
+#include "trace.h"
 
 //#define DEBUG_S390
 //#define DEBUG_S390_PTE
@@ -131,6 +132,8 @@ void cpu_reset(CPUS390XState *env)
     memset(env, 0, offsetof(CPUS390XState, breakpoints));
     /* FIXME: reset vector? */
     tlb_flush(env, 1);
+
+    trace_vcpu_reset(env);
 }
 
 #ifndef CONFIG_USER_ONLY
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index bad3577..2487451 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -30,6 +30,7 @@
 #include "disas.h"
 #include "tcg-op.h"
 #include "qemu-common.h"
+#include "trace.h"
 
 #include "helper.h"
 #define GEN_HELPER 1
@@ -205,6 +206,8 @@ void cpu_reset(CPUSH4State * env)
     set_flush_to_zero(1, &env->fp_status);
 #endif
     set_default_nan_mode(1, &env->fp_status);
+
+    trace_vcpu_reset(env);
 }
 
 typedef struct {
diff --git a/target-sparc/helper.c b/target-sparc/helper.c
index c80531a..98dc464 100644
--- a/target-sparc/helper.c
+++ b/target-sparc/helper.c
@@ -24,6 +24,7 @@
 
 #include "cpu.h"
 #include "qemu-common.h"
+#include "trace.h"
 
 //#define DEBUG_MMU
 //#define DEBUG_FEATURES
@@ -1166,6 +1167,8 @@ void cpu_reset(CPUSPARCState *env)
     env->npc = env->pc + 4;
 #endif
     env->cache_control = 0;
+
+    trace_vcpu_reset(env);
 }
 
 static int cpu_sparc_register(CPUSPARCState *env, const char *cpu_model)
diff --git a/trace-events b/trace-events
index cc59149..8042da3 100644
--- a/trace-events
+++ b/trace-events
@@ -509,3 +509,5 @@ escc_sunmouse_event(int dx, int dy, int buttons_state) "dx=%d dy=%d buttons=%01x
 
 # Create a new vCPU (CPUState structure)
 vcpu_init(void *vcpu) "%p"
+# Reset the state of a vCPU
+vcpu_reset(void *vcpu) "%p"

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro)
  2011-09-21 15:42 [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro) Lluís Vilanova
  2011-09-21 15:42 ` [Qemu-devel] [PATCH 2/3] trace: Add "vcpu_init" event Lluís Vilanova
  2011-09-21 15:42 ` [Qemu-devel] [PATCH 3/3] trace: Add "vcpu_reset" event Lluís Vilanova
@ 2011-09-23 16:20 ` Anthony Liguori
  2 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2011-09-23 16:20 UTC (permalink / raw)
  To: Lluís Vilanova; +Cc: Jan Kiszka, qemu-devel, Stefan Hajnoczi

On 09/21/2011 10:42 AM, Lluís Vilanova wrote:
> Implementation with 'CONFIG_USER_ONLY' is moved into new file 'cpus-user.c'.
>
> Signed-off-by: Lluís Vilanova<vilanova@ac.upc.edu>
> ---
>   Makefile.objs |    1 +
>   cpus-user.c   |    8 ++++++++
>   qemu-common.h |    4 ----
>   3 files changed, 9 insertions(+), 4 deletions(-)
>   create mode 100644 cpus-user.c
>
> diff --git a/Makefile.objs b/Makefile.objs
> index 1c65087..c94abd9 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -177,6 +177,7 @@ user-obj-y =
>   user-obj-y += envlist.o path.o
>   user-obj-y += tcg-runtime.o host-utils.o
>   user-obj-y += cutils.o cache-utils.o
> +user-obj-y += cpus-user.o
>   user-obj-y += $(trace-obj-y)
>
>   ######################################################################
> diff --git a/cpus-user.c b/cpus-user.c
> new file mode 100644
> index 0000000..c1e5e58
> --- /dev/null
> +++ b/cpus-user.c
> @@ -0,0 +1,8 @@
> +/* Implementation of routines in "cpus.c" when compiling for CONFIG_USER_ONLY */
> +
> +#include "qemu-common.h"
> +
> +
> +void qemu_init_vcpu(void *env)
> +{
> +}

New files need a copyright and license.

Regards,

Anthony Liguori

> diff --git a/qemu-common.h b/qemu-common.h
> index 404c421..7cda162 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -296,11 +296,7 @@ struct qemu_work_item {
>       int done;
>   };
>
> -#ifdef CONFIG_USER_ONLY
> -#define qemu_init_vcpu(env) do { } while (0)
> -#else
>   void qemu_init_vcpu(void *env);
> -#endif
>
>   typedef struct QEMUIOVector {
>       struct iovec *iov;
>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro)
  2011-09-21 13:23 Lluís Vilanova
@ 2011-09-21 13:45 ` Lluís Vilanova
  0 siblings, 0 replies; 6+ messages in thread
From: Lluís Vilanova @ 2011-09-21 13:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka, Stefan Hajnoczi

Please ignore these patches.

Implementation of 'qemu_init_vcpu' in CONFIG_USER_ONLY must be moved into a C
file to avoid an include loop between trace.h and qemu-common.h

Ideas on which file this is supposed to go?


Lluis

Lluís Vilanova writes:

> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  qemu-common.h |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)

> diff --git a/qemu-common.h b/qemu-common.h
> index 404c421..fca101e 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -297,7 +297,9 @@ struct qemu_work_item {
>  };
 
>  #ifdef CONFIG_USER_ONLY
> -#define qemu_init_vcpu(env) do { } while (0)
> +static inline void qemu_init_vcpu(void *env)
> +{
> +}
>  #else
>  void qemu_init_vcpu(void *env);
>  #endif



-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro)
@ 2011-09-21 13:23 Lluís Vilanova
  2011-09-21 13:45 ` Lluís Vilanova
  0 siblings, 1 reply; 6+ messages in thread
From: Lluís Vilanova @ 2011-09-21 13:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka, Stefan Hajnoczi

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 qemu-common.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/qemu-common.h b/qemu-common.h
index 404c421..fca101e 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -297,7 +297,9 @@ struct qemu_work_item {
 };
 
 #ifdef CONFIG_USER_ONLY
-#define qemu_init_vcpu(env) do { } while (0)
+static inline void qemu_init_vcpu(void *env)
+{
+}
 #else
 void qemu_init_vcpu(void *env);
 #endif

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-23 16:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-21 15:42 [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro) Lluís Vilanova
2011-09-21 15:42 ` [Qemu-devel] [PATCH 2/3] trace: Add "vcpu_init" event Lluís Vilanova
2011-09-21 15:42 ` [Qemu-devel] [PATCH 3/3] trace: Add "vcpu_reset" event Lluís Vilanova
2011-09-23 16:20 ` [Qemu-devel] [PATCH 1/3] Make 'qemu_init_vcpu' a function (instead of a macro) Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2011-09-21 13:23 Lluís Vilanova
2011-09-21 13:45 ` Lluís Vilanova

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.