From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUE7e-0007D6-7A for qemu-devel@nongnu.org; Wed, 17 Sep 2014 08:14:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUE7Y-0003kR-Nt for qemu-devel@nongnu.org; Wed, 17 Sep 2014 08:14:10 -0400 Received: from cantor2.suse.de ([195.135.220.15]:39033 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUE7Y-0003c2-Cw for qemu-devel@nongnu.org; Wed, 17 Sep 2014 08:14:04 -0400 Message-ID: <5419765C.1090803@suse.de> Date: Wed, 17 Sep 2014 13:54:04 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1410626734-3804-1-git-send-email-rth@twiddle.net> <1410626734-3804-2-git-send-email-rth@twiddle.net> In-Reply-To: <1410626734-3804-2-git-send-email-rth@twiddle.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 01/23] qom: Add cpu_exec_enter and cpu_exec_exit hooks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?B?QWxleCBCZW5u?= =?UTF-8?B?w6ll?= , aliguori@amazon.com Am 13.09.2014 um 18:45 schrieb Richard Henderson: > In preparation for removing a bunch of ifdefs from cpu_exec. >=20 > Cc: Andreas F=C3=A4rber > Signed-off-by: Richard Henderson > --- > cpu-exec.c | 9 ++------- > include/qom/cpu.h | 5 +++++ > qom/cpu.c | 6 ++++-- > 3 files changed, 11 insertions(+), 9 deletions(-) >=20 > diff --git a/cpu-exec.c b/cpu-exec.c > index bd93165..d5b86d0 100644 > --- a/cpu-exec.c > +++ b/cpu-exec.c > @@ -317,10 +317,7 @@ volatile sig_atomic_t exit_request; > int cpu_exec(CPUArchState *env) > { > CPUState *cpu =3D ENV_GET_CPU(env); > -#if !(defined(CONFIG_USER_ONLY) && \ > - (defined(TARGET_M68K) || defined(TARGET_PPC) || defined(TARGET_S= 390X))) > CPUClass *cc =3D CPU_GET_CLASS(cpu); > -#endif > #ifdef TARGET_I386 > X86CPU *x86_cpu =3D X86_CPU(cpu); > #endif > @@ -382,9 +379,8 @@ int cpu_exec(CPUArchState *env) > #elif defined(TARGET_XTENSA) > #elif defined(TARGET_TRICORE) > /* XXXXX */ > -#else > -#error unsupported target CPU > #endif > + cc->cpu_exec_enter(cpu); > cpu->exception_index =3D -1; > =20 > /* Calculate difference between guest clock and host clock. > @@ -856,9 +852,8 @@ int cpu_exec(CPUArchState *env) > #elif defined(TARGET_S390X) > #elif defined(TARGET_XTENSA) > /* XXXXX */ > -#else > -#error unsupported target CPU > #endif > + cc->cpu_exec_exit(cpu); > =20 > /* fail safe : never use current_cpu outside cpu_exec() */ > current_cpu =3D NULL; > diff --git a/include/qom/cpu.h b/include/qom/cpu.h > index 370b3eb..0340cf4 100644 > --- a/include/qom/cpu.h > +++ b/include/qom/cpu.h > @@ -99,6 +99,8 @@ struct TranslationBlock; > * @vmsd: State description for migration. > * @gdb_num_core_regs: Number of core registers accessible to GDB. > * @gdb_core_xml_file: File name for core registers GDB XML descriptio= n. > + * @cpu_exec_enter: Callback for cpu_exec preparation. > + * @cpu_exec_exit: Callback for cpu_exec cleanup. > * > * Represents a CPU family or model. > */ > @@ -149,6 +151,9 @@ typedef struct CPUClass { > const struct VMStateDescription *vmsd; > int gdb_num_core_regs; > const char *gdb_core_xml_file; > + > + void (*cpu_exec_enter)(CPUState *cpu); > + void (*cpu_exec_exit)(CPUState *cpu); I am fine with adding such hooks, but please let's use a better, active name. CPUClass is the struct name and cpu-exec is a file name; the hook should say what it's doing, not where the code (used to) live(s). Just exec_enter/exec_exit possibly? Thanks, Andreas > } CPUClass; > =20 > #ifdef HOST_WORDS_BIGENDIAN > diff --git a/qom/cpu.c b/qom/cpu.c > index ba8b402..6a9d02e 100644 > --- a/qom/cpu.c > +++ b/qom/cpu.c > @@ -202,7 +202,7 @@ static bool cpu_common_virtio_is_big_endian(CPUStat= e *cpu) > return target_words_bigendian(); > } > =20 > -static void cpu_common_debug_excp_handler(CPUState *cpu) > +static void cpu_common_noop(CPUState *cpu) > { > } > =20 > @@ -344,7 +344,9 @@ static void cpu_class_init(ObjectClass *klass, void= *data) > k->gdb_read_register =3D cpu_common_gdb_read_register; > k->gdb_write_register =3D cpu_common_gdb_write_register; > k->virtio_is_big_endian =3D cpu_common_virtio_is_big_endian; > - k->debug_excp_handler =3D cpu_common_debug_excp_handler; > + k->debug_excp_handler =3D cpu_common_noop; > + k->cpu_exec_enter =3D cpu_common_noop; > + k->cpu_exec_exit =3D cpu_common_noop; > dc->realize =3D cpu_common_realizefn; > /* > * Reason: CPUs still need special care by board code: wiring up >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg