linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Reading twd_base at run-time
@ 2015-03-27 16:16 Mason
  2015-03-27 16:35 ` Marc Zyngier
  0 siblings, 1 reply; 13+ messages in thread
From: Mason @ 2015-03-27 16:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hello everyone,

In arch/arm/kernel/smp_twd.c, twd_local_timer_register() receives a
struct twd_local_timer argument, which specifies

   1) the physical address of twd_base
   2) the twd interrupt number

There's a helper to fill out the static struct: DEFINE_TWD_LOCAL_TIMER()

But it seems to me (please correct me if I'm wrong) that the address
of twd_base can be read at run-time, making it one less parameter to
specify by hand at compile-time (with the risk that a HW engineer
change the address in the next chip with no warning).

Here's an incomplete patch to express my intent:

diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 6591e26..5177db8 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -369,14 +369,14 @@ out_free:
         return err;
  }
  
-int __init twd_local_timer_register(struct twd_local_timer *tlt)
+int __init twd_local_timer_register(void)
  {
         if (twd_base || twd_evt)
                 return -EBUSY;
  
-       twd_ppi = tlt->res[1].start;
+       twd_ppi = 29;
  
-       twd_base = ioremap(tlt->res[0].start, resource_size(&tlt->res[0]));
+       twd_base = ioremap(scu_a9_get_base() + 0x600, 0x10);
         if (!twd_base)
                 return -ENOMEM;
  

As far as I can tell, all platforms use 29 for twd_ppi, but I can make
sure if people agree this patch is indeed an improvement.

Regards.

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-04-01 14:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-27 16:16 Reading twd_base at run-time Mason
2015-03-27 16:35 ` Marc Zyngier
2015-03-27 20:33   ` Mason
2015-03-27 20:53     ` Russell King - ARM Linux
2015-04-01 12:07       ` Mason
2015-04-01 12:12         ` Russell King - ARM Linux
2015-04-01 12:47           ` Mason
2015-04-01 12:28         ` Marc Zyngier
2015-04-01 12:47           ` Mason
2015-04-01 13:01           ` Mason
2015-04-01 13:14             ` Marc Zyngier
2015-04-01 14:39               ` Mason
2015-04-01 14:56                 ` Marc Zyngier

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).