From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 06/18] arm: msm: implement proper dmb() for 7x27
Date: Tue, 12 Jan 2010 00:01:42 +0000 [thread overview]
Message-ID: <20100112000142.GO7925@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1263253516.26505.42.camel@c-dwalke-linux.qualcomm.com>
On Mon, Jan 11, 2010 at 03:45:16PM -0800, Daniel Walker wrote:
> On Mon, 2010-01-11 at 23:39 +0000, Russell King - ARM Linux wrote:
> > On Mon, Jan 11, 2010 at 02:47:25PM -0800, Daniel Walker wrote:
> > > From: Larry Bassel <lbassel@quicinc.com>
> > >
> > > For 7x27 it is necessary to write to strongly
> > > ordered memory after executing the coprocessor 15
> > > instruction dmb instruction.
> > >
> > > This is only for data barrier dmb().
> > > Note that the test for 7x27 is done on all MSM platforms
> > > (even ones such as 7201a whose kernel is distinct from
> > > that of 7x25/7x27).
> > >
> > > Acked-by: Willie Ruan <wruan@quicinc.com>
> > > Signed-off-by: Larry Bassel <lbassel@quicinc.com>
> > > Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
> >
> > Can only see half of this change - what's the actual implementation of
> > arch_barrier_extra()?
> >
> > I'd prefer not to include asm/memory.h into asm/system.h to avoid
> > needlessly polluting headers.
>
> I don't have a real patch for it yet, but here are the pieces ..
>
> +#define arch_barrier_extra() do \
> + { if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa()) \
> + write_to_strongly_ordered_memory(); \
> + } while (0)
>
> (btw, the machine types above registered either..)
Hmm. We can do far better than this. Rather than do two tests and call
a function, wouldn't it be better to do something like:
#ifdef CONFIG_ARM_DMB_MEM
extern int *dmb_mem;
#define dmb_extra() do { if (dmb_mem) *dmb_mem = 0; } while (0)
#else
#define dmb_extra() do { } while (0)
#endif
in asm/system.h, and only set dmb_mem for the affected platforms?
> static void map_zero_page_strongly_ordered(void)
> {
> if (zero_page_strongly_ordered)
> return;
>
> zero_page_strongly_ordered =
> ioremap_strongly_ordered(page_to_pfn(empty_zero_page)
> << PAGE_SHIFT, PAGE_SIZE);
This can't work. You're not allowed to map the same memory with differing
memory types from ARMv7. This ends up mapping 'empty_zero_page' as both
cacheable memory and strongly ordered. That's illegal according to the
ARM ARM.
You need to find something else to map - allocating a page of system
memory for this won't work either (it'll have the same issue.)
(This is a new problem to the ARM architecture, one which we're only just
getting to grips with - many of our old tricks with remapping DMA memory
no longer work on these latest CPUs. You really must not take the
remapping which the kernel does today as a good idea anymore.)
> void flush_axi_bus_buffer(void)
> {
> __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
> : : "r" (0) : "memory");
> write_to_strongly_ordered_memory();
Isn't this just one of your modified dmb()s ?
> }
>
> void *alloc_bootmem_aligned(unsigned long size, unsigned long alignment)
> {
> void *unused_addr = NULL;
> unsigned long addr, tmp_size, unused_size;
>
> /* Allocate maximum size needed, see where it ends up.
> * Then free it -- in this path there are no other allocators
> * so we can depend on getting the same address back
> * when we allocate a smaller piece that is aligned
> * at the end (if necessary) and the piece we really want,
> * then free the unused first piece.
> */
>
> tmp_size = size + alignment - PAGE_SIZE;
> addr = (unsigned long)alloc_bootmem(tmp_size);
> free_bootmem(__pa(addr), tmp_size);
>
> unused_size = alignment - (addr % alignment);
> if (unused_size)
> unused_addr = alloc_bootmem(unused_size);
>
> addr = (unsigned long)alloc_bootmem(size);
> if (unused_size)
> free_bootmem(__pa(unused_addr), unused_size);
>
> return (void *)addr;
Erm, there is __alloc_bootmem(size, align, 0) - the bootmem allocator
already does alignment.
next prev parent reply other threads:[~2010-01-12 0:01 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 22:47 [RFC 00/18] generic arm needed for msm Daniel Walker
2010-01-11 22:47 ` [RFC 01/18] arm: msm: allow ARCH_MSM to have v7 cpus Daniel Walker
2010-01-11 22:47 ` [RFC 02/18] arm: msm: add oprofile pmu support Daniel Walker
2010-01-11 22:47 ` [RFC 03/18] arm: boot: remove old ARM ID for QSD Daniel Walker
2010-01-15 21:26 ` Russell King - ARM Linux
2010-01-11 22:47 ` [RFC 04/18] arm: cache-l2x0: add l2x0 suspend and resume functions Daniel Walker
2010-01-11 23:44 ` Russell King - ARM Linux
2010-01-12 0:52 ` Ruan, Willie
2010-01-11 22:47 ` [RFC 05/18] arm: msm: implement ioremap_strongly_ordered Daniel Walker
2010-01-11 23:37 ` Russell King - ARM Linux
2010-01-28 23:04 ` Larry Bassel
2010-02-03 14:59 ` Russell King - ARM Linux
2010-01-11 22:47 ` [RFC 06/18] arm: msm: implement proper dmb() for 7x27 Daniel Walker
2010-01-11 23:39 ` Russell King - ARM Linux
2010-01-11 23:45 ` Daniel Walker
2010-01-12 0:01 ` Russell King - ARM Linux [this message]
2010-01-19 17:28 ` Jamie Lokier
2010-01-19 18:04 ` Russell King - ARM Linux
2010-01-19 21:12 ` Jamie Lokier
2010-01-19 23:11 ` Russell King - ARM Linux
2010-01-19 17:16 ` Jamie Lokier
2010-01-11 22:47 ` [RFC 07/18] arm: mm: retry on QSD icache parity errors Daniel Walker
2010-01-18 18:42 ` Ashwin Chaugule
2010-01-19 16:16 ` Ashwin Chaugule
2010-01-11 22:47 ` [RFC 08/18] arm: msm: set L2CR1 to enable prefetch and burst on Scorpion Daniel Walker
2010-01-11 23:45 ` Russell King - ARM Linux
2010-01-12 10:51 ` [RFC 08/18] arm: msm: set L2CR1 to enable prefetch and burston Scorpion Catalin Marinas
2010-01-12 11:23 ` Shilimkar, Santosh
2010-01-12 11:44 ` Russell King - ARM Linux
2010-01-12 13:32 ` [RFC 08/18] arm: msm: set L2CR1 to enable prefetch and burstonScorpion Catalin Marinas
2010-01-12 13:58 ` Russell King - ARM Linux
2010-01-12 14:41 ` [RFC 08/18] arm: msm: set L2CR1 to enable prefetch andburstonScorpion Catalin Marinas
2010-01-12 18:23 ` Daniel Walker
2010-01-13 10:36 ` Catalin Marinas
2010-01-19 17:38 ` Jamie Lokier
2010-01-13 6:14 ` [RFC 08/18] arm: msm: set L2CR1 to enable prefetch and burstonScorpion Shilimkar, Santosh
2010-01-12 20:21 ` [RFC 08/18] arm: msm: set L2CR1 to enable prefetch and burston Scorpion Nicolas Pitre
2010-01-11 22:47 ` [RFC 09/18] arm: mm: support error reporting in L1/L2 caches on QSD Daniel Walker
2010-01-11 22:47 ` [RFC 10/18] arm: mm: enable L2X0 to use L2 cache on MSM7X27 Daniel Walker
2010-01-11 22:47 ` [RFC 11/18] arm: msm: add ARCH_MSM_SCORPION to CPU_V7 Daniel Walker
2010-01-11 23:13 ` Russell King - ARM Linux
2010-01-11 23:17 ` Daniel Walker
2010-01-11 22:47 ` [RFC 12/18] arm: msm: Enable frequency scaling Daniel Walker
2010-01-11 22:47 ` [RFC 13/18] arm: msm: define HAVE_CLK for ARCH_MSM Daniel Walker
2010-01-11 22:47 ` [RFC 14/18] arm: msm: add v7 support for compiler version-4.1.1 Daniel Walker
2010-01-11 23:07 ` Russell King - ARM Linux
2010-01-11 22:47 ` [RFC 15/18] arm: vfp: Add additional vfp interfaces Daniel Walker
2010-01-11 22:47 ` [RFC 16/18] arm: msm: add arch_has_speculative_dfetch() Daniel Walker
2010-01-11 23:33 ` Russell King - ARM Linux
2010-01-12 0:28 ` Daniel Walker
2010-01-12 8:59 ` Russell King - ARM Linux
2010-01-11 22:47 ` [RFC 17/18] arm: mm: Add SW emulation for ARM domain manager feature Daniel Walker
2010-01-25 16:40 ` Catalin Marinas
2010-01-25 17:04 ` Nicolas Pitre
2010-01-25 18:25 ` Daniel Walker
2010-03-22 18:11 ` Daniel Walker
2010-03-22 18:58 ` Nicolas Pitre
2010-03-22 20:01 ` Daniel Walker
2010-03-22 20:32 ` Nicolas Pitre
2010-03-23 10:04 ` Catalin Marinas
2010-01-11 22:47 ` [RFC 18/18] arm: mm: qsd8x50: Fix incorrect permission faults Daniel Walker
2010-01-11 23:11 ` Russell King - ARM Linux
2010-01-19 17:10 ` Jamie Lokier
2010-01-19 17:33 ` Daniel Walker
2010-01-19 17:43 ` Jamie Lokier
2010-01-19 17:49 ` Daniel Walker
2010-01-19 18:09 ` Russell King - ARM Linux
2010-02-04 0:09 ` David Brown
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=20100112000142.GO7925@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).