linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: <linuxppc-dev@lists.ozlabs.org>
Subject: Updating the define_machine() structure at runtime?
Date: Mon, 16 May 2011 11:21:41 -0500	[thread overview]
Message-ID: <4DD14F15.5070902@freescale.com> (raw)

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

             reply	other threads:[~2011-05-16 16:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-16 16:21 Timur Tabi [this message]
2011-05-16 23:37 ` Updating the define_machine() structure at runtime? Benjamin Herrenschmidt

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=4DD14F15.5070902@freescale.com \
    --to=timur@freescale.com \
    --cc=linuxppc-dev@lists.ozlabs.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).