diff mbox series

[3/3] drm/pl111: depend on CONFIG_VEXPRESS_CONFIG

Message ID 20210602215252.695994-4-keescook@chromium.org (mailing list archive)
State New, archived
Headers show
Series drm: Fix randconfig link failures | expand

Commit Message

Kees Cook June 2, 2021, 9:52 p.m. UTC
Avoid randconfig build failures by requiring VEXPRESS_CONFIG:

aarch64-linux-gnu-ld: drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_vexpress_clcd_init':
pl111_versatile.c:(.text+0x220): undefined reference to `devm_regmap_init_vexpress_config'

Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/pl111/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rob Herring (Arm) June 3, 2021, 6:42 p.m. UTC | #1
On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <keescook@chromium.org> wrote:
>
> Avoid randconfig build failures by requiring VEXPRESS_CONFIG:
>
> aarch64-linux-gnu-ld: drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_vexpress_clcd_init':
> pl111_versatile.c:(.text+0x220): undefined reference to `devm_regmap_init_vexpress_config'

pl111_vexpress_clcd_init() starts with:

if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
                return -ENODEV;

Isn't that supposed to be enough to avoid an undefined reference?

Making the whole file depend on VEXPRESS_CONFIG is not right either.
Not all platforms need it.

>
> Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/gpu/drm/pl111/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
> index 80f6748055e3..c5210a5bef1b 100644
> --- a/drivers/gpu/drm/pl111/Kconfig
> +++ b/drivers/gpu/drm/pl111/Kconfig
> @@ -2,7 +2,7 @@
>  config DRM_PL111
>         tristate "DRM Support for PL111 CLCD Controller"
>         depends on DRM
> -       depends on ARM || ARM64 || COMPILE_TEST
> +       depends on VEXPRESS_CONFIG
>         depends on COMMON_CLK
>         select DRM_KMS_HELPER
>         select DRM_KMS_CMA_HELPER
> --
> 2.25.1
>
Daniel Vetter June 3, 2021, 7:19 p.m. UTC | #2
On Thu, Jun 3, 2021 at 8:43 PM Rob Herring <robh@kernel.org> wrote:
>
> On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <keescook@chromium.org> wrote:
> >
> > Avoid randconfig build failures by requiring VEXPRESS_CONFIG:
> >
> > aarch64-linux-gnu-ld: drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_vexpress_clcd_init':
> > pl111_versatile.c:(.text+0x220): undefined reference to `devm_regmap_init_vexpress_config'
>
> pl111_vexpress_clcd_init() starts with:
>
> if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
>                 return -ENODEV;
>
> Isn't that supposed to be enough to avoid an undefined reference?
>
> Making the whole file depend on VEXPRESS_CONFIG is not right either.
> Not all platforms need it.

It needs a compile-time status inline then for the functions we're
using in pl111.
-Daniel

>
> >
> > Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> > ---
> >  drivers/gpu/drm/pl111/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
> > index 80f6748055e3..c5210a5bef1b 100644
> > --- a/drivers/gpu/drm/pl111/Kconfig
> > +++ b/drivers/gpu/drm/pl111/Kconfig
> > @@ -2,7 +2,7 @@
> >  config DRM_PL111
> >         tristate "DRM Support for PL111 CLCD Controller"
> >         depends on DRM
> > -       depends on ARM || ARM64 || COMPILE_TEST
> > +       depends on VEXPRESS_CONFIG
> >         depends on COMMON_CLK
> >         select DRM_KMS_HELPER
> >         select DRM_KMS_CMA_HELPER
> > --
> > 2.25.1
> >
Rob Herring (Arm) June 3, 2021, 7:54 p.m. UTC | #3
On Thu, Jun 3, 2021 at 1:42 PM Rob Herring <robh@kernel.org> wrote:
>
> On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <keescook@chromium.org> wrote:
> >
> > Avoid randconfig build failures by requiring VEXPRESS_CONFIG:
> >
> > aarch64-linux-gnu-ld: drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_vexpress_clcd_init':
> > pl111_versatile.c:(.text+0x220): undefined reference to `devm_regmap_init_vexpress_config'
>
> pl111_vexpress_clcd_init() starts with:
>
> if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
>                 return -ENODEV;
>
> Isn't that supposed to be enough to avoid an undefined reference?
>
> Making the whole file depend on VEXPRESS_CONFIG is not right either.
> Not all platforms need it.

