/* Set LM0 to start of key */
        if (load_lm_ptr)
                emit_csr_wr(nfp_prog, reg_b(2 * 2), NFP_CSR_ACT_LM_ADDR0);
+       if (meta->func_id == BPF_FUNC_map_update_elem)
+               emit_csr_wr(nfp_prog, reg_b(3 * 2), NFP_CSR_ACT_LM_ADDR2);
 
        /* Load map ID into a register, it should actually fit as an immediate
         * but in case it doesn't deal with it here, not in the delay slots.
        case BPF_FUNC_xdp_adjust_head:
                return adjust_head(nfp_prog, meta);
        case BPF_FUNC_map_lookup_elem:
+       case BPF_FUNC_map_update_elem:
                return map_call_stack_common(nfp_prog, meta);
        default:
                WARN_ONCE(1, "verifier allowed unsupported function\n");
                        case BPF_FUNC_map_lookup_elem:
                                val = nfp_prog->bpf->helpers.map_lookup;
                                break;
+                       case BPF_FUNC_map_update_elem:
+                               val = nfp_prog->bpf->helpers.map_update;
+                               break;
                        default:
                                pr_err("relocation of unknown helper %d\n",
                                       val);
 
        case BPF_FUNC_map_lookup_elem:
                bpf->helpers.map_lookup = readl(&cap->func_addr);
                break;
+       case BPF_FUNC_map_update_elem:
+               bpf->helpers.map_update = readl(&cap->func_addr);
+               break;
        }
 
        return 0;
 
  *
  * @helpers:           helper addressess for various calls
  * @helpers.map_lookup:                map lookup helper address
+ * @helpers.map_update:                map update helper address
  */
 struct nfp_app_bpf {
        struct nfp_app *app;
 
        struct {
                u32 map_lookup;
+               u32 map_update;
        } helpers;
 };
 
 
 {
        const struct bpf_reg_state *reg1 = cur_regs(env) + BPF_REG_1;
        const struct bpf_reg_state *reg2 = cur_regs(env) + BPF_REG_2;
+       const struct bpf_reg_state *reg3 = cur_regs(env) + BPF_REG_3;
        struct nfp_app_bpf *bpf = nfp_prog->bpf;
        u32 func_id = meta->insn.imm;
 
                                          meta->func_id ? &meta->arg2 : NULL))
                        return -EOPNOTSUPP;
                break;
+
+       case BPF_FUNC_map_update_elem:
+               if (!nfp_bpf_map_call_ok("map_update", env, meta,
+                                        bpf->helpers.map_update, reg1) ||
+                   !nfp_bpf_stack_arg_ok("map_update", env, reg2,
+                                         meta->func_id ? &meta->arg2 : NULL) ||
+                   !nfp_bpf_stack_arg_ok("map_update", env, reg3, NULL))
+                       return -EOPNOTSUPP;
+               break;
        default:
                pr_vlog(env, "unsupported function id: %d\n", func_id);
                return -EOPNOTSUPP;