Skip to contentSkip to conversation

arch/powerpc/net/bpf_jit_comp32.c:153:7: error: implicit declaration of function 'PPC_RAW_LI32'; did you mean 'PPC_RAW_LI'?

PATCH kernel test robot 1 participant 1 message Apr 7

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://github.com/linuxppc/linux next-test
head:   e1f7a0e196e293c223a882788c6d1a884d06d6d8
commit: 92258b5bf1ec10204c23a793793a65dc92d17014 [41/45] powerpc32/bpf: Add fsession support
config: powerpc-randconfig-001-20260404 (https://download.01.org/0day-ci/archive/20260404/[email protected]/config)
compiler: powerpc-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260404/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from arch/powerpc/net/bpf_jit_comp32.c:19:
arch/powerpc/net/bpf_jit_comp32.c: In function 'store_func_meta':

>> arch/powerpc/net/bpf_jit_comp32.c:153:7: error: implicit declaration of function 'PPC_RAW_LI32'; did you mean 'PPC_RAW_LI'? [-Werror=implicit-function-declaration]
     EMIT(PPC_RAW_LI32(bpf_to_ppc(TMP_REG), (u32)func_meta));
          ^~~~~~~~~~~~
   arch/powerpc/net/bpf_jit.h:30:27: note: in definition of macro 'PLANT_INSTR'
     do { if (d) { (d)[idx] = instr; } idx++; } while (0)
                              ^~~~~
   arch/powerpc/net/bpf_jit_comp32.c:153:2: note: in expansion of macro 'EMIT'
     EMIT(PPC_RAW_LI32(bpf_to_ppc(TMP_REG), (u32)func_meta));
     ^~~~

cc1: some warnings being treated as errors

vim +153 arch/powerpc/net/bpf_jit_comp32.c

    18	
  > 19	#include "bpf_jit.h"
    20	
    21	/*
    22	 * Stack layout:
    23	 *
    24	 *		[	prev sp		] <-------------
    25	 *		[   nv gpr save area	] 16 * 4	|
    26	 * fp (r31) -->	[   ebpf stack space	] upto 512	|
    27	 *		[     frame header	] 16		|
    28	 * sp (r1) --->	[    stack pointer	] --------------
    29	 */
    30	
    31	/* for gpr non volatile registers r17 to r31 (14) + tail call */
    32	#define BPF_PPC_STACK_SAVE	(15 * 4 + 4)
    33	/* stack frame, ensure this is quadword aligned */
    34	#define BPF_PPC_STACKFRAME(ctx)	(STACK_FRAME_MIN_SIZE + BPF_PPC_STACK_SAVE + (ctx)->stack_size)
    35	
    36	#define PPC_EX32(r, i)		EMIT(PPC_RAW_LI((r), (i) < 0 ? -1 : 0))
    37	
    38	/* PPC NVR range -- update this if we ever use NVRs below r17 */
    39	#define BPF_PPC_NVR_MIN		_R17
    40	#define BPF_PPC_TC		_R16
    41	
    42	/* BPF register usage */
    43	#define TMP_REG			(MAX_BPF_JIT_REG + 0)
    44	
    45	/* BPF to ppc register mappings */
    46	void bpf_jit_init_reg_mapping(struct codegen_context *ctx)
    47	{
    48		/* function return value */
    49		ctx->b2p[BPF_REG_0] = _R12;
    50		/* function arguments */
    51		ctx->b2p[BPF_REG_1] = _R4;
    52		ctx->b2p[BPF_REG_2] = _R6;
    53		ctx->b2p[BPF_REG_3] = _R8;
    54		ctx->b2p[BPF_REG_4] = _R10;
    55		ctx->b2p[BPF_REG_5] = _R22;
    56		/* non volatile registers */
    57		ctx->b2p[BPF_REG_6] = _R24;
    58		ctx->b2p[BPF_REG_7] = _R26;
    59		ctx->b2p[BPF_REG_8] = _R28;
    60		ctx->b2p[BPF_REG_9] = _R30;
    61		/* frame pointer aka BPF_REG_10 */
    62		ctx->b2p[BPF_REG_FP] = _R18;
    63		/* eBPF jit internal registers */
    64		ctx->b2p[BPF_REG_AX] = _R20;
    65		ctx->b2p[TMP_REG] = _R31;		/* 32 bits */
    66	}
    67	
    68	static int bpf_jit_stack_offsetof(struct codegen_context *ctx, int reg)
    69	{
    70		if ((reg >= BPF_PPC_NVR_MIN && reg < 32) || reg == BPF_PPC_TC)
    71			return BPF_PPC_STACKFRAME(ctx) - 4 * (32 - reg);
    72	
    73		WARN(true, "BPF JIT is asking about unknown registers, will crash the stack");
    74		/* Use the hole we have left for alignment */
    75		return BPF_PPC_STACKFRAME(ctx) - 4;
    76	}
    77	
    78	#define SEEN_VREG_MASK		0x1ff80000 /* Volatile registers r3-r12 */
    79	#define SEEN_NVREG_FULL_MASK	0x0003ffff /* Non volatile registers r14-r31 */
    80	#define SEEN_NVREG_TEMP_MASK	0x00001e01 /* BPF_REG_5, BPF_REG_AX, TMP_REG */
    81	
    82	static inline bool bpf_has_stack_frame(struct codegen_context *ctx)
    83	{
    84		/*
    85		 * We only need a stack frame if:
    86		 * - we call other functions (kernel helpers), or
    87		 * - we use non volatile registers, or
    88		 * - we use tail call counter
    89		 * - the bpf program uses its stack area
    90		 * The latter condition is deduced from the usage of BPF_REG_FP
    91		 */
    92		return ctx->seen & (SEEN_FUNC | SEEN_TAILCALL | SEEN_NVREG_FULL_MASK) ||
    93		       bpf_is_seen_register(ctx, bpf_to_ppc(BPF_REG_FP));
    94	}
    95	
    96	void bpf_jit_realloc_regs(struct codegen_context *ctx)
    97	{
    98		unsigned int nvreg_mask;
    99	
   100		if (ctx->seen & SEEN_FUNC)
   101			nvreg_mask = SEEN_NVREG_TEMP_MASK;
   102		else
   103			nvreg_mask = SEEN_NVREG_FULL_MASK;
   104	
   105		while (ctx->seen & nvreg_mask &&
   106		      (ctx->seen & SEEN_VREG_MASK) != SEEN_VREG_MASK) {
   107			int old = 32 - fls(ctx->seen & (nvreg_mask & 0xaaaaaaab));
   108			int new = 32 - fls(~ctx->seen & (SEEN_VREG_MASK & 0xaaaaaaaa));
   109			int i;
   110	
   111			for (i = BPF_REG_0; i <= TMP_REG; i++) {
   112				if (ctx->b2p[i] != old)
   113					continue;
   114				ctx->b2p[i] = new;
   115				bpf_set_seen_register(ctx, new);
   116				bpf_clear_seen_register(ctx, old);
   117				if (i != TMP_REG) {
   118					bpf_set_seen_register(ctx, new - 1);
   119					bpf_clear_seen_register(ctx, old - 1);
   120				}
   121				break;
   122			}
   123		}
   124	}
   125	
   126	void prepare_for_fsession_fentry(u32 *image, struct codegen_context *ctx, int cookie_cnt,
   127							int cookie_off, int retval_off)
   128	{
   129		/*
   130		 * Set session cookies value
   131		 * Clear cookies field on stack
   132		 * Ensure retval to be cleared on fentry
   133		 */
   134		EMIT(PPC_RAW_LI(bpf_to_ppc(TMP_REG), 0));
   135	
   136		for (int i = 0; i < cookie_cnt; i++) {
   137			EMIT(PPC_RAW_STW(bpf_to_ppc(TMP_REG), _R1, cookie_off + 4 * i));
   138			EMIT(PPC_RAW_STW(bpf_to_ppc(TMP_REG), _R1, cookie_off + 4 * i + 4));
   139		}
   140	
   141		EMIT(PPC_RAW_STW(bpf_to_ppc(TMP_REG), _R1, retval_off));
   142		EMIT(PPC_RAW_STW(bpf_to_ppc(TMP_REG), _R1, retval_off + 4));
   143	}
   144	
   145	void store_func_meta(u32 *image, struct codegen_context *ctx,
   146						u64 func_meta, int func_meta_off)
   147	{
   148		/*
   149		 * Store func_meta to stack: [R1 + func_meta_off] = func_meta
   150		 * func_meta := argument count in first byte + cookie value
   151		 */
   152		/* Store lower word */
 > 153		EMIT(PPC_RAW_LI32(bpf_to_ppc(TMP_REG), (u32)func_meta));

154 EMIT(PPC_RAW_STW(bpf_to_ppc(TMP_REG), _R1, func_meta_off));
155
156 /* Store upper word */
157 EMIT(PPC_RAW_LI32(bpf_to_ppc(TMP_REG), (u32)(func_meta >> 32)));
158 EMIT(PPC_RAW_STW(bpf_to_ppc(TMP_REG), _R1, func_meta_off + 4));
159 }
160

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki