From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49331 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pmu7N-0000QZ-EY for qemu-devel@nongnu.org; Tue, 08 Feb 2011 15:24:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pmu7K-0001mu-0s for qemu-devel@nongnu.org; Tue, 08 Feb 2011 15:24:56 -0500 Received: from fmmailgate01.web.de ([217.72.192.221]:59819) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pmu7E-0001lg-Ad for qemu-devel@nongnu.org; Tue, 08 Feb 2011 15:24:53 -0500 Message-ID: <4D51A68E.8070501@web.de> Date: Tue, 08 Feb 2011 21:24:46 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1297185509-20996-1-git-send-email-pbonzini@redhat.com> <1297185509-20996-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1297185509-20996-4-git-send-email-pbonzini@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigA7901F7A0930C30FF44DD867" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [CFT PATCH 03/12] inline cpu_halted into sole caller List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA7901F7A0930C30FF44DD867 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2011-02-08 18:18, Paolo Bonzini wrote: > All implementations are now the same except SH, which can fit in > the default implementation easily. The newly added flag will not make > much sense on non-SH platforms, but I left it anyway. Alternatively yo= u > could #ifdef it out on non-SH. I think we can live with that additional variable setting. Just add a comment why it's there. >=20 > This reduces the number of places that have to be audited for patch 5 > ("always qemu_cpu_kick after unhalting a cpu"). >=20 > Signed-off-by: Paolo Bonzini > --- > cpu-defs.h | 1 + > cpu-exec.c | 9 +++++++-- > target-alpha/exec.h | 11 ----------- > target-arm/exec.h | 13 ------------- > target-cris/exec.h | 11 ----------- > target-i386/exec.h | 12 ------------ > target-m68k/exec.h | 10 ---------- > target-microblaze/exec.h | 11 ----------- > target-mips/exec.h | 11 ----------- > target-ppc/exec.h | 11 ----------- > target-s390x/exec.h | 12 ------------ > target-sh4/cpu.h | 1 - > target-sh4/exec.h | 11 ----------- > target-sparc/exec.h | 10 ---------- > 14 files changed, 8 insertions(+), 126 deletions(-) >=20 > diff --git a/cpu-defs.h b/cpu-defs.h > index db809ed..e4dee97 100644 > --- a/cpu-defs.h > +++ b/cpu-defs.h > @@ -159,6 +159,7 @@ typedef struct CPUWatchpoint { > target_ulong mem_io_vaddr; /* target virtual addr at which the = \ > memory was accessed */ = \ > uint32_t halted; /* Nonzero if the CPU is in suspend state */ = \ > + uint32_t intr_at_halt; /* Nonzero if an irq woke CPU from halted s= tate */ \ > uint32_t interrupt_request; = \ > volatile sig_atomic_t exit_request; = \ > CPU_COMMON_TLB = \ > diff --git a/cpu-exec.c b/cpu-exec.c > index 8c9fb8b..3d6ff35 100644 > --- a/cpu-exec.c > +++ b/cpu-exec.c > @@ -230,8 +230,13 @@ int cpu_exec(CPUState *env1) > uint8_t *tc_ptr; > unsigned long next_tb; > =20 > - if (cpu_halted(env1) =3D=3D EXCP_HALTED) > - return EXCP_HALTED; > + if (env1->halted) { > + if (!cpu_has_work(env1)) > + return EXCP_HALTED; > + > + env1->halted =3D 0; > + env1->intr_at_halt =3D 1; > + } > =20 > cpu_single_env =3D env1; > =20 > diff --git a/target-alpha/exec.h b/target-alpha/exec.h > index a8a38d2..6ae96d1 100644 > --- a/target-alpha/exec.h > +++ b/target-alpha/exec.h > @@ -42,17 +42,6 @@ static inline int cpu_has_work(CPUState *env) > return (env->interrupt_request & CPU_INTERRUPT_HARD); > } > =20 > -static inline int cpu_halted(CPUState *env) > -{ > - if (!env->halted) > - return 0; > - if (cpu_has_work(env)) { > - env->halted =3D 0; > - return 0; > - } > - return EXCP_HALTED; > -} > - > static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)= > { > env->pc =3D tb->pc; > diff --git a/target-arm/exec.h b/target-arm/exec.h > index e4c35a3..44e1b55 100644 > --- a/target-arm/exec.h > +++ b/target-arm/exec.h > @@ -32,19 +32,6 @@ static inline int cpu_has_work(CPUState *env) > (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_EX= ITTB)); > } > =20 > -static inline int cpu_halted(CPUState *env) { > - if (!env->halted) > - return 0; > - /* An interrupt wakes the CPU even if the I and F CPSR bits are > - set. We use EXITTB to silently wake CPU without causing an > - actual interrupt. */ > - if (cpu_has_work(env)) { > - env->halted =3D 0; > - return 0; > - } > - return EXCP_HALTED; > -} > - > #if !defined(CONFIG_USER_ONLY) > #include "softmmu_exec.h" > #endif > diff --git a/target-cris/exec.h b/target-cris/exec.h > index 34c0132..2d5d297 100644 > --- a/target-cris/exec.h > +++ b/target-cris/exec.h > @@ -33,17 +33,6 @@ static inline int cpu_has_work(CPUState *env) > return (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRU= PT_NMI)); > } > =20 > -static inline int cpu_halted(CPUState *env) { > - if (!env->halted) > - return 0; > - > - if (cpu_has_work(env)) { > - env->halted =3D 0; > - return 0; > - } > - return EXCP_HALTED; > -} > - > static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)= > { > env->pc =3D tb->pc; > diff --git a/target-i386/exec.h b/target-i386/exec.h > index fc8945b..3e7386e 100644 > --- a/target-i386/exec.h > +++ b/target-i386/exec.h > @@ -304,18 +304,6 @@ static inline int cpu_has_work(CPUState *env) > return work; > } > =20 > -static inline int cpu_halted(CPUState *env) { > - /* handle exit of HALTED state */ > - if (!env->halted) > - return 0; > - /* disable halt condition */ > - if (cpu_has_work(env)) { > - env->halted =3D 0; > - return 0; > - } > - return EXCP_HALTED; > -} > - > /* load efer and update the corresponding hflags. XXX: do consistency > checks with cpuid bits ? */ > static inline void cpu_load_efer(CPUState *env, uint64_t val) > diff --git a/target-m68k/exec.h b/target-m68k/exec.h > index f31e06e..91daa6b 100644 > --- a/target-m68k/exec.h > +++ b/target-m68k/exec.h > @@ -33,16 +33,6 @@ static inline int cpu_has_work(CPUState *env) > return (env->interrupt_request & (CPU_INTERRUPT_HARD)); > } > =20 > -static inline int cpu_halted(CPUState *env) { > - if (!env->halted) > - return 0; > - if (cpu_has_work(env)) { > - env->halted =3D 0; > - return 0; > - } > - return EXCP_HALTED; > -} > - > static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)= > { > env->pc =3D tb->pc; > diff --git a/target-microblaze/exec.h b/target-microblaze/exec.h > index ab19828..1efff30 100644 > --- a/target-microblaze/exec.h > +++ b/target-microblaze/exec.h > @@ -32,17 +32,6 @@ static inline int cpu_has_work(CPUState *env) > return (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRU= PT_NMI)); > } > =20 > -static inline int cpu_halted(CPUState *env) { > - if (!env->halted) > - return 0; > - > - if (cpu_has_work(env)) { > - env->halted =3D 0; > - return 0; > - } > - return EXCP_HALTED; > -} > - > static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)= > { > env->sregs[SR_PC] =3D tb->pc; > diff --git a/target-mips/exec.h b/target-mips/exec.h > index 1273654..b3c5a13 100644 > --- a/target-mips/exec.h > +++ b/target-mips/exec.h > @@ -36,17 +36,6 @@ static inline int cpu_has_work(CPUState *env) > return has_work; > } > =20 > -static inline int cpu_halted(CPUState *env) > -{ > - if (!env->halted) > - return 0; > - if (cpu_has_work(env)) { > - env->halted =3D 0; > - return 0; > - } > - return EXCP_HALTED; > -} > - > static inline void compute_hflags(CPUState *env) > { > env->hflags &=3D ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_C= P0 | > diff --git a/target-ppc/exec.h b/target-ppc/exec.h > index 4688ef5..f87847a 100644 > --- a/target-ppc/exec.h > +++ b/target-ppc/exec.h > @@ -38,17 +38,6 @@ static inline int cpu_has_work(CPUState *env) > } > =20 > =20 > -static inline int cpu_halted(CPUState *env) > -{ > - if (!env->halted) > - return 0; > - if (cpu_has_work(env)) { > - env->halted =3D 0; > - return 0; > - } > - return EXCP_HALTED; > -} > - > static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)= > { > env->nip =3D tb->pc; > diff --git a/target-s390x/exec.h b/target-s390x/exec.h > index bf3f264..f7893f3 100644 > --- a/target-s390x/exec.h > +++ b/target-s390x/exec.h > @@ -34,18 +34,6 @@ static inline int cpu_has_work(CPUState *env) > return env->interrupt_request & CPU_INTERRUPT_HARD; // guess > } > =20 > -static inline int cpu_halted(CPUState *env) > -{ > - if (!env->halted) { > - return 0; > - } > - if (cpu_has_work(env)) { > - env->halted =3D 0; > - return 0; > - } > - return EXCP_HALTED; > -} > - > static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock* tb)= > { > env->psw.addr =3D tb->pc; > diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h > index 789d188..7188c4d 100644 > --- a/target-sh4/cpu.h > +++ b/target-sh4/cpu.h > @@ -184,7 +184,6 @@ typedef struct CPUSH4State { > uint32_t cvr; /* Cache Version Register */ > =20 > void *intc_handle; > - int intr_at_halt; /* SR_BL ignored during sleep */ > memory_content *movcal_backup; > memory_content **movcal_backup_tail; > } CPUSH4State; > diff --git a/target-sh4/exec.h b/target-sh4/exec.h > index 2999c02..9f1c1f6 100644 > --- a/target-sh4/exec.h > +++ b/target-sh4/exec.h > @@ -32,17 +32,6 @@ static inline int cpu_has_work(CPUState *env) > return (env->interrupt_request & CPU_INTERRUPT_HARD); > } > =20 > -static inline int cpu_halted(CPUState *env) { > - if (!env->halted) > - return 0; > - if (cpu_has_work(env)) { > - env->halted =3D 0; > - env->intr_at_halt =3D 1; > - return 0; > - } > - return EXCP_HALTED; > -} > - > #ifndef CONFIG_USER_ONLY > #include "softmmu_exec.h" > #endif > diff --git a/target-sparc/exec.h b/target-sparc/exec.h > index f811571..f5c221e 100644 > --- a/target-sparc/exec.h > +++ b/target-sparc/exec.h > @@ -22,16 +22,6 @@ static inline int cpu_has_work(CPUState *env1) > } > =20 > =20 > -static inline int cpu_halted(CPUState *env1) { > - if (!env1->halted) > - return 0; > - if (cpu_has_work(env1)) { > - env1->halted =3D 0; > - return 0; > - } > - return EXCP_HALTED; > -} > - > static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)= > { > env->pc =3D tb->pc; Nice cleanup. Jan --------------enigA7901F7A0930C30FF44DD867 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk1Rpo4ACgkQitSsb3rl5xQRwgCfdj7S6ow1OTsleDqrP35R76SE BlAAmwRTixtuT7F/Zg0XzMbk5tmmQ76f =KrrF -----END PGP SIGNATURE----- --------------enigA7901F7A0930C30FF44DD867--