Skip to contentSkip to conversation

arch: Consolidate <asm/fb.h>

PATCH In review Thomas Zimmermann 6 participants 35 messages Apr 17, 2023 – Jun 28, 2023

Subsystems (14)
Arm (32-bit) x86 PowerPC MIPS +10 more subsystems
lore
Share & tools
lore
#0 lore raw

v3 cover arch: Consolidate <asm/fb.h>

Various architectures provide <asm/fb.h> with helpers for fbdev framebuffer devices. Share the contained code where possible. There is already <asm-generic/fb.h>, which implements generic (as in 'empty') functions of the fbdev helpers. The header was added in commit aafe4dbed0bf ("asm-generic: add generic versions of common headers"), but never used.

Each per-architecture header file declares and/or implements fbdev helpers and defines a preprocessor token for each. The generic header then provides the remaining helpers. It works like the I/O helpers in <asm/io.h>.

For PARISC, the architecture helpers are mixed up with helpers for the system's STI graphics firmware. We first move the STI code to appropriate locations under video/ and then move the architecture helper under arch/parisc.

For Sparc, there's an additional patch that moves the implementation from the header into a source file. This allows to avoid some include statements in the header file.

Built on arm, arm64, m68k, mips, parisc, powerpc, sparc and x86.

v3:
* use default fb_pgprotect() on arc, parisc, sparc64 (Arnd)
* fix includes in generic fb.h
v2:
* make writecombine the default mapping mode (Arnd)
* rework fb_pgprotect() on m68k

Thomas Zimmermann (19):
fbdev: Prepare generic architecture helpers
arch/arc: Implement <asm/fb.h> with generic helpers arch/arm: Implement <asm/fb.h> with generic helpers arch/arm64: Implement <asm/fb.h> with generic helpers arch/ia64: Implement <asm/fb.h> with generic helpers arch/loongarch: Implement <asm/fb.h> with generic helpers arch/m68k: Merge variants of fb_pgprotect() into single function arch/m68k: Implement <asm/fb.h> with generic helpers arch/mips: Implement <asm/fb.h> with generic helpers
video: Remove trailing whitespaces
video: Move HP PARISC STI core code to shared location arch/parisc: Remove trailing whitespaces
arch/parisc: Implement fb_is_primary_device() under arch/parisc arch/parisc: Implement <asm/fb.h> with generic helpers arch/powerpc: Implement <asm/fb.h> with generic helpers arch/sh: Implement <asm/fb.h> with generic helpers arch/sparc: Implement fb_is_primary_device() in source file arch/sparc: Implement <asm/fb.h> with generic helpers arch/x86: Implement <asm/fb.h> with generic helpers

 arch/arc/include/asm/fb.h                     |  16 +-
 arch/arm/include/asm/fb.h                     |  15 +-
 arch/arm64/include/asm/fb.h                   |  15 +-
 arch/ia64/include/asm/fb.h                    |  11 +-
 arch/loongarch/include/asm/fb.h               |  15 +-
 arch/m68k/include/asm/fb.h                    |  22 +--
 arch/mips/include/asm/fb.h                    |  10 +-
 arch/parisc/Makefile                          |   4 +-
 arch/parisc/include/asm/fb.h                  |  20 +--
 arch/parisc/video/Makefile                    |   3 +
 arch/parisc/video/fbdev.c                     |  27 +++
 arch/powerpc/include/asm/fb.h                 |   8 +-
 arch/sh/include/asm/fb.h                      |  15 +-
 arch/sparc/Makefile                           |   1 +
 arch/sparc/include/asm/fb.h                   |  33 ++--
 arch/sparc/video/Makefile                     |   3 +
 arch/sparc/video/fbdev.c                      |  24 +++
 arch/x86/include/asm/fb.h                     |  11 +-
 drivers/video/Kconfig                         |   7 +
 drivers/video/Makefile                        |   1 +
 drivers/video/console/Kconfig                 |   1 +
 drivers/video/console/Makefile                |   4 +-
 drivers/video/console/sticon.c                |   6 +-
 drivers/video/fbdev/Kconfig                   |   3 +-
 drivers/video/fbdev/stifb.c                   | 158 +++++++++---------
 drivers/video/{console => }/sticore.c         | 123 ++++++--------
 include/asm-generic/fb.h                      |  24 ++-
 .../video/fbdev => include/video}/sticore.h   |  16 +-
 28 files changed, 285 insertions(+), 311 deletions(-)
 create mode 100644 arch/parisc/video/Makefile
 create mode 100644 arch/parisc/video/fbdev.c
 create mode 100644 arch/sparc/video/Makefile
 create mode 100644 arch/sparc/video/fbdev.c
 rename drivers/video/{console => }/sticore.c (95%)
 rename {drivers/video/fbdev => include/video}/sticore.h (99%)

base-commit: c7cfe0c7215db9556ffe7ce33d1f60f768336cfd
prerequisite-patch-id: 0aa359f6144c4015c140c8a6750be19099c676fb
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
prerequisite-patch-id: cbc453ee02fae02af22fbfdce56ab732c7a88c36

Signature · 1 line
2.40.0
#1 lore raw

PATCH v3 1/19 fbdev: Prepare generic architecture helpers

Generic implementations of fb_pgprotect() and fb_is_primary_device() have been in the source code for a long time. Prepare the header file to make use of them.

Improve the code by using an inline function for fb_pgprotect() and by removing include statements. The default mode set by fb_pgprotect() is now writecombine, which is what most platforms want.

