From: Eugeniy Paltsev <eugeniy.paltsev@synopsys.com>
To: linux-snps-arc@lists.infradead.org,
Vineet Gupta <vineet.gupta1@synopsys.com>
Cc: linux-kernel@vger.kernel.org,
Alexey Brodkin <alexey.brodkin@synopsys.com>,
Eugeniy Paltsev <eugeniy.paltsev@synopsys.com>
Subject: [PATCH 3/5] ARCv2: Enable unaligned access in early ASM code
Date: Tue, 29 Jan 2019 13:49:40 +0300 [thread overview]
Message-ID: <20190129104942.31705-4-Eugeniy.Paltsev@synopsys.com> (raw)
In-Reply-To: <20190129104942.31705-1-Eugeniy.Paltsev@synopsys.com>
Even though we do enable AD bit in arc_init_IRQ() we need to do
it in early ASM code otherwise we may face unaligned data until
we reach arc_init_IRQ() because GCC starting from v8.1.0 actively
generates unaligned data as it assumes that:
* ARCv2 always has support of unaliged data
* This support is turned on in runtime
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
arch/arc/kernel/head.S | 14 ++++++++++++++
arch/arc/kernel/intc-arcv2.c | 2 --
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 8b90d25a15cc..ffe3d384fca5 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -17,6 +17,9 @@
#include <asm/entry.h>
#include <asm/arcregs.h>
#include <asm/cache.h>
+#ifdef CONFIG_ISA_ARCV2
+#include <asm/irqflags-arcv2.h>
+#endif
.macro CPU_EARLY_SETUP
@@ -47,6 +50,17 @@
sr r5, [ARC_REG_DC_CTRL]
1:
+
+ ; Enable / disable HW handling of unaligned access in the CPU.
+#ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS
+ kflag STATUS_AD_MASK
+#else
+ ; Handling of unaligned access is disabled by default but we disable it
+ ; manually in case of any bootloader enabled it earlier.
+ lr r5, [ARC_REG_STATUS32]
+ bclr r5, r5, STATUS_AD_BIT
+ kflag r5
+#endif
.endm
.section .init.text, "ax",@progbits
diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c
index 84b1c7157d1b..6359896da1ea 100644
--- a/arch/arc/kernel/intc-arcv2.c
+++ b/arch/arc/kernel/intc-arcv2.c
@@ -93,8 +93,6 @@ void arc_init_IRQ(void)
/* setup status32, don't enable intr yet as kernel doesn't want */
tmp = read_aux_reg(ARC_REG_STATUS32);
- if (IS_ENABLED(ARC_USE_UNALIGNED_MEM_ACCESS))
- tmp |= STATUS_AD_MASK;
tmp |= ARCV2_IRQ_DEF_PRIO << 1;
tmp &= ~STATUS_IE_MASK;
asm volatile("kflag %0 \n"::"r"(tmp));
--
2.14.5
next prev parent reply other threads:[~2019-01-29 10:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-29 10:49 [PATCH 0/5] introduce unaligned access under a Kconfig option Eugeniy Paltsev
2019-01-29 10:49 ` [PATCH 1/5] ARCv2: lib: memcpy: fix doing prefetchw outside of buffer Eugeniy Paltsev
2019-01-29 10:49 ` [PATCH 2/5] ARCv2: introduce unaligned access under a Kconfig option Eugeniy Paltsev
2019-01-29 21:44 ` Vineet Gupta
2019-01-30 16:44 ` Eugeniy Paltsev
2019-01-30 16:47 ` Vineet Gupta
2019-01-29 10:49 ` Eugeniy Paltsev [this message]
2019-01-29 10:49 ` [PATCH 4/5] ARCv2: use unaligned access in SW Eugeniy Paltsev
2019-01-29 10:49 ` [PATCH 5/5] ARCv2: LIB: MEMCPY: fixed and optimised routine Eugeniy Paltsev
2019-01-29 21:55 ` Vineet Gupta
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=20190129104942.31705-4-Eugeniy.Paltsev@synopsys.com \
--to=eugeniy.paltsev@synopsys.com \
--cc=alexey.brodkin@synopsys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=vineet.gupta1@synopsys.com \
/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).