Specifically, these defconfigs will break as they all use PL111 but
don't need nor enable VEXPRESS_CONFIG:

arch/arm/configs/integrator_defconfig:CONFIG_DRM_PL111=y
arch/arm/configs/lpc18xx_defconfig:CONFIG_DRM_PL111=y
arch/arm/configs/lpc32xx_defconfig:CONFIG_DRM_PL111=y
arch/arm/configs/nhk8815_defconfig:CONFIG_DRM_PL111=y
arch/arm/configs/realview_defconfig:CONFIG_DRM_PL111=y
arch/arm/configs/spear3xx_defconfig:CONFIG_DRM_PL111=y
arch/arm/configs/versatile_defconfig:CONFIG_DRM_PL111=y

These defconfigs should all be failing with the same error, but don't
from what I've tried nor have I seen any kernelci failures.

Rob
Kees Cook June 3, 2021, 9:19 p.m. UTC | #4
On Thu, Jun 03, 2021 at 09:19:42PM +0200, Daniel Vetter wrote:
> On Thu, Jun 3, 2021 at 8:43 PM Rob Herring <robh@kernel.org> wrote:
> >
> > On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <keescook@chromium.org> wrote:
> > >
> > > Avoid randconfig build failures by requiring VEXPRESS_CONFIG:
> > >
> > > aarch64-linux-gnu-ld: drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_vexpress_clcd_init':
> > > pl111_versatile.c:(.text+0x220): undefined reference to `devm_regmap_init_vexpress_config'
> >
> > pl111_vexpress_clcd_init() starts with:
> >
> > if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
> >                 return -ENODEV;
> >
> > Isn't that supposed to be enough to avoid an undefined reference?

Ah! I missed that when reading the code. I see the problem now. It's
because of:

CONFIG_VEXPRESS_CONFIG=m
CONFIG_DRM_PL111=y

I think the right fix is:

diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
index 80f6748055e3..662fc38f92ba 100644
--- a/drivers/gpu/drm/pl111/Kconfig
+++ b/drivers/gpu/drm/pl111/Kconfig
@@ -3,6 +3,7 @@ config DRM_PL111
 	tristate "DRM Support for PL111 CLCD Controller"
 	depends on DRM
 	depends on ARM || ARM64 || COMPILE_TEST
+	depends on VEXPRESS_CONFIG=y || VEXPRESS_CONFIG=DRM
 	depends on COMMON_CLK
 	select DRM_KMS_HELPER
 	select DRM_KMS_CMA_HELPER

I will go check the defconfigs Rob mentioned...

> > Making the whole file depend on VEXPRESS_CONFIG is not right either.
> > Not all platforms need it.
> 
> It needs a compile-time status inline then for the functions we're
> using in pl111.

FYI, this is the config I was working from, which was throwing link errors:
https://lore.kernel.org/lkml/202105300926.fX0MYySp-lkp@intel.com/

> -Daniel
> 
> >
> > >
> > > Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > > ---
> > >  drivers/gpu/drm/pl111/Kconfig | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
> > > index 80f6748055e3..c5210a5bef1b 100644
> > > --- a/drivers/gpu/drm/pl111/Kconfig
> > > +++ b/drivers/gpu/drm/pl111/Kconfig
> > > @@ -2,7 +2,7 @@
> > >  config DRM_PL111
> > >         tristate "DRM Support for PL111 CLCD Controller"
> > >         depends on DRM
> > > -       depends on ARM || ARM64 || COMPILE_TEST
> > > +       depends on VEXPRESS_CONFIG
> > >         depends on COMMON_CLK
> > >         select DRM_KMS_HELPER
> > >         select DRM_KMS_CMA_HELPER
> > > --
> > > 2.25.1
> > >
> 
> 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
Kees Cook June 3, 2021, 9:29 p.m. UTC | #5
On Thu, Jun 03, 2021 at 02:19:52PM -0700, Kees Cook wrote:
> On Thu, Jun 03, 2021 at 09:19:42PM +0200, Daniel Vetter wrote:
> > On Thu, Jun 3, 2021 at 8:43 PM Rob Herring <robh@kernel.org> wrote:
> > >
> > > On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <keescook@chromium.org> wrote:
> > > >
> > > > Avoid randconfig build failures by requiring VEXPRESS_CONFIG:
> > > >
> > > > aarch64-linux-gnu-ld: drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_vexpress_clcd_init':
> > > > pl111_versatile.c:(.text+0x220): undefined reference to `devm_regmap_init_vexpress_config'
> > >
> > > pl111_vexpress_clcd_init() starts with:
> > >
> > > if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
> > >                 return -ENODEV;
> > >
> > > Isn't that supposed to be enough to avoid an undefined reference?
> 
> Ah! I missed that when reading the code. I see the problem now. It's
> because of:
> 
> CONFIG_VEXPRESS_CONFIG=m
> CONFIG_DRM_PL111=y
> 
> I think the right fix is:
> 
> diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
> index 80f6748055e3..662fc38f92ba 100644
> --- a/drivers/gpu/drm/pl111/Kconfig
> +++ b/drivers/gpu/drm/pl111/Kconfig
> @@ -3,6 +3,7 @@ config DRM_PL111
>  	tristate "DRM Support for PL111 CLCD Controller"
>  	depends on DRM
>  	depends on ARM || ARM64 || COMPILE_TEST
> +	depends on VEXPRESS_CONFIG=y || VEXPRESS_CONFIG=DRM

