linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] ARM: reset: add reset functionality for jumping to a physical address
Date: Wed, 8 Jun 2011 17:24:29 +0100	[thread overview]
Message-ID: <20110608162429.GA28436@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1106081707040.11513@localhost6.localdomain6>

On Wed, Jun 08, 2011 at 05:10:05PM +0100, Frank Hofmann wrote:
> 
> 
> On Wed, 8 Jun 2011, Will Deacon wrote:
> 
> >On Wed, Jun 08, 2011 at 04:55:11PM +0100, Frank Hofmann wrote:
> >>
> >>
> >>On Tue, 7 Jun 2011, Frank Hofmann wrote:
> >>
> >>>
> >>>
> >>>On Tue, 7 Jun 2011, Dave Martin wrote:
> >>[ ... ]
> >>>>How about:
> >>>>
> >>>>	typeof(cpu_reset) *phys_reset =
> >>>>		(typeof(cpu_reset) *)virt_to_phys(cpu_reset);
> >>>
> >>>Function pointers ;-)
> >>>Thanks.
> >>
> >>Hmmm ...
> >>
> >>Just found a problem with this.
> >>
> >>If you have a MULTI_CPU config, this doesn't compile. For two reasons:
> >>
> >>1. you cannot use cpu_reset as argument to virt_to_phys because you can't
> >>    take the address
> >>    That bit can be fixed by changing the MULTI_CPU #define in
> >>    <asm/proc-fns.h> not to include the macro argument.
> >>    (There is no code in the arm tree using cpu_reset_whatever names which
> >>    would break from that change ... still, not that nice)
> >>
> >>2. even when you do that, you loose the "typeof()" information and the
> >>    above still doesn't compile.
> >>
> >>Only a manual type override,
> >>
> >> 	void (*phys_reset)(unsigned long) = (void (*)(unsigned long))cpu_reset;
> >>
> >>is accepted then.
> >
> >Damn, yes, I assumed the MULTI_CPU case would just pointer at the structure field,
> >but it takes the argument as parameter for the invocation. Oh well, I'll hardcode
> >the type after all then!
> 
> It's not just that - the worse bit is that as long as the #define
> looks like:
> 
> #define	cpu_reset(addr)		processor.reset(addr)
> 
> compile is being refused; one has to ditch the argument part of the
> macro to be able to take the address.
> 
> I'm unsure how desirable that change is; it's got the unwanted
> consequence that people who decide to use function names like
> "graphics_cpu_reset" or "cpu_reset_specialregisters" would fall flat
> on their face.

The preprocessor won't expand a macro name unless it appears as a separate
token, surely?

So if I have

#define cpu_reset processor.reset

then 

	cpu_reset(graphics_cpu_reset)

expands to

	processor.reset(graphics_cpu_reset)

Which is the intention (even if it's a stupid example)

Cheers
---Dave

  parent reply	other threads:[~2011-06-08 16:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06 17:04 [PATCH 0/6] MMU disabling code and kexec fixes Will Deacon
2011-06-06 17:04 ` [PATCH 1/6] ARM: l2x0: fix disabling function to avoid livelock Will Deacon
2011-06-06 17:04 ` [PATCH 2/6] ARM: l2x0: fix invalidate-all " Will Deacon
2011-06-06 17:04 ` [PATCH 3/6] ARM: proc-v7: add definition of cpu_reset for ARMv7 cores Will Deacon
2011-06-06 17:04 ` [PATCH 4/6] ARM: reset: add reset functionality for jumping to a physical address Will Deacon
2011-06-07 11:22   ` Frank Hofmann
2011-06-07 11:37     ` Frank Hofmann
2011-06-07 13:22       ` Will Deacon
2011-06-07 13:54         ` Frank Hofmann
2011-06-07 15:36           ` Dave Martin
2011-06-07 16:21             ` Frank Hofmann
2011-06-08 15:55               ` Frank Hofmann
2011-06-08 16:05                 ` Will Deacon
2011-06-08 16:10                   ` Frank Hofmann
2011-06-08 16:14                     ` Will Deacon
2011-06-08 16:24                     ` Dave Martin [this message]
2011-06-09 10:00                       ` Frank Hofmann
2011-06-09 10:06                         ` Will Deacon
2011-06-06 17:04 ` [PATCH 5/6] ARM: kexec: use arm_machine_reset for branching to the reboot buffer Will Deacon
2011-06-06 17:04 ` [PATCH 6/6] ARM: stop: execute platform callback from cpu_stop code Will Deacon

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=20110608162429.GA28436@arm.com \
    --to=dave.martin@linaro.org \
    --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).