* [Qemu-devel] QEMU ARM946 emulation, DIGIC, and MPU fault handling
@ 2014-01-23 22:25 Peter Maydell
2014-01-23 23:36 ` Andreas Färber
2014-01-24 8:31 ` Antony Pavlov
0 siblings, 2 replies; 5+ messages in thread
From: Peter Maydell @ 2014-01-23 22:25 UTC (permalink / raw)
To: QEMU Developers, Antony Pavlov
Hi Antony; have you noticed any issues with QEMU's handling of
MPU faults (data or address faults) on our ARM946 model?
I ask because DIGIC is the only board we have that uses the 946,
and as far as I can tell from the QEMU source code we will
incorrectly trash the access permissions registers any time we
take an MPU fault.
By 'access permission registers' I mean these:
MRC p15, 0, Rd, c5, c0, 2; read data access permission bits
MRC p15, 0, Rd, c5, c0, 3; read instruction access permission bits
MRC p15, 0, Rd, c5, c0, 0; read data access permission bits
MRC p15, 0, Rd, c5, c0, 1; read instruction access permission bits
as described in the 946 TRM:
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0201d/Babfaiic.html
Looking at the source code it seems like cpu_arm_handle_mmu_fault()
will write the fault status into c5_data/c5_insn, because that is where
we keep the DFSR and IFSR for an ARM with an MMU.
Since the 946 doesn't provide any way to find out what the fault
address actually was (it has no DFAR or IFAR) I presume that all
guest software treats a data abort or prefetch abort as a fatal error,
which is probably part of why nobody's ever noticed this.
This bug would also affect the ARMv7M CPU (Cortex-M3) we emulate,
except that as far as I can tell we don't implement its MPU interface at all!
(it uses memory mapped registers rather than cp15 regs, and they just
aren't wired up in armv7m_nvic.c...)
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] QEMU ARM946 emulation, DIGIC, and MPU fault handling
2014-01-23 22:25 [Qemu-devel] QEMU ARM946 emulation, DIGIC, and MPU fault handling Peter Maydell
@ 2014-01-23 23:36 ` Andreas Färber
2014-01-23 23:52 ` Peter Maydell
2014-01-24 8:31 ` Antony Pavlov
1 sibling, 1 reply; 5+ messages in thread
From: Andreas Färber @ 2014-01-23 23:36 UTC (permalink / raw)
To: Peter Maydell, QEMU Developers; +Cc: Antony Pavlov
Am 23.01.2014 23:25, schrieb Peter Maydell:
> This bug would also affect the ARMv7M CPU (Cortex-M3) we emulate,
> except that as far as I can tell we don't implement its MPU interface at all!
> (it uses memory mapped registers rather than cp15 regs, and they just
> aren't wired up in armv7m_nvic.c...)
That matches my memories of investigating Cortex-R4. There is some MPU
code present somewhere, but it appeared to be for some older CPU,
possibly OMAP2.
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] QEMU ARM946 emulation, DIGIC, and MPU fault handling
2014-01-23 23:36 ` Andreas Färber
@ 2014-01-23 23:52 ` Peter Maydell
0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2014-01-23 23:52 UTC (permalink / raw)
To: Andreas Färber; +Cc: QEMU Developers, Antony Pavlov
On 23 January 2014 23:36, Andreas Färber <afaerber@suse.de> wrote:
> Am 23.01.2014 23:25, schrieb Peter Maydell:
>> This bug would also affect the ARMv7M CPU (Cortex-M3) we emulate,
>> except that as far as I can tell we don't implement its MPU interface at all!
>> (it uses memory mapped registers rather than cp15 regs, and they just
>> aren't wired up in armv7m_nvic.c...)
>
> That matches my memories of investigating Cortex-R4. There is some MPU
> code present somewhere, but it appeared to be for some older CPU,
> possibly OMAP2.
The only CPUs with an MPU we support are the 946 and the M3.
(The OMAP SoCs have always had MPUs: OMAP1 was a 926 and
OMAP2 an 1136.)
Apparently in theory the Integrator/CP board can handle a 946.
I guess it would have to be running uClinux.
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] QEMU ARM946 emulation, DIGIC, and MPU fault handling
2014-01-23 22:25 [Qemu-devel] QEMU ARM946 emulation, DIGIC, and MPU fault handling Peter Maydell
2014-01-23 23:36 ` Andreas Färber
@ 2014-01-24 8:31 ` Antony Pavlov
2014-01-25 9:13 ` Georg Hofstetter
1 sibling, 1 reply; 5+ messages in thread
From: Antony Pavlov @ 2014-01-24 8:31 UTC (permalink / raw)
To: Peter Maydell
Cc: Alex Dumitrache, Giovanni Condello, QEMU Developers, g3gg0,
Andreas Färber
On Thu, 23 Jan 2014 22:25:36 +0000
Peter Maydell <peter.maydell@linaro.org> wrote:
> Hi Antony; have you noticed any issues with QEMU's handling of
> MPU faults (data or address faults) on our ARM946 model?
> I ask because DIGIC is the only board we have that uses the 946,
> and as far as I can tell from the QEMU source code we will
> incorrectly trash the access permissions registers any time we
> take an MPU fault.
>
> By 'access permission registers' I mean these:
>
> MRC p15, 0, Rd, c5, c0, 2; read data access permission bits
> MRC p15, 0, Rd, c5, c0, 3; read instruction access permission bits
> MRC p15, 0, Rd, c5, c0, 0; read data access permission bits
> MRC p15, 0, Rd, c5, c0, 1; read instruction access permission bits
>
> as described in the 946 TRM:
> http://infocenter.arm.com/help/topic/com.arm.doc.ddi0201d/Babfaiic.html
>
> Looking at the source code it seems like cpu_arm_handle_mmu_fault()
> will write the fault status into c5_data/c5_insn, because that is where
> we keep the DFSR and IFSR for an ARM with an MMU.
>
> Since the 946 doesn't provide any way to find out what the fault
> address actually was (it has no DFAR or IFAR) I presume that all
> guest software treats a data abort or prefetch abort as a fatal error,
> which is probably part of why nobody's ever noticed this.
>
> This bug would also affect the ARMv7M CPU (Cortex-M3) we emulate,
> except that as far as I can tell we don't implement its MPU interface at all!
> (it uses memory mapped registers rather than cp15 regs, and they just
> aren't wired up in armv7m_nvic.c...)
Sorry for delay!
The number of software, running on DIGIC is very limited:
* Canon Camera firware + maybe Magic Lantern or CHDK;
* barebox.
I know nothing about MPU fault handling in barebox.
I'm planning to merge current qemu DIGIC support with patches from MagicLantern qemu patches.
May be during this work I'll be capable to answer your question, but just now I have no answer, sorry.
May be Magic Lantern people (especiall g3gg0) can help? I have added them to Cc.
--
Best regards,
Antony Pavlov
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] QEMU ARM946 emulation, DIGIC, and MPU fault handling
2014-01-24 8:31 ` Antony Pavlov
@ 2014-01-25 9:13 ` Georg Hofstetter
0 siblings, 0 replies; 5+ messages in thread
From: Georg Hofstetter @ 2014-01-25 9:13 UTC (permalink / raw)
To: Antony Pavlov, Peter Maydell
Cc: Alex Dumitrache, Giovanni Condello, QEMU Developers, g3gg0,
Andreas Färber
Am 24.01.2014 09:31, schrieb Antony Pavlov:
> On Thu, 23 Jan 2014 22:25:36 +0000
> Peter Maydell <peter.maydell@linaro.org> wrote:
>
>> Since the 946 doesn't provide any way to find out what the fault
>> address actually was (it has no DFAR or IFAR) I presume that all
>> guest software treats a data abort or prefetch abort as a fatal error,
>> which is probably part of why nobody's ever noticed this.
Hi,
speaking for EOS models: indeed the original manufacturer's OS does not
handle these cases very different. They pick up the context (including
LR, the failing instruction), print an error message and kill the
failing task.
So at least the original OS does not use MPU systematically, like it
would be necessary for some kind of swapping etc.
BR,
Georg
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-25 9:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 22:25 [Qemu-devel] QEMU ARM946 emulation, DIGIC, and MPU fault handling Peter Maydell
2014-01-23 23:36 ` Andreas Färber
2014-01-23 23:52 ` Peter Maydell
2014-01-24 8:31 ` Antony Pavlov
2014-01-25 9:13 ` Georg Hofstetter
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).