Cc: Martin Schwidefsky <schwidef...@de.ibm.com>
Cc: Heiko Carstens <heiko.carst...@de.ibm.com>
Signed-off-by: Jiong Wang <jiong.w...@netronome.com>
---
 arch/s390/net/bpf_jit_comp.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 51dd026..8315b2e 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -299,9 +299,11 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 
b1)
 
 #define EMIT_ZERO(b1)                                          \
 ({                                                             \
-       /* llgfr %dst,%dst (zero extend to 64 bit) */           \
-       EMIT4(0xb9160000, b1, b1);                              \
-       REG_SET_SEEN(b1);                                       \
+       if (!fp->aux->verifier_zext) {                          \
+               /* llgfr %dst,%dst (zero extend to 64 bit) */   \
+               EMIT4(0xb9160000, b1, b1);                      \
+               REG_SET_SEEN(b1);                               \
+       }                                                       \
 })
 
 /*
@@ -515,6 +517,13 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, 
struct bpf_prog *fp, int i
                jit->seen |= SEEN_REG_AX;
        switch (insn->code) {
        /*
+        * BPF_ZEXT
+        */
+       case BPF_ALU | BPF_ZEXT: /* dst = (u32) dst */
+               /* llgfr %dst,%dst */
+               EMIT4(0xb9160000, dst_reg, dst_reg);
+               break;
+       /*
         * BPF_MOV
         */
        case BPF_ALU | BPF_MOV | BPF_X: /* dst = (u32) src */
@@ -1282,6 +1291,11 @@ static int bpf_jit_prog(struct bpf_jit *jit, struct 
bpf_prog *fp)
        return 0;
 }
 
+bool bpf_jit_hardware_zext(void)
+{
+       return false;
+}
+
 /*
  * Compile eBPF program "fp"
  */
-- 
2.7.4

Reply via email to