All of lore.kernel.org
 help / color / mirror / Atom feed
From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 01/40] Subject: ARM: mm: proc-macros Add generic proc/cache/tlb struct definition macros
Date: Thu, 7 Jul 2011 11:07:15 +0100	[thread overview]
Message-ID: <20110707100715.GB2486@arm.com> (raw)
In-Reply-To: <20110707082251.GH8286@n2100.arm.linux.org.uk>

On Thu, Jul 07, 2011 at 09:22:51AM +0100, Russell King - ARM Linux wrote:
> On Thu, Jun 23, 2011 at 06:50:09PM +0100, Dave Martin wrote:
> > +.macro define_cache_functions name:req, default:req, \
> > +		flush_kern_dcache_area, dma_map_area, dma_flush_range
> > +	.align 2
> > + 	.type	\name\()_cache_fns, #object
> > +ENTRY(\name\()_cache_fns)
> > +	.long	\default\()_flush_icache_all
> > +	.long	\default\()_flush_kern_cache_all
> > +	.long	\default\()_flush_user_cache_all
> > +	.long	\default\()_flush_user_cache_range
> > +	.long	\default\()_coherent_kern_range
> > +	.long	\default\()_coherent_user_range
> > +	.ifb \flush_kern_dcache_area
> > +		.long	\default\()_flush_kern_dcache_area
> > +	.else
> > +		.long	\flush_kern_dcache_area
> > +	.endif
> > +	.ifb \dma_map_area
> > +		.long	\default\()_dma_map_area
> > +	.else
> > +		.long	\dma_map_area
> > +	.endif
> > +	.long	\default\()_dma_unmap_area
> > +	.ifb \dma_flush_range
> > +		.long	\default\()_dma_flush_range
> > +	.else
> > +		.long	\dma_flush_range
> > +	.endif
> > +	.size	\name\()_cache_fns, . - \name\()_cache_fns
> > +.endm
> 
> This looks wrong.  The flush_kern_dcache_area and DMA stuff can't be
> any different:
> 
> #define __cpuc_flush_icache_all         __glue(_CACHE,_flush_icache_all)
> #define __cpuc_flush_kern_all           __glue(_CACHE,_flush_kern_cache_all)
> #define __cpuc_flush_user_all           __glue(_CACHE,_flush_user_cache_all)
> #define __cpuc_flush_user_range         __glue(_CACHE,_flush_user_cache_range)
> #define __cpuc_coherent_kern_range      __glue(_CACHE,_coherent_kern_range)
> #define __cpuc_coherent_user_range      __glue(_CACHE,_coherent_user_range)
> #define __cpuc_flush_dcache_area        __glue(_CACHE,_flush_kern_dcache_area)
> 
> #define dmac_map_area                   __glue(_CACHE,_dma_map_area)
> #define dmac_unmap_area                 __glue(_CACHE,_dma_unmap_area)
> #define dmac_flush_range                __glue(_CACHE,_dma_flush_range)
> 
> If they don't conform to the "<cachename>_<functionname>" pattern then
> single-cache model kernels will not compile.

I added this override capability purely because some proc-*.S define multiple
sets of cache functions which are mostly common but have some differences.
This facility is actually just used by feroceon and xscale, so you're probably
right -- it may be better to fix those than encourage deviation elsewhere.

If this makes any CPU broken, it must by definition be broken already since
I was very careful to ensure there was no change to symbols or generated
code as a result of these patches.

IIUC, these processors may already not work for a single cache model kernel.
In asm/glue-cache.h, this seems to be acknowledged for feroceon (which defines
MULTI_CACHE unconditionally if CONFIG_CPU_FEROCEON is defined).

For xscale, there is no unconditional MULTI_CACHE, so it looks as though if
a single cache model kernel is built, xscale_dma_map_area may get used
unconditionally instead of xscale_dma_a0_map_area even for the buggy A0/A1
processor revisions.  That won't result in a compile failure, just some
incorrect cache maintenance at runtime -- if so, it looks like a bug.

> As these macros are supposed to be about correctness, they should be
> enforcing that too, and not allowing certain functions to be overriden
> by different names.

I guess I agree with that -- making it too easy to override individual
functions may encourage people to do the wrong thing.  So yes, taking away
that generic override capability the forcing people to define appropriate
aliases in the proc-*.S files sounds like a better approach.

However, we also have the problem that any kenel containing multiple sets
of cache fns needs to have MULTI_CACHE defined; otherwise, a faulty
kernel may be built silently.  I think this only applies to xscale right now,
if I've understood correctly.

The easiest solution to that particular problem would be to define MULTI_CACHE
for xscale unconditionally, as is done for feroceon.