Oops, no, I had this backwairds:

	depends on !VEXPRESS_CONFIG || VEXPRESS_CONFIG=DRM

_that_ lets me build with:

# CONFIG_VEXPRESS_CONFIG is not set
CONFIG_DRM_PL111=y

CONFIG_VEXPRESS_CONFIG=y
CONFIG_DRM_PL111=y

CONFIG_VEXPRESS_CONFIG=m
CONFIG_DRM_PL111=m

CONFIG_VEXPRESS_CONFIG=y
CONFIG_DRM_PL111=m

and disallows:

CONFIG_VEXPRESS_CONFIG=m
CONFIG_DRM_PL111=y

(this will force CONFIG_DRM_PL111=m)

-Kees

>  	depends on COMMON_CLK
>  	select DRM_KMS_HELPER
>  	select DRM_KMS_CMA_HELPER
> 
> I will go check the defconfigs Rob mentioned...
> 
> > > Making the whole file depend on VEXPRESS_CONFIG is not right either.
> > > Not all platforms need it.
> > 
> > It needs a compile-time status inline then for the functions we're
> > using in pl111.
> 
> FYI, this is the config I was working from, which was throwing link errors:
> https://lore.kernel.org/lkml/202105300926.fX0MYySp-lkp@intel.com/
> 
> > -Daniel
> > 
> > >
> > > >
> > > > Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> > > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > > > ---
> > > >  drivers/gpu/drm/pl111/Kconfig | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
> > > > index 80f6748055e3..c5210a5bef1b 100644
> > > > --- a/drivers/gpu/drm/pl111/Kconfig
> > > > +++ b/drivers/gpu/drm/pl111/Kconfig
> > > > @@ -2,7 +2,7 @@
> > > >  config DRM_PL111
> > > >         tristate "DRM Support for PL111 CLCD Controller"
> > > >         depends on DRM
> > > > -       depends on ARM || ARM64 || COMPILE_TEST
> > > > +       depends on VEXPRESS_CONFIG
> > > >         depends on COMMON_CLK
> > > >         select DRM_KMS_HELPER
> > > >         select DRM_KMS_CMA_HELPER
> > > > --
> > > > 2.25.1
> > > >
> > 
> > 
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> 
> -- 
> Kees Cook
Daniel Vetter June 3, 2021, 9:41 p.m. UTC | #6
On Thu, Jun 3, 2021 at 11:29 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Thu, Jun 03, 2021 at 02:19:52PM -0700, Kees Cook wrote:
> > On Thu, Jun 03, 2021 at 09:19:42PM +0200, Daniel Vetter wrote:
> > > On Thu, Jun 3, 2021 at 8:43 PM Rob Herring <robh@kernel.org> wrote:
> > > >
> > > > On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <keescook@chromium.org> wrote:
> > > > >
> > > > > Avoid randconfig build failures by requiring VEXPRESS_CONFIG:
> > > > >
> > > > > aarch64-linux-gnu-ld: drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_vexpress_clcd_init':
> > > > > pl111_versatile.c:(.text+0x220): undefined reference to `devm_regmap_init_vexpress_config'
> > > >
> > > > pl111_vexpress_clcd_init() starts with:
> > > >
> > > > if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
> > > >                 return -ENODEV;
> > > >
> > > > Isn't that supposed to be enough to avoid an undefined reference?
> >
> > Ah! I missed that when reading the code. I see the problem now. It's
> > because of:
> >
> > CONFIG_VEXPRESS_CONFIG=m
> > CONFIG_DRM_PL111=y
> >
> > I think the right fix is:
> >
> > diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
> > index 80f6748055e3..662fc38f92ba 100644
> > --- a/drivers/gpu/drm/pl111/Kconfig
> > +++ b/drivers/gpu/drm/pl111/Kconfig
> > @@ -3,6 +3,7 @@ config DRM_PL111
> >       tristate "DRM Support for PL111 CLCD Controller"
> >       depends on DRM
> >       depends on ARM || ARM64 || COMPILE_TEST
> > +     depends on VEXPRESS_CONFIG=y || VEXPRESS_CONFIG=DRM
>
> Oops, no, I had this backwairds:
>
>         depends on !VEXPRESS_CONFIG || VEXPRESS_CONFIG=DRM

Can you pls throw this into an incremental patch on top of
drm-misc-next? It's a non-rebasing tree and all that (linux-next
should have it next day too I guess).

Thanks, Daniel

> _that_ lets me build with:
>
> # CONFIG_VEXPRESS_CONFIG is not set
> CONFIG_DRM_PL111=y
>
> CONFIG_VEXPRESS_CONFIG=y
> CONFIG_DRM_PL111=y
>
> CONFIG_VEXPRESS_CONFIG=m
> CONFIG_DRM_PL111=m
>
> CONFIG_VEXPRESS_CONFIG=y
> CONFIG_DRM_PL111=m
>
> and disallows:
>
> CONFIG_VEXPRESS_CONFIG=m
> CONFIG_DRM_PL111=y
>
> (this will force CONFIG_DRM_PL111=m)
>
> -Kees
>
> >       depends on COMMON_CLK
> >       select DRM_KMS_HELPER
> >       select DRM_KMS_CMA_HELPER
> >
> > I will go check the defconfigs Rob mentioned...
> >
> > > > Making the whole file depend on VEXPRESS_CONFIG is not right either.
> > > > Not all platforms need it.
> > >
> > > It needs a compile-time status inline then for the functions we're
> > > using in pl111.
> >
> > FYI, this is the config I was working from, which was throwing link errors:
> > https://lore.kernel.org/lkml/202105300926.fX0MYySp-lkp@intel.com/
> >
> > > -Daniel
> > >
> > > >
> > > > >
> > > > > Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> > > > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > > > > ---
> > > > >  drivers/gpu/drm/pl111/Kconfig | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
> > > > > index 80f6748055e3..c5210a5bef1b 100644
> > > > > --- a/drivers/gpu/drm/pl111/Kconfig
> > > > > +++ b/drivers/gpu/drm/pl111/Kconfig
> > > > > @@ -2,7 +2,7 @@
> > > > >  config DRM_PL111
> > > > >         tristate "DRM Support for PL111 CLCD Controller"
> > > > >         depends on DRM
> > > > > -       depends on ARM || ARM64 || COMPILE_TEST
> > > > > +       depends on VEXPRESS_CONFIG
> > > > >         depends on COMMON_CLK
> > > > >         select DRM_KMS_HELPER
> > > > >         select DRM_KMS_CMA_HELPER
> > > > > --
> > > > > 2.25.1
> > > > >
> > >
> > >
> > >
> > > --
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > http://blog.ffwll.ch
> >
> > --
> > Kees Cook
>
> --
> Kees Cook
Kees Cook June 3, 2021, 9:48 p.m. UTC | #7
On Thu, Jun 03, 2021 at 11:41:01PM +0200, Daniel Vetter wrote:
> On Thu, Jun 3, 2021 at 11:29 PM Kees Cook <keescook@chromium.org> wrote:
> >
> > On Thu, Jun 03, 2021 at 02:19:52PM -0700, Kees Cook wrote:
> > > On Thu, Jun 03, 2021 at 09:19:42PM +0200, Daniel Vetter wrote:
> > > > On Thu, Jun 3, 2021 at 8:43 PM Rob Herring <robh@kernel.org> wrote:
> > > > >
> > > > > On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <keescook@chromium.org> wrote:
> > > > > >
> > > > > > Avoid randconfig build failures by requiring VEXPRESS_CONFIG:
> > > > > >
> > > > > > aarch64-linux-gnu-ld: drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_vexpress_clcd_init':
> > > > > > pl111_versatile.c:(.text+0x220): undefined reference to `devm_regmap_init_vexpress_config'
> > > > >
> > > > > pl111_vexpress_clcd_init() starts with:
> > > > >
> > > > > if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
> > > > >                 return -ENODEV;
> > > > >
> > > > > Isn't that supposed to be enough to avoid an undefined reference?
> > >
> > > Ah! I missed that when reading the code. I see the problem now. It's
> > > because of:
> > >
> > > CONFIG_VEXPRESS_CONFIG=m
> > > CONFIG_DRM_PL111=y
> > >
> > > I think the right fix is:
> > >
> > > diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
> > > index 80f6748055e3..662fc38f92ba 100644
> > > --- a/drivers/gpu/drm/pl111/Kconfig
> > > +++ b/drivers/gpu/drm/pl111/Kconfig
> > > @@ -3,6 +3,7 @@ config DRM_PL111
> > >       tristate "DRM Support for PL111 CLCD Controller"
> > >       depends on DRM
> > >       depends on ARM || ARM64 || COMPILE_TEST
> > > +     depends on VEXPRESS_CONFIG=y || VEXPRESS_CONFIG=DRM
> >
> > Oops, no, I had this backwairds:
> >
> >         depends on !VEXPRESS_CONFIG || VEXPRESS_CONFIG=DRM
> 
> Can you pls throw this into an incremental patch on top of
> drm-misc-next? It's a non-rebasing tree and all that (linux-next
> should have it next day too I guess).

Ah! Yes, sorry. I wasn't sure if you'd reverted it yet. One moment...

-Kees
diff mbox series

Patch

diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
index 80f6748055e3..c5210a5bef1b 100644
--- a/drivers/gpu/drm/pl111/Kconfig
+++ b/drivers/gpu/drm/pl111/Kconfig
@@ -2,7 +2,7 @@ 
 config DRM_PL111
 	tristate "DRM Support for PL111 CLCD Controller"
 	depends on DRM
-	depends on ARM || ARM64 || COMPILE_TEST
+	depends on VEXPRESS_CONFIG
 	depends on COMMON_CLK
 	select DRM_KMS_HELPER
 	select DRM_KMS_CMA_HELPER