diff mbox series

[v3,17/19] arch/sparc: Implement fb_is_primary_device() in source file

Message ID 20230417125651.25126-18-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series arch: Consolidate <asm/fb.h> | expand

Commit Message

Thomas Zimmermann April 17, 2023, 12:56 p.m. UTC
Other architectures implment fb_is_primary_device() in a source
file. Do the same on sparc. No functional changes, but allows to
remove several include statement from <asm/fb.h>.

v2:
	* don't include <asm/prom.h> in header file

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/Makefile         |  1 +
 arch/sparc/include/asm/fb.h | 23 +++++------------------
 arch/sparc/video/Makefile   |  3 +++
 arch/sparc/video/fbdev.c    | 24 ++++++++++++++++++++++++
 4 files changed, 33 insertions(+), 18 deletions(-)
 create mode 100644 arch/sparc/video/Makefile
 create mode 100644 arch/sparc/video/fbdev.c

Comments

Guenter Roeck June 24, 2023, 1:55 a.m. UTC | #1
Hi,

On Mon, Apr 17, 2023 at 02:56:49PM +0200, Thomas Zimmermann wrote:
> Other architectures implment fb_is_primary_device() in a source
> file. Do the same on sparc. No functional changes, but allows to
> remove several include statement from <asm/fb.h>.
> 
> v2:
> 	* don't include <asm/prom.h> in header file
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: "David S. Miller" <davem@davemloft.net>

This patch results (or appears to result) in the following build error
when trying to build sparc64:allmodconfig.

Error log:
<stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
WARNING: modpost: drivers/cpufreq/sparc-us2e-cpufreq: section mismatch in reference: cpufreq_us2e_driver+0x20 (section: .data) -> us2e_freq_cpu_init (section: .init.text)
WARNING: modpost: drivers/cpufreq/sparc-us3-cpufreq: section mismatch in reference: cpufreq_us3_driver+0x20 (section: .data) -> us3_freq_cpu_init (section: .init.text)
ERROR: modpost: missing MODULE_LICENSE() in arch/sparc/video/fbdev.o
ERROR: modpost: "__xchg_called_with_bad_pointer" [lib/atomic64_test.ko] undefined!

Bisect log attached. Note that I suspect that there are several problems,
but that is difficult to determine since this patch can not easily
be reverted.

Guenter

