linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/6] ARM: psci: add support for PSCI invocations from the kernel
Date: Tue, 18 Dec 2012 10:11:25 +0000	[thread overview]
Message-ID: <20121218101125.GC9072@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <alpine.LFD.2.02.1212171537230.1263@xanadu.home>

On Mon, Dec 17, 2012 at 08:51:27PM +0000, Nicolas Pitre wrote:
> On Mon, 17 Dec 2012, Will Deacon wrote:
> 
> > This patch adds support for the Power State Coordination Interface
> > defined by ARM, allowing Linux to request CPU-centric power-management
> > operations from firmware implementing the PSCI protocol.
> > 
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> 
> [...]
> 
> > +/*
> > + * The following two functions are invoked via the invoke_psci_fn pointer
> > + * and will not be inlined, allowing us to piggyback on the AAPCS.
> > + */
> 
> To make sure the code is always in sync with the intent, you could mark 
> those with  noinline as well.

Can do.

> > +static int __invoke_psci_fn_hvc(u32 function_id, u32 arg0, u32 arg1, u32 arg2)
> > +{
> > +	asm volatile(
> > +			__asmeq("%0", "r0")
> > +			__asmeq("%1", "r1")
> > +			__asmeq("%2", "r2")
> > +			__asmeq("%3", "r3")
> > +			__HVC(0)
> > +		: "+r" (function_id)
> > +		: "r" (arg0), "r" (arg1), "r" (arg2));
> > +
> > +	return function_id;
> > +}
> > +
> > +static int __invoke_psci_fn_smc(u32 function_id, u32 arg0, u32 arg1, u32 arg2)
> > +{
> > +	asm volatile(
> > +			__asmeq("%0", "r0")
> > +			__asmeq("%1", "r1")
> > +			__asmeq("%2", "r2")
> > +			__asmeq("%3", "r3")
> > +			__SMC(0)
> > +		: "+r" (function_id)
> > +		: "r" (arg0), "r" (arg1), "r" (arg2));
> > +
> > +	return function_id;
> > +}
> > +
> > +static int psci_cpu_suspend(struct psci_power_state state,
> > +			    unsigned long entry_point)
> > +{
> > +	int err;
> > +	u32 fn, power_state;
> > +
> > +	fn = psci_function_id[PSCI_FN_CPU_SUSPEND];
> > +	power_state = psci_power_state_pack(state);
> > +	err = invoke_psci_fn(fn, power_state, (u32)entry_point, 0);
> 
> Why do you need the u32 cast here?

That's a hangover from when entry_point was a void *. I'll fix that, thanks.

> > +static int __init psci_init(void)
> > +{
> > +	struct device_node *np;
> > +	const char *method;
> > +	u32 base, id;
> > +
> > +	np = of_find_matching_node(NULL, psci_of_match);
> > +	if (!np)
> > +		return 0;
> > +
> > +	pr_info("probing function IDs from device-tree\n");
> 
> Having "probing function IDs from device-tree" in the middle of a kernel 
> log isn't very informative.  Better make this more useful or remove it.
> 
> > +
> > +	if (of_property_read_u32(np, "function-base", &base)) {
> > +		pr_warning("missing \"function-base\" property\n");
> 
> Same thing here: this lacks context in a kernel log.
> And so on for the other occurrences.

Actually, these are all prefixed with "psci: " thanks to the pr_fmt
definition at the top of the file. I can remove them if you like, but then
it's not obvious which parts of the PSCI code are available from looking at
a kernel boot log.

Cheers for the review,

Will

  reply	other threads:[~2012-12-18 10:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 16:35 [PATCH v2 0/6] Add support for a fake, para-virtualised machine Will Deacon
2012-12-17 16:35 ` [PATCH v2 1/6] ARM: opcodes: add missing include of linux/linkage.h Will Deacon
2012-12-17 16:35 ` [PATCH v2 2/6] ARM: opcodes: add opcodes definitions for ARM security extensions Will Deacon
2012-12-17 16:35 ` [PATCH v2 3/6] ARM: psci: add devicetree binding for describing PSCI firmware Will Deacon
2012-12-17 20:00   ` Arnd Bergmann
2012-12-18 10:08     ` Will Deacon
2012-12-17 16:35 ` [PATCH v2 4/6] ARM: psci: add support for PSCI invocations from the kernel Will Deacon
2012-12-17 20:51   ` Nicolas Pitre
2012-12-18 10:11     ` Will Deacon [this message]
2012-12-18 21:59       ` Nicolas Pitre
2012-12-19 11:27         ` Will Deacon
2012-12-17 16:35 ` [PATCH v2 5/6] ARM: Dummy Virtual Machine platform support Will Deacon
2012-12-18 12:04   ` [Xen-devel] " Stefano Stabellini
2012-12-18 13:14     ` Will Deacon
2012-12-18 13:32       ` Stefano Stabellini
2012-12-18 18:01       ` Christopher Covington
2012-12-18 18:18         ` Marc Zyngier
2012-12-19 15:25           ` Christopher Covington
2012-12-20 13:12             ` Stefano Stabellini
2012-12-20 13:25               ` Marc Zyngier
2012-12-17 16:35 ` [PATCH v2 6/6] ARM: mach-virt: add SMP support using PSCI Will Deacon
2012-12-17 21:45   ` Nicolas Pitre
2012-12-18 10:49     ` Will Deacon
2012-12-18 12:19   ` [Xen-devel] " Stefano Stabellini
2012-12-18 13:12     ` Marc Zyngier

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=20121218101125.GC9072@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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).