Skip to contentSkip to conversation

drm/panthor: Fix 3 issues reported by the kernel test bot

PATCH Applied Boris Brezillon 5 participants 24 messages Mar 4, 2024 – Mar 11, 2024

Subsystems (3)
lore
Share & tools
lore

Boris Brezillon

author maintainer
#0 lore raw

cover drm/panthor: Fix 3 issues reported by the kernel test bot

Hello,

Here are three trivial fixes for bugs reported by the intel kernel test bot.

Regards,

Boris

Boris Brezillon (3):
drm/panthor: Fix panthor_devfreq kerneldoc
drm/panthor: Explicitly include page.h for the {virt,__phys)_to_pfn()
defs
drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

 drivers/gpu/drm/panthor/Kconfig           | 1 +
 drivers/gpu/drm/panthor/panthor_devfreq.c | 2 +-
 drivers/gpu/drm/panthor/panthor_device.c  | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 1/3 drm/panthor: Fix panthor_devfreq kerneldoc

Missing '*' to have a valid kerneldoc prefix.

---
 drivers/gpu/drm/panthor/panthor_devfreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_devfreq.c +1 -1
index 7ac4fa290f27..c6d3c327cc24 100644
@@ -34,7 +34,7 @@ struct panthor_devfreq {
 	/** @last_busy_state: True if the GPU was busy last time we updated the state. */
 	bool last_busy_state;
 
-	/*
+	/**
 	 * @lock: Lock used to protect busy_time, idle_time, time_last_update and
 	 * last_busy_state.
 	 *
Signature · 1 line
2.43.0
maintainer
#2 lore raw

Re: [PATCH 1/3] drm/panthor: Fix panthor_devfreq kerneldoc

Quoted 5 lines · Boris Brezillon

Missing '*' to have a valid kerneldoc prefix.

LGTM :)

Best regards,
Liviu

Quoted 20 lines
---
 drivers/gpu/drm/panthor/panthor_devfreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_devfreq.c +1 -1
index 7ac4fa290f27..c6d3c327cc24 100644
@@ -34,7 +34,7 @@ struct panthor_devfreq {
 	/** @last_busy_state: True if the GPU was busy last time we updated the state. */
 	bool last_busy_state;
 
-	/*
+	/**
 	 * @lock: Lock used to protect busy_time, idle_time, time_last_update and
 	 * last_busy_state.
 	 *
Signature · 1 line
2.43.0
Signature · 8 lines
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
maintainer Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH 1/3] drm/panthor: Fix panthor_devfreq kerneldoc

In reply to Boris Brezillon
Quoted 5 lines · Boris Brezillon

Missing '*' to have a valid kerneldoc prefix.

Quoted 17 lines
---
 drivers/gpu/drm/panthor/panthor_devfreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_devfreq.c +1 -1
index 7ac4fa290f27..c6d3c327cc24 100644
@@ -34,7 +34,7 @@ struct panthor_devfreq {
 	/** @last_busy_state: True if the GPU was busy last time we updated the state. */
 	bool last_busy_state;
 
-	/*
+	/**
 	 * @lock: Lock used to protect busy_time, idle_time, time_last_update and
 	 * last_busy_state.
 	 *
author maintainer
#4 lore raw

PATCH 2/3 drm/panthor: Explicitly include page.h for the {virt, __phys)_to_pfn() defs

In reply to Boris Brezillon

Something on arm[64] must be including <asm/page.h>, but things fail to compile on sparc64. Make sure this header is included explicitly so this driver can be compile-tested on all supported architectures.

---
 drivers/gpu/drm/panthor/panthor_device.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/panthor/panthor_device.c +2 -0
index bfe8da4a6e4c..68e467ee458a 100644
@@ -3,6 +3,8 @@
 /* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */
 /* Copyright 2023 Collabora ltd. */
 
+#include <asm/page.h>
+
 #include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] drm/panthor: Explicitly include page.h for the {virt,__phys)_to_pfn() defs

Quoted 3 lines · Boris Brezillon

Something on arm[64] must be including <asm/page.h>, but things fail to compile on sparc64. Make sure this header is included explicitly so this driver can be compile-tested on all supported architectures.

Is compilation on sparc64 possible because of 'depends on COMPILE_TEST'? Otherwise it doesn't make sense to try to build this for any arch other than arm[64].

Regardless, patch looks harmless, so

Best regards,
Liviu

Quoted 24 lines
---
 drivers/gpu/drm/panthor/panthor_device.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/panthor/panthor_device.c +2 -0
index bfe8da4a6e4c..68e467ee458a 100644
@@ -3,6 +3,8 @@
 /* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */
 /* Copyright 2023 Collabora ltd. */
 
+#include <asm/page.h>
+
 #include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
Signature · 1 line
2.43.0
Signature · 8 lines
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
author maintainer
#6 lore raw

Re: [PATCH 2/3] drm/panthor: Explicitly include page.h for the {virt,__phys)_to_pfn() defs

Quoted 6 lines · On Mon, 4 Mar 2024 11:16:48 +0000 Liviu Dudau <[email protected]> wrote:
Quoted 3 lines · Boris Brezillon

Something on arm[64] must be including <asm/page.h>, but things fail to compile on sparc64. Make sure this header is included explicitly so this driver can be compile-tested on all supported architectures.

Is compilation on sparc64 possible because of 'depends on COMPILE_TEST'?

Yes.

Quoted 35 lines

Otherwise it doesn't make sense to try to build this for any arch other than arm[64].

Regardless, patch looks harmless, so

Best regards,
Liviu

Quoted 24 lines
---
 drivers/gpu/drm/panthor/panthor_device.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/panthor/panthor_device.c +2 -0
index bfe8da4a6e4c..68e467ee458a 100644
@@ -3,6 +3,8 @@
 /* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */
 /* Copyright 2023 Collabora ltd. */
 
+#include <asm/page.h>
+
 #include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 2/3
#7 lore raw

Re: [PATCH 2/3] drm/panthor: Explicitly include page.h for the {virt,__phys)_to_pfn() defs

In reply to Boris Brezillon
Quoted 7 lines · Boris Brezillon

Something on arm[64] must be including <asm/page.h>, but things fail to compile on sparc64. Make sure this header is included explicitly so this driver can be compile-tested on all supported architectures.

Seems reasonable, although I do wonder if it's right to include a "asm" header here or if we should pull in something like "linux/mm.h" which includes asm/page.h. I can find examples of both. Either way:

Quoted 17 lines
---
 drivers/gpu/drm/panthor/panthor_device.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/panthor/panthor_device.c +2 -0
index bfe8da4a6e4c..68e467ee458a 100644
@@ -3,6 +3,8 @@
 /* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */
 /* Copyright 2023 Collabora ltd. */
 
+#include <asm/page.h>
+
 #include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
author maintainer
#8 lore raw

Re: [PATCH 2/3] drm/panthor: Explicitly include page.h for the {virt,__phys)_to_pfn() defs

Quoted 5 lines · On Mon, 4 Mar 2024 12:31:23 +0000 Steven Price <[email protected]> wrote:
Quoted 4 lines · Boris Brezillon

Something on arm[64] must be including <asm/page.h>, but things fail to compile on sparc64. Make sure this header is included explicitly so this driver can be compile-tested on all supported architectures.

Quoted 7 lines
Quoted 3 lines

Seems reasonable, although I do wonder if it's right to include a "asm" header here or if we should pull in something like "linux/mm.h" which includes asm/page.h. I can find examples of both. Either way:

Actually, I considered including linux/mm.h too, so I'm happy to go for this option (will fix when applying.

Quoted 21 lines
Quoted 17 lines
---
 drivers/gpu/drm/panthor/panthor_device.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/panthor/panthor_device.c +2 -0
index bfe8da4a6e4c..68e467ee458a 100644
@@ -3,6 +3,8 @@
 /* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */
 /* Copyright 2023 Collabora ltd. */
 
+#include <asm/page.h>
+
 #include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>  
author maintainer
#9 lore raw

PATCH 3/3 drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

In reply to Boris Brezillon

panthor_device_resume/suspend() are only compiled when CONFIG_PM is enabled but panthro_drv.c doesn't use the pm_ptr() macro to conditionally discard resume/suspend assignments, which causes undefined symbol errors at link time when !PM.

We could fix that by using pm_ptr(), but supporting the !PM case makes little sense (the whole point of these embedded GPUs is to be low power, so proper PM is a basic requirement in that case). So let's just enforce the presence of CONFIG_PM with a Kconfig dependency instead.

If someone needs to relax this dependency, it can be done in a follow-up.

---
 drivers/gpu/drm/panthor/Kconfig          | 1 +
 drivers/gpu/drm/panthor/panthor_device.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/panthor/Kconfig +1 -0
index 55b40ad07f3b..fdce7c1b2310 100644
@@ -6,6 +6,7 @@ config DRM_PANTHOR
 	depends on ARM || ARM64 || COMPILE_TEST
 	depends on !GENERIC_ATOMIC64  # for IOMMU_IO_PGTABLE_LPAE
 	depends on MMU
+	depends on PM
 	select DEVFREQ_GOV_SIMPLE_ONDEMAND
 	select DRM_EXEC
 	select DRM_GEM_SHMEM_HELPER
drivers/gpu/drm/panthor/panthor_device.c +0 -2
index 68e467ee458a..efea29143a54 100644
@@ -403,7 +403,6 @@ int panthor_device_mmap_io(struct panthor_device *ptdev, struct vm_area_struct *
 	return 0;
 }
 
-#ifdef CONFIG_PM
 int panthor_device_resume(struct device *dev)
 {
 	struct panthor_device *ptdev = dev_get_drvdata(dev);
@@ -548,4 +547,3 @@ int panthor_device_suspend(struct device *dev)
 	mutex_unlock(&ptdev->pm.mmio_lock);
 	return ret;
 }
-#endif
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 3/3
#10 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 10 lines · Boris Brezillon

panthor_device_resume/suspend() are only compiled when CONFIG_PM is enabled but panthro_drv.c doesn't use the pm_ptr() macro to conditionally discard resume/suspend assignments, which causes undefined symbol errors at link time when !PM.

We could fix that by using pm_ptr(), but supporting the !PM case makes little sense (the whole point of these embedded GPUs is to be low power, so proper PM is a basic requirement in that case). So let's just enforce the presence of CONFIG_PM with a Kconfig dependency instead.

Quoted 5 lines

If someone needs to relax this dependency, it can be done in a follow-up.

Agree on this, there is no point on running on kernels without CONFIG_PM enabled.

Best regards,
Liviu

Quoted 37 lines
---
 drivers/gpu/drm/panthor/Kconfig          | 1 +
 drivers/gpu/drm/panthor/panthor_device.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/panthor/Kconfig +1 -0
index 55b40ad07f3b..fdce7c1b2310 100644
@@ -6,6 +6,7 @@ config DRM_PANTHOR
 	depends on ARM || ARM64 || COMPILE_TEST
 	depends on !GENERIC_ATOMIC64  # for IOMMU_IO_PGTABLE_LPAE
 	depends on MMU
+	depends on PM
 	select DEVFREQ_GOV_SIMPLE_ONDEMAND
 	select DRM_EXEC
 	select DRM_GEM_SHMEM_HELPER
drivers/gpu/drm/panthor/panthor_device.c +0 -2
index 68e467ee458a..efea29143a54 100644
@@ -403,7 +403,6 @@ int panthor_device_mmap_io(struct panthor_device *ptdev, struct vm_area_struct *
 	return 0;
 }
 
-#ifdef CONFIG_PM
 int panthor_device_resume(struct device *dev)
 {
 	struct panthor_device *ptdev = dev_get_drvdata(dev);
@@ -548,4 +547,3 @@ int panthor_device_suspend(struct device *dev)
 	mutex_unlock(&ptdev->pm.mmio_lock);
 	return ret;
 }
-#endif
Signature · 1 line
2.43.0
Signature · 8 lines
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
maintainer Reviewed-by on v1 3/3
#11 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

In reply to Boris Brezillon
Quoted 10 lines · Boris Brezillon

panthor_device_resume/suspend() are only compiled when CONFIG_PM is enabled but panthro_drv.c doesn't use the pm_ptr() macro to conditionally discard resume/suspend assignments, which causes undefined symbol errors at link time when !PM.

We could fix that by using pm_ptr(), but supporting the !PM case makes little sense (the whole point of these embedded GPUs is to be low power, so proper PM is a basic requirement in that case). So let's just enforce the presence of CONFIG_PM with a Kconfig dependency instead.

Quoted 5 lines

If someone needs to relax this dependency, it can be done in a follow-up.

Seems reasonable, it should be easy to relax the CONFIG_PM condition in the future if anyone has an actual need.

Quoted 34 lines
---
 drivers/gpu/drm/panthor/Kconfig          | 1 +
 drivers/gpu/drm/panthor/panthor_device.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/panthor/Kconfig +1 -0
index 55b40ad07f3b..fdce7c1b2310 100644
@@ -6,6 +6,7 @@ config DRM_PANTHOR
 	depends on ARM || ARM64 || COMPILE_TEST
 	depends on !GENERIC_ATOMIC64  # for IOMMU_IO_PGTABLE_LPAE
 	depends on MMU
+	depends on PM
 	select DEVFREQ_GOV_SIMPLE_ONDEMAND
 	select DRM_EXEC
 	select DRM_GEM_SHMEM_HELPER
drivers/gpu/drm/panthor/panthor_device.c +0 -2
index 68e467ee458a..efea29143a54 100644
@@ -403,7 +403,6 @@ int panthor_device_mmap_io(struct panthor_device *ptdev, struct vm_area_struct *
 	return 0;
 }
 
-#ifdef CONFIG_PM
 int panthor_device_resume(struct device *dev)
 {
 	struct panthor_device *ptdev = dev_get_drvdata(dev);
@@ -548,4 +547,3 @@ int panthor_device_suspend(struct device *dev)
 	mutex_unlock(&ptdev->pm.mmio_lock);
 	return ret;
 }
-#endif
#12 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

In reply to Boris Brezillon
Quoted 11 lines · Boris Brezillon

panthor_device_resume/suspend() are only compiled when CONFIG_PM is enabled but panthro_drv.c doesn't use the pm_ptr() macro to conditionally discard resume/suspend assignments, which causes undefined symbol errors at link time when !PM.

We could fix that by using pm_ptr(), but supporting the !PM case makes little sense (the whole point of these embedded GPUs is to be low power, so proper PM is a basic requirement in that case). So let's just enforce the presence of CONFIG_PM with a Kconfig dependency instead.

If someone needs to relax this dependency, it can be done in a follow-up.

This breaks the config for me:

SYNC include/config/auto.conf.cmd
GEN Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected!
drivers/iommu/Kconfig:14: symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3: symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183: symbol PM is selected by PM_SLEEP
kernel/power/Kconfig:117: symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35: symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67: symbol XEN_SAVE_RESTORE depends on XEN
arch/x86/xen/Kconfig:6: symbol XEN depends on PARAVIRT
arch/x86/Kconfig:781: symbol PARAVIRT is selected by HYPERV
drivers/hv/Kconfig:5: symbol HYPERV depends on X86_LOCAL_APIC
arch/x86/Kconfig:1106: symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081: symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39: symbol PCI_MSI is selected by AMD_IOMMU
drivers/iommu/amd/Kconfig:3: symbol AMD_IOMMU depends on IOMMU_SUPPORT
For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations"

BR,
Jani.

Quoted 38 lines
---
 drivers/gpu/drm/panthor/Kconfig          | 1 +
 drivers/gpu/drm/panthor/panthor_device.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/panthor/Kconfig +1 -0
index 55b40ad07f3b..fdce7c1b2310 100644
@@ -6,6 +6,7 @@ config DRM_PANTHOR
 	depends on ARM || ARM64 || COMPILE_TEST
 	depends on !GENERIC_ATOMIC64  # for IOMMU_IO_PGTABLE_LPAE
 	depends on MMU
+	depends on PM
 	select DEVFREQ_GOV_SIMPLE_ONDEMAND
 	select DRM_EXEC
 	select DRM_GEM_SHMEM_HELPER
drivers/gpu/drm/panthor/panthor_device.c +0 -2
index 68e467ee458a..efea29143a54 100644
@@ -403,7 +403,6 @@ int panthor_device_mmap_io(struct panthor_device *ptdev, struct vm_area_struct *
 	return 0;
 }
 
-#ifdef CONFIG_PM
 int panthor_device_resume(struct device *dev)
 {
 	struct panthor_device *ptdev = dev_get_drvdata(dev);
@@ -548,4 +547,3 @@ int panthor_device_suspend(struct device *dev)
 	mutex_unlock(&ptdev->pm.mmio_lock);
 	return ret;
 }
-#endif
Signature · 1 line
Jani Nikula, Intel
author maintainer
#13 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 18 lines · On Mon, 11 Mar 2024 13:05:01 +0200 Jani Nikula <[email protected]>…

This breaks the config for me:

SYNC include/config/auto.conf.cmd
GEN Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected!
drivers/iommu/Kconfig:14: symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3: symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183: symbol PM is selected by PM_SLEEP
kernel/power/Kconfig:117: symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35: symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67: symbol XEN_SAVE_RESTORE depends on XEN
arch/x86/xen/Kconfig:6: symbol XEN depends on PARAVIRT
arch/x86/Kconfig:781: symbol PARAVIRT is selected by HYPERV
drivers/hv/Kconfig:5: symbol HYPERV depends on X86_LOCAL_APIC
arch/x86/Kconfig:1106: symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081: symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39: symbol PCI_MSI is selected by AMD_IOMMU
drivers/iommu/amd/Kconfig:3: symbol AMD_IOMMU depends on IOMMU_SUPPORT

Uh, I guess we want a "depends on IOMMU_SUPPORT" instead of "select IOMMU_SUPPORT" in panthor then.

Quoted 2 lines

For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations"

#14 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 22 lines · Boris Brezillon
Quoted 18 lines · On Mon, 11 Mar 2024 13:05:01 +0200 Jani Nikula <[email protected]>…

This breaks the config for me:

SYNC include/config/auto.conf.cmd
GEN Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected!
drivers/iommu/Kconfig:14: symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3: symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183: symbol PM is selected by PM_SLEEP
kernel/power/Kconfig:117: symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35: symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67: symbol XEN_SAVE_RESTORE depends on XEN
arch/x86/xen/Kconfig:6: symbol XEN depends on PARAVIRT
arch/x86/Kconfig:781: symbol PARAVIRT is selected by HYPERV
drivers/hv/Kconfig:5: symbol HYPERV depends on X86_LOCAL_APIC
arch/x86/Kconfig:1106: symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081: symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39: symbol PCI_MSI is selected by AMD_IOMMU
drivers/iommu/amd/Kconfig:3: symbol AMD_IOMMU depends on IOMMU_SUPPORT

Quoted 2 lines

Uh, I guess we want a "depends on IOMMU_SUPPORT" instead of "select IOMMU_SUPPORT" in panthor then.

That works for me.

Quoted 3 lines
Quoted 3 lines

For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations"

Signature · 1 line
Jani Nikula, Intel
author maintainer
#15 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 23 lines · On Mon, 11 Mar 2024 13:49:56 +0200 Jani Nikula <[email protected]>…
Quoted 22 lines · Boris Brezillon
Quoted 18 lines · On Mon, 11 Mar 2024 13:05:01 +0200 Jani Nikula <[email protected]>…

This breaks the config for me:

SYNC include/config/auto.conf.cmd
GEN Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected!
drivers/iommu/Kconfig:14: symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3: symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183: symbol PM is selected by PM_SLEEP
kernel/power/Kconfig:117: symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35: symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67: symbol XEN_SAVE_RESTORE depends on XEN
arch/x86/xen/Kconfig:6: symbol XEN depends on PARAVIRT
arch/x86/Kconfig:781: symbol PARAVIRT is selected by HYPERV
drivers/hv/Kconfig:5: symbol HYPERV depends on X86_LOCAL_APIC
arch/x86/Kconfig:1106: symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081: symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39: symbol PCI_MSI is selected by AMD_IOMMU
drivers/iommu/amd/Kconfig:3: symbol AMD_IOMMU depends on IOMMU_SUPPORT

Quoted 4 lines
Quoted 2 lines

Uh, I guess we want a "depends on IOMMU_SUPPORT" instead of "select IOMMU_SUPPORT" in panthor then.

That works for me.

Let's revert the faulty commit first. We'll see if Steve has a different solution for the original issue.

Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations"

#16 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 26 lines · Boris Brezillon
Quoted 23 lines · On Mon, 11 Mar 2024 13:49:56 +0200 Jani Nikula <[email protected]>…
Quoted 22 lines · Boris Brezillon
Quoted 18 lines · On Mon, 11 Mar 2024 13:05:01 +0200 Jani Nikula <[email protected]>…

This breaks the config for me:

SYNC include/config/auto.conf.cmd
GEN Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected!
drivers/iommu/Kconfig:14: symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3: symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183: symbol PM is selected by PM_SLEEP
kernel/power/Kconfig:117: symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35: symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67: symbol XEN_SAVE_RESTORE depends on XEN
arch/x86/xen/Kconfig:6: symbol XEN depends on PARAVIRT
arch/x86/Kconfig:781: symbol PARAVIRT is selected by HYPERV
drivers/hv/Kconfig:5: symbol HYPERV depends on X86_LOCAL_APIC
arch/x86/Kconfig:1106: symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081: symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39: symbol PCI_MSI is selected by AMD_IOMMU
drivers/iommu/amd/Kconfig:3: symbol AMD_IOMMU depends on IOMMU_SUPPORT

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Uh, I guess we want a "depends on IOMMU_SUPPORT" instead of "select IOMMU_SUPPORT" in panthor then.

That works for me.

Let's revert the faulty commit first. We'll see if Steve has a different solution for the original issue.

FWIW, the reasoning in the offending commit seems incredibly tenuous. There are far more practical reasons for building an arm/arm64 kernel without PM - for debugging or whatever, and where one may even still want a usable GPU, let alone just a non-broken build - than there are for building this driver for x86. Using pm_ptr() is trivial, and if you want to support COMPILE_TEST then there's really no justifiable excuse not to.

Thanks,
Robin.

author maintainer
#17 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 35 lines · On Mon, 11 Mar 2024 13:11:28 +0000 Robin Murphy <[email protected]> wrote:
Quoted 26 lines · Boris Brezillon
Quoted 23 lines · On Mon, 11 Mar 2024 13:49:56 +0200 Jani Nikula <[email protected]>…
Quoted 22 lines · Boris Brezillon
Quoted 18 lines · On Mon, 11 Mar 2024 13:05:01 +0200 Jani Nikula <[email protected]>…

This breaks the config for me:

SYNC include/config/auto.conf.cmd
GEN Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected!
drivers/iommu/Kconfig:14: symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3: symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183: symbol PM is selected by PM_SLEEP
kernel/power/Kconfig:117: symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35: symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67: symbol XEN_SAVE_RESTORE depends on XEN
arch/x86/xen/Kconfig:6: symbol XEN depends on PARAVIRT
arch/x86/Kconfig:781: symbol PARAVIRT is selected by HYPERV
drivers/hv/Kconfig:5: symbol HYPERV depends on X86_LOCAL_APIC
arch/x86/Kconfig:1106: symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081: symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39: symbol PCI_MSI is selected by AMD_IOMMU
drivers/iommu/amd/Kconfig:3: symbol AMD_IOMMU depends on IOMMU_SUPPORT

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Uh, I guess we want a "depends on IOMMU_SUPPORT" instead of "select IOMMU_SUPPORT" in panthor then.

That works for me.

Let's revert the faulty commit first. We'll see if Steve has a different solution for the original issue.

Quoted 7 lines

FWIW, the reasoning in the offending commit seems incredibly tenuous. There are far more practical reasons for building an arm/arm64 kernel without PM - for debugging or whatever, and where one may even still want a usable GPU, let alone just a non-broken build - than there are for building this driver for x86. Using pm_ptr() is trivial, and if you want to support COMPILE_TEST then there's really no justifiable excuse not to.

The problem is not just about using pm_ptr(), but also making sure panthor_device_resume/suspend() are called called in the init/unplug path when !PM, as I don't think the PM helpers automate that for us. I was just aiming for a simple fix that wouldn't force me to test the !PM case...

Quoted 3 lines

Thanks,
Robin.

#18 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 46 lines · Boris Brezillon
Quoted 35 lines · On Mon, 11 Mar 2024 13:11:28 +0000 Robin Murphy <[email protected]> wrote:
Quoted 26 lines · Boris Brezillon
Quoted 23 lines · On Mon, 11 Mar 2024 13:49:56 +0200 Jani Nikula <[email protected]>…
Quoted 22 lines · Boris Brezillon
Quoted 18 lines · On Mon, 11 Mar 2024 13:05:01 +0200 Jani Nikula <[email protected]>…

This breaks the config for me:

SYNC include/config/auto.conf.cmd
GEN Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected!
drivers/iommu/Kconfig:14: symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3: symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183: symbol PM is selected by PM_SLEEP
kernel/power/Kconfig:117: symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35: symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67: symbol XEN_SAVE_RESTORE depends on XEN
arch/x86/xen/Kconfig:6: symbol XEN depends on PARAVIRT
arch/x86/Kconfig:781: symbol PARAVIRT is selected by HYPERV
drivers/hv/Kconfig:5: symbol HYPERV depends on X86_LOCAL_APIC
arch/x86/Kconfig:1106: symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081: symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39: symbol PCI_MSI is selected by AMD_IOMMU
drivers/iommu/amd/Kconfig:3: symbol AMD_IOMMU depends on IOMMU_SUPPORT

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Uh, I guess we want a "depends on IOMMU_SUPPORT" instead of "select IOMMU_SUPPORT" in panthor then.

That works for me.

Let's revert the faulty commit first. We'll see if Steve has a different solution for the original issue.

Quoted 7 lines

FWIW, the reasoning in the offending commit seems incredibly tenuous. There are far more practical reasons for building an arm/arm64 kernel without PM - for debugging or whatever, and where one may even still want a usable GPU, let alone just a non-broken build - than there are for building this driver for x86. Using pm_ptr() is trivial, and if you want to support COMPILE_TEST then there's really no justifiable excuse not to.

Quoted 5 lines

The problem is not just about using pm_ptr(), but also making sure panthor_device_resume/suspend() are called called in the init/unplug path when !PM, as I don't think the PM helpers automate that for us. I was just aiming for a simple fix that wouldn't force me to test the !PM case...

Fair enough, at worst we could always have a runtime check and refuse to probe in conditions we don't think are worth the bother of implementing fully-functional support for. However if we want to make an argument for only supporting "realistic" configs at build time then that is an argument for dropping COMPILE_TEST as well.

Thanks,
Robin.

maintainer
#19 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 60 lines · Robin Murphy
Quoted 54 lines · Boris Brezillon
Quoted 43 lines · On Mon, 11 Mar 2024 13:11:28 +0000 Robin Murphy <[email protected]> wrote:
Quoted 34 lines · Boris Brezillon

On Mon, 11 Mar 2024 13:49:56 +0200
Jani Nikula <[email protected]> wrote:

Quoted 31 lines
Quoted 29 lines · Boris Brezillon

On Mon, 11 Mar 2024 13:05:01 +0200
Jani Nikula <[email protected]> wrote:

Quoted 25 lines

This breaks the config for me:

    SYNC    include/config/auto.conf.cmd
    GEN     Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected! drivers/iommu/Kconfig:14:    symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3:    symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183:    symbol PM is selected by PM_SLEEP kernel/power/Kconfig:117:    symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35:    symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67:    symbol XEN_SAVE_RESTORE depends on XEN arch/x86/xen/Kconfig:6:    symbol XEN depends on PARAVIRT arch/x86/Kconfig:781:    symbol PARAVIRT is selected by HYPERV drivers/hv/Kconfig:5:    symbol HYPERV depends on X86_LOCAL_APIC arch/x86/Kconfig:1106:    symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081:    symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39:    symbol PCI_MSI is selected by AMD_IOMMU drivers/iommu/amd/Kconfig:3:    symbol AMD_IOMMU depends on IOMMU_SUPPORT

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Uh, I guess we want a "depends on IOMMU_SUPPORT" instead of "select IOMMU_SUPPORT" in panthor then.

That works for me.

Let's revert the faulty commit first. We'll see if Steve has a different solution for the original issue.

Quoted 7 lines

FWIW, the reasoning in the offending commit seems incredibly tenuous. There are far more practical reasons for building an arm/arm64 kernel without PM - for debugging or whatever, and where one may even still want a usable GPU, let alone just a non-broken build - than there are for building this driver for x86. Using pm_ptr() is trivial, and if you want to support COMPILE_TEST then there's really no justifiable excuse not to.

Quoted 5 lines

The problem is not just about using pm_ptr(), but also making sure panthor_device_resume/suspend() are called called in the init/unplug path when !PM, as I don't think the PM helpers automate that for us. I was just aiming for a simple fix that wouldn't force me to test the !PM case...

Quoted 5 lines

Fair enough, at worst we could always have a runtime check and refuse to probe in conditions we don't think are worth the bother of implementing fully-functional support for. However if we want to make an argument for only supporting "realistic" configs at build time then that is an argument for dropping COMPILE_TEST as well.

Can we just replace the "depends on PM" with "select PM"? In my (admittedly very limited) testing this works. Otherwise I think we need to bite the bullet and support !PM in some way (maybe just as Robin suggests with a runtime bail out).

Steve

author maintainer
#20 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 67 lines · On Mon, 11 Mar 2024 13:46:23 +0000 Steven Price <[email protected]> wrote:
Quoted 60 lines · Robin Murphy
Quoted 54 lines · Boris Brezillon
Quoted 43 lines · On Mon, 11 Mar 2024 13:11:28 +0000 Robin Murphy <[email protected]> wrote:
Quoted 34 lines · Boris Brezillon

On Mon, 11 Mar 2024 13:49:56 +0200
Jani Nikula <[email protected]> wrote:

Quoted 31 lines
Quoted 29 lines · Boris Brezillon

On Mon, 11 Mar 2024 13:05:01 +0200
Jani Nikula <[email protected]> wrote:

Quoted 25 lines

This breaks the config for me:

    SYNC    include/config/auto.conf.cmd
    GEN     Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected! drivers/iommu/Kconfig:14:    symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3:    symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183:    symbol PM is selected by PM_SLEEP kernel/power/Kconfig:117:    symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35:    symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67:    symbol XEN_SAVE_RESTORE depends on XEN arch/x86/xen/Kconfig:6:    symbol XEN depends on PARAVIRT arch/x86/Kconfig:781:    symbol PARAVIRT is selected by HYPERV drivers/hv/Kconfig:5:    symbol HYPERV depends on X86_LOCAL_APIC arch/x86/Kconfig:1106:    symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081:    symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39:    symbol PCI_MSI is selected by AMD_IOMMU drivers/iommu/amd/Kconfig:3:    symbol AMD_IOMMU depends on IOMMU_SUPPORT

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Uh, I guess we want a "depends on IOMMU_SUPPORT" instead of "select IOMMU_SUPPORT" in panthor then.

That works for me.

Let's revert the faulty commit first. We'll see if Steve has a different solution for the original issue.

Quoted 7 lines

FWIW, the reasoning in the offending commit seems incredibly tenuous. There are far more practical reasons for building an arm/arm64 kernel without PM - for debugging or whatever, and where one may even still want a usable GPU, let alone just a non-broken build - than there are for building this driver for x86. Using pm_ptr() is trivial, and if you want to support COMPILE_TEST then there's really no justifiable excuse not to.

Quoted 5 lines

The problem is not just about using pm_ptr(), but also making sure panthor_device_resume/suspend() are called called in the init/unplug path when !PM, as I don't think the PM helpers automate that for us. I was just aiming for a simple fix that wouldn't force me to test the !PM case...

Quoted 5 lines

Fair enough, at worst we could always have a runtime check and refuse to probe in conditions we don't think are worth the bother of implementing fully-functional support for. However if we want to make an argument for only supporting "realistic" configs at build time then that is an argument for dropping COMPILE_TEST as well.

Quoted 4 lines

Can we just replace the "depends on PM" with "select PM"? In my (admittedly very limited) testing this works. Otherwise I think we need to bite the bullet and support !PM in some way (maybe just as Robin suggests with a runtime bail out).

I won't have time to test it this week, but if someone is interested, here's a diff implementing manual resume/suspend in the init/unplug path:

--->8---

author maintainer
#21 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 75 lines · On Mon, 11 Mar 2024 14:58:37 +0100 Boris Brezillon…
Quoted 67 lines · On Mon, 11 Mar 2024 13:46:23 +0000 Steven Price <[email protected]> wrote:
Quoted 60 lines · Robin Murphy
Quoted 54 lines · Boris Brezillon
Quoted 43 lines · On Mon, 11 Mar 2024 13:11:28 +0000 Robin Murphy <[email protected]> wrote:
Quoted 34 lines · Boris Brezillon

On Mon, 11 Mar 2024 13:49:56 +0200
Jani Nikula <[email protected]> wrote:

Quoted 31 lines
Quoted 29 lines · Boris Brezillon

On Mon, 11 Mar 2024 13:05:01 +0200
Jani Nikula <[email protected]> wrote:

Quoted 25 lines

This breaks the config for me:

    SYNC    include/config/auto.conf.cmd
    GEN     Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected! drivers/iommu/Kconfig:14:    symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3:    symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183:    symbol PM is selected by PM_SLEEP kernel/power/Kconfig:117:    symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35:    symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67:    symbol XEN_SAVE_RESTORE depends on XEN arch/x86/xen/Kconfig:6:    symbol XEN depends on PARAVIRT arch/x86/Kconfig:781:    symbol PARAVIRT is selected by HYPERV drivers/hv/Kconfig:5:    symbol HYPERV depends on X86_LOCAL_APIC arch/x86/Kconfig:1106:    symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081:    symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39:    symbol PCI_MSI is selected by AMD_IOMMU drivers/iommu/amd/Kconfig:3:    symbol AMD_IOMMU depends on IOMMU_SUPPORT

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Uh, I guess we want a "depends on IOMMU_SUPPORT" instead of "select IOMMU_SUPPORT" in panthor then.

That works for me.

Let's revert the faulty commit first. We'll see if Steve has a different solution for the original issue.

Quoted 7 lines

FWIW, the reasoning in the offending commit seems incredibly tenuous. There are far more practical reasons for building an arm/arm64 kernel without PM - for debugging or whatever, and where one may even still want a usable GPU, let alone just a non-broken build - than there are for building this driver for x86. Using pm_ptr() is trivial, and if you want to support COMPILE_TEST then there's really no justifiable excuse not to.

Quoted 5 lines

The problem is not just about using pm_ptr(), but also making sure panthor_device_resume/suspend() are called called in the init/unplug path when !PM, as I don't think the PM helpers automate that for us. I was just aiming for a simple fix that wouldn't force me to test the !PM case...

Quoted 5 lines

Fair enough, at worst we could always have a runtime check and refuse to probe in conditions we don't think are worth the bother of implementing fully-functional support for. However if we want to make an argument for only supporting "realistic" configs at build time then that is an argument for dropping COMPILE_TEST as well.

Quoted 4 lines

Can we just replace the "depends on PM" with "select PM"? In my (admittedly very limited) testing this works. Otherwise I think we need to bite the bullet and support !PM in some way (maybe just as Robin suggests with a runtime bail out).

Quoted 5 lines

I won't have time to test it this week, but if someone is interested, here's a diff implementing manual resume/suspend in the init/unplug path:

--->8---

This time with the diff :-)

