All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Jim Mussared" <jim@groklearning.com>,
	"Steffen Görtz" <mail@steffen-goertz.de>,
	"Su Hang" <suhang16@mails.ucas.ac.cn>,
	"Liviu Ionescu" <ilg@livius.net>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
	"Steffen Gortz" <qemu.ml@steffen-goertz.de>,
	qemu-arm <qemu-arm@nongnu.org>, "Joel Stanley" <joel@jms.id.au>,
	"Julia Suvorova" <jusual@mail.ru>
Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH v3 4/7] target/arm: add "cortex-m0" CPU model
Date: Fri, 10 Aug 2018 00:37:53 -0300	[thread overview]
Message-ID: <5bec224b-79df-c7ec-be22-38cf53236e00@amsat.org> (raw)
In-Reply-To: <CAFEAcA-YQ1yE0jc2CgTvvPipNjMC=7SkKQcKHV5-vgPwEBFHSQ@mail.gmail.com>

On 07/30/2018 02:51 PM, Peter Maydell wrote:
> On 27 July 2018 at 06:26, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>> Hi Stefan,
>>
>> On 07/25/2018 05:59 AM, Stefan Hajnoczi wrote:
>>> Define a "cortex-m0" ARMv6-M CPU model.
>>>
>>> Most of the register reset values set by other CPU models are not
>>> relevant for the cut-down ARMv6-M architecture.
>>>
>>> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
>>> ---
>>>  target/arm/cpu.c | 11 +++++++++++
>>>  1 file changed, 11 insertions(+)
>>>
>>> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
>>> index 3848ef46aa..7e477c0d23 100644
>>> --- a/target/arm/cpu.c
>>> +++ b/target/arm/cpu.c
>>> @@ -1255,6 +1255,15 @@ static void arm11mpcore_initfn(Object *obj)
>>>      cpu->reset_auxcr = 1;
>>>  }
>>>
>>> +static void cortex_m0_initfn(Object *obj)
>>> +{
>>> +    ARMCPU *cpu = ARM_CPU(obj);
>>> +    set_feature(&cpu->env, ARM_FEATURE_V6);
>>> +    set_feature(&cpu->env, ARM_FEATURE_M);
>>
>> What about ARM_FEATURE_THUMB2 (T32)?
> 
> No, the M0 doesn't have Thumb2. It has Thumb1 plus a tiny set
> of 32-bit instructions (which we deal with specially in translate.c).

Oh I thought it as Thumb2, ok.

> 
> (As it happens we generally can't get to the checks on the THUMB2
> feature for a v6M core, so I think but have not checked thoroughly
> that it would make no difference to QEMU's behaviour whether the
> feature bit was set or not.)
> 
>> Peter: Since the M0 (optionally?) supports 32x32 multiply, should this
>> cpu use the ARM_FEATURE_THUMB_DSP feature? Else this might trigger an
>> 'Undefined Instruction' in disas_thumb2_insn().
> 
> ARM_FEATURE_THUMB_DSP only enables checks in disas_thumb2_insn()
> (and 32x32->32 multiply is not one of the insns it gates).
> The only insns in that function that a v6M core can execute are
> msr, mrs, dsb, dmb, isb and bl, none of which are affected by that
> feature switch.

Yes.

> 
>> And what about optional ARM_FEATURE_PMSA?
>> Oh this would be cortex_m0plus_initfn() for "cortex-m0-plus", ok.
> 
> Yep, plain M0 has no MPU (and so we're postponing the work
> of implementing the v6M PMSA, which IIRC isn't quite the
> same as the v7M one).

Thanks for your detailed explanations :)

Regards,

Phil.

  reply	other threads:[~2018-08-10  3:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-25  8:59 [Qemu-devel] [PATCH v3 0/7] arm: add Cortex M0 CPU model and hex file loader Stefan Hajnoczi
2018-07-25  8:59 ` [Qemu-devel] [PATCH v3 1/7] hw/arm: rename armv7m_load_kernel() Stefan Hajnoczi
2018-07-27  4:52   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-07-30 17:30   ` [Qemu-devel] " Peter Maydell
2018-07-25  8:59 ` [Qemu-devel] [PATCH v3 2/7] hw/arm: rename TYPE_ARMV7M to TYPE_ARM_M_PROFILE Stefan Hajnoczi
2018-07-27  4:53   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-07-30 17:29   ` [Qemu-devel] " Peter Maydell
2018-07-25  8:59 ` [Qemu-devel] [PATCH v3 3/7] hw/arm: make bitbanded IO optional on ARM M Profile Stefan Hajnoczi
2018-07-27  4:53   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-07-30 17:33   ` [Qemu-devel] " Peter Maydell
2018-07-31 17:18   ` Peter Maydell
2018-07-25  8:59 ` [Qemu-devel] [PATCH v3 4/7] target/arm: add "cortex-m0" CPU model Stefan Hajnoczi
2018-07-27  5:26   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-07-30 17:51     ` Peter Maydell
2018-08-10  3:37       ` Philippe Mathieu-Daudé [this message]
2018-07-30 17:52   ` [Qemu-devel] " Peter Maydell
2018-08-02  6:47     ` Stefan Hajnoczi
2018-07-25  8:59 ` [Qemu-devel] [PATCH v3 5/7] loader: add rom transaction API Stefan Hajnoczi
2018-07-30 17:57   ` Peter Maydell
2018-07-25  8:59 ` [Qemu-devel] [PATCH v3 6/7] loader: Implement .hex file loader Stefan Hajnoczi
2018-07-30 18:01   ` Peter Maydell
2018-08-02  6:51     ` Stefan Hajnoczi
2018-08-02 12:43     ` Stefan Hajnoczi
2018-08-02 22:04       ` Peter Maydell
2018-08-03 10:32         ` Stefan Hajnoczi
2018-07-25  8:59 ` [Qemu-devel] [PATCH v3 7/7] Add QTest testcase for the Intel Hexadecimal Stefan Hajnoczi
2018-07-27  4:52   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-07-27 23:58     ` Su Hang
2018-08-02  6:53       ` Stefan Hajnoczi
2018-07-25  9:04 ` [Qemu-devel] [PATCH v3 0/7] arm: add Cortex M0 CPU model and hex file loader Stefan Hajnoczi

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=5bec224b-79df-c7ec-be22-38cf53236e00@amsat.org \
    --to=f4bug@amsat.org \
    --cc=alistair@alistair23.me \
    --cc=ilg@livius.net \
    --cc=jim@groklearning.com \
    --cc=joel@jms.id.au \
    --cc=jusual@mail.ru \
    --cc=mail@steffen-goertz.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu.ml@steffen-goertz.de \
    --cc=stefanha@redhat.com \
    --cc=suhang16@mails.ucas.ac.cn \
    --cc=sundeep.lkml@gmail.com \
    /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.