From: junxiao.bi@windriver.com (Junxiao Bi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] ARM: gic: fix big endian support
Date: Tue, 15 Nov 2011 10:06:21 +0800 [thread overview]
Message-ID: <1321322785-2981-2-git-send-email-junxiao.bi@windriver.com> (raw)
In-Reply-To: <1321322785-2981-1-git-send-email-junxiao.bi@windriver.com>
The irq state from gic is in little-endian mode. We need do endian
conversion for it in big-endian machine. Usually byte swapping of
32-bits word needs 4 assembler instructions for arm machine which
arch < 6. But since the high order half word of the irq state is
zero, there is a way that can use lesser instrunctions to improve
the performance since we only need a bytes swaping of half word.
That's what swab16_low_half and swab16_high_half do.
Signed-off-by: Junxiao Bi <junxiao.bi@windriver.com>
---
arch/arm/include/asm/assembler.h | 27 +++++++++++++++++++++++
arch/arm/include/asm/hardware/entry-macro-gic.S | 7 ++++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 29035e8..3ddee22 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -302,4 +302,31 @@
.size \name , . - \name
.endm
+/*
+ * swab16_low_half is used to swap the bytes order of the low order
+ * half word, it assumes that the high order half word is zero.
+ * swab16_high_half is used to swap the bytes order of the high order
+ * half word, it assumes that the low order half word is zero.
+ */
+#if __LINUX_ARM_ARCH__ >= 6
+ .macro swab16_low_half, reg
+ rev \reg, \reg
+ .endm
+
+ .macro swab16_high_half, reg
+ rev \reg, \reg
+ .endm
+#else
+ .macro swab16_low_half, reg
+ mov \reg, \reg, ror #8
+ orr \reg, \reg, \reg, lsr #16
+ bic \reg, \reg, \reg, lsl #16
+ .endm
+
+ .macro swab16_high_half, reg
+ swab16_low_half \reg
+ mov \reg, \reg, lsl #16
+ .endm
+#endif
+
#endif /* __ASM_ASSEMBLER_H__ */
diff --git a/arch/arm/include/asm/hardware/entry-macro-gic.S b/arch/arm/include/asm/hardware/entry-macro-gic.S
index 74ebc80..3453273 100644
--- a/arch/arm/include/asm/hardware/entry-macro-gic.S
+++ b/arch/arm/include/asm/hardware/entry-macro-gic.S
@@ -9,6 +9,7 @@
*/
#include <asm/hardware/gic.h>
+#include <asm/assembler.h>
#ifndef HAVE_GET_IRQNR_PREAMBLE
.macro get_irqnr_preamble, base, tmp
@@ -35,6 +36,9 @@
.macro get_irqnr_and_base, irqnr, irqstat, base, tmp
ldr \irqstat, [\base, #GIC_CPU_INTACK]
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ swab16_low_half \irqstat
+#endif
/* bits 12-10 = src CPU, 9-0 = int # */
ldr \tmp, =1021
@@ -55,6 +59,9 @@
.macro test_for_ipi, irqnr, irqstat, base, tmp
bic \irqnr, \irqstat, #0x1c00
cmp \irqnr, #16
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ swab16_high_half \irqstat
+#endif
strcc \irqstat, [\base, #GIC_CPU_EOI]
cmpcs \irqnr, \irqnr
.endm
--
1.7.0.4
next prev parent reply other threads:[~2011-11-15 2:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-15 2:06 [PATCH 1/6] ARM: fix be8 support for phys/virt address conversion Junxiao Bi
2011-11-15 2:06 ` Junxiao Bi [this message]
2011-11-21 19:11 ` [PATCH 2/6] ARM: gic: fix big endian support Nicolas Pitre
2011-11-22 1:47 ` Bi Junxiao
2011-11-22 4:10 ` Nicolas Pitre
2011-11-22 5:22 ` Bi Junxiao
2011-11-22 10:33 ` Dave Martin
2011-11-23 2:32 ` Bi Junxiao
2011-11-15 2:06 ` [PATCH 3/6] ARM: early_printk: pl01x: " Junxiao Bi
2011-11-15 2:06 ` [PATCH 4/6] ARM: add big endian support for peripheral access Junxiao Bi
2011-11-15 2:06 ` [PATCH 5/6] ARM: Atomic64: fix 64bit ops in BE mode Junxiao Bi
2011-11-21 19:24 ` Nicolas Pitre
2011-11-15 2:06 ` [PATCH 6/6] ARM: support kernel modules in BE8 mode Junxiao Bi
2011-11-21 19:29 ` Nicolas Pitre
2011-11-22 1:32 ` Bi Junxiao
2011-11-22 4:17 ` Nicolas Pitre
2011-11-22 5:27 ` Bi Junxiao
2011-11-22 10:47 ` Dave Martin
2011-11-23 3:30 ` Bi Junxiao
2011-11-21 5:44 ` [PATCH 1/6] ARM: fix be8 support for phys/virt address conversion Bi Junxiao
2011-11-21 18:32 ` Nicolas Pitre
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=1321322785-2981-2-git-send-email-junxiao.bi@windriver.com \
--to=junxiao.bi@windriver.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).