--->8---

drivers/gpu/drm/panthor/panthor_device.c +11 -0
index 69deb8e17778..3d05e7358f0e 100644
@@ -87,6 +87,10 @@ void panthor_device_unplug(struct panthor_device *ptdev)
        pm_runtime_dont_use_autosuspend(ptdev->base.dev);
        pm_runtime_put_sync_suspend(ptdev->base.dev);
 
+       /* If PM is disabled, we need to call the suspend handler manually. */
+       if (!IS_ENABLED(CONFIG_PM))
+               panthor_device_suspend(ptdev->base.dev);
+
        /* Report the unplug operation as done to unblock concurrent
         * panthor_device_unplug() callers.
         */
@@ -218,6 +222,13 @@ int panthor_device_init(struct panthor_device *ptdev)
        if (ret)
                return ret;
 
+       /* If PM is disabled, we need to call panthor_device_resume() manually. */
+       if (!IS_ENABLED(CONFIG_PM)) {
+               ret = panthor_device_resume(ptdev->base.dev);
+               if (ret)
+                       return ret;
+       }
+
        ret = panthor_gpu_init(ptdev);
        if (ret)
                goto err_rpm_put;
drivers/gpu/drm/panthor/panthor_drv.c +3 -1
index ff484506229f..2ea6a9f436db 100644
@@ -1407,17 +1407,19 @@ static const struct of_device_id dt_match[] = {
 };
 MODULE_DEVICE_TABLE(of, dt_match);
 
