From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LZRMc-00009n-L2 for qemu-devel@nongnu.org; Tue, 17 Feb 2009 09:55:58 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LZRMa-00009X-9A for qemu-devel@nongnu.org; Tue, 17 Feb 2009 09:55:57 -0500 Received: from [199.232.76.173] (port=48144 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LZRMa-00009U-2y for qemu-devel@nongnu.org; Tue, 17 Feb 2009 09:55:56 -0500 Received: from mail-bw0-f205.google.com ([209.85.218.205]:48417) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LZRMZ-0006BK-FK for qemu-devel@nongnu.org; Tue, 17 Feb 2009 09:55:55 -0500 Received: by bwz1 with SMTP id 1so4282726bwz.10 for ; Tue, 17 Feb 2009 06:55:52 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1234864778-19099-2-git-send-email-yu.liu@freescale.com> References: <1234864778-19099-1-git-send-email-yu.liu@freescale.com> <1234864778-19099-2-git-send-email-yu.liu@freescale.com> Date: Tue, 17 Feb 2009 16:55:51 +0200 Message-ID: Subject: Re: [Qemu-devel] [PATCH 1/5] kvm/powerpc: Enable MPIC for E500 platform. From: Blue Swirl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm-ppc@vger.kernel.org, Liu Yu , hollisb@us.ibm.com, aurelien@aurel32.net On 2/17/09, Liu Yu wrote: > MPIC and OpenPIC have very similar design. > So a lot of code can be reused. > > Modification mainly include: > 1. keep struct openpic_t to the maximum size of both MPIC and OpenPIC. > 2. endianess swap. > MPIC has the same endianess as target, so no need to swap for MPIC. I don't think this is correct, the host can still be different endian from target. > 3. using different init functions and function pointers for reset and irq raise. You didn't register the reset handler with qemu_register_reset. > Haven't test OpenPIC. > > Signed-off-by: Liu Yu > +static void mpic_src_write (void *opaque, uint32_t addr, uint32_t val) > + if (addr < 0x180) { > + idx = MPIC_EXT_IRQ; > + } else if (addr >= 0x200 && addr < 0xa00) { > + idx = MPIC_INT_IRQ; > + addr -= 0x200; > + } else if (addr >= 0x1600 && addr < 0x1700) { > + idx = MPIC_MSG_IRQ; > + addr -= 0x1600; > + } else if (addr >= 0x1C00 && addr < 0x1D00) { > + idx = MPIC_MSI_IRQ; > + addr -= 0x1C00; > + } else { > + return; It would be faster and simpler to register different handlers for these memory areas, same goes for mpic_src_read, mpic_writel and mpic_readl. > + register_savevm("mpic", 0, 1, openpic_save, openpic_load, mpp); When the save format changes, the version number should be bumped.