From: Eduardo Habkost <ehabkost@redhat.com>
To: Alistair Francis <alistair23@gmail.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Andrew Jones <drjones@redhat.com>, Rob Herring <robh@kernel.org>,
Igor Mitsyanko <i.mitsyanko@gmail.com>,
Alistair Francis <alistair@alistair23.me>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>, Jan Kiszka <jan.kiszka@web.de>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 6/6] arm: drop intermadiate cpu_model -> cpu type parsing and use cpu type directly
Date: Sat, 9 Sep 2017 17:30:14 -0300 [thread overview]
Message-ID: <20170909203014.GG7570@localhost.localdomain> (raw)
In-Reply-To: <CAKmqyKO4yRz3R0BJ+gz=UfLc0d_AoNtEAHn-SNFMzg3xo12D=Q@mail.gmail.com>
On Tue, Sep 05, 2017 at 03:46:07PM -0700, Alistair Francis wrote:
> On Tue, Sep 5, 2017 at 3:12 PM, Eduardo Habkost <ehabkost@redhat.com> wrote:
> > On Tue, Sep 05, 2017 at 02:47:52PM -0700, Alistair Francis wrote:
> >> On Tue, Sep 5, 2017 at 2:31 PM, Eduardo Habkost <ehabkost@redhat.com> wrote:
> > [...]
> >> >> diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
> >> >> index f61e735..1cd6374 100644
> >> >> --- a/hw/arm/stm32f205_soc.c
> >> >> +++ b/hw/arm/stm32f205_soc.c
> >> >> @@ -112,7 +112,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
> >> >>
> >> >> armv7m = DEVICE(&s->armv7m);
> >> >> qdev_prop_set_uint32(armv7m, "num-irq", 96);
> >> >> - qdev_prop_set_string(armv7m, "cpu-model", s->cpu_model);
> >> >> + qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type);
> >> >> object_property_set_link(OBJECT(&s->armv7m), OBJECT(get_system_memory()),
> >> >> "memory", &error_abort);
> >> >> object_property_set_bool(OBJECT(&s->armv7m), true, "realized", &err);
> >> >> @@ -200,7 +200,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
> >> >> }
> >> >>
> >> >> static Property stm32f205_soc_properties[] = {
> >> >> - DEFINE_PROP_STRING("cpu-model", STM32F205State, cpu_model),
> >> >> + DEFINE_PROP_STRING("cpu-type", STM32F205State, cpu_type),
> >> >
> >> > Same as armv7m: are we 100% sure users are not setting this
> >> > manually?
> >>
> >> In an embedded board like this it really doesn't make sense to let the
> >> user overwrite the CPU. The SoC will take it as an option, but the
> >> board (which creates the SoC) just blindly always uses the same CPU.
> >> That feature is more for QOMificatoion then any real reason though.
> >>
> >
> > I'm not talking about -cpu (no user-visible change in the
> > handling of -cpu should result from this patch), but about
> > possible cases where the user set the "cpu-model" property using
> > another mechanism, like -global. Probably it's impossible for an
> > user to override the property successfully, but I would like to
> > be sure.
>
> Ah, that is trickier.
>
> I guess that is possible to do, but the object setting logic should
> handle the error gracefully and inform the user of the error.
After looking at the code more closely, I think we can be 100%
sure the user doesn't rely on the property, because:
* TYPE_ARMV7M and TYPE_STM32F205_SOC are both sysbus devices
with user_creatable=false, so the user can't instantiate them
directly;
* The only places where those objects are realized inside the
code are:
* mps2_common_init()
* netduino2_init()
* stm32f205_soc_realize()
* armv7m_init()
Those functions always set the "cpu-model" property immediately
before realize.
This means any value set by the user (e.g. using -global) would
be always overwritten before realize.
However, I have a suggestion for Igor: making a separate patch
that renames the existing property to "x-cpu-model", and using
"x-cpu-type" in this series. This way we will explicitly
document the fact that the property is not a stable
user/management interface.
>
> >
> >
> >> In saying that I think a warning if the user tries to set the CPU
> >> would make sense. I know that this issues comes up in other ARM boards
> >> (Zynq-7000 has the same issue as well) so maybe a machine property
> >> saying that the board doesn't accept custom CPUs would be a good idea.
> >
> > Yeah, there are multiple cases in this patch where boards are
> > validating the CPU model, but not all boards do that. A generic
> > MachineClass::valid_cpu_types[] field would be useful.
> >
> >>
> >> Overall I think this patch is moving in the right direction though and
> >> this CPU option being ignored existed before this series.
> >
> > I agree this is going on the right direction. However, I don't
> > see any board that ignore the CPU option: all of them seem to use
> > cpu_model when creating the CPUs, already.
>
> The Netduino2 will ignore any CPU options and always use a Cortex-m3.
> I was wrong about Zynq-7000 though, it does respect the -cpu option.
>
> Thanks,
> Alistair
>
> >
> > --
> > Eduardo
--
Eduardo
next prev parent reply other threads:[~2017-09-09 20:30 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-04 14:00 [Qemu-devel] [PATCH 0/6] generalize parsing of cpu_model (x86/arm) Igor Mammedov
2017-09-04 14:00 ` [Qemu-devel] [PATCH 1/6] qom: cpus: split cpu_generic_init() on feature parsing and cpu creation parts Igor Mammedov
2017-09-04 15:30 ` Philippe Mathieu-Daudé
2017-09-04 14:00 ` [Qemu-devel] [PATCH 2/6] cpu: make cpu_generic_init() abort QEMU on error Igor Mammedov
2017-09-04 15:15 ` Philippe Mathieu-Daudé
2017-09-11 14:30 ` Igor Mammedov
2017-09-05 5:41 ` Thomas Huth
2017-09-05 11:22 ` Eduardo Habkost
2017-09-11 14:51 ` Igor Mammedov
2017-09-05 20:19 ` Eduardo Habkost
2017-09-11 14:23 ` Igor Mammedov
2017-09-04 14:00 ` [Qemu-devel] [PATCH 3/6] cpu: rename cpu_parse_features() to cpu_parse_cpu_model() Igor Mammedov
2017-09-04 15:03 ` Philippe Mathieu-Daudé
2017-09-04 19:06 ` Igor Mammedov
2017-09-05 5:38 ` Thomas Huth
2017-09-11 15:07 ` Igor Mammedov
2017-09-04 14:01 ` [Qemu-devel] [PATCH 4/6] vl.c: convert cpu_model to cpu type and set of global properties before machine_init() Igor Mammedov
2017-09-04 14:01 ` [Qemu-devel] [PATCH 5/6] pc: use generic cpu_model parsing Igor Mammedov
2017-09-04 15:33 ` Philippe Mathieu-Daudé
2017-09-04 14:01 ` [Qemu-devel] [PATCH 6/6] arm: drop intermadiate cpu_model -> cpu type parsing and use cpu type directly Igor Mammedov
2017-09-05 21:31 ` Eduardo Habkost
2017-09-05 21:47 ` Alistair Francis
2017-09-05 22:12 ` Eduardo Habkost
2017-09-05 22:46 ` Alistair Francis
2017-09-06 0:16 ` Alistair Francis
2017-09-09 20:30 ` Eduardo Habkost [this message]
2017-09-09 22:41 ` Peter Maydell
2017-09-09 23:22 ` Eduardo Habkost
2017-09-12 10:22 ` Igor Mammedov
2017-09-12 12:01 ` Eduardo Habkost
2017-09-12 10:53 ` Igor Mammedov
2017-09-12 16:29 ` Alistair Francis
2017-09-12 11:02 ` Igor Mammedov
2017-09-12 12:04 ` Eduardo Habkost
2017-09-12 12:11 ` Igor Mammedov
2017-09-12 12:53 ` Eduardo Habkost
2017-09-12 14:06 ` Igor Mammedov
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=20170909203014.GG7570@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=alistair23@gmail.com \
--cc=alistair@alistair23.me \
--cc=drjones@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=i.mitsyanko@gmail.com \
--cc=imammedo@redhat.com \
--cc=jan.kiszka@web.de \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=robh@kernel.org \
--cc=rth@twiddle.net \
/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).