From: thomas.petazzoni@free-electrons.com (Thomas Petazzoni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/8] arm: mvebu: don't hardcode a physical address in headsmp.S
Date: Thu, 6 Jun 2013 12:27:45 +0200 [thread overview]
Message-ID: <20130606122745.3c94d43e@skate> (raw)
In-Reply-To: <20130606091327.GF15208@mudshark.cambridge.arm.com>
Dear Will Deacon,
On Thu, 6 Jun 2013 10:13:27 +0100, Will Deacon wrote:
> > + struct resource res;
> > pr_info("Initializing Coherency fabric\n");
> > + of_address_to_resource(np, 0, &res);
> > + coherency_phys_base = res.start;
>
> So you have the primary CPU writing this address, before it is
> coherent...
[...]
> > ENTRY(armada_xp_secondary_startup)
> > + /* Get coherency fabric base physical address */
> > + adr r0, 1f
> > + ldmia r0, {r1, r2}
> > + sub r0, r0, r1
> > + add r2, r2, r0
> > + ldr r0, [r2]
>
> ... and the secondaries reading it, before they are coherent.
> How do you ensure that the write is indeed visible?
Indeed. As discussed on IRC, I've fixed that by adding a sync_cache_w()
on the coherency_phys_base variable after it has been updated by the
boot CPU. By the time the secondary CPUs read their value, the MMU is
not enabled, so the caches aren't enabled, so they are directly seeing
the contents of the memory. So hopefully, this should solve your
concern.
> Furthermore, it's worth noting that of_find_matching_node takes the
> devtree_lock spinlock, so you need to be careful calling that if
> you're not coherent.
Also as discussed on IRC, we're not coherent with regard to the
secondary CPUs, but those other CPUs have not started yet. And being
part of the coherency unit is apparently not required for strex and al.
to operate properly.
I've just sent a v2 of this patch that adds the sync_cache_w(), and
also adjust the assembly code as per the suggestions of Nicolas Pitre.
Thanks for your comments!
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2013-06-06 10:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-05 7:04 [PATCH 0/8] Support Marvell bootloaders remapping registers at different locations Thomas Petazzoni
2013-06-05 7:04 ` [PATCH 1/8] arm: mvebu: remove dependency of SMP init on static I/O mapping Thomas Petazzoni
2013-06-05 7:04 ` [PATCH 2/8] arm: mvebu: avoid hardcoded virtual address in coherency code Thomas Petazzoni
2013-06-05 7:04 ` [PATCH 3/8] arm: mvebu: move cache and mvebu-mbus initialization later Thomas Petazzoni
2013-06-05 7:04 ` [PATCH 4/8] arm: mvebu: remove hardcoded static I/O mapping Thomas Petazzoni
2013-06-05 7:04 ` [PATCH 5/8] arm: mvebu: don't hardcode a physical address in headsmp.S Thomas Petazzoni
2013-06-05 20:42 ` Nicolas Pitre
2013-06-05 21:33 ` Thomas Petazzoni
2013-06-06 9:13 ` Will Deacon
2013-06-06 10:27 ` Thomas Petazzoni [this message]
2013-06-06 10:24 ` [PATCH v2] " Thomas Petazzoni
2013-06-06 12:45 ` Will Deacon
2013-06-06 16:49 ` Nicolas Pitre
2013-06-06 17:59 ` Jason Cooper
2013-06-05 7:04 ` [PATCH 6/8] arm: mvebu: don't hardcode the physical address for mvebu-mbus Thomas Petazzoni
2013-06-05 7:05 ` [PATCH 7/8] arm: mvebu: add another earlyprintk Kconfig option Thomas Petazzoni
2013-06-05 13:45 ` Jason Cooper
2013-06-05 13:47 ` Thomas Petazzoni
2013-06-05 14:07 ` Jason Cooper
2013-06-05 7:05 ` [PATCH 8/8] arm: mvebu: disable DEBUG_LL/EARLY_PRINTK in defconfig Thomas Petazzoni
2013-06-05 8:34 ` [PATCH 0/8] Support Marvell bootloaders remapping registers at different locations Arnd Bergmann
2013-06-05 21:01 ` Jason Cooper
2013-06-06 18:02 ` Jason Cooper
2013-06-07 7:45 ` Thomas Petazzoni
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=20130606122745.3c94d43e@skate \
--to=thomas.petazzoni@free-electrons.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).