Symbols are protected by preprocessor guards. Architectures that provide a symbol need to define a preprocessor token of the same name and value. Otherwise the header file will provide a generic implementation. This pattern has been taken from <asm/io.h>.

v3:
* include the correct header files
v2:
* use writecombine mappings by default (Arnd)

---
 include/asm-generic/fb.h | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
include/asm-generic/fb.h +22 -2
index f9f18101ed36..c8af99f5a535 100644
@@ -1,13 +1,33 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+
 #ifndef __ASM_GENERIC_FB_H_
 #define __ASM_GENERIC_FB_H_
-#include <linux/fb.h>
 
-#define fb_pgprotect(...) do {} while (0)
+/*
+ * Only include this header file from your architecture's <asm/fb.h>.
+ */
+
+#include <linux/mm_types.h>
+#include <linux/pgtable.h>
+
+struct fb_info;
+struct file;
+
+#ifndef fb_pgprotect
+#define fb_pgprotect fb_pgprotect
+static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
+				unsigned long off)
+{
+	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+}
+#endif
 
+#ifndef fb_is_primary_device
+#define fb_is_primary_device fb_is_primary_device
 static inline int fb_is_primary_device(struct fb_info *info)
 {
 	return 0;
 }
+#endif
 
 #endif /* __ASM_GENERIC_FB_H_ */
Signature · 1 line
2.40.0
#2 lore raw

PATCH v3 2/19 arch/arc: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. On arc, pgprot_writecombine() and pgprot_noncached() are the same; hence no functional changes.

v3:
* use default implementation for fb_pgprotect() (Arnd)

---
 arch/arc/include/asm/fb.h | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
arch/arc/include/asm/fb.h +2 -14
index dc2e303cdbbb..9c2383d29cbb 100644
@@ -1,20 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
-	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-}
-
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
#3 lore raw

PATCH v3 3/19 arch/arm: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
* use default implementation for fb_pgprotect() (Arnd)

---
 arch/arm/include/asm/fb.h | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
arch/arm/include/asm/fb.h +1 -14
index d92e99cd8c8a..ce20a43c3033 100644
@@ -1,19 +1,6 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}
-
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
#4 lore raw

PATCH v3 4/19 arch/arm64: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
* use default implementation for fb_pgprotect() (Arnd)

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/include/asm/fb.h | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
arch/arm64/include/asm/fb.h +1 -14
index bdc735ee1f67..1a495d8fb2ce 100644
@@ -5,19 +5,6 @@
 #ifndef __ASM_FB_H_
 #define __ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}
-
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* __ASM_FB_H_ */
Signature · 1 line
2.40.0
#5 lore raw

PATCH v3 5/19 arch/ia64: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.

---
 arch/ia64/include/asm/fb.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
arch/ia64/include/asm/fb.h +5 -6
index 5f95782bfa46..0208f64a0da0 100644
@@ -2,11 +2,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
 #include <linux/efi.h>
+
 #include <asm/page.h>
 
+struct file;
+
 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 				unsigned long off)
 {
@@ -15,10 +16,8 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 	else
 		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 }
+#define fb_pgprotect fb_pgprotect
 
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
#6 lore raw

PATCH v3 6/19 arch/loongarch: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
* use default implementation for fb_pgprotect() (Arnd)

---
 arch/loongarch/include/asm/fb.h | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
arch/loongarch/include/asm/fb.h +1 -14
index 3116bde8772d..ff82f20685c8 100644
@@ -5,19 +5,6 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}
-
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
reviewer Reviewed-by on v3 6/19
#7 lore raw

Re: [PATCH v3 06/19] arch/loongarch: Implement <asm/fb.h> with generic helpers

Hi,

Quoted 28 lines · Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
* use default implementation for fb_pgprotect() (Arnd)

---
  arch/loongarch/include/asm/fb.h | 15 +--------------
  1 file changed, 1 insertion(+), 14 deletions(-)
arch/loongarch/include/asm/fb.h +0 -7
index 3116bde8772d..ff82f20685c8 100644
@@ -5,19 +5,6 @@
  #ifndef _ASM_FB_H_
  #define _ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{

arch/loongarch/include/asm/fb.h line 10

Quoted 10 lines
arch/loongarch/include/asm/fb.h +1 -7
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}
-
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
  #endif /* _ASM_FB_H_ */

Sorry for the late review. The change is fairly trivial, so:

Thanks!

Signature · 3 lines
WANG "xen0n" Xuerui

Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
#8 lore raw

PATCH v3 7/19 arch/m68k: Merge variants of fb_pgprotect() into single function

In reply to Thomas Zimmermann

Merge all variants of fb_pgprotect() into a single function body. There are two different cases for MMU systems. For non-MMU systems, the function body will be empty. No functional changes, but this will help with the switch to <asm-generic/fb.h>.

---
 arch/m68k/include/asm/fb.h | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
arch/m68k/include/asm/fb.h +3 -9
index b86c6e2e26dd..4f96989922af 100644
@@ -7,17 +7,13 @@
 #include <asm/page.h>
 #include <asm/setup.h>
 
-#ifdef CONFIG_MMU
-#ifdef CONFIG_SUN3
 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 				unsigned long off)
 {
+#ifdef CONFIG_MMU
+#ifdef CONFIG_SUN3
 	pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
-}
 #else
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
 	if (CPU_IS_020_OR_030)
 		pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
 	if (CPU_IS_040_OR_060) {
@@ -25,11 +21,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 		/* Use no-cache mode, serialized */
 		pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
 	}
