All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 1/4] ARM: Allow assembler.h to be used with inline asm
       [not found] <20131009161006.GC2306@localhost.localdomain>
@ 2013-10-09 16:54 ` Nicolas Pitre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Pitre @ 2013-10-09 16:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 9 Oct 2013, Dave Martin wrote:

> It could make sense to add the new helper to asm/swab.h, but that might
> result in pollution when it's included via linux/swab.h.

Yet its name is specific enough that this is rather unlikely.  So maybe 
this would be the best compromize.


Nicolas

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

* [RFC PATCH 1/4] ARM: Allow assembler.h to be used with inline asm
       [not found] <20131009171202.GD2306@localhost.localdomain>
@ 2013-10-09 17:27 ` Nicolas Pitre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Pitre @ 2013-10-09 17:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 9 Oct 2013, Dave Martin wrote:

> On Wed, Oct 09, 2013 at 12:54:31PM -0400, Nicolas Pitre wrote:
> > On Wed, 9 Oct 2013, Dave Martin wrote:
> > 
> > > It could make sense to add the new helper to asm/swab.h, but that might
> > > result in pollution when it's included via linux/swab.h.
> > 
> > Yet its name is specific enough that this is rather unlikely.  So maybe 
> > this would be the best compromize.
> 
> You mean the names of the introduced macros?

Yes.


Nicolas

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

* [RFC PATCH 1/4] ARM: Allow assembler.h to be used with inline asm
  2013-10-09 15:00     ` Dave Martin
@ 2013-10-09 15:32       ` Nicolas Pitre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Pitre @ 2013-10-09 15:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 9 Oct 2013, Dave Martin wrote:

> On Wed, Oct 09, 2013 at 03:42:11PM +0100, Russell King - ARM Linux wrote:
> > On Wed, Oct 09, 2013 at 03:29:50PM +0100, Dave Martin wrote:
> > > There are a few things in assembler.h that would be useful with
> > > inline asm, but currently assembler.h refuses to be included into C
> > > files.
> > > 
> > > In particular, the optional feature macros (PLD() and friends) can
> > > be used sensibly with inline asm, with a string argument.
> > > 
> > > This patch enables the relevant parts of aassembler.h to be
> > > included in C files and used in inline asm.
> > > 
> > > Since assembler.h by definition can't be included in any C file up
> > > to now, this should not introduce any namespace clashes.
> > 
> > I think it would be better to move the two macros (PLD and CALGN) out of
> > this file, rather than covering almost the entire file with this #ifdef.
> 
> Certainly we could do that.  When I started this hack, I though that a
> larger proportion of the file would be relevant...
> 
> Any thoughts on a sensible name?  asm/asm-common.h, maybe?

Since there is no need for CALGN() or PLD() in C code yet, maybe it is 
best to leave them where they are for the time being.

And then adding __asm_swab32() to opcodes.h feels quite natural with the 
purpose of that file's content.  Then including that fine to solve the 
CCI code endianness should be fine.

If anything, maybe it is the name opcodes.h which is misrepresenting the 
scope of its content.


Nicolas

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

* [RFC PATCH 1/4] ARM: Allow assembler.h to be used with inline asm
  2013-10-09 14:42   ` Russell King - ARM Linux
@ 2013-10-09 15:00     ` Dave Martin
  2013-10-09 15:32       ` Nicolas Pitre
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Martin @ 2013-10-09 15:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 09, 2013 at 03:42:11PM +0100, Russell King - ARM Linux wrote:
> On Wed, Oct 09, 2013 at 03:29:50PM +0100, Dave Martin wrote:
> > There are a few things in assembler.h that would be useful with
> > inline asm, but currently assembler.h refuses to be included into C
> > files.
> > 
> > In particular, the optional feature macros (PLD() and friends) can
> > be used sensibly with inline asm, with a string argument.
> > 
> > This patch enables the relevant parts of aassembler.h to be
> > included in C files and used in inline asm.
> > 
> > Since assembler.h by definition can't be included in any C file up
> > to now, this should not introduce any namespace clashes.
> 
> I think it would be better to move the two macros (PLD and CALGN) out of
> this file, rather than covering almost the entire file with this #ifdef.

Certainly we could do that.  When I started this hack, I though that a
larger proportion of the file would be relevant...

Any thoughts on a sensible name?  asm/asm-common.h, maybe?

Cheers
---Dave

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

* [RFC PATCH 1/4] ARM: Allow assembler.h to be used with inline asm
  2013-10-09 14:29 ` [RFC PATCH 1/4] ARM: Allow assembler.h to be used with inline asm Dave Martin
