From: "Alex Züpke" <alexander.zuepke@hs-rm.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 6/6] ARM: enable PMSAv7-style MPU on Cortex-M3/M4
Date: Wed, 15 Jul 2015 09:31:52 +0200 [thread overview]
Message-ID: <55A60C68.1090308@hs-rm.de> (raw)
In-Reply-To: <CAFEAcA9Zc5pfoH5+YpRQ005EQ+n6qJwPCmkTsE5WYB25_f4Nzg@mail.gmail.com>
Am 14.07.2015 um 19:49 schrieb Peter Maydell:
> On 7 July 2015 at 19:25, Alex Zuepke <alexander.zuepke@hs-rm.de> wrote:
>
> A commit message that wasn't just the one-line summary would
> be nice. Sometimes a patch really is trivial enough that it's
> not worth describing in more than just a single line, but
> those situations are the exception rather than the rule.
OK.
> [snip]
>> @@ -406,6 +436,57 @@ static void nvic_writel(nvic_state *s, uint32_t offset, uint32_t value)
>> qemu_log_mask(LOG_UNIMP,
>> "NVIC: AUX fault status registers unimplemented\n");
>> break;
>> + case 0xd94: /* MPU control register. */
>> + cpu = ARM_CPU(current_cpu);
>> + if (cpu->pmsav7_dregion == 0)
>> + break;
>> + cpu->env.v7m.mpu_ctrl = value & 0x7;
>> + if (cpu->env.v7m.mpu_ctrl & MPU_CTRL_ENABLE)
>> + cpu->env.cp15.sctlr_ns |= SCTLR_M;
>> + else
>> + cpu->env.cp15.sctlr_ns &= ~SCTLR_M;
>> + /* TODO: mimic MPU_CTRL_HFNMIENA */
>
> That will be interesting to implement.
>
>> + if (cpu->env.v7m.mpu_ctrl & MPU_CTRL_PRIVDEFENA)
>> + cpu->env.cp15.sctlr_ns |= SCTLR_BR;
>> + else
>> + cpu->env.cp15.sctlr_ns &= ~SCTLR_BR;
>
> This is kind of ugly. Wouldn't it be nicer to make the code
> which tests for MMU-enabled and privdefena be M-profile aware?
Yes, but I wanted to keep the impact as small as possible ...
As a general question: is it OK to (mis-)use the existing cp15 register infrastructure for that,
or should I put the MPU enable bits, region number, etc into dedicated MPU-related sub structures in CPUARMState?
> [snip]
>> @@ -445,6 +526,19 @@ static uint64_t nvic_sysreg_read(void *opaque, hwaddr addr,
>> return val & 0xffff;
>> }
>> break;
>> + case 0xda0 ... 0xdb7: /* MPU_RSAR and aliases. */
>> + cpu = ARM_CPU(current_cpu);
>> + if (cpu->pmsav7_dregion == 0)
>> + break;
>> + if ((size == 2) && (offset & 7) == 0) {
>> + val = cpu->env.pmsav7.drsr[cpu->env.cp15.c6_rgnr];
>> + return val & 0xffff;
>> + }
>> + if ((size == 2) && (offset & 7) == 2) {
>> + val = cpu->env.pmsav7.dracr[cpu->env.cp15.c6_rgnr];
>> + return val & 0xffff;
>> + }
>
> RASR is UNPREDICTABLE for non-word-size access, so we don't need
> this at all.
It's from ARM recommended sample code:
http://infocenter.arm.com/help/topic/com.arm.doc.dui0553a/BIHHHDDJ.html
Thanks a lot for the reviews!
I'll send a new set of patches next week.
Best regards
Alex
next prev parent reply other threads:[~2015-07-15 7:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1436293553-15575-1-git-send-email-alexander.zuepke@hs-rm.de>
2015-07-07 18:25 ` [Qemu-devel] [PATCH 1/6] ARM: add Cortex-M3/M4 exception configuration and status registers Alex Zuepke
2015-07-14 16:35 ` Peter Maydell
2015-07-14 17:01 ` Peter Maydell
2015-07-07 18:25 ` [Qemu-devel] [PATCH 2/6] ARM: accessors to " Alex Zuepke
2015-07-14 16:52 ` Peter Maydell
2015-07-07 18:25 ` [Qemu-devel] [PATCH 3/6] ARM: Cortex-M3/M4: honor STKALIGN in CCR Alex Zuepke
2015-07-14 16:58 ` Peter Maydell
2015-07-07 18:25 ` [Qemu-devel] [PATCH 4/6] ARM: Cortex-M3/M4: on exception, set basic bits in exhandling registers Alex Zuepke
2015-07-14 17:16 ` Peter Maydell
2015-07-07 18:25 ` [Qemu-devel] [PATCH 5/6] ARM: enable ARM_FEATURE_MPU for Cortex-M3/M4 Alex Zuepke
2015-07-07 20:50 ` Peter Crosthwaite
2015-07-08 7:56 ` Alex Züpke
2015-07-08 21:42 ` Peter Crosthwaite
2015-07-07 18:25 ` [Qemu-devel] [PATCH 6/6] ARM: enable PMSAv7-style MPU on Cortex-M3/M4 Alex Zuepke
2015-07-14 17:49 ` Peter Maydell
2015-07-15 7:31 ` Alex Züpke [this message]
2015-07-16 10:26 ` Peter Maydell
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=55A60C68.1090308@hs-rm.de \
--to=alexander.zuepke@hs-rm.de \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.