-}
 #endif /* CONFIG_SUN3 */
-#else
-#define fb_pgprotect(...) do {} while (0)
 #endif /* CONFIG_MMU */
+}
 
 static inline int fb_is_primary_device(struct fb_info *info)
 {
Signature · 1 line
2.40.0
#9 lore raw

PATCH v3 8/19 arch/m68k: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.

v2:
* provide empty fb_pgprotect() on non-MMU systems

---
 arch/m68k/include/asm/fb.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
arch/m68k/include/asm/fb.h +4 -6
index 4f96989922af..24273fc7ad91 100644
@@ -2,11 +2,11 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
 #include <asm/page.h>
 #include <asm/setup.h>
 
+struct file;
+
 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 				unsigned long off)
 {
@@ -24,10 +24,8 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 #endif /* CONFIG_SUN3 */
 #endif /* CONFIG_MMU */
 }
+#define fb_pgprotect fb_pgprotect
 
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
#10 lore raw

PATCH v3 9/19 arch/mips: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.

Cc Thomas Bogendoerfer <[email protected]>
---
 arch/mips/include/asm/fb.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
arch/mips/include/asm/fb.h +4 -6
index bd3f68c9ddfc..6bda0a81d8ca 100644
@@ -1,19 +1,17 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
 #include <asm/page.h>
 
+struct file;
+
 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 				unsigned long off)
 {
 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 }
+#define fb_pgprotect fb_pgprotect
 
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
#11 lore raw

PATCH v3 10/19 video: Remove trailing whitespaces

In reply to Thomas Zimmermann

Fix trailing whitespaces. No functional changes.

---
 drivers/video/console/sticon.c  |   4 +-
 drivers/video/console/sticore.c | 102 ++++++++++-----------
 drivers/video/fbdev/sticore.h   |  14 +--
 drivers/video/fbdev/stifb.c     | 156 ++++++++++++++++----------------
 4 files changed, 138 insertions(+), 138 deletions(-)
drivers/video/console/sticon.c +2 -2
index 2cea69418a83..89ad7ade6cf9 100644
@@ -282,7 +282,7 @@ static void sticon_init(struct vc_data *c, int init)
     vc_cols = sti_onscreen_x(sti) / sti->font->width;
     vc_rows = sti_onscreen_y(sti) / sti->font->height;
     c->vc_can_do_color = 1;