+#ifdef CONFIG_PM
 static DEFINE_RUNTIME_DEV_PM_OPS(panthor_pm_ops,
                                 panthor_device_suspend,
                                 panthor_device_resume,
                                 NULL);
+#endif
 
 static struct platform_driver panthor_driver = {
        .probe = panthor_probe,
        .remove_new = panthor_remove,
        .driver = {
                .name = "panthor",
-               .pm = &panthor_pm_ops,
+               .pm = pm_ptr(&panthor_pm_ops),
                .of_match_table = dt_match,
        },
 };
author maintainer
#22 lore raw

Re: [PATCH 3/3] drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Quoted 106 lines · On Mon, 11 Mar 2024 14:59:39 +0100 Boris Brezillon…
Quoted 75 lines · On Mon, 11 Mar 2024 14:58:37 +0100 Boris Brezillon…
Quoted 67 lines · On Mon, 11 Mar 2024 13:46:23 +0000 Steven Price <[email protected]> wrote:
Quoted 60 lines · Robin Murphy
Quoted 54 lines · Boris Brezillon
Quoted 43 lines · On Mon, 11 Mar 2024 13:11:28 +0000 Robin Murphy <[email protected]> wrote:
Quoted 34 lines · Boris Brezillon

On Mon, 11 Mar 2024 13:49:56 +0200
Jani Nikula <[email protected]> wrote:

