linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: qcom: Always inline gpi_update_reg
@ 2021-01-12 19:12 Nathan Chancellor
  2021-01-13 11:21 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2021-01-12 19:12 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Vinod Koul
  Cc: Dan Williams, Nick Desaulniers, linux-arm-msm, dmaengine,
	linux-kernel, clang-built-linux, Nathan Chancellor

When building with CONFIG_UBSAN_UNSIGNED_OVERFLOW, clang decides not to
inline gpi_update_reg, which causes a linkage failure around __bad_mask:

ld.lld: error: undefined symbol: __bad_mask
>>> referenced by bitfield.h:119 (include/linux/bitfield.h:119)
>>>               dma/qcom/gpi.o:(gpi_update_reg) in archive drivers/built-in.a
>>> referenced by bitfield.h:119 (include/linux/bitfield.h:119)
>>>               dma/qcom/gpi.o:(gpi_update_reg) in archive drivers/built-in.a

If gpi_update_reg is not inlined, the mask value will not be known at
compile time so the check in field_multiplier stays in the final
object file, causing the above linkage failure. Always inline
gpi_update_reg so that this check can never fail.

Fixes: 5d0c3533a19f ("dmaengine: qcom: Add GPI dma driver")
Link: https://github.com/ClangBuiltLinux/linux/issues/1243
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/dma/qcom/gpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c
index 1a0bf6b0567a..e48eb397f433 100644
--- a/drivers/dma/qcom/gpi.c
+++ b/drivers/dma/qcom/gpi.c
@@ -584,7 +584,7 @@ static inline void gpi_write_reg_field(struct gpii *gpii, void __iomem *addr,
 	gpi_write_reg(gpii, addr, val);
 }
 
-static inline void
+static __always_inline void
 gpi_update_reg(struct gpii *gpii, u32 offset, u32 mask, u32 val)
 {
 	void __iomem *addr = gpii->regs + offset;

base-commit: 7c53f6b671f4aba70ff15e1b05148b10d58c2837
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: qcom: Always inline gpi_update_reg
  2021-01-12 19:12 [PATCH] dmaengine: qcom: Always inline gpi_update_reg Nathan Chancellor
@ 2021-01-13 11:21 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2021-01-13 11:21 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Andy Gross, Bjorn Andersson, Dan Williams, Nick Desaulniers,
	linux-arm-msm, dmaengine, linux-kernel, clang-built-linux

On 12-01-21, 12:12, Nathan Chancellor wrote:
> When building with CONFIG_UBSAN_UNSIGNED_OVERFLOW, clang decides not to
> inline gpi_update_reg, which causes a linkage failure around __bad_mask:
> 
> ld.lld: error: undefined symbol: __bad_mask
> >>> referenced by bitfield.h:119 (include/linux/bitfield.h:119)
> >>>               dma/qcom/gpi.o:(gpi_update_reg) in archive drivers/built-in.a
> >>> referenced by bitfield.h:119 (include/linux/bitfield.h:119)
> >>>               dma/qcom/gpi.o:(gpi_update_reg) in archive drivers/built-in.a
> 
> If gpi_update_reg is not inlined, the mask value will not be known at
> compile time so the check in field_multiplier stays in the final
> object file, causing the above linkage failure. Always inline
> gpi_update_reg so that this check can never fail.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-13 11:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 19:12 [PATCH] dmaengine: qcom: Always inline gpi_update_reg Nathan Chancellor
2021-01-13 11:21 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).