qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-devel@nongnu.org, "Andreas Färber" <afaerber@suse.de>,
	"Peter Jovanovic" <petar.jovanovic@imgtec.com>
Subject: Re: [Qemu-devel] [PATCH for-1.6] mips_malta: do not raise exceptions when accessing invalid memory
Date: Mon, 12 Aug 2013 23:18:40 +0200	[thread overview]
Message-ID: <20130812211839.GN4193@ohm.aurel32.net> (raw)
In-Reply-To: <520947DE.9080306@weilnetz.de>

On Mon, Aug 12, 2013 at 10:38:54PM +0200, Stefan Weil wrote:
> Am 12.08.2013 21:44, schrieb Aurelien Jarno:
> > Since commit c658b94f6e8c206c59d02aa6fbac285b86b53d2c, MIPS raises
> > exceptions when accessing invalid memory. This is not the correct
> > behaviour for MIPS Malta Core LV, as the GT-64120A system controller
> > just ignore undecoded access. This feature is used by the Linux kernel
> > to probe for some devices.
> >
> > Emulate the correct behaviour in QEMU by adding an empty slot covering
> > the entire memory space decoded by the GT-64120A.
> >
> > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> > ---
> >  default-configs/mips-softmmu.mak     |    1 +
> >  default-configs/mips64-softmmu.mak   |    1 +
> >  default-configs/mips64el-softmmu.mak |    1 +
> >  default-configs/mipsel-softmmu.mak   |    1 +
> >  hw/mips/mips_malta.c                 |    6 ++++++
> >  5 files changed, 10 insertions(+)
> >
> > diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
> > index 926709a..71177ef 100644
> > --- a/default-configs/mips-softmmu.mak
> > +++ b/default-configs/mips-softmmu.mak
> > @@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y
> >  CONFIG_MC146818RTC=y
> >  CONFIG_VT82C686=y
> >  CONFIG_ISA_TESTDEV=y
> > +CONFIG_EMPTY_SLOT=y
> > diff --git a/default-configs/mips64-softmmu.mak b/default-configs/mips64-softmmu.mak
> > index 0ef3f09..617301b 100644
> > --- a/default-configs/mips64-softmmu.mak
> > +++ b/default-configs/mips64-softmmu.mak
> > @@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y
> >  CONFIG_MC146818RTC=y
> >  CONFIG_VT82C686=y
> >  CONFIG_ISA_TESTDEV=y
> > +CONFIG_EMPTY_SLOT=y
> > diff --git a/default-configs/mips64el-softmmu.mak b/default-configs/mips64el-softmmu.mak
> > index 6089318..317b151 100644
> > --- a/default-configs/mips64el-softmmu.mak
> > +++ b/default-configs/mips64el-softmmu.mak
> > @@ -36,3 +36,4 @@ CONFIG_JAZZ_LED=y
> >  CONFIG_MC146818RTC=y
> >  CONFIG_VT82C686=y
> >  CONFIG_ISA_TESTDEV=y
> > +CONFIG_EMPTY_SLOT=y
> > diff --git a/default-configs/mipsel-softmmu.mak b/default-configs/mipsel-softmmu.mak
> > index cd59e24..532a9ae 100644
> > --- a/default-configs/mipsel-softmmu.mak
> > +++ b/default-configs/mipsel-softmmu.mak
> > @@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y
> >  CONFIG_MC146818RTC=y
> >  CONFIG_VT82C686=y
> >  CONFIG_ISA_TESTDEV=y
> > +CONFIG_EMPTY_SLOT=y
> > diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> > index 0f5de33..61cb3e4 100644
> > --- a/hw/mips/mips_malta.c
> > +++ b/hw/mips/mips_malta.c
> > @@ -50,6 +50,7 @@
> >  #include "qemu/host-utils.h"
> >  #include "sysemu/qtest.h"
> >  #include "qemu/error-report.h"
> > +#include "hw/empty_slot.h"
> >  
> >  //#define DEBUG_BOARD_INIT
> >  
> > @@ -908,6 +909,11 @@ void mips_malta_init(QEMUMachineInitArgs *args)
> >      DeviceState *dev = qdev_create(NULL, TYPE_MIPS_MALTA);
> >      MaltaState *s = MIPS_MALTA(dev);
> >  
> > +    /* The whole address space decoded by the GT-64120A doesn't generate
> > +       exception when accessing invalid memory. Create an empty slot to
> > +       emulate this feature. */
> > +    empty_slot_init(0, 0x1fffffff);
> > +
> >      qdev_init_nofail(dev);
> >  
> >      /* Make sure the first 3 serial ports are associated with a device. */
> 
> Hello Aurelien,
> 
> the patch fixes Linux boot with Malta, therefore
> 
> Tested-by: Stefan Weil <sw@weilnetz.de>
> 
> The 2nd parameter of empty_slot_init is not the end address
> but the length, so I think it should be 0x20000000. With this
> modification, the patch is good for 1.6.

Thanks for the test, I'll fix that.

> I did not find a hint in the GT-64120A documentation about
> handling of addresses without connected devices. It is still

Me neither, there is no mention on returning such error to the CPU.
Given how old is this kind of chipset (from the R4700/R5000 era), my
guess is that these are simply ignored. 

> strange that the exception handler throws a secondary
> exception with the current code.

The exception handler is provided by the kernel, and I guess this kind
of exception is not very common, so not handled very well.

Regards,
Aurelien

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2013-08-12 21:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-12 19:44 [Qemu-devel] [PATCH for-1.6] mips_malta: do not raise exceptions when accessing invalid memory Aurelien Jarno
2013-08-12 20:38 ` Stefan Weil
2013-08-12 21:18   ` Aurelien Jarno [this message]
2013-08-13 10:05 ` James Hogan
2013-08-13 12:32   ` Andreas Färber
2013-08-13 20:23     ` Aurelien Jarno
2013-08-13 20:45       ` Peter Maydell
2013-08-13 21:15         ` Aurelien Jarno
2013-08-13 21:20           ` Peter Maydell
2013-08-13 21:26             ` Aurelien Jarno
2013-08-14  5:18               ` [Qemu-devel] Free BIOS for MIPS Malta (was: mips_malta: do not raise exceptions when accessing invalid memory) Stefan Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130812211839.GN4193@ohm.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=afaerber@suse.de \
    --cc=petar.jovanovic@imgtec.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).