* Updating the define_machine() structure at runtime?
@ 2011-05-16 16:21 Timur Tabi
2011-05-16 23:37 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2011-05-16 16:21 UTC (permalink / raw)
To: linuxppc-dev
I would like to get some opinions on the following.
I'm working on extending our existing board definition files to support our
ePAPR reference hypervisor. Because our hypervisor provides a virtual PIC, we
need to have different functions for define_machine() structure that related to
the PIC, but most everything else can stay the same.
define_machine(p4080_hv) {
.name = "P4080DS HV",
.probe = p4080hv_probe,
.setup_arch = corenet_ds_setup_arch,
.init_IRQ = fsl_hv_pic_init,
#ifdef CONFIG_PCI
.pcibios_fixup_bus = fsl_pcibios_fixup_bus,
#endif
.get_irq = ehv_pic_get_irq,
.restart = fsl_hv_restart,
.power_off = fsl_hv_halt,
.halt = fsl_hv_halt,
.calibrate_decr = generic_calibrate_decr,
.progress = udbg_progress,
};
Rather than create two such structures for each board that can support the
hypervisor (one with HV support, one without), I would like to do the following
instead. What do you all think?
define_machine(p4080_ds) {
.name = "P4080 DS",
.probe = p4080_ds_probe,
...
.get_irq = mpic_get_coreint_irq,
};
static int __init p4080_ds_probe(void)
{
...
#ifdef CONFIG_FSL_HYPERVISOR
if (of_flat_dt_is_compatible(root, "fsl,P4080DS-hv")) {
mach_p4080_ds.get_irq = ehv_pic_get_irq;
...
return 1;
} else
return 0;
#endif
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Updating the define_machine() structure at runtime?
2011-05-16 16:21 Updating the define_machine() structure at runtime? Timur Tabi
@ 2011-05-16 23:37 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2011-05-16 23:37 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
On Mon, 2011-05-16 at 11:21 -0500, Timur Tabi wrote:
> I would like to get some opinions on the following.
>
> I'm working on extending our existing board definition files to support our
> ePAPR reference hypervisor. Because our hypervisor provides a virtual PIC, we
> need to have different functions for define_machine() structure that related to
> the PIC, but most everything else can stay the same.
.../...
> static int __init p4080_ds_probe(void)
> {
> ...
> #ifdef CONFIG_FSL_HYPERVISOR
> if (of_flat_dt_is_compatible(root, "fsl,P4080DS-hv")) {
> mach_p4080_ds.get_irq = ehv_pic_get_irq;
> ...
> return 1;
> } else
> return 0;
> #endif
One approach i've been taking more often nowadays is to have the PIC
code setup the ppc_md hooks itself.
You don't need to do it in probe(), just in setup_arch or init_IRQ,
wherever you do your PIC discovery, have it set it up.
For example, xics sets get_irq itself, which is necessary because the
xics code itself can have multiple variants.
We could probably make mpic.c do the same when MPIC_PRIMARY is set (or
keep that a wrapper for now).
Cheers,
Ben.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-05-16 23:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-16 16:21 Updating the define_machine() structure at runtime? Timur Tabi
2011-05-16 23:37 ` Benjamin Herrenschmidt
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).