-    
+
     if (init) {
 	c->vc_cols = vc_cols;
 	c->vc_rows = vc_rows;
@@ -374,7 +374,7 @@ static const struct consw sti_con = {
 	.con_font_set		= sticon_font_set,
 	.con_font_default	= sticon_font_default,
 	.con_build_attr		= sticon_build_attr,
-	.con_invert_region	= sticon_invert_region, 
+	.con_invert_region	= sticon_invert_region,
 };
 
 
drivers/video/console/sticore.c +51 -51

322 lines not on this page · raw message

drivers/video/fbdev/sticore.h +7 -7
index 0ebdd28a0b81..c0879352cde4 100644
@@ -27,11 +27,11 @@
  *
  * Probably the best solution to all this is have the generic code manage
  * the screen buffer and a kernel thread to call STI occasionally.
- * 
+ *
  * Luckily, the frame buffer guys have the same problem so we can just wait
  * for them to fix it and steal their solution.   prumpf
  */
- 
+
 #include <asm/io.h>
 
 #define STI_WAIT 1
@@ -56,7 +56,7 @@
 /* STI function configuration structs */
 
 typedef union region {
-	struct { 
+	struct {
 		u32 offset	: 14;	/* offset in 4kbyte page */
 		u32 sys_only	: 1;	/* don't map to user space */
 		u32 cache	: 1;	/* map to data cache */
@@ -154,7 +154,7 @@ struct sti_conf_inptr {
 };
 
 struct sti_conf_outptr_ext {
-	u32 crt_config[3];	/* hardware specific X11/OGL information */	
+	u32 crt_config[3];	/* hardware specific X11/OGL information */
 	u32 crt_hdw[3];
 	u32 future_ptr;
 };
@@ -211,7 +211,7 @@ struct sti_rom {
 	u32 set_cm_entry;
 	u32 dma_ctrl;
 	 u8 res040[7 * 4];
-	
+
 	u32 init_graph_addr;
 	u32 state_mgmt_addr;
 	u32 font_unp_addr;
@@ -271,7 +271,7 @@ struct sti_font_flags {
 	u32 pad : 30;		/* pad to word boundary */
 	u32 future_ptr; 	/* pointer to future data */
 };
-	
+
 struct sti_font_outptr {
 	s32 errno;		/* error number on failure */
 	u32 future_ptr; 	/* pointer to future data */
@@ -338,7 +338,7 @@ struct sti_all_data {
 
 struct sti_struct {
 	spinlock_t lock;
-		
+
 	/* char **mon_strings; */
 	int sti_mem_request;
 	u32 graphics_id[2];
drivers/video/fbdev/stifb.c +78 -78

530 lines not on this page · raw message

Signature · 1 line
2.40.0
#12 lore raw

PATCH v3 11/19 video: Move HP PARISC STI core code to shared location

In reply to Thomas Zimmermann

STI core files have been located in console and fbdev code. Move the source code and header to the directories for video helpers. Also update the config and build rules such that the code depends on the config symbol CONFIG_STI_CORE, which STI console and STI framebuffer select automatically.

Cleans up the console makefile and prepares PARISC to implement fb_is_primary_device() within the arch/ directory. No functional changes.

---
 drivers/video/Kconfig                            | 7 +++++++
 drivers/video/Makefile                           | 1 +
 drivers/video/console/Kconfig                    | 1 +
 drivers/video/console/Makefile                   | 4 +---
 drivers/video/console/sticon.c                   | 2 +-
 drivers/video/fbdev/Kconfig                      | 3 +--
 drivers/video/fbdev/stifb.c                      | 2 +-
 drivers/video/{console => }/sticore.c            | 2 +-
 {drivers/video/fbdev => include/video}/sticore.h | 0
 9 files changed, 14 insertions(+), 8 deletions(-)
 rename drivers/video/{console => }/sticore.c (99%)
 rename {drivers/video/fbdev => include/video}/sticore.h (100%)
drivers/video/Kconfig +7 -0
index bf05363d8906..8b2b9ac37c3d 100644
@@ -11,6 +11,13 @@ config APERTURE_HELPERS
 	  Support tracking and hand-over of aperture ownership. Required
 	  by graphics drivers for firmware-provided framebuffers.
 
+config STI_CORE
+	bool
+	depends on PARISC
+	help
+	  STI refers to the HP "Standard Text Interface" which is a set of
+	  BIOS routines contained in a ROM chip in HP PA-RISC based machines.
+
 config VIDEO_CMDLINE
 	bool
 
drivers/video/Makefile +1 -0
index 831c9fa57a6c..6bbc03950899 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_APERTURE_HELPERS)    += aperture.o
+obj-$(CONFIG_STI_CORE)            += sticore.o
 obj-$(CONFIG_VGASTATE)            += vgastate.o
 obj-$(CONFIG_VIDEO_CMDLINE)       += cmdline.o
 obj-$(CONFIG_VIDEO_NOMODESET)     += nomodeset.o
drivers/video/console/Kconfig +1 -0
index 22cea5082ac4..a2a88d42edf0 100644
@@ -141,6 +141,7 @@ config STI_CONSOLE
 	depends on PARISC && HAS_IOMEM
 	select FONT_SUPPORT
 	select CRC32
+	select STI_CORE
 	default y
 	help
 	  The STI console is the builtin display/keyboard on HP-PARISC
drivers/video/console/Makefile +1 -3
index db07b784bd2c..fd79016a0d95 100644
@@ -5,8 +5,6 @@
 
 obj-$(CONFIG_DUMMY_CONSOLE)       += dummycon.o
 obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o
-obj-$(CONFIG_STI_CONSOLE)         += sticon.o sticore.o
+obj-$(CONFIG_STI_CONSOLE)         += sticon.o
 obj-$(CONFIG_VGA_CONSOLE)         += vgacon.o
 obj-$(CONFIG_MDA_CONSOLE)         += mdacon.o
-
-obj-$(CONFIG_FB_STI)              += sticore.o
drivers/video/console/sticon.c +1 -1
index 89ad7ade6cf9..d11cfd2d68b5 100644
@@ -50,7 +50,7 @@
 
 #include <asm/io.h>
 
-#include "../fbdev/sticore.h"
+#include <video/sticore.h>
 
 /* switching to graphics mode */
 #define BLANK 0
drivers/video/fbdev/Kconfig +1 -2
index 96e91570cdd3..485e8c35d5c6 100644
@@ -551,10 +551,9 @@ config FB_STI
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
+	select STI_CORE
 	default y
 	help
-	  STI refers to the HP "Standard Text Interface" which is a set of
-	  BIOS routines contained in a ROM chip in HP PA-RISC based machines.
 	  Enabling this option will implement the linux framebuffer device
 	  using calls to the STI BIOS routines for initialisation.
 
drivers/video/fbdev/stifb.c +1 -1
index 99996bc7e6d9..baca6974e288 100644
@@ -69,7 +69,7 @@
 #include <asm/grfioctl.h>	/* for HP-UX compatibility */
 #include <linux/uaccess.h>
 
-#include "sticore.h"
+#include <video/sticore.h>
 
 /* REGION_BASE(fb_info, index) returns the virtual address for region <index> */
 #define REGION_BASE(fb_info, index) \
drivers/video/sticore.c renamed from drivers/video/console/sticore.c +1 -1
similarity index 99%
rename from drivers/video/console/sticore.c
rename to drivers/video/sticore.c
index 6ea9596a3c4b..f8aaedea437d 100644
@@ -32,7 +32,7 @@
 #include <asm/grfioctl.h>
 #include <asm/fb.h>
 
-#include "../fbdev/sticore.h"
+#include <video/sticore.h>
 
 #define STI_DRIVERVERSION "Version 0.9c"
 
include/video/sticore.h renamed from drivers/video/fbdev/sticore.h +0 -0
similarity index 100%
rename from drivers/video/fbdev/sticore.h
rename to include/video/sticore.h
Signature · 1 line
2.40.0
#13 lore raw

PATCH v3 12/19 arch/parisc: Remove trailing whitespaces

In reply to Thomas Zimmermann

Fix trailing whitespaces. No functional changes.

Cc "James E.J. Bottomley" <[email protected]>
Cc Helge Deller <[email protected]>
---
 arch/parisc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/Makefile +1 -1
index a2d8600521f9..0d049a6f6a60 100644
@@ -11,7 +11,7 @@
 # Copyright (C) 1994 by Linus Torvalds
 # Portions Copyright (C) 1999 The Puffin Group
 #
-# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries, 
+# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries,
 # Mike Shaver, Helge Deller and Martin K. Petersen
 #
 
Signature · 1 line
2.40.0
#14 lore raw

PATCH v3 13/19 arch/parisc: Implement fb_is_primary_device() under arch/parisc

In reply to Thomas Zimmermann

Move PARISC's implementation of fb_is_primary_device() into the architecture directory. This the place of the declaration and where other architectures implement this function. No functional changes.

Cc "James E.J. Bottomley" <[email protected]>
Cc Helge Deller <[email protected]>
---
 arch/parisc/Makefile         |  2 ++
 arch/parisc/include/asm/fb.h |  2 +-
 arch/parisc/video/Makefile   |  3 +++
 arch/parisc/video/fbdev.c    | 27 +++++++++++++++++++++++++++
 drivers/video/sticore.c      | 19 -------------------
 include/video/sticore.h      |  2 ++
 6 files changed, 35 insertions(+), 20 deletions(-)
 create mode 100644 arch/parisc/video/Makefile
 create mode 100644 arch/parisc/video/fbdev.c
arch/parisc/Makefile +2 -0
index 0d049a6f6a60..968ebe17494c 100644
@@ -119,6 +119,8 @@ export LIBGCC
 
 libs-y	+= arch/parisc/lib/ $(LIBGCC)
 
+drivers-y += arch/parisc/video/
+
 boot	:= arch/parisc/boot
 
 PALO := $(shell if (which palo 2>&1); then : ; \
arch/parisc/include/asm/fb.h +1 -1
index 55d29c4f716e..0b9a38ced5c8 100644
@@ -12,7 +12,7 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 	pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
 }
 
-#if defined(CONFIG_FB_STI)
+#if defined(CONFIG_STI_CORE)
 int fb_is_primary_device(struct fb_info *info);
 #else
 static inline int fb_is_primary_device(struct fb_info *info)
arch/parisc/video/Makefile new file +3 -0
new file mode 100644
index 000000000000..16a73cce4661
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_STI_CORE) += fbdev.o
arch/parisc/video/fbdev.c new file +27 -0
new file mode 100644
index 000000000000..4a0ae08fc75b
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2000 Philipp Rumpf <[email protected]>
+ * Copyright (C) 2001-2020 Helge Deller <[email protected]>
+ * Copyright (C) 2001-2002 Thomas Bogendoerfer <[email protected]>
+ */
+
+#include <linux/module.h>
+
+#include <asm/fb.h>
+
+#include <video/sticore.h>
+
+int fb_is_primary_device(struct fb_info *info)
+{
+	struct sti_struct *sti;
+
+	sti = sti_get_rom(0);
+
+	/* if no built-in graphics card found, allow any fb driver as default */
+	if (!sti)
+		return true;
+
+	/* return true if it's the default built-in framebuffer driver */
+	return (sti->info = info);
+}
+EXPORT_SYMBOL(fb_is_primary_device);
drivers/video/sticore.c +0 -19
index f8aaedea437d..7eb925f2ba9c 100644
@@ -30,7 +30,6 @@
 #include <asm/pdc.h>
 #include <asm/cacheflush.h>
 #include <asm/grfioctl.h>
-#include <asm/fb.h>
 
 #include <video/sticore.h>
 
@@ -1148,24 +1147,6 @@ int sti_call(const struct sti_struct *sti, unsigned long func,
 	return ret;
 }
 
-#if defined(CONFIG_FB_STI)
-/* check if given fb_info is the primary device */
-int fb_is_primary_device(struct fb_info *info)
-{
-	struct sti_struct *sti;
-
-	sti = sti_get_rom(0);
-
-	/* if no built-in graphics card found, allow any fb driver as default */
-	if (!sti)
-		return true;
-
-	/* return true if it's the default built-in framebuffer driver */
-	return (sti->info = info);
-}
-EXPORT_SYMBOL(fb_is_primary_device);
-#endif
-
 MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer");
 MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");
 MODULE_LICENSE("GPL v2");
include/video/sticore.h +2 -0
index c0879352cde4..fbb78d7e7565 100644
@@ -2,6 +2,8 @@
 #ifndef STICORE_H
 #define STICORE_H
 
+struct fb_info;
+
 /* generic STI structures & functions */
 
 #define MAX_STI_ROMS 4		/* max no. of ROMs which this driver handles */
Signature · 1 line
2.40.0
#15 lore raw

PATCH v3 14/19 arch/parisc: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. On PARISC, pgprot_writecombine() and pgprot_noncached() are the same; hence no functional changes.

v3:
* use default implementation for fb_pgprotect() (Arnd)

Cc "James E.J. Bottomley" <[email protected]>
Cc Helge Deller <[email protected]>
---
 arch/parisc/include/asm/fb.h | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
arch/parisc/include/asm/fb.h +4 -14
index 0b9a38ced5c8..658a8a7dc531 100644
@@ -2,23 +2,13 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
-	pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
-}
+struct fb_info;
 
 #if defined(CONFIG_STI_CORE)
 int fb_is_primary_device(struct fb_info *info);
-#else
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#define fb_is_primary_device fb_is_primary_device
 #endif
 
+#include <asm-generic/fb.h>
+
 #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
#16 lore raw

PATCH v3 15/19 arch/powerpc: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.

Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Christophe Leroy <[email protected]>
---
 arch/powerpc/include/asm/fb.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/fb.h +3 -5
index 6541ab77c5b9..5f1a2e5f7654 100644
@@ -2,8 +2,8 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
-#include <linux/fb.h>
 #include <linux/fs.h>
+
 #include <asm/page.h>
 
 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
@@ -13,10 +13,8 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 						 vma->vm_end - vma->vm_start,
 						 vma->vm_page_prot);
 }
+#define fb_pgprotect fb_pgprotect
 
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
#17 lore raw

PATCH v3 16/19 arch/sh: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
* use default implementation for fb_pgprotect() (Arnd)

Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc John Paul Adrian Glaubitz <[email protected]>
---
 arch/sh/include/asm/fb.h | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
arch/sh/include/asm/fb.h +1 -14
index 9a0bca2686fd..19df13ee9ca7 100644
@@ -2,19 +2,6 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}
-
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
#18 lore raw

Re: [PATCH v3 16/19] arch/sh: Implement <asm/fb.h> with generic helpers

Hi Thomas!

Quoted 21 lines · Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
* use default implementation for fb_pgprotect() (Arnd)

Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc John Paul Adrian Glaubitz <[email protected]>
---
 arch/sh/include/asm/fb.h | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
arch/sh/include/asm/fb.h +0 -0
index 9a0bca2686fd..19df13ee9ca7 100644
@@ -2,19 +2,6 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_

arch/sh/include/asm/fb.h line 13

Quoted 10 lines
arch/sh/include/asm/fb.h +0 -9
 
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}

Looking at the macro in asm-generic/fb.h, fb_pgprotect() is being replaced with a no-op function. Is that intentional? Can you briefly explain the background for this change?

arch/sh/include/asm/fb.h line 7

Quoted 7 lines
arch/sh/include/asm/fb.h +1 -4
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_FB_H_ */

Thanks,
Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#19 lore raw

Re: [PATCH v3 16/19] arch/sh: Implement <asm/fb.h> with generic helpers

Hi

Am 17.04.23 um 15:02 schrieb John Paul Adrian Glaubitz:

Quoted 25 lines

Hi Thomas!

Quoted 22 lines · Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
* use default implementation for fb_pgprotect() (Arnd)

Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc John Paul Adrian Glaubitz <[email protected]>
---
  arch/sh/include/asm/fb.h | 15 +--------------
  1 file changed, 1 insertion(+), 14 deletions(-)
arch/sh/include/asm/fb.h +0 -0
index 9a0bca2686fd..19df13ee9ca7 100644
@@ -2,19 +2,6 @@
  #ifndef _ASM_FB_H_
  #define _ASM_FB_H_
 
Quoted 13 lines

arch/sh/include/asm/fb.h line 13

Quoted 9 lines
arch/sh/include/asm/fb.h +0 -9
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}