Quoted 31 lines
Quoted 29 lines · Boris Brezillon

On Mon, 11 Mar 2024 13:05:01 +0200
Jani Nikula <[email protected]> wrote:

Quoted 25 lines

This breaks the config for me:

    SYNC    include/config/auto.conf.cmd
    GEN     Makefile
drivers/iommu/Kconfig:14:error: recursive dependency detected! drivers/iommu/Kconfig:14:    symbol IOMMU_SUPPORT is selected by DRM_PANTHOR
drivers/gpu/drm/panthor/Kconfig:3:    symbol DRM_PANTHOR depends on PM
kernel/power/Kconfig:183:    symbol PM is selected by PM_SLEEP kernel/power/Kconfig:117:    symbol PM_SLEEP depends on HIBERNATE_CALLBACKS
kernel/power/Kconfig:35:    symbol HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE
arch/x86/xen/Kconfig:67:    symbol XEN_SAVE_RESTORE depends on XEN arch/x86/xen/Kconfig:6:    symbol XEN depends on PARAVIRT arch/x86/Kconfig:781:    symbol PARAVIRT is selected by HYPERV drivers/hv/Kconfig:5:    symbol HYPERV depends on X86_LOCAL_APIC arch/x86/Kconfig:1106:    symbol X86_LOCAL_APIC depends on X86_UP_APIC
arch/x86/Kconfig:1081:    symbol X86_UP_APIC prompt is visible depending on PCI_MSI
drivers/pci/Kconfig:39:    symbol PCI_MSI is selected by AMD_IOMMU drivers/iommu/amd/Kconfig:3:    symbol AMD_IOMMU depends on IOMMU_SUPPORT

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Uh, I guess we want a "depends on IOMMU_SUPPORT" instead of "select IOMMU_SUPPORT" in panthor then.

