From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: Reading twd_base at run-time
Date: Fri, 27 Mar 2015 20:53:01 +0000 [thread overview]
Message-ID: <20150327205301.GD4019@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <5515BEA5.6040307@free.fr>
On Fri, Mar 27, 2015 at 09:33:41PM +0100, Mason wrote:
> Heya,
>
> On 27/03/2015 17:35, Marc Zyngier wrote:
>
> > Hi Mason,
> >
> > On 27/03/15 16:16, Mason wrote:
> >
> >> 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).
> >
> > The main problem with that is that said HW engineer has ^%$%^%-up
> > PERIPHBASE, and that you can't trust it. I've seen a number of these
> > kicking around.
>
> I don't understand your remark, perhaps mine was unclear?
Mark's reply seems clear to me.
> The value of PERIPHBASE is left to the implementer, right?
> So the HW engineer picks addrA for revA, then changes his
> mind for revB, and picks addrB. No screw-up there, right?
>
> The problem comes when said engineer forgets to notify the
> grunts in software that they're supposed to change
> #define PERIPH_BASE ADDR_A
> to
> #define PERIPH_BASE ADDR_B
> in the header files for revB.
>
> Looking up PERIPH_BASE at run-time through cp15 solves that
> particular issue. Do you disagree?
That's one scenario. Here's the scenario Mark is describing - one which
has real-world examples:
Hardware engineer picks address A for rev A and sets CP15 to address A.
Everything works. Hardware engineer then picks address B for rev B, but
forgets to update CP15. It breaks.
If it's in DT, it can be fixed. It should be there anyway as part of
the hardware description. DT is a description of the hardware.
--
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2015-03-27 20:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=20150327205301.GD4019@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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).