Looking at the macro in asm-generic/fb.h, fb_pgprotect() is being replaced with a no-op function. Is that intentional? Can you briefly explain the background for this change?

Patch 01 of this patchset changes the generic fb_pgprotect() to set pgprot_writecombine(). So on SH, there should be no change at all.

Best regards
Thomas

Quoted 12 lines

arch/sh/include/asm/fb.h line 7

Quoted 8 lines
arch/sh/include/asm/fb.h +1 -4
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
  #endif /* _ASM_FB_H_ */

Thanks,
Adrian

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
#20 lore raw

Re: [PATCH v3 16/19] arch/sh: Implement <asm/fb.h> with generic helpers

Am 17.04.23 um 16:06 schrieb Thomas Zimmermann:

Quoted 42 lines

Hi

Am 17.04.23 um 15:02 schrieb John Paul Adrian Glaubitz:

Quoted 30 lines

Hi Thomas!

Quoted 27 lines · Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
    * use default implementation for fb_pgprotect() (Arnd)

Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc John Paul Adrian Glaubitz <[email protected]>

---
  arch/sh/include/asm/fb.h | 15 +--------------

  1 file changed, 1 insertion(+), 14 deletions(-)
arch/sh/include/asm/fb.h +0 -5
index 9a0bca2686fd..19df13ee9ca7 100644
@@ -2,19 +2,6 @@
   #ifndef _ASM_FB_H_
   #define _ASM_FB_H_
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct 
 vm_area_struct *vma,