That works for me.

Let's revert the faulty commit first. We'll see if Steve has a different solution for the original issue.

Quoted 7 lines

FWIW, the reasoning in the offending commit seems incredibly tenuous. There are far more practical reasons for building an arm/arm64 kernel without PM - for debugging or whatever, and where one may even still want a usable GPU, let alone just a non-broken build - than there are for building this driver for x86. Using pm_ptr() is trivial, and if you want to support COMPILE_TEST then there's really no justifiable excuse not to.

Quoted 5 lines

The problem is not just about using pm_ptr(), but also making sure panthor_device_resume/suspend() are called called in the init/unplug path when !PM, as I don't think the PM helpers automate that for us. I was just aiming for a simple fix that wouldn't force me to test the !PM case...

Quoted 5 lines

Fair enough, at worst we could always have a runtime check and refuse to probe in conditions we don't think are worth the bother of implementing fully-functional support for. However if we want to make an argument for only supporting "realistic" configs at build time then that is an argument for dropping COMPILE_TEST as well.

Quoted 4 lines

Can we just replace the "depends on PM" with "select PM"? In my (admittedly very limited) testing this works. Otherwise I think we need to bite the bullet and support !PM in some way (maybe just as Robin suggests with a runtime bail out).

Quoted 5 lines

I won't have time to test it this week, but if someone is interested, here's a diff implementing manual resume/suspend in the init/unplug path:

--->8---

This time with the diff :-)

--->8---

drivers/gpu/drm/panthor/panthor_device.c +4 -0
index 69deb8e17778..3d05e7358f0e 100644
@@ -87,6 +87,10 @@ void panthor_device_unplug(struct panthor_device *ptdev)
        pm_runtime_dont_use_autosuspend(ptdev->base.dev);
        pm_runtime_put_sync_suspend(ptdev->base.dev);
 
+       /* If PM is disabled, we need to call the suspend handler manually. */
+       if (!IS_ENABLED(CONFIG_PM))
+               panthor_device_suspend(ptdev->base.dev);
+
        /* Report the unplug operation as done to unblock concurrent
         * panthor_device_unplug() callers.
         */
@@ -218,6 +222,13 @@ int panthor_device_init(struct panthor_device *ptdev)
        if (ret)
                return ret;
 

drivers/gpu/drm/panthor/panthor_device.c int panthor_device_init(struct panthor_device *ptdev) · line 234

Quoted 10 lines
drivers/gpu/drm/panthor/panthor_device.c +7 -0
+       /* If PM is disabled, we need to call panthor_device_resume() manually. */
+       if (!IS_ENABLED(CONFIG_PM)) {
+               ret = panthor_device_resume(ptdev->base.dev);
+               if (ret)
+                       return ret;
+       }
+
        ret = panthor_gpu_init(ptdev);
        if (ret)
                goto err_rpm_put;