---
# bad: [8d2be868b42c08290509c60515865f4de24ea704] Add linux-next specific files for 20230623
# good: [45a3e24f65e90a047bef86f927ebdc4c710edaa1] Linux 6.4-rc7
git bisect start 'HEAD' 'v6.4-rc7'
# good: [a5838c78db6a3a02e8d221e588c948f792e7f256] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git
git bisect good a5838c78db6a3a02e8d221e588c948f792e7f256
# bad: [cca41cc0b5485a0ec20707316c1a00082c01a2af] Merge branch 'for-next' of git://git.kernel.dk/linux-block.git
git bisect bad cca41cc0b5485a0ec20707316c1a00082c01a2af
# bad: [901bdf5ea1a836400ee69aa32b04e9c209271ec7] Merge tag 'amd-drm-next-6.5-2023-06-09' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
git bisect bad 901bdf5ea1a836400ee69aa32b04e9c209271ec7
# good: [c2d2588c702364ff53916ddd97e2b26fd4f4a317] drm/amdkfd: add send exception operation
git bisect good c2d2588c702364ff53916ddd97e2b26fd4f4a317
# bad: [1b842f73edbb1f8513ef4a89389176c628dc014a] drm/i915/guc: Remove some obsolete definitions
git bisect bad 1b842f73edbb1f8513ef4a89389176c628dc014a
# bad: [b8887e796e06b1de4db899f49d531d220f94f393] Merge tag 'drm-misc-next-2023-05-24' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
git bisect bad b8887e796e06b1de4db899f49d531d220f94f393
# bad: [bfdede3a58ea970333d77a05144a7bcec13cf515] drm/rockchip: cdn-dp: call drm_connector_update_edid_property() unconditionally
git bisect bad bfdede3a58ea970333d77a05144a7bcec13cf515
# good: [b50f6d465ac1fb37cab7bfb39ac6c9fb9d8e3716] arch/powerpc: Implement <asm/fb.h> with generic helpers
git bisect good b50f6d465ac1fb37cab7bfb39ac6c9fb9d8e3716
# bad: [322d716a3e8a74fb75cd0f657647be4df253fd2f] drm/vkms: isolate pixel conversion functionality
git bisect bad 322d716a3e8a74fb75cd0f657647be4df253fd2f
# bad: [55b24786b74863b8f10e4d262e642749911cb3bb] drm/display: Add missing OLED Vesa brightnesses definitions
git bisect bad 55b24786b74863b8f10e4d262e642749911cb3bb
# bad: [1c9da7db8899fa0e891997118d75b46d38102497] drm/armada: Include <linux/of.h>
git bisect bad 1c9da7db8899fa0e891997118d75b46d38102497
# bad: [db76f19a607d6cf4a9d5868d05675c355e99809c] arch/sparc: Implement <asm/fb.h> with generic helpers
git bisect bad db76f19a607d6cf4a9d5868d05675c355e99809c
# bad: [4eec0b3048fcd74b504c2a6828a07f133a8ab508] arch/sparc: Implement fb_is_primary_device() in source file
git bisect bad 4eec0b3048fcd74b504c2a6828a07f133a8ab508
# good: [b6cf29637be638a6846d2d297d80cf7c6fb74faf] arch/sh: Implement <asm/fb.h> with generic helpers
git bisect good b6cf29637be638a6846d2d297d80cf7c6fb74faf
# first bad commit: [4eec0b3048fcd74b504c2a6828a07f133a8ab508] arch/sparc: Implement fb_is_primary_device() in source file
Arnd Bergmann June 24, 2023, 9:27 a.m. UTC | #2
On Sat, Jun 24, 2023, at 03:55, Guenter Roeck wrote:
>
> On Mon, Apr 17, 2023 at 02:56:49PM +0200, Thomas Zimmermann wrote:
>> Other architectures implment fb_is_primary_device() in a source
>> file. Do the same on sparc. No functional changes, but allows to
>> remove several include statement from <asm/fb.h>.
>> 
>> v2:
>> 	* don't include <asm/prom.h> in header file
>> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: "David S. Miller" <davem@davemloft.net>
>
> This patch results (or appears to result) in the following build error
> when trying to build sparc64:allmodconfig.
>
> Error log:
> <stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
> WARNING: modpost: drivers/cpufreq/sparc-us2e-cpufreq: section mismatch 
> in reference: cpufreq_us2e_driver+0x20 (section: .data) -> 
> us2e_freq_cpu_init (section: .init.text)
> WARNING: modpost: drivers/cpufreq/sparc-us3-cpufreq: section mismatch 
> in reference: cpufreq_us3_driver+0x20 (section: .data) -> 
> us3_freq_cpu_init (section: .init.text)
> ERROR: modpost: "__xchg_called_with_bad_pointer" [lib/atomic64_test.ko] 
> undefined!

These all look like old bugs that would be trivially fixed if
anyone cared about sparc.

> ERROR: modpost: missing MODULE_LICENSE() in arch/sparc/video/fbdev.o

I checked that there are no callers of fb_is_primary_device()
in built-in code when CONFIG_FB is =m, so adding the MODULE_LICENSE()
and MODULE_DESCRIPTION() tags to the file is the correct fix.

    Arnd