Quoted 8 lines

arch/sh/include/asm/fb.h line 13

Quoted 4 lines
arch/sh/include/asm/fb.h +0 -4
-                unsigned long off)
-{
-    vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}

Looking at the macro in asm-generic/fb.h, fb_pgprotect() is being replaced with a no-op function. Is that intentional? Can you briefly explain the background for this change?

Quoted 1 line

Patch 01 of this patchset changes the generic fb_pgprotect() to set pgprot_writecombine(). So on SH, there should be no change at all.

In case you didn't receive that patch:

https://patchwork.freedesktop.org/patch/532493/?series=116157&rev=3

Quoted 16 lines

Best regards
Thomas

Quoted 11 lines

arch/sh/include/asm/fb.h line 7

Quoted 7 lines
arch/sh/include/asm/fb.h +1 -4
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-    return 0;
-}
+#include <asm-generic/fb.h>
   #endif /* _ASM_FB_H_ */

Thanks,
Adrian

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
#21 lore raw

Re: [PATCH v3 16/19] arch/sh: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Hi Thomas!

Quoted 42 lines · Thomas Zimmermann

Hi

Am 17.04.23 um 15:02 schrieb John Paul Adrian Glaubitz:

Quoted 25 lines

Hi Thomas!

Quoted 22 lines · Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
* use default implementation for fb_pgprotect() (Arnd)

Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc John Paul Adrian Glaubitz <[email protected]>
---
  arch/sh/include/asm/fb.h | 15 +--------------
  1 file changed, 1 insertion(+), 14 deletions(-)
