* [Qemu-devel] ARM cpu object, setting properties from board model
@ 2013-11-19 20:01 Peter Maydell
2013-11-19 20:12 ` Peter Maydell
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Peter Maydell @ 2013-11-19 20:01 UTC (permalink / raw)
To: QEMU Developers, Andreas Färber
I find myself with a use case where I would like to set
a CPU object property from the board model init function
(specifically, I'd like the board model to be able to say
"this CPU will boot via PSCI so if you're KVM then start
it appropriately").
I could just reach in and fiddle with the ARMCPU field
the way hw/arm/highback.c does with reset_cbar (and in fact
that's what I'm likely to do for the moment). However it
seems like it would be nicer for it to be an official
QOM property. This is alas not currently possible because
cpu_arm_init() does both 'init' and 'realize', and once
you've called it it's too late to set properties.
Andreas -- did you have any thoughts/plans/code in this area?
Splitting the realize part out of cpu_arm_init(), or
providing a cpu_arm_init_dont_realize() [ugh], would be
easy to code but is it going in the right direction?
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] ARM cpu object, setting properties from board model
2013-11-19 20:01 [Qemu-devel] ARM cpu object, setting properties from board model Peter Maydell
@ 2013-11-19 20:12 ` Peter Maydell
2013-11-19 20:16 ` Igor Mammedov
2013-11-20 15:19 ` Andreas Färber
2 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2013-11-19 20:12 UTC (permalink / raw)
To: QEMU Developers, Andreas Färber
On 19 November 2013 20:01, Peter Maydell <peter.maydell@linaro.org> wrote:
> I find myself with a use case where I would like to set
> a CPU object property from the board model init function
> (specifically, I'd like the board model to be able to say
> "this CPU will boot via PSCI so if you're KVM then start
> it appropriately").
>
> I could just reach in and fiddle with the ARMCPU field
> the way hw/arm/highback.c does with reset_cbar (and in fact
> that's what I'm likely to do for the moment).
In fact it turns out that I can't do it like this, because
kvm_arch_init_vcpu() gets called as part of realize, so
I really do have to set the field/property after init
but before realize. So much for expediency :-)
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] ARM cpu object, setting properties from board model
2013-11-19 20:01 [Qemu-devel] ARM cpu object, setting properties from board model Peter Maydell
2013-11-19 20:12 ` Peter Maydell
@ 2013-11-19 20:16 ` Igor Mammedov
2013-11-20 15:19 ` Andreas Färber
2 siblings, 0 replies; 5+ messages in thread
From: Igor Mammedov @ 2013-11-19 20:16 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, Andreas Färber
On Tue, 19 Nov 2013 20:01:28 +0000
Peter Maydell <peter.maydell@linaro.org> wrote:
> I find myself with a use case where I would like to set
> a CPU object property from the board model init function
> (specifically, I'd like the board model to be able to say
> "this CPU will boot via PSCI so if you're KVM then start
> it appropriately").
>
> I could just reach in and fiddle with the ARMCPU field
> the way hw/arm/highback.c does with reset_cbar (and in fact
> that's what I'm likely to do for the moment). However it
> seems like it would be nicer for it to be an official
> QOM property. This is alas not currently possible because
> cpu_arm_init() does both 'init' and 'realize', and once
> you've called it it's too late to set properties.
It's possible to use global properties even with cpu_arm_init(),
if it's registered for CPU type before cpu_arm_init() is called.
Than that property would be applied to every new CPU instance
by device_post_init() hook on before object_new() returns.
>
> Andreas -- did you have any thoughts/plans/code in this area?
> Splitting the realize part out of cpu_arm_init(), or
> providing a cpu_arm_init_dont_realize() [ugh], would be
> easy to code but is it going in the right direction?
>
> thanks
> -- PMM
>
--
Regards,
Igor
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] ARM cpu object, setting properties from board model
2013-11-19 20:01 [Qemu-devel] ARM cpu object, setting properties from board model Peter Maydell
2013-11-19 20:12 ` Peter Maydell
2013-11-19 20:16 ` Igor Mammedov
@ 2013-11-20 15:19 ` Andreas Färber
2013-11-20 15:36 ` Peter Maydell
2 siblings, 1 reply; 5+ messages in thread
From: Andreas Färber @ 2013-11-20 15:19 UTC (permalink / raw)
To: Peter Maydell, QEMU Developers; +Cc: Igor Mammedov
Am 19.11.2013 21:01, schrieb Peter Maydell:
> I find myself with a use case where I would like to set
> a CPU object property from the board model init function
> (specifically, I'd like the board model to be able to say
> "this CPU will boot via PSCI so if you're KVM then start
> it appropriately").
>
> I could just reach in and fiddle with the ARMCPU field
> the way hw/arm/highback.c does with reset_cbar (and in fact
> that's what I'm likely to do for the moment). However it
> seems like it would be nicer for it to be an official
> QOM property. This is alas not currently possible because
> cpu_arm_init() does both 'init' and 'realize', and once
> you've called it it's too late to set properties.
>
> Andreas -- did you have any thoughts/plans/code in this area?
> Splitting the realize part out of cpu_arm_init(), or
> providing a cpu_arm_init_dont_realize() [ugh], would be
> easy to code but is it going in the right direction?
My first thought without reviewing the code is to just inline
object_new() followed by object_property_set_bool() in the machine -
that's what I've done for my downstream rl78, where I needed to postpone
realizing the CPU until the firmware blob had been loaded (similar to
armv7m, you may remember pointing me to that example :)).
You are free to split cpu_arm_init() into calling a non-realizing
function, followed by the realization step, then you can reuse that in
multiple places if needed. Mid-term I intend cpu_*_init() to not realize
the CPU - for boards that is waiting on the recursive realization
support, so that only *-user would need to manually realize the CPU.
I would by contrast caution not to blindly use global properties for
cpu_arm_init() since mixed cores are getting more and more common. For
x86 that is much less problematic.
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] ARM cpu object, setting properties from board model
2013-11-20 15:19 ` Andreas Färber
@ 2013-11-20 15:36 ` Peter Maydell
0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2013-11-20 15:36 UTC (permalink / raw)
To: Andreas Färber; +Cc: Igor Mammedov, QEMU Developers
On 20 November 2013 15:19, Andreas Färber <afaerber@suse.de> wrote:
> My first thought without reviewing the code is to just inline
> object_new() followed by object_property_set_bool() in the machine -
> that's what I've done for my downstream rl78, where I needed to postpone
> realizing the CPU until the firmware blob had been loaded (similar to
> armv7m, you may remember pointing me to that example :)).
OK. We're treating cpu_class_by_name() as a public function
(which just happens to only be called by target-* code at the moment)
then? Just opencoding it is probably simplest, then.
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-20 15:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19 20:01 [Qemu-devel] ARM cpu object, setting properties from board model Peter Maydell
2013-11-19 20:12 ` Peter Maydell
2013-11-19 20:16 ` Igor Mammedov
2013-11-20 15:19 ` Andreas Färber
2013-11-20 15:36 ` Peter Maydell
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).