From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YipeJ-0002iu-AH for qemu-devel@nongnu.org; Thu, 16 Apr 2015 15:40:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YipeG-0001EL-4O for qemu-devel@nongnu.org; Thu, 16 Apr 2015 15:40:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58778) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YipeF-0001EE-M1 for qemu-devel@nongnu.org; Thu, 16 Apr 2015 15:40:27 -0400 Message-ID: <5530101F.4060100@redhat.com> Date: Thu, 16 Apr 2015 21:40:15 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <201504131929543844171@sangfor.com.cn> <552E30F5.2020207@imgtec.com> <552F97FF.4000109@imgtec.com> <552FA4B9.4070204@redhat.com> <552FCF9F.4020500@imgtec.com> <552FD278.5040303@redhat.com> <55300CAC.20103@imgtec.com> In-Reply-To: <55300CAC.20103@imgtec.com> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Question]Support of China loogson processor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leon Alrae Cc: James Hogan , qemu-devel , vt On 16/04/2015 21:25, Leon Alrae wrote: > On 16/04/15 16:17, Paolo Bonzini wrote: >> >> >> On 16/04/2015 17:05, Leon Alrae wrote: >>> On 16/04/2015 13:02, Paolo Bonzini wrote: >>>> >>>> >>>> On 16/04/2015 13:07, Leon Alrae wrote: >>>>> Since I also haven't had a chance to test Loongson emulation, I thought >>>>> I'd give it a try (TCG only, Loongson-2E cpu and fulong2e machine). >>>>> >>>>> Good news is that I'm able to get to the login prompt using ancient QEMU >>>>> v1.0, kernel 2.6.33 (with additional patch from >>>>> https://lists.gnu.org/archive/html/qemu-devel/2010-06/msg02566.html) and >>>>> some old debian image I had handy. However, in any newer version >>>>> starting from v1.1.0 of QEMU something goes horribly wrong and it just >>>>> segfaults somewhere inside hw/bonito.c quite early during kernel >>>>> booting. >>>> >>>> Where exactly? If it's related to the memory API conversion, it may be >>>> easy to fix. I can look at a backtrace (or you can just put the Debian >>>> image somewhere I can grab it). >>> >>> Bisect points at: 5312bd8b3152f8d4fcf9389ba54e32b09f4b4093 >>> >>> Crash occurs during the first access, below there is backtrace from >>> working and not working case: >> >> This is my best guess... >> >> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c >> index 8bdd569..8134d0b 100644 >> --- a/hw/pci-host/bonito.c >> +++ b/hw/pci-host/bonito.c >> @@ -233,7 +233,7 @@ static void bonito_writel(void *opaque, hwaddr addr, >> uint32_t saddr; >> int reset = 0; >> >> - saddr = (addr - BONITO_REGBASE) >> 2; >> + saddr = addr >> 2; >> >> DPRINTF("bonito_writel "TARGET_FMT_plx" val %x saddr %x\n", addr, val, saddr); >> switch (saddr) { >> @@ -295,7 +295,7 @@ static uint64_t bonito_readl(void *opaque, hwaddr addr, >> PCIBonitoState *s = opaque; >> uint32_t saddr; >> >> - saddr = (addr - BONITO_REGBASE) >> 2; >> + saddr = addr >> 2; >> >> DPRINTF("bonito_readl "TARGET_FMT_plx"\n", addr); >> switch (saddr) { >> > > Nice. Thanks! > > Would you send the patch or should I do this? With this fix fulong2e > machine is brought back to life. It would be great to have it in 2.3. You can send a pull request directly (add my Signed-off-by and Cc: qemu-stable@nongnu.org, please), but it is possible Peter will tell you to wait for 2.3.1. It's been broken for a few years already. :) Paolo