arch/sh/include/asm/fb.h +0 -0
index 9a0bca2686fd..19df13ee9ca7 100644
@@ -2,19 +2,6 @@
  #ifndef _ASM_FB_H_
  #define _ASM_FB_H_
 
Quoted 13 lines

arch/sh/include/asm/fb.h line 13

Quoted 9 lines
arch/sh/include/asm/fb.h +0 -9
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}

Looking at the macro in asm-generic/fb.h, fb_pgprotect() is being replaced with a no-op function. Is that intentional? Can you briefly explain the background for this change?

Quoted 3 lines

Patch 01 of this patchset changes the generic fb_pgprotect() to set pgprot_writecombine(). So on SH, there should be no change at all.

Ah, I missed that, thanks for the explanation. Let me check and Ack your patch then. I assume you will be taking this patch as part of the whole series through your own tree?

Thanks,
Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#22 lore raw

Re: [PATCH v3 16/19] arch/sh: Implement <asm/fb.h> with generic helpers

Hi

Am 17.04.23 um 16:13 schrieb John Paul Adrian Glaubitz:

Quoted 45 lines

Hi Thomas!

Quoted 42 lines · Thomas Zimmermann

Hi

Am 17.04.23 um 15:02 schrieb John Paul Adrian Glaubitz:

Quoted 38 lines

Hi Thomas!

Quoted 21 lines · Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
* use default implementation for fb_pgprotect() (Arnd)

Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc John Paul Adrian Glaubitz <[email protected]>
---
   arch/sh/include/asm/fb.h | 15 +--------------
   1 file changed, 1 insertion(+), 14 deletions(-)
arch/sh/include/asm/fb.h +0 -0
index 9a0bca2686fd..19df13ee9ca7 100644
@@ -2,19 +2,6 @@
   #ifndef _ASM_FB_H_
   #define _ASM_FB_H_

arch/sh/include/asm/fb.h line 13

Quoted 10 lines
arch/sh/include/asm/fb.h +0 -9
 
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}

Looking at the macro in asm-generic/fb.h, fb_pgprotect() is being replaced with a no-op function. Is that intentional? Can you briefly explain the background for this change?

Quoted 5 lines
Quoted 3 lines

Patch 01 of this patchset changes the generic fb_pgprotect() to set pgprot_writecombine(). So on SH, there should be no change at all.

Ah, I missed that, thanks for the explanation. Let me check and Ack your patch

Thanks!

Quoted 2 lines

then. I assume you will be taking this patch as part of the whole series through your own tree?

Yes, I'd merge it through drm-misc-next ideally.

Best regards
Thomas

Quoted 4 lines

Thanks,
Adrian

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
maintainer Acked-by on v3 16/19
#23 lore raw

Re: [PATCH v3 16/19] arch/sh: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann
Quoted 29 lines · Thomas Zimmermann

Replace the architecture's fbdev helpers with the generic ones from <asm-generic/fb.h>. No functional changes.

v2:
* use default implementation for fb_pgprotect() (Arnd)

Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc John Paul Adrian Glaubitz <[email protected]>
---
 arch/sh/include/asm/fb.h | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
arch/sh/include/asm/fb.h +0 -7
index 9a0bca2686fd..19df13ee9ca7 100644
@@ -2,19 +2,6 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
-				unsigned long off)
-{

arch/sh/include/asm/fb.h line 7

Quoted 10 lines
arch/sh/include/asm/fb.h +1 -7
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-}
-
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-	return 0;
-}
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_FB_H_ */
Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#24 lore raw

PATCH v3 17/19 arch/sparc: Implement fb_is_primary_device() in source file

In reply to Thomas Zimmermann

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

---
 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
arch/sparc/Makefile +1 -0
index a4ea5b05f288..95a9211e48e3 100644
@@ -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
 
arch/sparc/include/asm/fb.h +5 -18
index f699962e9ddf..28609f7a965c 100644
@@ -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_ */
arch/sparc/video/Makefile new file +3 -0
new file mode 100644
index 000000000000..6baddbd58e4d
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_FB) += fbdev.o
arch/sparc/video/fbdev.c new file +24 -0
new file mode 100644
index 000000000000..dadd5799fbb3
@@ -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);
Signature · 1 line
2.40.0
#25 lore raw

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

Hi,

Quoted 9 lines · Thomas Zimmermann

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

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
maintainer
#26 lore raw

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

Quoted 15 lines · Guenter Roeck
Quoted 9 lines · Thomas Zimmermann

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

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

Quoted 10 lines

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.

Quoted 1 line

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

#27 lore raw

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

Quoted 27 lines · Arnd Bergmann
Quoted 15 lines · Guenter Roeck
Quoted 9 lines · Thomas Zimmermann

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

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

Quoted 10 lines

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!

Quoted 3 lines

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

Quoted 7 lines
Quoted 1 line

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

maintainer
#28 lore raw

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

Quoted 28 lines · Guenter Roeck
Quoted 27 lines · Arnd Bergmann
Quoted 25 lines · Guenter Roeck
Quoted 9 lines · Thomas Zimmermann

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

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!

Quoted 6 lines
Quoted 3 lines

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.

Quoted 1 line

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

