2021-06-02 21:55:26

by Kees Cook

[permalink] [raw]
Subject: [PATCH 0/3] drm: Fix randconfig link failures

Hi,

While tracking down spurious "orphan section" warnings on arm and arm64,
I needed to fix several other issues that it seems other folks have
tripped over before.

Here's the series that fixed everything for me...

-Kees


Arnd Bergmann (1):
drm/msm/a6xx: add CONFIG_QCOM_LLCC dependency

Kees Cook (2):
drm: Avoid circular dependencies for CONFIG_FB
drm/pl111: depend on CONFIG_VEXPRESS_CONFIG

drivers/gpu/drm/Kconfig | 2 +-
drivers/gpu/drm/msm/Kconfig | 3 ++-
drivers/gpu/drm/pl111/Kconfig | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)

--
2.25.1


2021-06-02 21:56:03

by Kees Cook

[permalink] [raw]
Subject: [PATCH 1/3] drm: Avoid circular dependencies for CONFIG_FB

When cleaning up other drm config dependencies, it is too easy to create
larger problems. Instead, mark CONFIG_FB as a "depends":

drivers/gpu/drm/Kconfig:74:error: recursive dependency detected!

Suggested-by: Arnd Bergmann <[email protected]>
Link: https://lore.kernel.org/lkml/CAK8P3a3jUQs6c5tESSNMbqfuymewj9FhqRizyHcfOXf8Rgy-nA@mail.gmail.com/
Signed-off-by: Kees Cook <[email protected]>
---
drivers/gpu/drm/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 3c16bd1afd87..90891284ccec 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -83,7 +83,7 @@ config DRM_KMS_HELPER
config DRM_KMS_FB_HELPER
bool
depends on DRM_KMS_HELPER
- select FB
+ depends on FB
select FRAMEBUFFER_CONSOLE if !EXPERT
select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
select FB_SYS_FOPS
--
2.25.1

2021-06-02 21:56:07

by Kees Cook

[permalink] [raw]
Subject: [PATCH 2/3] drm/msm/a6xx: add CONFIG_QCOM_LLCC dependency

From: Arnd Bergmann <[email protected]>

When LLCC support is in a loadable module, the adreno support
cannot be built-in:

aarch64-linux-ld: drivers/gpu/drm/msm/adreno/a6xx_gpu.o: in function `a6xx_gpu_init':
a6xx_gpu.c:(.text+0xe0): undefined reference to `llcc_slice_getd'
a6xx_gpu.c:(.text+0xe0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `llcc_slice_getd'
aarch64-linux-ld: a6xx_gpu.c:(.text+0xec): undefined reference to `llcc_slice_getd'
a6xx_gpu.c:(.text+0xec): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `llcc_slice_getd'
aarch64-linux-ld: drivers/gpu/drm/msm/adreno/a6xx_gpu.o: in function `a6xx_destroy':
a6xx_gpu.c:(.text+0x274): undefined reference to `llcc_slice_putd'
a6xx_gpu.c:(.text+0x274): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `llcc_slice_putd'
aarch64-linux-ld: a6xx_gpu.c:(.text+0x27c): undefined reference to `llcc_slice_putd'

Add a Kconfig dependency that disallows the broken configuration
but allows all working ones.

Fixes: 474dadb8b0d5 ("drm/msm/a6xx: Add support for using system cache(LLC)")
Signed-off-by: Arnd Bergmann <[email protected]>
Reported-by: kernel test robot <[email protected]>
Reviewed-by: Sai Prakash Ranjan <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
drivers/gpu/drm/msm/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 10f693ea89d3..52536e7adb95 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -7,6 +7,8 @@ config DRM_MSM
depends on IOMMU_SUPPORT
depends on OF && COMMON_CLK
depends on QCOM_OCMEM || QCOM_OCMEM=n
+ depends on QCOM_LLCC || QCOM_LLCC=n
+ depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
select IOMMU_IO_PGTABLE
select QCOM_MDT_LOADER if ARCH_QCOM
select REGULATOR
@@ -15,7 +17,6 @@ config DRM_MSM
select SHMEM
select TMPFS
select QCOM_SCM if ARCH_QCOM
- select QCOM_COMMAND_DB if ARCH_QCOM
select WANT_DEV_COREDUMP
select SND_SOC_HDMI_CODEC if SND_SOC
select SYNC_FILE
--
2.25.1

2021-06-02 21:58:09

by Kees Cook

[permalink] [raw]
Subject: [PATCH 3/3] drm/pl111: depend on CONFIG_VEXPRESS_CONFIG

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 <[email protected]>
---
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

2021-06-03 08:51:26

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 1/3] drm: Avoid circular dependencies for CONFIG_FB

On Wed, Jun 02, 2021 at 02:52:50PM -0700, Kees Cook wrote:
> When cleaning up other drm config dependencies, it is too easy to create
> larger problems. Instead, mark CONFIG_FB as a "depends":
>
> drivers/gpu/drm/Kconfig:74:error: recursive dependency detected!
>
> Suggested-by: Arnd Bergmann <[email protected]>
> Link: https://lore.kernel.org/lkml/CAK8P3a3jUQs6c5tESSNMbqfuymewj9FhqRizyHcfOXf8Rgy-nA@mail.gmail.com/
> Signed-off-by: Kees Cook <[email protected]>

I rebased this one for -next and applied all three patches to
drm-misc-next.
-Daniel

> ---
> drivers/gpu/drm/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 3c16bd1afd87..90891284ccec 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -83,7 +83,7 @@ config DRM_KMS_HELPER
> config DRM_KMS_FB_HELPER
> bool
> depends on DRM_KMS_HELPER
> - select FB
> + depends on FB
> select FRAMEBUFFER_CONSOLE if !EXPERT
> select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
> select FB_SYS_FOPS
> --
> 2.25.1
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2021-06-03 18:45:59

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/pl111: depend on CONFIG_VEXPRESS_CONFIG

On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <[email protected]> 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 <[email protected]>
> ---
> 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
>

2021-06-03 18:50:16

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 1/3] drm: Avoid circular dependencies for CONFIG_FB

On Thu, Jun 3, 2021 at 3:48 AM Daniel Vetter <[email protected]> wrote:
>
> On Wed, Jun 02, 2021 at 02:52:50PM -0700, Kees Cook wrote:
> > When cleaning up other drm config dependencies, it is too easy to create
> > larger problems. Instead, mark CONFIG_FB as a "depends":
> >
> > drivers/gpu/drm/Kconfig:74:error: recursive dependency detected!
> >
> > Suggested-by: Arnd Bergmann <[email protected]>
> > Link: https://lore.kernel.org/lkml/CAK8P3a3jUQs6c5tESSNMbqfuymewj9FhqRizyHcfOXf8Rgy-nA@mail.gmail.com/
> > Signed-off-by: Kees Cook <[email protected]>
>
> I rebased this one for -next and applied all three patches to
> drm-misc-next.

Patch 3 is not the right fix and I think breaks some platforms.

Rob

2021-06-03 19:24:17

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/pl111: depend on CONFIG_VEXPRESS_CONFIG

On Thu, Jun 3, 2021 at 8:43 PM Rob Herring <[email protected]> wrote:
>
> On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <[email protected]> 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 <[email protected]>
> > ---
> > 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

2021-06-03 19:56:26

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/pl111: depend on CONFIG_VEXPRESS_CONFIG

On Thu, Jun 3, 2021 at 1:42 PM Rob Herring <[email protected]> wrote:
>
> On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <[email protected]> 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

2021-06-03 21:22:56

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/pl111: depend on CONFIG_VEXPRESS_CONFIG

On Thu, Jun 03, 2021 at 09:19:42PM +0200, Daniel Vetter wrote:
> On Thu, Jun 3, 2021 at 8:43 PM Rob Herring <[email protected]> wrote:
> >
> > On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <[email protected]> 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/[email protected]/

> -Daniel
>
> >
> > >
> > > Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> > > Signed-off-by: Kees Cook <[email protected]>
> > > ---
> > > 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

2021-06-03 21:33:19

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/pl111: depend on CONFIG_VEXPRESS_CONFIG

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 <[email protected]> wrote:
> > >
> > > On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <[email protected]> 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/[email protected]/
>
> > -Daniel
> >
> > >
> > > >
> > > > Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> > > > Signed-off-by: Kees Cook <[email protected]>
> > > > ---
> > > > 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

2021-06-03 21:42:49

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/pl111: depend on CONFIG_VEXPRESS_CONFIG

On Thu, Jun 3, 2021 at 11:29 PM Kees Cook <[email protected]> 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 <[email protected]> wrote:
> > > >
> > > > On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <[email protected]> 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/[email protected]/
> >
> > > -Daniel
> > >
> > > >
> > > > >
> > > > > Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> > > > > Signed-off-by: Kees Cook <[email protected]>
> > > > > ---
> > > > > 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



--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2021-06-03 21:52:42

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/pl111: depend on CONFIG_VEXPRESS_CONFIG

On Thu, Jun 03, 2021 at 11:41:01PM +0200, Daniel Vetter wrote:
> On Thu, Jun 3, 2021 at 11:29 PM Kees Cook <[email protected]> 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 <[email protected]> wrote:
> > > > >
> > > > > On Wed, Jun 2, 2021 at 4:53 PM Kees Cook <[email protected]> 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

--
Kees Cook