Guenter Roeck June 24, 2023, 1:26 p.m. UTC | #3
On 6/24/23 02:27, Arnd Bergmann wrote:
> On Sat, Jun 24, 2023, at 03:55, Guenter Roeck wrote:
>>
>> On Mon, Apr 17, 2023 at 02:56:49PM +0200, Thomas Zimmermann wrote:
>>> Other architectures implment fb_is_primary_device() in a source
>>> file. Do the same on sparc. No functional changes, but allows to
>>> remove several include statement from <asm/fb.h>.
>>>
>>> v2:
>>> 	* don't include <asm/prom.h> in header file
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> Cc: "David S. Miller" <davem@davemloft.net>
>>
>> This patch results (or appears to result) in the following build error
>> when trying to build sparc64:allmodconfig.
>>
>> Error log:
>> <stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
>> WARNING: modpost: drivers/cpufreq/sparc-us2e-cpufreq: section mismatch
>> in reference: cpufreq_us2e_driver+0x20 (section: .data) ->
>> us2e_freq_cpu_init (section: .init.text)
>> WARNING: modpost: drivers/cpufreq/sparc-us3-cpufreq: section mismatch
>> in reference: cpufreq_us3_driver+0x20 (section: .data) ->
>> us3_freq_cpu_init (section: .init.text)
>> ERROR: modpost: "__xchg_called_with_bad_pointer" [lib/atomic64_test.ko]
>> undefined!
> 
> These all look like old bugs that would be trivially fixed if
> anyone cared about sparc.
> 

Odd argument, given that this _is_ a sparc patch. Those may be old
bugs, but at least in 6.4-rc7 sparc64:allmodconfig does at least compile.

Sure, I can stop build testing it if that is where things are going.

Guenter

>> ERROR: modpost: missing MODULE_LICENSE() in arch/sparc/video/fbdev.o
> 
> I checked that there are no callers of fb_is_primary_device()
> in built-in code when CONFIG_FB is =m, so adding the MODULE_LICENSE()
> and MODULE_DESCRIPTION() tags to the file is the correct fix.
> 
>      Arnd
Arnd Bergmann June 24, 2023, 2:21 p.m. UTC | #4
On Sat, Jun 24, 2023, at 15:26, Guenter Roeck wrote:
> On 6/24/23 02:27, Arnd Bergmann wrote:
>> On Sat, Jun 24, 2023, at 03:55, Guenter Roeck wrote:
>>>
>>> On Mon, Apr 17, 2023 at 02:56:49PM +0200, Thomas Zimmermann wrote:
>>>> Other architectures implment fb_is_primary_device() in a source
>>>> file. Do the same on sparc. No functional changes, but allows to
>>>> remove several include statement from <asm/fb.h>.
>>>>
>>>> v2:
>>>> 	* don't include <asm/prom.h> in header file
>>>>
>>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>>> Cc: "David S. Miller" <davem@davemloft.net>
>>>
>>> This patch results (or appears to result) in the following build error
>>> when trying to build sparc64:allmodconfig.
>>>
>>> Error log:
>>> <stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
>>> WARNING: modpost: drivers/cpufreq/sparc-us2e-cpufreq: section mismatch
>>> in reference: cpufreq_us2e_driver+0x20 (section: .data) ->
>>> us2e_freq_cpu_init (section: .init.text)
>>> WARNING: modpost: drivers/cpufreq/sparc-us3-cpufreq: section mismatch
>>> in reference: cpufreq_us3_driver+0x20 (section: .data) ->
>>> us3_freq_cpu_init (section: .init.text)
>>> ERROR: modpost: "__xchg_called_with_bad_pointer" [lib/atomic64_test.ko]
>>> undefined!
>> 
>> These all look like old bugs that would be trivially fixed if
>> anyone cared about sparc.
>> 
>
> Odd argument, given that this _is_ a sparc patch. Those may be old
> bugs, but at least in 6.4-rc7 sparc64:allmodconfig does at least compile.

The first three are non-fatal warnings even with CONFIG_WERROR=y, I'm
sure they have been there for years. I don't immediately see what
caused the __xchg_called_with_bad_pointer error, but it does not
look related to the fbdev patch. I would guess that this is a second
regression that happened to come in at the same time.

> Sure, I can stop build testing it if that is where things are going.