maintainer
#29 lore raw

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

Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · Guenter Roeck
Quoted 8 lines · Arnd Bergmann
Quoted 3 lines · Guenter Roeck

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.

Quoted 6 lines
Quoted 2 lines

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

Arnd

#30 lore raw

PATCH v3 18/19 arch/sparc: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Replace sparc64's fb_pgprotect() with the generic one from <asm-generic/fb.h>. On sparc, pgprot_writecombine() and pgprot_noncached() are the same; hence no functional changes

v3:

	* use default implementation for fb_pgprotect() on
	  sparc64 (Arnd)

v2:
* restore the original fb_pgprotect()

---
 arch/sparc/include/asm/fb.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
arch/sparc/include/asm/fb.h +8 -8
index 28609f7a965c..689ee5c60054 100644
@@ -2,20 +2,20 @@
 #ifndef _SPARC_FB_H_
 #define _SPARC_FB_H_
 
-#include <linux/fs.h>
-
-#include <asm/page.h>
-
 struct fb_info;
+struct file;
+struct vm_area_struct;
 
+#ifdef CONFIG_SPARC32
 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 				unsigned long off)
-{
-#ifdef CONFIG_SPARC64
-	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+{ }
+#define fb_pgprotect fb_pgprotect
 #endif
-}
 
 int fb_is_primary_device(struct fb_info *info);
+#define fb_is_primary_device fb_is_primary_device
+
+#include <asm-generic/fb.h>
 
 #endif /* _SPARC_FB_H_ */
Signature · 1 line
2.40.0
#31 lore raw

PATCH v3 19/19 arch/x86: Implement <asm/fb.h> with generic helpers

In reply to Thomas Zimmermann

Include <asm-generic/fb.h> and set the required preprocessor tokens correctly. x86 now implements its own set of fb helpers, but still follows the overall pattern of the other <asm/fb.h> files.

v3:
* clarified commit message

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
---
 arch/x86/include/asm/fb.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
arch/x86/include/asm/fb.h +8 -3
index ab4c960146e3..a3fb801f12f1 100644
@@ -2,10 +2,11 @@
 #ifndef _ASM_X86_FB_H
 #define _ASM_X86_FB_H
 
-#include <linux/fb.h>
-#include <linux/fs.h>
 #include <asm/page.h>
 
+struct fb_info;
+struct file;
+
 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 				unsigned long off)
 {
@@ -16,7 +17,11 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 		pgprot_val(vma->vm_page_prot)  			prot | cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
 }
+#define fb_pgprotect fb_pgprotect
+
+int fb_is_primary_device(struct fb_info *info);
+#define fb_is_primary_device fb_is_primary_device
 
-extern int fb_is_primary_device(struct fb_info *info);
+#include <asm-generic/fb.h>
 
 #endif /* _ASM_X86_FB_H */
Signature · 1 line
2.40.0
maintainer Acked-by on the v3 series
#32 lore raw
In reply to Thomas Zimmermann
Quoted 11 lines · Thomas Zimmermann

Various architectures provide <asm/fb.h> with helpers for fbdev framebuffer devices. Share the contained code where possible. There is already <asm-generic/fb.h>, which implements generic (as in 'empty') functions of the fbdev helpers. The header was added in commit aafe4dbed0bf ("asm-generic: add generic versions of common headers"), but never used.

Each per-architecture header file declares and/or implements fbdev helpers and defines a preprocessor token for each. The generic header then provides the remaining helpers. It works like the I/O helpers in <asm/io.h>.

Looks all good to me,

Arnd

#33 lore raw

Hi

Am 17.04.23 um 16:12 schrieb Arnd Bergmann:

Quoted 8 lines · Thomas Zimmermann
Quoted 7 lines

Various architectures provide <asm/fb.h> with helpers for fbdev framebuffer devices. Share the contained code where possible. There is already <asm-generic/fb.h>, which implements generic (as in 'empty') functions of the fbdev helpers. The header was added in commit aafe4dbed0bf ("asm-generic: add generic versions of common headers"), but never used.

Quoted 8 lines
Quoted 4 lines

Each per-architecture header file declares and/or implements fbdev helpers and defines a preprocessor token for each. The generic header then provides the remaining helpers. It works like the I/O helpers in <asm/io.h>.

Looks all good to me,

Thanks a lot. I know that Helge wants to test the PARISC changes, so I'll keep this series pending for a bit longer. I'd like to merge the patches through the DRM tree, if no one objects.

Best regards
Thomas

Quoted 2 lines

Arnd

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
maintainer Acked-by
#34 lore raw

Hi Thomas,

Quoted 13 lines · Thomas Zimmermann
Quoted 12 lines
Quoted 11 lines

Various architectures provide <asm/fb.h> with helpers for fbdev framebuffer devices. Share the contained code where possible. There is already <asm-generic/fb.h>, which implements generic (as in 'empty') functions of the fbdev helpers. The header was added in commit aafe4dbed0bf ("asm-generic: add generic versions of common headers"), but never used.

Each per-architecture header file declares and/or implements fbdev helpers and defines a preprocessor token for each. The generic header then provides the remaining helpers. It works like the I/O helpers in <asm/io.h>.

Quoted 7 lines
Quoted 3 lines

Looks all good to me,

Thanks a lot. I know that Helge wants to test the PARISC changes, so I'll keep this series pending for a bit longer. I'd like to merge the patches through the DRM tree, if no one objects.

Yes, patch is good and I've tested it on parisc. Thanks!

You may add:

to the series and take it through the drm tree.

Helge