@ 2013-10-09 14:42   ` Russell King - ARM Linux
  2013-10-09 15:00     ` Dave Martin
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2013-10-09 14:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 09, 2013 at 03:29:50PM +0100, Dave Martin wrote:
> There are a few things in assembler.h that would be useful with
> inline asm, but currently assembler.h refuses to be included into C
> files.
> 
> In particular, the optional feature macros (PLD() and friends) can
> be used sensibly with inline asm, with a string argument.
> 
> This patch enables the relevant parts of aassembler.h to be
> included in C files and used in inline asm.
> 
> Since assembler.h by definition can't be included in any C file up
> to now, this should not introduce any namespace clashes.

I think it would be better to move the two macros (PLD and CALGN) out of
this file, rather than covering almost the entire file with this #ifdef.

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

* [RFC PATCH 1/4] ARM: Allow assembler.h to be used with inline asm
  2013-10-09 14:29 [RFC PATCH 0/4] ARM: Unify const-swabbing and conditional asm Dave Martin
@ 2013-10-09 14:29 ` Dave Martin
  2013-10-09 14:42   ` Russell King - ARM Linux
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Martin @ 2013-10-09 14:29 UTC (permalink / raw)
  To: linux-arm-kernel

There are a few things in assembler.h that would be useful with
inline asm, but currently assembler.h refuses to be included into C
files.

In particular, the optional feature macros (PLD() and friends) can
be used sensibly with inline asm, with a string argument.

This patch enables the relevant parts of aassembler.h to be
included in C files and used in inline asm.

Since assembler.h by definition can't be included in any C file up
to now, this should not introduce any namespace clashes.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
---
 arch/arm/include/asm/assembler.h |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index fcc1b5b..a71d117 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -16,14 +16,12 @@
 #ifndef __ASM_ASSEMBLER_H__
 #define __ASM_ASSEMBLER_H__
 
-#ifndef __ASSEMBLY__
-#error "Only include this from assembly code"
-#endif
-
 #include <asm/ptrace.h>
 #include <asm/domain.h>
 #include <asm/opcodes-virt.h>
 
+#ifdef __ASSEMBLY__
+
 #define IOMEM(x)	(x)
 
 /*
@@ -53,6 +51,8 @@
 #define put_byte_3      lsl #0
 #endif
 
+#endif /* __ASSEMBLY__ */
+
 /*
  * Data preload for architectures that support it
  */
@@ -77,6 +77,8 @@
 #define CALGN(code...)
 #endif
 
+#ifdef __ASSEMBLY__
+
 /*
  * Enable and disable interrupts
  */
@@ -376,4 +378,6 @@ THUMB(	orr	\reg , \reg , #PSR_T_BIT	)
 #endif
 	.endm
 
+#endif /* __ASSEMBLY__ */
+
 #endif /* __ASM_ASSEMBLER_H__ */
-- 
1.7.9.5

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

end of thread, other threads:[~2013-10-09 17:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20131009161006.GC2306@localhost.localdomain>
2013-10-09 16:54 ` [RFC PATCH 1/4] ARM: Allow assembler.h to be used with inline asm Nicolas Pitre
     [not found] <20131009171202.GD2306@localhost.localdomain>
2013-10-09 17:27 ` Nicolas Pitre
2013-10-09 14:29 [RFC PATCH 0/4] ARM: Unify const-swabbing and conditional asm Dave Martin
2013-10-09 14:29 ` [RFC PATCH 1/4] ARM: Allow assembler.h to be used with inline asm Dave Martin
2013-10-09 14:42   ` Russell King - ARM Linux
2013-10-09 15:00     ` Dave Martin
2013-10-09 15:32       ` Nicolas Pitre

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.