I think we clearly want to fix the fbdev regression you found, and
maybe bisect the atomic64_test as well to see if that was caused by
a recent patch to get it into a working state again.

Regarding whether to continue build testing: if every kernel build
warns about a missing syscall for almost four years (clone3 was
added in 5.3 and requires a minimal review to hook it up to asm
code), it shows that the architecture is seriously neglected
already.

     Arnd
Arnd Bergmann June 28, 2023, 10:01 a.m. UTC | #5
On Sat, Jun 24, 2023, at 16:21, Arnd Bergmann wrote:
> On Sat, Jun 24, 2023, at 15:26, Guenter Roeck wrote:
>> On 6/24/23 02:27, Arnd Bergmann wrote:
>>> On Sat, Jun 24, 2023, at 03:55, Guenter Roeck wrote:
>>>>
>>>> ERROR: modpost: "__xchg_called_with_bad_pointer" [lib/atomic64_test.ko]
>>>> undefined!
>>> 
>>> These all look like old bugs that would be trivially fixed if
>>> anyone cared about sparc.
>>> 
>>
>> Odd argument, given that this _is_ a sparc patch. Those may be old
>> bugs, but at least in 6.4-rc7 sparc64:allmodconfig does at least compile.
>
> I think we clearly want to fix the fbdev regression you found, and
> maybe bisect the atomic64_test as well to see if that was caused by
> a recent patch to get it into a working state again.

I have bisected this as well now and sent a trivial fix, see
https://lore.kernel.org/lkml/20230628094938.2318171-1-arnd@kernel.org/

      Arnd
diff mbox series

Patch

diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index a4ea5b05f288..95a9211e48e3 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -60,6 +60,7 @@  libs-y                 += arch/sparc/prom/
 libs-y                 += arch/sparc/lib/
 
 drivers-$(CONFIG_PM) += arch/sparc/power/
+drivers-$(CONFIG_FB) += arch/sparc/video/
 
 boot := arch/sparc/boot
 
diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/fb.h
index f699962e9ddf..28609f7a965c 100644
--- a/arch/sparc/include/asm/fb.h
+++ b/arch/sparc/include/asm/fb.h
@@ -1,11 +1,12 @@ 
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef _SPARC_FB_H_
 #define _SPARC_FB_H_
-#include <linux/console.h>
-#include <linux/fb.h>
+
 #include <linux/fs.h>
+
 #include <asm/page.h>
-#include <asm/prom.h>
+
+struct fb_info;
 
 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 				unsigned long off)
@@ -15,20 +16,6 @@  static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 #endif
 }
 
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	struct device *dev = info->device;
-	struct device_node *node;
-
-	if (console_set_on_cmdline)
-		return 0;
-
-	node = dev->of_node;
-	if (node &&
-	    node == of_console_device)
-		return 1;
-
-	return 0;
-}
+int fb_is_primary_device(struct fb_info *info);
 
 #endif /* _SPARC_FB_H_ */
diff --git a/arch/sparc/video/Makefile b/arch/sparc/video/Makefile
new file mode 100644
index 000000000000..6baddbd58e4d
--- /dev/null
+++ b/arch/sparc/video/Makefile
@@ -0,0 +1,3 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_FB) += fbdev.o
diff --git a/arch/sparc/video/fbdev.c b/arch/sparc/video/fbdev.c
new file mode 100644
index 000000000000..dadd5799fbb3
--- /dev/null
+++ b/arch/sparc/video/fbdev.c
@@ -0,0 +1,24 @@ 
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/console.h>
+#include <linux/fb.h>
+#include <linux/module.h>
+
+#include <asm/fb.h>
+#include <asm/prom.h>
+
+int fb_is_primary_device(struct fb_info *info)
+{
+	struct device *dev = info->device;
+	struct device_node *node;
+
+	if (console_set_on_cmdline)
+		return 0;
+
+	node = dev->of_node;
+	if (node && node == of_console_device)
+		return 1;
+
+	return 0;
+}
+EXPORT_SYMBOL(fb_is_primary_device);