diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-10-08 21:04:12 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-09 09:51:03 -0700 |
commit | 995e101ffa71eff6ae5f5d5bf1ca8ec757b4ed21 (patch) | |
tree | 5d6f71a7fc6b801139b763cf3c75b6adc50da344 /drivers/net/ethernet/netronome/nfp/nfp_asm.h | |
parent | 9f15d0f438372986b0f9de36f805fe2dd83f9c27 (diff) | |
download | linux-995e101ffa71eff6ae5f5d5bf1ca8ec757b4ed21.tar.bz2 |
nfp: bpf: encode extended LM pointer operands
Most instructions have special fields which allow switching
between base and extended Local Memory pointers. Introduce
those to register encoding, we will use the extra LM pointers
to access high addresses of the stack.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/nfp_asm.h')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/nfp_asm.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_asm.h b/drivers/net/ethernet/netronome/nfp/nfp_asm.h index d722f6878bd8..40a51a45afd7 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_asm.h +++ b/drivers/net/ethernet/netronome/nfp/nfp_asm.h @@ -100,6 +100,7 @@ enum br_ctx_signal_state { #define OP_BB_DEFBR 0x00000300000ULL #define OP_BB_ADDR_LO 0x007ffc00000ULL #define OP_BB_ADDR_HI 0x10000000000ULL +#define OP_BB_SRC_LMEXTN 0x40000000000ULL #define OP_BALU_BASE 0x0e800000000ULL #define OP_BA_A_SRC 0x000000003ffULL @@ -115,6 +116,8 @@ enum br_ctx_signal_state { #define OP_IMMED_SHIFT 0x00600000000ULL #define OP_IMMED_BASE 0x0f000000000ULL #define OP_IMMED_WR_AB 0x20000000000ULL +#define OP_IMMED_SRC_LMEXTN 0x40000000000ULL +#define OP_IMMED_DST_LMEXTN 0x80000000000ULL enum immed_width { IMMED_WIDTH_ALL = 0, @@ -139,6 +142,8 @@ enum immed_shift { #define OP_SHF_OP 0x00e00000000ULL #define OP_SHF_DST_AB 0x01000000000ULL #define OP_SHF_WR_AB 0x20000000000ULL +#define OP_SHF_SRC_LMEXTN 0x40000000000ULL +#define OP_SHF_DST_LMEXTN 0x80000000000ULL enum shf_op { SHF_OP_NONE = 0, @@ -161,6 +166,8 @@ enum shf_sc { #define OP_ALU_DST_AB 0x01000000000ULL #define OP_ALU_BASE 0x0a000000000ULL #define OP_ALU_WR_AB 0x20000000000ULL +#define OP_ALU_SRC_LMEXTN 0x40000000000ULL +#define OP_ALU_DST_LMEXTN 0x80000000000ULL enum alu_op { ALU_OP_NONE = 0x00, @@ -189,6 +196,8 @@ enum alu_dst_ab { #define OP_LDF_BMASK 0x0000f000000ULL #define OP_LDF_SHF 0x001f0000000ULL #define OP_LDF_WR_AB 0x20000000000ULL +#define OP_LDF_SRC_LMEXTN 0x40000000000ULL +#define OP_LDF_DST_LMEXTN 0x80000000000ULL #define OP_CMD_A_SRC 0x000000000ffULL #define OP_CMD_CTX 0x00000000300ULL @@ -231,6 +240,8 @@ enum cmd_ctx_swap { #define OP_LCSR_B_SRC 0x000000ffc00ULL #define OP_LCSR_WRITE 0x00000200000ULL #define OP_LCSR_ADDR 0x001ffc00000ULL +#define OP_LCSR_SRC_LMEXTN 0x40000000000ULL +#define OP_LCSR_DST_LMEXTN 0x80000000000ULL enum lcsr_wr_src { LCSR_WR_AREG, @@ -243,7 +254,9 @@ enum lcsr_wr_src { /* Software register representation, independent of operand type */ #define NN_REG_TYPE GENMASK(31, 24) -#define NN_REG_LM_IDX BIT(22) +#define NN_REG_LM_IDX GENMASK(23, 22) +#define NN_REG_LM_IDX_HI BIT(23) +#define NN_REG_LM_IDX_LO BIT(22) #define NN_REG_LM_MOD GENMASK(21, 20) #define NN_REG_VAL GENMASK(7, 0) @@ -285,7 +298,7 @@ static inline swreg __enc_swreg(u16 id, u8 type) static inline swreg __enc_swreg_lm(u8 id, enum nfp_bpf_lm_mode mode, u8 off) { - WARN_ON(id > 1 || (off && mode != NN_LM_MOD_NONE)); + WARN_ON(id > 3 || (off && mode != NN_LM_MOD_NONE)); return (__force swreg)(FIELD_PREP(NN_REG_TYPE, NN_REG_LMEM) | FIELD_PREP(NN_REG_LM_IDX, id) | @@ -310,7 +323,12 @@ static inline u16 swreg_value(swreg reg) static inline bool swreg_lm_idx(swreg reg) { - return FIELD_GET(NN_REG_LM_IDX, swreg_raw(reg)); + return FIELD_GET(NN_REG_LM_IDX_LO, swreg_raw(reg)); +} + +static inline bool swreg_lmextn(swreg reg) +{ + return FIELD_GET(NN_REG_LM_IDX_HI, swreg_raw(reg)); } static inline enum nfp_bpf_lm_mode swreg_lm_mode(swreg reg) @@ -324,6 +342,8 @@ struct nfp_insn_ur_regs { u16 areg, breg; bool swap; bool wr_both; + bool dst_lmextn; + bool src_lmextn; }; struct nfp_insn_re_regs { @@ -333,6 +353,8 @@ struct nfp_insn_re_regs { bool swap; bool wr_both; bool i8; + bool dst_lmextn; + bool src_lmextn; }; int swreg_to_unrestricted(swreg dst, swreg lreg, swreg rreg, |