Received: from eggs.gnu.org ([2001:4830:134:3::10]:45843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXyf4-0006Ky-A9 for qemu-devel@nongnu.org; Wed, 09 Apr 2014 16:00:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXyet-0008J1-EY for qemu-devel@nongnu.org; Wed, 09 Apr 2014 15:59:54 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) From: Alexander Graf In-Reply-To: <5345A080.8040101@gmail.com> Date: Wed, 9 Apr 2014 21:59:41 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <3CAF74B4-22CF-4971-AAB7-805C73A007FC@suse.de> References: <1396817714-26768-1-git-send-email-agraf@suse.de> <5344545C.7060608@gmail.com> <534454CD.2060500@suse.de> <5345A080.8040101@gmail.com> Subject: Re: [Qemu-devel] [PATCH v2] PPC: Clean up DECR implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tom Musta Cc: "qemu-ppc@nongnu.org" , "qemu-devel@nongnu.org" > Am 09.04.2014 um 21:33 schrieb Tom Musta : >=20 >> On 4/8/2014 2:58 PM, Alexander Graf wrote: >>> On 04/08/2014 09:56 PM, Tom Musta wrote: >>> On 4/6/2014 3:55 PM, Alexander Graf wrote: >>> >>>=20 >>>> @@ -806,6 +838,10 @@ clk_setup_cb cpu_ppc_tb_init (CPUPPCState *env, ui= nt32_t freq) >>>> tb_env =3D g_malloc0(sizeof(ppc_tb_t)); >>>> env->tb_env =3D tb_env; >>>> tb_env->flags =3D PPC_DECR_UNDERFLOW_TRIGGERED; >>>> + if (env->insns_flags & PPC_SEGMENT_64B) { >>>> + /* All Book3S 64bit CPUs implement level based DEC logic */ >>>> + tb_env->flags |=3D PPC_DECR_UNDERFLOW_LEVEL; >>>> + } >>>> /* Create new timer */ >>>> tb_env->decr_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, &cpu_ppc_d= ecr_cb, cpu); >>>> if (0) { >>> Equating Book3S with PPC_SEGMENT_64B is clever ... is it too clever? Es= pecially since >>> the SLB Bridge is in the phased-out category and consequently we should e= xpect future >>> Book3S implementations to not support this instruction category. >>=20 >> Maybe it's too clever :). I'm very open to suggestions on how to figure t= his out otherwise. Or maybe we should just rework the way timers get created= and make them be part of the core itself? >>=20 >>=20 >> Alex >=20 > A somewhat more practical approach than redesigning timer init: The phras= ing introduced into Book3S > that corresponds to your UNDERFLOW_LEVEL flag has existed at least since I= SA 2.03. And 2.03 introduced > some new features, like SPE and Altivec. So ... e6500 supports Altivec :) >=20 > if (env->insns_flags & (PPC_SEGMENT_64B | PPC_SPE | PPC_ALTIVEC)) { > /* All Book3S 64bit CPUs implement level based DEC logic */ > tb_env->flags |=3D PPC_DECR_UNDERFLOW_LEVEL; > } >=20 > would catch a few more. I'm not sure we get into this code for Book3E mac= hines, but if you are worried > about that you could also ensure that insns_flags doesn't have PPC_BOOKE o= n. Phew, I'm not quite sure. We can do it as an interim solution, but really th= e timer is a core property rather than a machine device :). So eventually th= is should get reworked. Alex