From: Johan Almbladh <johan.almbladh@anyfinetworks.com>
To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
paulburton@kernel.org
Cc: kafai@fb.com, songliubraving@fb.com, yhs@fb.com,
john.fastabend@gmail.com, kpsingh@kernel.org,
tsbogend@alpha.franken.de, chenhuacai@kernel.org,
jiaxun.yang@flygoat.com, yangtiezhu@loongson.cn,
tony.ambardar@gmail.com, bpf@vger.kernel.org,
linux-mips@vger.kernel.org, netdev@vger.kernel.org,
Johan Almbladh <johan.almbladh@anyfinetworks.com>
Subject: [PATCH 2/7] mips: uasm: Add workaround for Loongson-2F nop CPU errata
Date: Tue, 5 Oct 2021 18:54:03 +0200 [thread overview]
Message-ID: <20211005165408.2305108-3-johan.almbladh@anyfinetworks.com> (raw)
In-Reply-To: <20211005165408.2305108-1-johan.almbladh@anyfinetworks.com>
This patch implements a workaround for the Loongson-2F nop in generated,
code, if the existing option CONFIG_CPU_NOP_WORKAROUND is set. Before,
the binutils option -mfix-loongson2f-nop was enabled, but no workaround
was done when emitting MIPS code. Now, the nop pseudo instruction is
emitted as "or ax,ax,zero" instead of the default "sll zero,zero,0". This
is consistent with the workaround implemented by binutils.
Link: https://sourceware.org/legacy-ml/binutils/2009-11/msg00387.html
Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
---
arch/mips/include/asm/uasm.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
index 5efa4e2dc9ab..296bcf31abb5 100644
--- a/arch/mips/include/asm/uasm.h
+++ b/arch/mips/include/asm/uasm.h
@@ -249,7 +249,11 @@ static inline void uasm_l##lb(struct uasm_label **lab, u32 *addr) \
#define uasm_i_bnezl(buf, rs, off) uasm_i_bnel(buf, rs, 0, off)
#define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3)
#define uasm_i_move(buf, a, b) UASM_i_ADDU(buf, a, 0, b)
+#ifdef CONFIG_CPU_NOP_WORKAROUNDS
+#define uasm_i_nop(buf) uasm_i_or(buf, 1, 1, 0)
+#else
#define uasm_i_nop(buf) uasm_i_sll(buf, 0, 0, 0)
+#endif
#define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1)
static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1,
--
2.30.2
next prev parent reply other threads:[~2021-10-05 16:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 16:54 [PATCH 0/7] A new eBPF JIT implementation for MIPS Johan Almbladh
2021-10-05 16:54 ` [PATCH 1/7] MIPS: uasm: Enable muhu opcode for MIPS R6 Johan Almbladh
2021-10-05 16:54 ` Johan Almbladh [this message]
2021-10-05 17:59 ` [PATCH 2/7] mips: uasm: Add workaround for Loongson-2F nop CPU errata Jiaxun Yang
2021-10-18 12:00 ` Maciej W. Rozycki
2021-10-18 12:17 ` Johan Almbladh
2021-10-05 16:54 ` [PATCH 3/7] mips: bpf: Add eBPF JIT for 32-bit MIPS Johan Almbladh
2021-10-05 16:54 ` [PATCH 4/7] mips: bpf: Add new eBPF JIT for 64-bit MIPS Johan Almbladh
2021-10-05 16:54 ` [PATCH 5/7] mips: bpf: Add JIT workarounds for CPU errata Johan Almbladh
2021-10-05 18:00 ` Jiaxun Yang
2022-01-07 9:25 ` Huang Pei
2022-01-07 10:17 ` Daniel Borkmann
2021-10-05 16:54 ` [PATCH 6/7] mips: bpf: Enable eBPF JITs Johan Almbladh
2021-10-05 16:54 ` [PATCH 7/7] mips: bpf: Remove old BPF JIT implementations Johan Almbladh
2021-10-06 14:10 ` [PATCH 0/7] A new eBPF JIT implementation for MIPS patchwork-bot+netdevbpf
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=20211005165408.2305108-3-johan.almbladh@anyfinetworks.com \
--to=johan.almbladh@anyfinetworks.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chenhuacai@kernel.org \
--cc=daniel@iogearbox.net \
--cc=jiaxun.yang@flygoat.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paulburton@kernel.org \
--cc=songliubraving@fb.com \
--cc=tony.ambardar@gmail.com \
--cc=tsbogend@alpha.franken.de \
--cc=yangtiezhu@loongson.cn \
--cc=yhs@fb.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 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.