Do you think we need a generic check for such situations?

Cheers
---Dave

  parent reply	other threads:[~2011-07-07 10:07 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-23 17:50 [PATCH v3 00/40] ARM: mm: Add generic macros for declaring various CPU structs Dave Martin
2011-06-23 17:50 ` [PATCH v3 01/40] Subject: ARM: mm: proc-macros Add generic proc/cache/tlb struct definition macros Dave Martin
2011-07-07  8:22   ` Russell King - ARM Linux
2011-07-07  9:32     ` Will Deacon
2011-07-07 10:07     ` Dave Martin [this message]
2011-07-07 10:16       ` Russell King - ARM Linux
2011-07-07 10:25         ` Dave Martin
2011-06-23 17:50 ` [PATCH v3 02/40] Subject: ARM: assembler.h: Add string declaration macro Dave Martin
2011-06-23 17:50 ` [PATCH v3 03/40] Subject: ARM: mm: cache-fa: Use the new processor struct macros Dave Martin
2011-06-23 17:50 ` [PATCH v3 04/40] Subject: ARM: mm: cache-v3: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 05/40] Subject: ARM: mm: cache-v4: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 06/40] Subject: ARM: mm: cache-v4wb: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 07/40] Subject: ARM: mm: cache-v4wt: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 08/40] Subject: ARM: mm: cache-v6: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 09/40] Subject: ARM: mm: cache-v7: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 10/40] Subject: ARM: mm: proc-arm1020: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 11/40] Subject: ARM: mm: proc-arm1020e: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 12/40] Subject: ARM: mm: proc-arm1022: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 13/40] Subject: ARM: mm: proc-arm1026: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 14/40] Subject: ARM: mm: proc-arm6_7: " Dave Martin
2011-07-07  9:10   ` Russell King - ARM Linux
2011-07-07 10:11     ` Dave Martin
2011-06-23 17:50 ` [PATCH v3 15/40] Subject: ARM: mm: proc-arm720: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 16/40] Subject: ARM: mm: proc-arm740: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 17/40] Subject: ARM: mm: proc-arm7tdmi: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 18/40] Subject: ARM: mm: proc-arm920: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 19/40] Subject: ARM: mm: proc-arm922: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 20/40] Subject: ARM: mm: proc-arm925: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 21/40] Subject: ARM: mm: proc-arm926: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 22/40] Subject: ARM: mm: proc-arm940: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 23/40] Subject: ARM: mm: proc-arm946: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 24/40] Subject: ARM: mm: proc-arm9tdmi: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 25/40] Subject: ARM: mm: proc-fa526: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 26/40] Subject: ARM: mm: proc-feroceon: " Dave Martin
2011-07-07  9:14   ` Russell King - ARM Linux
2011-07-07 10:14     ` Dave Martin
2011-06-23 17:50 ` [PATCH v3 27/40] Subject: ARM: mm: proc-mohawk: " Dave Martin
2011-07-07  9:11   ` Russell King - ARM Linux
2011-07-07 10:21     ` Dave Martin
2011-06-23 17:50 ` [PATCH v3 28/40] Subject: ARM: mm: proc-sa110: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 29/40] Subject: ARM: mm: proc-sa1100: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 30/40] Subject: ARM: mm: proc-v6: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 31/40] Subject: ARM: mm: proc-v7: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 32/40] Subject: ARM: mm: proc-xsc3: Use new generic struct definition macros Dave Martin
2011-06-23 17:50 ` [PATCH v3 33/40] Subject: ARM: mm: proc-xscale: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 34/40] Subject: ARM: mm: tlb-fa: Use the new processor struct macros Dave Martin
2011-06-23 17:50 ` [PATCH v3 35/40] Subject: ARM: mm: tlb-v3: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 36/40] Subject: ARM: mm: tlb-v4: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 37/40] Subject: ARM: mm: tlb-v4wb: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 38/40] Subject: ARM: mm: tlb-v4wbi: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 39/40] Subject: ARM: mm: tlb-v6: " Dave Martin
2011-06-23 17:50 ` [PATCH v3 40/40] Subject: ARM: mm: tlb-v7: " Dave Martin
2011-06-23 23:44 ` [PATCH v3 00/40] ARM: mm: Add generic macros for declaring various CPU structs Nicolas Pitre
2011-06-24 10:10   ` Dave Martin
2011-06-24 13:32     ` Nicolas Pitre
2011-06-24 13:54       ` Dave Martin
2011-06-28 10:53 ` Dave Martin
2011-07-01 10:10 ` 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=20110707100715.GB2486@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.