From: Peter Maydell <peter.maydell@linaro.org>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-arm <qemu-arm@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>,
"patches@linaro.org" <patches@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] arm: Don't crash if user tries to use a Cortex-M CPU without an NVIC
Date: Mon, 11 Jun 2018 16:33:10 +0100 [thread overview]
Message-ID: <CAFEAcA8XC08joMpMgrBD99DSJLW=ri-8gtUpqM9jtFZLHnoxAg@mail.gmail.com> (raw)
In-Reply-To: <20180611172644.5eeef770@redhat.com>
On 11 June 2018 at 16:26, Igor Mammedov <imammedo@redhat.com> wrote:
> On Fri, 1 Jun 2018 17:03:55 +0100
> Peter Maydell <peter.maydell@linaro.org> wrote:
>
>> The Cortex-M CPU and its NVIC are two intimately intertwined parts of
>> the same hardware; it is not possible to use one without the other.
>> Unfortunately a lot of our board models don't do any sanity checking
>> on the CPU type the user asks for, so a command line like
>> qemu-system-arm -M versatilepb -cpu cortex-m3
>> will create an M3 without an NVIC, and coredump immediately.
>> In the other direction, trying a non-M-profile CPU in an M-profile
>> board won't blow up, but doesn't do anything useful either:
>> qemu-system-arm -M lm3s6965evb -cpu arm926
>> +#ifndef CONFIG_USER_ONLY
>> + /* The NVIC and M-profile CPU are two halves of a single piece of
>> + * hardware; trying to use one without the other is a command line
>> + * error and will result in segfaults if not caught here.
>> + */
>> + if (arm_feature(env, ARM_FEATURE_M)) {
>> + if (!env->nvic) {
>> + error_setg(errp, "This board cannot be used with Cortex-M CPUs");
> mentioning board in CPU's realize seems a little bit strange,
> maybe something similar to following would be better:
>
> "Cortex-M CPUs require device_foo for working"
I think the text as I have it is of more practical use to the
user, who is clearly not going to be very familiar with how
M-profile systems work if they've run into this error message.
"requires an NVIC" doesn't tell them what's actually wrong;
"this board doesn't work with this CPU" gives them a fighting
chance of understanding that they've given two incompatible
command line options.
thanks
-- PMM
prev parent reply other threads:[~2018-06-11 15:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-01 16:03 [Qemu-devel] [PATCH] arm: Don't crash if user tries to use a Cortex-M CPU without an NVIC Peter Maydell
2018-06-11 14:05 ` [Qemu-devel] [Qemu-arm] " Peter Maydell
2018-06-11 15:19 ` Philippe Mathieu-Daudé
2018-06-11 15:26 ` [Qemu-devel] " Igor Mammedov
2018-06-11 15:33 ` Peter Maydell [this message]
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='CAFEAcA8XC08joMpMgrBD99DSJLW=ri-8gtUpqM9jtFZLHnoxAg@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=imammedo@redhat.com \
--cc=patches@linaro.org \
--cc=qemu-arm@nongnu.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 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).