From patchwork Fri Aug 14 10:37:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 31388 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id D8F6AB6EDF for ; Fri, 14 Aug 2009 20:38:59 +1000 (EST) Received: from localhost ([127.0.0.1]:60393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbuBP-00076S-PZ for incoming@patchwork.ozlabs.org; Fri, 14 Aug 2009 06:38:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MbuAZ-00075q-EC for qemu-devel@nongnu.org; Fri, 14 Aug 2009 06:37:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbuAT-00071Z-JN for qemu-devel@nongnu.org; Fri, 14 Aug 2009 06:37:57 -0400 Received: from [199.232.76.173] (port=60421 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbuAT-00071W-Aa for qemu-devel@nongnu.org; Fri, 14 Aug 2009 06:37:53 -0400 Received: from mail-yx0-f188.google.com ([209.85.210.188]:57109) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MbuAS-0006zE-HZ for qemu-devel@nongnu.org; Fri, 14 Aug 2009 06:37:52 -0400 Received: by yxe26 with SMTP id 26so1803823yxe.4 for ; Fri, 14 Aug 2009 03:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=4ella0UB4ttO7cTVhvBINwr9kjA8h1hLYVADrHtae9k=; b=Lzx3/LehtaSWR4Af7VQTFI3kx+2tYqC6rnuGAOoPqLND+aU1Ik+zbrZhhuUKFwYiNz xutTplMJKjjhgbG9h607IlcV8m3g2IhI36LcRLlpkQbpjMr19Bx4aQFmsbPXkugjxbn/ l0oDsVjRYKZcHyiFnn+t5Vap4/CyIYSmKitGg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=ow9kc2NlAa0uB1YZTrSv5DW6SP64MnnDNzOlgDEBWPSrhavR2QFv+xsEIc1V+cM4MX dSemY7zZwJbUFK2oUMJNuYvhUbSam5JlsYuYHVFi5Vlv8NXTWKCPLnItVNdlFnCAorJZ TbGbePACmZl1wVxYxPemTygr2WncKFMidt79Q= MIME-Version: 1.0 Received: by 10.90.91.9 with SMTP id o9mr1020481agb.31.1250246271167; Fri, 14 Aug 2009 03:37:51 -0700 (PDT) In-Reply-To: References: From: Artyom Tarasenko Date: Fri, 14 Aug 2009 12:37:31 +0200 Message-ID: Subject: Re: [Qemu-devel] [Patch] sparc32 remove an unnecessary cpu irq set To: Blue Swirl X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: qemu-devel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 2009/8/13 Blue Swirl : > On Thu, Aug 13, 2009 at 6:44 PM, Artyom > Tarasenko wrote: >> 2009/8/12 Igor Kovalenko : >>> PUT_PSR is asking to be made inline function with arch-specific parts, >>> the sparc64 counterpart is too similar. >> Ok, here we go: > > Sorry, it does not apply. Ups, copy&paste error, sorry. This time I send it as an attachment. >> -#if !defined(CONFIG_USER_ONLY) >> -                            cpu_check_irqs(env); >> -#endif > > This should be in a separate patch, preferably one with the check > moved to helper_wrpsr. But that's the purpose of the patch. The check is moved to PUT_PSR, not to helper_wrpsr, because helper_wrpsr is not the only function calling PUT_PSR. From the code I can't tell that the other calls can not trigger an irq as well. >> +/* sum4m.c, sun4u.c */ >> +void cpu_check_irqs(CPUSPARCState *env); > > The prototypes should remain in header files. The two lines are moved from the line number 481 to the line number 588 within the same file. Btw there's a typo, I guess it should be su_n_4m. :) Fixed this too. Signed-off-by: Artyom Tarasenko diff --git a/cpu-exec.c b/cpu-exec.c index 1718dc4..2b74aee 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -485,9 +485,6 @@ int cpu_exec(CPUState *env1) env->exception_index = env->interrupt_index; do_interrupt(env); env->interrupt_index = 0; -#if !defined(CONFIG_USER_ONLY) - cpu_check_irqs(env); -#endif next_tb = 0; } } else if (interrupt_request & CPU_INTERRUPT_TIMER) { diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 2428bb2..19a81c4 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -439,6 +439,21 @@ int cpu_sparc_exec(CPUSPARCState *s); #endif #ifndef NO_CPU_IO_DEFS + +static inline int cpu_cwp_inc(CPUSPARCState *env1, int cwp) +{ + if (unlikely(cwp >= env1->nwindows)) + cwp -= env1->nwindows; + return cwp; +} + +static inline int cpu_cwp_dec(CPUSPARCState *env1, int cwp) +{ + if (unlikely(cwp < 0)) + cwp += env1->nwindows; + return cwp; +} +#endif static inline void memcpy32(target_ulong *dst, const target_ulong *src) { dst[0] = src[0]; @@ -463,43 +478,30 @@ static inline void cpu_set_cwp(CPUSPARCState *env1, int new_cwp) env1->regwptr = env1->regbase + (new_cwp * 16); } -static inline int cpu_cwp_inc(CPUSPARCState *env1, int cwp) -{ - if (unlikely(cwp >= env1->nwindows)) - cwp -= env1->nwindows; - return cwp; -} +/* sun4m.c, sun4u.c */ +void cpu_check_irqs(CPUSPARCState *env); -static inline int cpu_cwp_dec(CPUSPARCState *env1, int cwp) +static inline void PUT_PSR(CPUSPARCState *env, target_ulong val) { - if (unlikely(cwp < 0)) - cwp += env1->nwindows; - return cwp; -} + env->psr = val & PSR_ICC; + env->psref = (val & PSR_EF)? 1 : 0; +#if ((!defined (TARGET_SPARC64)) && !defined(CONFIG_USER_ONLY)) + int _newpsrpil=(val & PSR_PIL) >> 8; + if((_newpsrpil>env->psrpil)&& ((env->pil_in&15)>_newpsrpil)) { + env->psrpil = _newpsrpil; + cpu_check_irqs(env); + } else env->psrpil = _newpsrpil; +#else + env->psrpil = (val & PSR_PIL) >> 8; #endif - + env->psrs = (val & PSR_S)? 1 : 0; + env->psrps = (val & PSR_PS)? 1 : 0; #if !defined (TARGET_SPARC64) -#define PUT_PSR(env, val) do { int _tmp = val; \ - env->psr = _tmp & PSR_ICC; \ - env->psref = (_tmp & PSR_EF)? 1 : 0; \ - env->psrpil = (_tmp & PSR_PIL) >> 8; \ - env->psrs = (_tmp & PSR_S)? 1 : 0; \ - env->psrps = (_tmp & PSR_PS)? 1 : 0; \ - env->psret = (_tmp & PSR_ET)? 1 : 0; \ - cpu_set_cwp(env, _tmp & PSR_CWP); \ - CC_OP = CC_OP_FLAGS; \ - } while (0) -#else -#define PUT_PSR(env, val) do { int _tmp = val; \ - env->psr = _tmp & PSR_ICC; \ - env->psref = (_tmp & PSR_EF)? 1 : 0; \ - env->psrpil = (_tmp & PSR_PIL) >> 8; \ - env->psrs = (_tmp & PSR_S)? 1 : 0; \ - env->psrps = (_tmp & PSR_PS)? 1 : 0; \ - cpu_set_cwp(env, _tmp & PSR_CWP); \ - CC_OP = CC_OP_FLAGS; \ - } while (0) + env->psret = (val & PSR_ET)? 1 : 0; #endif + cpu_set_cwp(env, val & PSR_CWP); + CC_OP = CC_OP_FLAGS; +} #ifdef TARGET_SPARC64 #define GET_CCR(env) (((env->xcc >> 20) << 4) | ((env->psr & PSR_ICC) >> 20)) @@ -585,9 +587,6 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) #include "cpu-all.h" #include "exec-all.h" -/* sum4m.c, sun4u.c */ -void cpu_check_irqs(CPUSPARCState *env); - #ifdef TARGET_SPARC64 /* sun4u.c */ void cpu_tick_set_count(void *opaque, uint64_t count);