And I forgot to remove the #ifdef CONFIG_PM in panthor_device.c.

Quoted 25 lines
drivers/gpu/drm/panthor/panthor_drv.c +3 -1
index ff484506229f..2ea6a9f436db 100644
@@ -1407,17 +1407,19 @@ static const struct of_device_id dt_match[] = {
 };
 MODULE_DEVICE_TABLE(of, dt_match);
 
+#ifdef CONFIG_PM
 static DEFINE_RUNTIME_DEV_PM_OPS(panthor_pm_ops,
                                 panthor_device_suspend,
                                 panthor_device_resume,
                                 NULL);
+#endif
 
 static struct platform_driver panthor_driver = {
        .probe = panthor_probe,
        .remove_new = panthor_remove,
        .driver = {
                .name = "panthor",
-               .pm = &panthor_pm_ops,
+               .pm = pm_ptr(&panthor_pm_ops),
                .of_match_table = dt_match,
        },
 };
author maintainer Applied
#23 lore raw
In reply to Boris Brezillon
Quoted 7 lines · On Mon, 4 Mar 2024 10:08:09 +0100 Boris Brezillon…

Hello,

Here are three trivial fixes for bugs reported by the intel kernel test bot.

Regards,

Quoted 7 lines

Boris

Boris Brezillon (3):
drm/panthor: Fix panthor_devfreq kerneldoc
drm/panthor: Explicitly include page.h for the {virt,__phys)_to_pfn()
defs
drm/panthor: Fix undefined panthor_device_suspend/resume symbol issue

Queued to drm-misc-next.

Quoted 6 lines
 drivers/gpu/drm/panthor/Kconfig           | 1 +
 drivers/gpu/drm/panthor/panthor_devfreq.c | 2 +-
 drivers/gpu/drm/panthor/panthor_device.c  | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)