Skip to content

Commit 7ee8acd

Browse files
arndbmchehab
authored andcommitted
media: verisilicon: fix excessive stack usage
In some configurations, gcc decides not to inline the register accessor functions, which in turn leads to lots of temporary hantro_reg structures on the stack that cannot be eliminated because they escape into an uninlined function: drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:1022:1: warning: the frame size of 1112 bytes is larger than 1024 bytes [-Wframe-larger-than=] Mark all of these as __always_inline so the compiler is able to completely eliminate the temporary structures instead, which brings the stack usage back down to just the normal local variables. Closes: https://lore.kernel.org/oe-kbuild-all/202306151506.goHEegOd-lkp@intel.com/ [hverkuil: fix function prototype alignment, wrap commit log] Reported-by: kernel test robot <lkp@intel.com> Fixes: 727a400 ("media: verisilicon: Add Rockchip AV1 decoder") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
1 parent d05dea7 commit 7ee8acd

File tree

1 file changed

+21
-21
lines changed
  • drivers/media/platform/verisilicon

1 file changed

+21
-21
lines changed

drivers/media/platform/verisilicon/hantro.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -370,64 +370,64 @@ extern int hantro_debug;
370370
pr_err("%s:%d: " fmt, __func__, __LINE__, ##args)
371371

372372
/* Structure access helpers. */
373-
static inline struct hantro_ctx *fh_to_ctx(struct v4l2_fh *fh)
373+
static __always_inline struct hantro_ctx *fh_to_ctx(struct v4l2_fh *fh)
374374
{
375375
return container_of(fh, struct hantro_ctx, fh);
376376
}
377377

378378
/* Register accessors. */
379-
static inline void vepu_write_relaxed(struct hantro_dev *vpu,
380-
u32 val, u32 reg)
379+
static __always_inline void vepu_write_relaxed(struct hantro_dev *vpu,
380+
u32 val, u32 reg)
381381
{
382382
vpu_debug(6, "0x%04x = 0x%08x\n", reg / 4, val);
383383
writel_relaxed(val, vpu->enc_base + reg);
384384
}
385385

386-
static inline void vepu_write(struct hantro_dev *vpu, u32 val, u32 reg)
386+
static __always_inline void vepu_write(struct hantro_dev *vpu, u32 val, u32 reg)
387387
{
388388
vpu_debug(6, "0x%04x = 0x%08x\n", reg / 4, val);
389389
writel(val, vpu->enc_base + reg);
390390
}
391391

392-
static inline u32 vepu_read(struct hantro_dev *vpu, u32 reg)
392+
static __always_inline u32 vepu_read(struct hantro_dev *vpu, u32 reg)
393393
{
394394
u32 val = readl(vpu->enc_base + reg);
395395

396396
vpu_debug(6, "0x%04x = 0x%08x\n", reg / 4, val);
397397
return val;
398398
}
399399

400-
static inline void vdpu_write_relaxed(struct hantro_dev *vpu,
401-
u32 val, u32 reg)
400+
static __always_inline void vdpu_write_relaxed(struct hantro_dev *vpu,
401+
u32 val, u32 reg)
402402
{
403403
vpu_debug(6, "0x%04x = 0x%08x\n", reg / 4, val);
404404
writel_relaxed(val, vpu->dec_base + reg);
405405
}
406406

407-
static inline void vdpu_write(struct hantro_dev *vpu, u32 val, u32 reg)
407+
static __always_inline void vdpu_write(struct hantro_dev *vpu, u32 val, u32 reg)
408408
{
409409
vpu_debug(6, "0x%04x = 0x%08x\n", reg / 4, val);
410410
writel(val, vpu->dec_base + reg);
411411
}
412412

413-
static inline void hantro_write_addr(struct hantro_dev *vpu,
414-
unsigned long offset,
415-
dma_addr_t addr)
413+
static __always_inline void hantro_write_addr(struct hantro_dev *vpu,
414+
unsigned long offset,
415+
dma_addr_t addr)
416416
{
417417
vdpu_write(vpu, addr & 0xffffffff, offset);
418418
}
419419

420-
static inline u32 vdpu_read(struct hantro_dev *vpu, u32 reg)
420+
static __always_inline u32 vdpu_read(struct hantro_dev *vpu, u32 reg)
421421
{
422422
u32 val = readl(vpu->dec_base + reg);
423423

424424
vpu_debug(6, "0x%04x = 0x%08x\n", reg / 4, val);
425425
return val;
426426
}
427427

428-
static inline u32 vdpu_read_mask(struct hantro_dev *vpu,
429-
const struct hantro_reg *reg,
430-
u32 val)
428+
static __always_inline u32 vdpu_read_mask(struct hantro_dev *vpu,
429+
const struct hantro_reg *reg,
430+
u32 val)
431431
{
432432
u32 v;
433433

@@ -437,16 +437,16 @@ static inline u32 vdpu_read_mask(struct hantro_dev *vpu,
437437
return v;
438438
}
439439

440-
static inline void hantro_reg_write(struct hantro_dev *vpu,
441-
const struct hantro_reg *reg,
442-
u32 val)
440+
static __always_inline void hantro_reg_write(struct hantro_dev *vpu,
441+
const struct hantro_reg *reg,
442+
u32 val)
443443
{
444444
vdpu_write_relaxed(vpu, vdpu_read_mask(vpu, reg, val), reg->base);
445445
}
446446

447-
static inline void hantro_reg_write_s(struct hantro_dev *vpu,
448-
const struct hantro_reg *reg,
449-
u32 val)
447+
static __always_inline void hantro_reg_write_s(struct hantro_dev *vpu,
448+
const struct hantro_reg *reg,
449+
u32 val)
450450
{
451451
vdpu_write(vpu, vdpu_read_mask(vpu, reg, val), reg->base);
452452
}

0 commit comments

Comments
 (0)