From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YipQA-0006yi-5y for qemu-devel@nongnu.org; Thu, 16 Apr 2015 15:25:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YipQ5-0005PK-Rg for qemu-devel@nongnu.org; Thu, 16 Apr 2015 15:25:54 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:37348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YipQ5-0005Oj-MB for qemu-devel@nongnu.org; Thu, 16 Apr 2015 15:25:49 -0400 Message-ID: <55300CAC.20103@imgtec.com> Date: Thu, 16 Apr 2015 20:25:32 +0100 From: Leon Alrae 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> In-Reply-To: <552FD278.5040303@redhat.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: Paolo Bonzini Cc: James Hogan , qemu-devel , vt 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. Leon