* [PATCH v2] powerpc test_emulate_step: fix DS operand in ld encoding to appropriate value
@ 2020-03-11 10:24 Balamuruhan S
2020-03-16 7:58 ` Naveen N. Rao
2020-03-26 12:06 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Balamuruhan S @ 2020-03-11 10:24 UTC (permalink / raw)
To: mpe
Cc: ravi.bangoria, jniethe5, Balamuruhan S, paulus, sandipan,
naveen.n.rao, linuxppc-dev
ld instruction should have 14 bit immediate field (DS) concatenated with
0b00 on the right, encode it accordingly. Introduce macro `IMM_DS()`
to encode DS form instructions with 14 bit immediate field.
Fixes: 4ceae137bdab ("powerpc: emulate_step() tests for load/store instructions")
Reviewed-by: Sandipan Das <sandipan@linux.ibm.com>
Signed-off-by: Balamuruhan S <bala24@linux.ibm.com>
---
arch/powerpc/lib/test_emulate_step.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
changes in v2:
-------------
* squash the commits as per Christophe's review comment
diff --git a/arch/powerpc/lib/test_emulate_step.c b/arch/powerpc/lib/test_emulate_step.c
index 42347067739c..007292a1ad01 100644
--- a/arch/powerpc/lib/test_emulate_step.c
+++ b/arch/powerpc/lib/test_emulate_step.c
@@ -13,19 +13,20 @@
#include <asm/code-patching.h>
#define IMM_L(i) ((uintptr_t)(i) & 0xffff)
+#define IMM_DS(i) ((uintptr_t)(i) & 0xfffc)
/*
* Defined with TEST_ prefix so it does not conflict with other
* definitions.
*/
#define TEST_LD(r, base, i) (PPC_INST_LD | ___PPC_RT(r) | \
- ___PPC_RA(base) | IMM_L(i))
+ ___PPC_RA(base) | IMM_DS(i))
#define TEST_LWZ(r, base, i) (PPC_INST_LWZ | ___PPC_RT(r) | \
___PPC_RA(base) | IMM_L(i))
#define TEST_LWZX(t, a, b) (PPC_INST_LWZX | ___PPC_RT(t) | \
___PPC_RA(a) | ___PPC_RB(b))
#define TEST_STD(r, base, i) (PPC_INST_STD | ___PPC_RS(r) | \
- ___PPC_RA(base) | ((i) & 0xfffc))
+ ___PPC_RA(base) | IMM_DS(i))
#define TEST_LDARX(t, a, b, eh) (PPC_INST_LDARX | ___PPC_RT(t) | \
___PPC_RA(a) | ___PPC_RB(b) | \
__PPC_EH(eh))
base-commit: 5aa19adac1f3152a5fd3b865a1ab46bb845d3696
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] powerpc test_emulate_step: fix DS operand in ld encoding to appropriate value
2020-03-11 10:24 [PATCH v2] powerpc test_emulate_step: fix DS operand in ld encoding to appropriate value Balamuruhan S
@ 2020-03-16 7:58 ` Naveen N. Rao
2020-03-26 12:06 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Naveen N. Rao @ 2020-03-16 7:58 UTC (permalink / raw)
To: Balamuruhan S, mpe
Cc: ravi.bangoria, jniethe5, paulus, sandipan, linuxppc-dev
Balamuruhan S wrote:
> ld instruction should have 14 bit immediate field (DS) concatenated with
> 0b00 on the right, encode it accordingly. Introduce macro `IMM_DS()`
> to encode DS form instructions with 14 bit immediate field.
>
> Fixes: 4ceae137bdab ("powerpc: emulate_step() tests for load/store instructions")
> Reviewed-by: Sandipan Das <sandipan@linux.ibm.com>
> Signed-off-by: Balamuruhan S <bala24@linux.ibm.com>
> ---
> arch/powerpc/lib/test_emulate_step.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
LGTM. We ought to be careful when using TEST_LD() to ensure that the
immediate value is aligned to a word, but since this is for selftests,
we don't need to enforce that.
Long term, we should also consider generalizing the macros across this
and the eBPF codebase so that we can reuse these.
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
- Naveen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] powerpc test_emulate_step: fix DS operand in ld encoding to appropriate value
2020-03-11 10:24 [PATCH v2] powerpc test_emulate_step: fix DS operand in ld encoding to appropriate value Balamuruhan S
2020-03-16 7:58 ` Naveen N. Rao
@ 2020-03-26 12:06 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2020-03-26 12:06 UTC (permalink / raw)
To: Balamuruhan S
Cc: ravi.bangoria, jniethe5, Balamuruhan S, paulus, sandipan,
naveen.n.rao, linuxppc-dev
On Wed, 2020-03-11 at 10:24:05 UTC, Balamuruhan S wrote:
> ld instruction should have 14 bit immediate field (DS) concatenated with
> 0b00 on the right, encode it accordingly. Introduce macro `IMM_DS()`
> to encode DS form instructions with 14 bit immediate field.
>
> Fixes: 4ceae137bdab ("powerpc: emulate_step() tests for load/store instructions")
> Reviewed-by: Sandipan Das <sandipan@linux.ibm.com>
> Signed-off-by: Balamuruhan S <bala24@linux.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/3e74a0e16342626511c43937c120beb990539307
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-26 12:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-11 10:24 [PATCH v2] powerpc test_emulate_step: fix DS operand in ld encoding to appropriate value Balamuruhan S
2020-03-16 7:58 ` Naveen N. Rao
2020-03-26 12:06 ` Michael Ellerman
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).