From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LaF1x-0002Xk-4S for qemu-devel@nongnu.org; Thu, 19 Feb 2009 14:57:57 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LaF1v-0002XP-9C for qemu-devel@nongnu.org; Thu, 19 Feb 2009 14:57:56 -0500 Received: from [199.232.76.173] (port=36526 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LaF1v-0002XM-3M for qemu-devel@nongnu.org; Thu, 19 Feb 2009 14:57:55 -0500 Received: from mx20.gnu.org ([199.232.41.8]:63714) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LaF1u-0000mA-Hg for qemu-devel@nongnu.org; Thu, 19 Feb 2009 14:57:54 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LaF1s-0008SE-TZ for qemu-devel@nongnu.org; Thu, 19 Feb 2009 14:57:53 -0500 From: Vladimir Prus Subject: Re: [Qemu-devel] SH: Improve the interrupt controller Date: Thu, 19 Feb 2009 22:57:58 +0300 References: <200812112252.17620.vladimir@codesourcery.com> <200902121405.34112.vladimir@codesourcery.com> <200902171832.n1HIWFGd002332@smtp09.dti.ne.jp> In-Reply-To: <200902171832.n1HIWFGd002332@smtp09.dti.ne.jp> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_GnbnJ5DqqB7w5FT" Message-Id: <200902192257.58689.vladimir@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: takasi-y@ops.dti.ne.jp Cc: qemu-devel@nongnu.org --Boundary-00=_GnbnJ5DqqB7w5FT Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tuesday 17 February 2009 21:32:15 takasi-y@ops.dti.ne.jp wrote: > Hi, Vladimir. > > Some more fixes added. Would you please test this for your target? > I would like you to post it if it works for yours. > > I've tested > Head: svn://svn.sv.gnu.org/qemu/trunk@6626 > + Last patch: http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00546.html > + This patch. Yoshii, with these patches, I've got lockup again, so I've debugged deeper. The lockup happens because the TMU0 source was asserted, but not enabled. On 7785, that source is controlled using: - INT2PRI0 register, which is priority register. In debugger, I see write to this register being processed, and bumping enable_count. - INT2MSKR register (and it's clear register). It's never written. On the CPU, INT2MSKR is initialized to all zeros, not masking anything. In QEMU, we set enable_max to 2 and enable_count to 0. Therefore, after INT2PRI0 is written, processor allows the interrupt, and QEMU does not. I attach a patch to correct this -- what do you think? Thanks, Volodya - Volodya --Boundary-00=_GnbnJ5DqqB7w5FT Content-Type: text/x-diff; charset="iso 8859-15"; name="mask_groups.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mask_groups.diff" diff --git a/hw/sh_intc.c b/hw/sh_intc.c index 7cd1fad..2369e8b 100644 --- a/hw/sh_intc.c +++ b/hw/sh_intc.c @@ -367,6 +367,10 @@ static void sh_intc_register_source(struct intc_desc *desc, for (k = 0; k < ARRAY_SIZE(mr->enum_ids); k++) { if (mr->enum_ids[k] == source) { s->enable_max++; + // Account for the fact that mask registers are + // zero by default, and therefore don't mask + // an interrupt by default. + s->enable_count++; break; } } @@ -431,6 +435,7 @@ void sh_intc_register_sources(struct intc_desc *desc, child = sh_intc_source(desc, gr->enum_ids[k]); child->enable_max += s->enable_max; + child->enable_count += s->enable_count; } /* Chain sources within each group via source->next_enum_id, @@ -537,3 +542,18 @@ void sh_intc_init_irl_priorities(struct intc_source *s) s->priority = priority-- *2; assert(priority == 0); } + +void sh_intc_debug_lockup (struct intc_desc *desc) +{ + int i; + for (i = 0; i < desc->nr_sources; i++) + { + struct intc_source *source = desc->sources + i; + + if (source->asserted && !source->pending) + { + printf ("source %d (%x) asserted, not pending, e = %d/%d\n", + i, source->vect, source->enable_count, source->enable_max); + } + } +} --Boundary-00=_GnbnJ5DqqB7w5FT--