Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKriB-0007d4-Lh for qemu-devel@nongnu.org; Thu, 08 Jan 2009 05:01:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKriA-0007co-FQ for qemu-devel@nongnu.org; Thu, 08 Jan 2009 05:01:58 -0500 Received: from [199.232.76.173] (port=54089 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKriA-0007cj-2q for qemu-devel@nongnu.org; Thu, 08 Jan 2009 05:01:58 -0500 Received: from bart.se.axis.com ([195.60.68.10]:44121) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LKri9-0001Fz-DK for qemu-devel@nongnu.org; Thu, 08 Jan 2009 05:01:57 -0500 Received: from bart.se.axis.com (bart.se.axis.com [127.0.0.1]) by bart.se.axis.com (Postfix) with ESMTP id 72DC164106 for ; Thu, 8 Jan 2009 11:01:56 +0100 (CET) Received: from axis.com (edgar.se.axis.com [10.93.151.1]) by bart.se.axis.com (Postfix) with ESMTP id 65A1163F7C for ; Thu, 8 Jan 2009 11:01:56 +0100 (CET) Date: Thu, 8 Jan 2009 11:01:56 +0100 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] [PATCH]: add leon target Message-ID: <20090108100156.GB26971@edgar.se.axis.com> References: <20090107102439.GA15209@ulanbator.act-europe.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tristan Gingold Cc: qemu-devel@nongnu.org On Thu, Jan 08, 2009 at 09:53:01AM +0100, Tristan Gingold wrote: > > On Jan 7, 2009, at 6:03 PM, Blue Swirl wrote: > >> On 1/7/09, Tristan Gingold wrote: >>> Hi, Thanks for the patch Tristian, I've got a couple of comments: >>> >>> this patch adds a new target: leon which is an open source sparc v8 >>> variant. >> >> Thanks for the patch. Is there any way to test the system, rom images >> etc? Any system level docs? > > I can send an image if you need one. I can also send the sources but I > suppose it would be useless to you > as this is Ada code. > > For docs, see: > http://www.atmel.com/dyn/products/product_card.asp?part_id=3178 > > or www.gaisler.com > > (Don't forget leon is open-source. You can get VHDL files if you need). > >> Do you think it would be useful to port OpenBIOS to the system? > > Usually this chip is used in space engine: no disk and no ethernet. I > doubt OpenBIOS would be useful. > Gaisler Research provides a monitor but I didn't test it on qemu (and I am > not sure it is freely available). > Also there is a port of Linux. I once made it running on qemu (maybe 4 > years ago). It should be the > easiest way to test the system. > >>> The cpu itself implements the v8 architecture so there is nothing to >>> change. >>> However the devices are different and in particular the interrupt >>> controller. >>> >>> To handle different interrupt controllers, I added a new field in >>> CPUSPARCState like it is done on PowerPC. >> >> I have a feeling that this should be handled some other way but I >> don't know how yet. CPU emulation should not know about boards. > > I have the same feeling too. I am ready to improve the code but I need a > few advices. > As currently implemented CPU emulation know about interrupt controller. > Wether interrupt controller > belongs to CPU or to the board is an open question :-) > Do you simply prefer to have hooks in CPUSPARCState ? >From my experience, interrupt controllers are usually not considered to be part of the CPU. Regarding the leon interrupt controller, I had a quick look at the vhdl and AFAICT there is no need for any special tricks in the sparc cpu model. What you need is to handle accesses to the interrupt clear register, in your code you seem to call it ITC and your io_writel does not handle it. This is the place to hook in calls to mask off bits from the pending interrupt reg. Your leon software should be writing to this register when acking interrupts. What you are doing know is providing a magic automatic ACK from the core as soon as the interrupt is taken, IIUC this is not what leon does. > > The same question applies to the MMU. Most of early SPARC models do not > have an integrated MMU. > Leon2 MMU is optional too. > >>> Comments are welcome, >>> Tristan. >> >> Maybe the leon.c should be split, each device in a separate file. >> Though I guess the devices are so unique that they won't be used >> elsewhere. > > Yes, they are so unique that it would create a lot of small files. I am > not sure we want to go that way. IMO you should be splitting the different blocks into separate files as already suggested. You should also register separate IO regions for every block. This is important in order to be able to reuse the blocks for different leon based socs/boards that may have different memory maps. Cheers