2023-04-17 12:58:45

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 00/19] 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
--
2.40.0


2023-04-17 12:58:48

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 01/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)

Signed-off-by: Thomas Zimmermann <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
---
include/asm-generic/fb.h | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/fb.h b/include/asm-generic/fb.h
index f9f18101ed36..c8af99f5a535 100644
--- a/include/asm-generic/fb.h
+++ b/include/asm-generic/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 12:58:52

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 02/19] arch/arc: Implement <asm/fb.h> with generic helpers

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)

Signed-off-by: Thomas Zimmermann <[email protected]>
Cc: Vineet Gupta <[email protected]>
---
arch/arc/include/asm/fb.h | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/arc/include/asm/fb.h b/arch/arc/include/asm/fb.h
index dc2e303cdbbb..9c2383d29cbb 100644
--- a/arch/arc/include/asm/fb.h
+++ b/arch/arc/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 12:58:54

by Thomas Zimmermann

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

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)

Signed-off-by: Thomas Zimmermann <[email protected]>
Cc: Huacai Chen <[email protected]>
Cc: WANG Xuerui <[email protected]>
---
arch/loongarch/include/asm/fb.h | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/arch/loongarch/include/asm/fb.h b/arch/loongarch/include/asm/fb.h
index 3116bde8772d..ff82f20685c8 100644
--- a/arch/loongarch/include/asm/fb.h
+++ b/arch/loongarch/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 12:59:00

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 04/19] arch/arm64: Implement <asm/fb.h> with generic helpers

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)

Signed-off-by: Thomas Zimmermann <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
---
arch/arm64/include/asm/fb.h | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/arch/arm64/include/asm/fb.h b/arch/arm64/include/asm/fb.h
index bdc735ee1f67..1a495d8fb2ce 100644
--- a/arch/arm64/include/asm/fb.h
+++ b/arch/arm64/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 12:59:02

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 05/19] arch/ia64: Implement <asm/fb.h> with generic helpers

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

Signed-off-by: Thomas Zimmermann <[email protected]>
---
arch/ia64/include/asm/fb.h | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/ia64/include/asm/fb.h b/arch/ia64/include/asm/fb.h
index 5f95782bfa46..0208f64a0da0 100644
--- a/arch/ia64/include/asm/fb.h
+++ b/arch/ia64/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 12:59:02

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 03/19] arch/arm: Implement <asm/fb.h> with generic helpers

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)

Signed-off-by: Thomas Zimmermann <[email protected]>
Cc: Russell King <[email protected]>
---
arch/arm/include/asm/fb.h | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/arch/arm/include/asm/fb.h b/arch/arm/include/asm/fb.h
index d92e99cd8c8a..ce20a43c3033 100644
--- a/arch/arm/include/asm/fb.h
+++ b/arch/arm/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 12:59:08

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 08/19] arch/m68k: Implement <asm/fb.h> with generic helpers

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

Signed-off-by: Thomas Zimmermann <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/include/asm/fb.h | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/fb.h
index 4f96989922af..24273fc7ad91 100644
--- a/arch/m68k/include/asm/fb.h
+++ b/arch/m68k/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 12:59:21

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 07/19] arch/m68k: Merge variants of fb_pgprotect() into single function

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>.

Signed-off-by: Thomas Zimmermann <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/include/asm/fb.h | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/fb.h
index b86c6e2e26dd..4f96989922af 100644
--- a/arch/m68k/include/asm/fb.h
+++ b/arch/m68k/include/asm/fb.h
@@ -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)
{
--
2.40.0

2023-04-17 12:59:26

by Thomas Zimmermann

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

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)

Signed-off-by: Thomas Zimmermann <[email protected]>
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(-)

diff --git a/arch/sh/include/asm/fb.h b/arch/sh/include/asm/fb.h
index 9a0bca2686fd..19df13ee9ca7 100644
--- a/arch/sh/include/asm/fb.h
+++ b/arch/sh/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 12:59:32

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 11/19] video: Move HP PARISC STI core code to shared location

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.

Signed-off-by: Thomas Zimmermann <[email protected]>
---
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%)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index bf05363d8906..8b2b9ac37c3d 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -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

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 831c9fa57a6c..6bbc03950899 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -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
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 22cea5082ac4..a2a88d42edf0 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -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
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index db07b784bd2c..fd79016a0d95 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -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
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index 89ad7ade6cf9..d11cfd2d68b5 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -50,7 +50,7 @@

#include <asm/io.h>

-#include "../fbdev/sticore.h"
+#include <video/sticore.h>

/* switching to graphics mode */
#define BLANK 0
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 96e91570cdd3..485e8c35d5c6 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -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.

diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c
index 99996bc7e6d9..baca6974e288 100644
--- a/drivers/video/fbdev/stifb.c
+++ b/drivers/video/fbdev/stifb.c
@@ -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) \
diff --git a/drivers/video/console/sticore.c b/drivers/video/sticore.c
similarity index 99%
rename from drivers/video/console/sticore.c
rename to drivers/video/sticore.c
index 6ea9596a3c4b..f8aaedea437d 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/sticore.c
@@ -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"

diff --git a/drivers/video/fbdev/sticore.h b/include/video/sticore.h
similarity index 100%
rename from drivers/video/fbdev/sticore.h
rename to include/video/sticore.h
--
2.40.0

2023-04-17 12:59:34

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 17/19] arch/sparc: Implement fb_is_primary_device() in source file

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 <[email protected]>
Cc: "David S. Miller" <[email protected]>
---
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

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);
--
2.40.0

2023-04-17 12:59:34

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 18/19] arch/sparc: Implement <asm/fb.h> with generic helpers

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()

Signed-off-by: Thomas Zimmermann <[email protected]>
Cc: "David S. Miller" <[email protected]>
---
arch/sparc/include/asm/fb.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/fb.h
index 28609f7a965c..689ee5c60054 100644
--- a/arch/sparc/include/asm/fb.h
+++ b/arch/sparc/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 13:00:01

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 09/19] arch/mips: Implement <asm/fb.h> with generic helpers

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

Signed-off-by: Thomas Zimmermann <[email protected]>
Cc: Thomas Bogendoerfer <[email protected]>
---
arch/mips/include/asm/fb.h | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/mips/include/asm/fb.h b/arch/mips/include/asm/fb.h
index bd3f68c9ddfc..6bda0a81d8ca 100644
--- a/arch/mips/include/asm/fb.h
+++ b/arch/mips/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 13:00:03

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 12/19] arch/parisc: Remove trailing whitespaces

Fix trailing whitespaces. No functional changes.

Signed-off-by: Thomas Zimmermann <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: Helge Deller <[email protected]>
---
arch/parisc/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index a2d8600521f9..0d049a6f6a60 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -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
#

--
2.40.0

2023-04-17 13:00:24

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 13/19] arch/parisc: Implement fb_is_primary_device() under arch/parisc

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.

Signed-off-by: Thomas Zimmermann <[email protected]>
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

diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 0d049a6f6a60..968ebe17494c 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -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 : ; \
diff --git a/arch/parisc/include/asm/fb.h b/arch/parisc/include/asm/fb.h
index 55d29c4f716e..0b9a38ced5c8 100644
--- a/arch/parisc/include/asm/fb.h
+++ b/arch/parisc/include/asm/fb.h
@@ -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)
diff --git a/arch/parisc/video/Makefile b/arch/parisc/video/Makefile
new file mode 100644
index 000000000000..16a73cce4661
--- /dev/null
+++ b/arch/parisc/video/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_STI_CORE) += fbdev.o
diff --git a/arch/parisc/video/fbdev.c b/arch/parisc/video/fbdev.c
new file mode 100644
index 000000000000..4a0ae08fc75b
--- /dev/null
+++ b/arch/parisc/video/fbdev.c
@@ -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);
diff --git a/drivers/video/sticore.c b/drivers/video/sticore.c
index f8aaedea437d..7eb925f2ba9c 100644
--- a/drivers/video/sticore.c
+++ b/drivers/video/sticore.c
@@ -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");
diff --git a/include/video/sticore.h b/include/video/sticore.h
index c0879352cde4..fbb78d7e7565 100644
--- a/include/video/sticore.h
+++ b/include/video/sticore.h
@@ -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 */
--
2.40.0

2023-04-17 13:00:57

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 10/19] video: Remove trailing whitespaces

Fix trailing whitespaces. No functional changes.

Signed-off-by: Thomas Zimmermann <[email protected]>
---
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(-)

diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index 2cea69418a83..89ad7ade6cf9 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -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,
};


diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index db568f67e4dc..6ea9596a3c4b 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -6,12 +6,12 @@
* Copyright (C) 2000 Philipp Rumpf <[email protected]>
* Copyright (C) 2001-2020 Helge Deller <[email protected]>
* Copyright (C) 2001-2002 Thomas Bogendoerfer <[email protected]>
- *
+ *
* TODO:
* - call STI in virtual mode rather than in real mode
- * - screen blanking with state_mgmt() in text mode STI ?
+ * - screen blanking with state_mgmt() in text mode STI ?
* - try to make it work on m68k hp workstations ;)
- *
+ *
*/

#define pr_fmt(fmt) "%s: " fmt, KBUILD_MODNAME
@@ -66,12 +66,12 @@ static const u8 col_trans[8] = {
#define c_index(sti, c) ((c) & 0xff)

static const struct sti_init_flags default_init_flags = {
- .wait = STI_WAIT,
+ .wait = STI_WAIT,
.reset = 1,
- .text = 1,
+ .text = 1,
.nontext = 1,
- .no_chg_bet = 1,
- .no_chg_bei = 1,
+ .no_chg_bet = 1,
+ .no_chg_bei = 1,
.init_cmap_tx = 1,
};

@@ -104,7 +104,7 @@ static int sti_init_graph(struct sti_struct *sti)
pr_err("STI init_graph failed (ret %d, errno %d)\n", ret, err);
return -1;
}
-
+
return 0;
}

@@ -120,7 +120,7 @@ static void sti_inq_conf(struct sti_struct *sti)
s32 ret;

outptr->ext_ptr = STI_PTR(&sti->sti_data->inq_outptr_ext);
-
+
do {
spin_lock_irqsave(&sti->lock, flags);
memset(inptr, 0, sizeof(*inptr));
@@ -162,9 +162,9 @@ sti_putc(struct sti_struct *sti, int c, int y, int x,
}

static const struct sti_blkmv_flags clear_blkmv_flags = {
- .wait = STI_WAIT,
- .color = 1,
- .clear = 1,
+ .wait = STI_WAIT,
+ .color = 1,
+ .clear = 1,
};

void
@@ -185,7 +185,7 @@ sti_set(struct sti_struct *sti, int src_y, int src_x,
struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr;
s32 ret;
unsigned long flags;
-
+
do {
spin_lock_irqsave(&sti->lock, flags);
*inptr = inptr_default;
@@ -224,7 +224,7 @@ sti_clear(struct sti_struct *sti, int src_y, int src_x,
}

static const struct sti_blkmv_flags default_blkmv_flags = {
- .wait = STI_WAIT,
+ .wait = STI_WAIT,
};

void
@@ -291,14 +291,14 @@ static int __init sti_setup(char *str)
{
if (str)
strscpy(default_sti_path, str, sizeof(default_sti_path));
-
+
return 1;
}

/* Assuming the machine has multiple STI consoles (=graphic cards) which
* all get detected by sticon, the user may define with the linux kernel
* parameter sti=<x> which of them will be the initial boot-console.
- * <x> is a number between 0 and MAX_STI_ROMS, with 0 as the default
+ * <x> is a number between 0 and MAX_STI_ROMS, with 0 as the default
* STI screen.
*/
__setup("sti=", sti_setup);
@@ -341,13 +341,13 @@ static int sti_font_setup(char *str)
* should be used by the sticon driver to draw characters to the screen.
* Possible values are:
* - sti_font=<fb_fontname>:
- * <fb_fontname> is the name of one of the linux-kernel built-in
- * framebuffer font names (e.g. VGA8x16, SUN22x18).
- * This is only available if the fonts have been statically compiled
+ * <fb_fontname> is the name of one of the linux-kernel built-in
+ * framebuffer font names (e.g. VGA8x16, SUN22x18).
+ * This is only available if the fonts have been statically compiled
* in with e.g. the CONFIG_FONT_8x16 or CONFIG_FONT_SUN12x22 options.
* - sti_font=<number> (<number> = 1,2,3,...)
* most STI ROMs have built-in HP specific fonts, which can be selected
- * by giving the desired number to the sticon driver.
+ * by giving the desired number to the sticon driver.
* NOTE: This number is machine and STI ROM dependend.
* - sti_font=<height>x<width> (e.g. sti_font=16x8)
* <height> and <width> gives hints to the height and width of the
@@ -359,12 +359,12 @@ __setup("sti_font=", sti_font_setup);
#endif


-
+
static void sti_dump_globcfg(struct sti_glob_cfg *glob_cfg,
unsigned int sti_mem_request)
{
struct sti_glob_cfg_ext *cfg;
-
+
pr_debug("%d text planes\n"
"%4d x %4d screen resolution\n"
"%4d x %4d offscreen\n"
@@ -384,7 +384,7 @@ static void sti_dump_globcfg(struct sti_glob_cfg *glob_cfg,
glob_cfg->reent_lvl,
glob_cfg->save_addr);

- /* dump extended cfg */
+ /* dump extended cfg */
cfg = PTR_STI((unsigned long)glob_cfg->ext_ptr);
pr_debug("monitor %d\n"
"in friendly mode: %d\n"
@@ -437,10 +437,10 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address,
glob_cfg->save_addr = STI_PTR(save_addr);
for (i=0; i<8; i++) {
unsigned long newhpa, len;
-
+
if (sti->pd) {
unsigned char offs = sti->rm_entry[i];
-
+
if (offs == 0)
continue;
if (offs != PCI_ROM_ADDRESS &&
@@ -456,18 +456,18 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address,

sti->regions_phys[i] =
REGION_OFFSET_TO_PHYS(sti->regions[i], newhpa);
-
+
len = sti->regions[i].region_desc.length * 4096;
if (len)
glob_cfg->region_ptrs[i] = sti->regions_phys[i];
-
+
pr_debug("region #%d: phys %08lx, region_ptr %08x, len=%lukB, "
"btlb=%d, sysonly=%d, cache=%d, last=%d\n",
i, sti->regions_phys[i], glob_cfg->region_ptrs[i],
len/1024,
sti->regions[i].region_desc.btlb,
sti->regions[i].region_desc.sys_only,
- sti->regions[i].region_desc.cache,
+ sti->regions[i].region_desc.cache,
sti->regions[i].region_desc.last);

/* last entry reached ? */
@@ -482,7 +482,7 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address,
glob_cfg_ext->sti_mem_addr = STI_PTR(sti_mem_addr);

sti->glob_cfg = glob_cfg;
-
+
return 0;
}

@@ -495,7 +495,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
void *dest;
struct sti_rom_font *nf;
struct sti_cooked_font *cooked_font;
-
+
if (fbfont_name && strlen(fbfont_name))
fbfont = find_font(fbfont_name);
if (!fbfont)
@@ -505,8 +505,8 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)

pr_info(" using %ux%u framebuffer font %s\n",
fbfont->width, fbfont->height, fbfont->name);
-
- bpc = ((fbfont->width+7)/8) * fbfont->height;
+
+ bpc = ((fbfont->width+7)/8) * fbfont->height;
size = bpc * fbfont->charcount;
size += sizeof(struct sti_rom_font);

@@ -533,7 +533,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
kfree(nf);
return NULL;
}
-
+
cooked_font->raw = nf;
cooked_font->raw_ptr = nf;
cooked_font->next_font = NULL;
@@ -617,9 +617,9 @@ static void sti_dump_rom(struct sti_struct *sti)
int nr;

pr_info(" id %04x-%04x, conforms to spec rev. %d.%02x\n",
- rom->graphics_id[0],
+ rom->graphics_id[0],
rom->graphics_id[1],
- rom->revno[0] >> 4,
+ rom->revno[0] >> 4,
rom->revno[0] & 0x0f);
pr_debug(" supports %d monitors\n", rom->num_mons);
pr_debug(" font start %08x\n", rom->font_start);
@@ -647,7 +647,7 @@ static int sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
{
struct sti_rom_font *raw_font, *font_start;
struct sti_cooked_font *cooked_font;
-
+
cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
if (!cooked_font)
return 0;
@@ -745,7 +745,7 @@ static struct sti_rom *sti_get_bmode_rom (unsigned long address)

raw_font = ((void *)raw) + raw->font_start;
font_start = raw_font;
-
+
while (raw_font->next_font) {
BMODE_RELOCATE (raw_font->next_font);
raw_font = ((void *)font_start) + raw_font->next_font;
@@ -759,7 +759,7 @@ static struct sti_rom *sti_get_wmode_rom(unsigned long address)
struct sti_rom *raw;
unsigned long size;

- /* read the ROM size directly from the struct in ROM */
+ /* read the ROM size directly from the struct in ROM */
size = gsc_readl(address + offsetof(struct sti_rom,last_addr));

raw = kmalloc(size, STI_LOWMEM);
@@ -869,7 +869,7 @@ static struct sti_struct *sti_try_rom_generic(unsigned long address,
pr_warn("maximum number of STI ROMS reached !\n");
return NULL;
}
-
+
sti = kzalloc(sizeof(*sti), GFP_KERNEL);
if (!sti)
return NULL;
@@ -890,19 +890,19 @@ static struct sti_struct *sti_try_rom_generic(unsigned long address,
u32 *rm;
i = gsc_readl(address+0x04);
if (i != 1) {
- /* The ROM could have multiple architecture
+ /* The ROM could have multiple architecture
* dependent images (e.g. i386, parisc,...) */
pr_warn("PCI ROM is not a STI ROM type image (0x%8x)\n", i);
goto out_err;
}
-
+
sti->pd = pd;

i = gsc_readl(address+0x0c);
pr_debug("PCI ROM size (from header) = %d kB\n",
le16_to_cpu(i>>16)*512/1024);
rm_offset = le16_to_cpu(i & 0xffff);
- if (rm_offset) {
+ if (rm_offset) {
/* read 16 bytes from the pci region mapper array */
rm = (u32*) &sti->rm_entry;
*rm++ = gsc_readl(address+rm_offset+0x00);
@@ -915,9 +915,9 @@ static struct sti_struct *sti_try_rom_generic(unsigned long address,
pr_debug("sig %04x, PCI STI ROM at %08lx\n", sig, address);
goto test_rom;
}
-
+
ok = 0;
-
+
if ((sig & 0xff) == 0x01) {
pr_debug(" byte mode ROM at %08lx, hpa at %08lx\n",
address, hpa);
@@ -941,7 +941,7 @@ static struct sti_struct *sti_try_rom_generic(unsigned long address,
*/
if (sti->pd) {
unsigned long rom_base;
- rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE);
+ rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE);
pci_write_config_dword(sti->pd, PCI_ROM_ADDRESS, rom_base & ~PCI_ROM_ADDRESS_ENABLE);
pr_debug("STI PCI ROM disabled\n");
}
@@ -952,13 +952,13 @@ static struct sti_struct *sti_try_rom_generic(unsigned long address,
sti_inq_conf(sti);
sti_dump_globcfg(sti->glob_cfg, sti->sti_mem_request);
sti_dump_outptr(sti);
-
+
pr_info(" graphics card name: %s\n",
sti->sti_data->inq_outptr.dev_name);

sti_roms[num_sti_roms] = sti;
num_sti_roms++;
-
+
return sti;

out_err:
@@ -974,9 +974,9 @@ static void sticore_check_for_default_sti(struct sti_struct *sti, char *path)
}

/*
- * on newer systems PDC gives the address of the ROM
+ * on newer systems PDC gives the address of the ROM
* in the additional address field addr[1] while on
- * older Systems the PDC stores it in page0->proc_sti
+ * older Systems the PDC stores it in page0->proc_sti
*/
static int __init sticore_pa_init(struct parisc_device *dev)
{
@@ -1005,7 +1005,7 @@ static int sticore_pci_init(struct pci_dev *pd, const struct pci_device_id *ent)
unsigned int fb_len, rom_len;
int err;
struct sti_struct *sti;
-
+
err = pci_enable_device(pd);
if (err < 0) {
dev_err(&pd->dev, "Cannot enable PCI device\n");
@@ -1032,7 +1032,7 @@ static int sticore_pci_init(struct pci_dev *pd, const struct pci_device_id *ent)
print_pci_hwpath(pd, sti->pa_path);
sticore_check_for_default_sti(sti, sti->pa_path);
}
-
+
if (!sti) {
pr_warn("Unable to handle STI device '%s'\n", pci_name(pd));
return -ENODEV;
diff --git a/drivers/video/fbdev/sticore.h b/drivers/video/fbdev/sticore.h
index 0ebdd28a0b81..c0879352cde4 100644
--- a/drivers/video/fbdev/sticore.h
+++ b/drivers/video/fbdev/sticore.h
@@ -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];
diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c
index ef8a4c5fc687..99996bc7e6d9 100644
--- a/drivers/video/fbdev/stifb.c
+++ b/drivers/video/fbdev/stifb.c
@@ -1,11 +1,11 @@
/*
- * linux/drivers/video/stifb.c -
- * Low level Frame buffer driver for HP workstations with
+ * linux/drivers/video/stifb.c -
+ * Low level Frame buffer driver for HP workstations with
* STI (standard text interface) video firmware.
*
* Copyright (C) 2001-2006 Helge Deller <[email protected]>
* Portions Copyright (C) 2001 Thomas Bogendoerfer <[email protected]>
- *
+ *
* Based on:
* - linux/drivers/video/artistfb.c -- Artist frame buffer driver
* Copyright (C) 2000 Philipp Rumpf <[email protected]>
@@ -14,7 +14,7 @@
* - HP Xhp cfb-based X11 window driver for XFree86
* (c)Copyright 1992 Hewlett-Packard Co.
*
- *
+ *
* The following graphics display devices (NGLE family) are supported by this driver:
*
* HPA4070A known as "HCRX", a 1280x1024 color device with 8 planes
@@ -30,7 +30,7 @@
* supports 1280x1024 color displays with 8 planes.
* HP710G same as HP710C, 1280x1024 grayscale only
* HP710L same as HP710C, 1024x768 color only
- * HP712 internal graphics support on HP9000s712 SPU, supports 640x480,
+ * HP712 internal graphics support on HP9000s712 SPU, supports 640x480,
* 1024x768 or 1280x1024 color displays on 8 planes (Artist)
*
* This file is subject to the terms and conditions of the GNU General Public
@@ -92,7 +92,7 @@ typedef struct {
__s32 misc_video_end;
} video_setup_t;

-typedef struct {
+typedef struct {
__s16 sizeof_ngle_data;
__s16 x_size_visible; /* visible screen dim in pixels */
__s16 y_size_visible;
@@ -177,10 +177,10 @@ static int __initdata stifb_bpp_pref[MAX_STI_ROMS];
#endif /* DEBUG_STIFB_REGS */


-#define ENABLE 1 /* for enabling/disabling screen */
+#define ENABLE 1 /* for enabling/disabling screen */
#define DISABLE 0

-#define NGLE_LOCK(fb_info) do { } while (0)
+#define NGLE_LOCK(fb_info) do { } while (0)
#define NGLE_UNLOCK(fb_info) do { } while (0)

static void
@@ -198,9 +198,9 @@ SETUP_HW(struct stifb_info *fb)

static void
SETUP_FB(struct stifb_info *fb)
-{
+{
unsigned int reg10_value = 0;
-
+
SETUP_HW(fb);
switch (fb->id)
{
@@ -210,15 +210,15 @@ SETUP_FB(struct stifb_info *fb)
reg10_value = 0x13601000;
break;
case S9000_ID_A1439A:
- if (fb->info.var.bits_per_pixel == 32)
+ if (fb->info.var.bits_per_pixel == 32)
reg10_value = 0xBBA0A000;
- else
+ else
reg10_value = 0x13601000;
break;
case S9000_ID_HCRX:
if (fb->info.var.bits_per_pixel == 32)
reg10_value = 0xBBA0A000;
- else
+ else
reg10_value = 0x13602000;
break;
case S9000_ID_TIMBER:
@@ -243,7 +243,7 @@ START_IMAGE_COLORMAP_ACCESS(struct stifb_info *fb)
}

static void
-WRITE_IMAGE_COLOR(struct stifb_info *fb, int index, int color)
+WRITE_IMAGE_COLOR(struct stifb_info *fb, int index, int color)
{
SETUP_HW(fb);
WRITE_WORD(((0x100+index)<<2), fb, REG_3);
@@ -251,30 +251,30 @@ WRITE_IMAGE_COLOR(struct stifb_info *fb, int index, int color)
}

static void
-FINISH_IMAGE_COLORMAP_ACCESS(struct stifb_info *fb)
-{
+FINISH_IMAGE_COLORMAP_ACCESS(struct stifb_info *fb)
+{
WRITE_WORD(0x400, fb, REG_2);
if (fb->info.var.bits_per_pixel == 32) {
WRITE_WORD(0x83000100, fb, REG_1);
} else {
if (fb->id == S9000_ID_ARTIST || fb->id == CRT_ID_VISUALIZE_EG)
WRITE_WORD(0x80000100, fb, REG_26);
- else
+ else
WRITE_WORD(0x80000100, fb, REG_1);
}
SETUP_FB(fb);
}

static void
-SETUP_RAMDAC(struct stifb_info *fb)
+SETUP_RAMDAC(struct stifb_info *fb)
{
SETUP_HW(fb);
WRITE_WORD(0x04000000, fb, 0x1020);
WRITE_WORD(0xff000000, fb, 0x1028);
}

-static void
-CRX24_SETUP_RAMDAC(struct stifb_info *fb)
+static void
+CRX24_SETUP_RAMDAC(struct stifb_info *fb)
{
SETUP_HW(fb);
WRITE_WORD(0x04000000, fb, 0x1000);
@@ -286,14 +286,14 @@ CRX24_SETUP_RAMDAC(struct stifb_info *fb)
}

#if 0
-static void
+static void
HCRX_SETUP_RAMDAC(struct stifb_info *fb)
{
WRITE_WORD(0xffffffff, fb, REG_32);
}
#endif

-static void
+static void
CRX24_SET_OVLY_MASK(struct stifb_info *fb)
{
SETUP_HW(fb);
@@ -314,7 +314,7 @@ ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable)
WRITE_WORD(value, fb, 0x1038);
}

-static void
+static void
CRX24_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable)
{
unsigned int value = enable ? 0x10000000 : 0x30000000;
@@ -325,11 +325,11 @@ CRX24_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable)
}

static void
-ARTIST_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable)
+ARTIST_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable)
{
u32 DregsMiscVideo = REG_21;
u32 DregsMiscCtl = REG_27;
-
+
SETUP_HW(fb);
if (enable) {
WRITE_WORD(READ_WORD(fb, DregsMiscVideo) | 0x0A000000, fb, DregsMiscVideo);
@@ -344,7 +344,7 @@ ARTIST_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable)
(READ_BYTE(fb, REG_16b3) - 1)

#define HYPER_CONFIG_PLANES_24 0x00000100
-
+
#define IS_24_DEVICE(fb) \
(fb->deviceSpecificConfig & HYPER_CONFIG_PLANES_24)

@@ -470,15 +470,15 @@ SETUP_ATTR_ACCESS(struct stifb_info *fb, unsigned BufferNumber)
}

static void
-SET_ATTR_SIZE(struct stifb_info *fb, int width, int height)
+SET_ATTR_SIZE(struct stifb_info *fb, int width, int height)
{
- /* REG_6 seems to have special values when run on a
+ /* REG_6 seems to have special values when run on a
RDI precisionbook parisc laptop (INTERNAL_EG_DX1024 or
INTERNAL_EG_X1024). The values are:
0x2f0: internal (LCD) & external display enabled
0x2a0: external display only
0x000: zero on standard artist graphic cards
- */
+ */
WRITE_WORD(0x00000000, fb, REG_6);
WRITE_WORD((width<<16) | height, fb, REG_9);
WRITE_WORD(0x05000000, fb, REG_6);
@@ -486,7 +486,7 @@ SET_ATTR_SIZE(struct stifb_info *fb, int width, int height)
}

static void
-FINISH_ATTR_ACCESS(struct stifb_info *fb)
+FINISH_ATTR_ACCESS(struct stifb_info *fb)
{
SETUP_HW(fb);
WRITE_WORD(0x00000000, fb, REG_12);
@@ -499,7 +499,7 @@ elkSetupPlanes(struct stifb_info *fb)
SETUP_FB(fb);
}

-static void
+static void
ngleSetupAttrPlanes(struct stifb_info *fb, int BufferNumber)
{
SETUP_ATTR_ACCESS(fb, BufferNumber);
@@ -519,7 +519,7 @@ rattlerSetupPlanes(struct stifb_info *fb)
* read mask register for overlay planes, not image planes).
*/
CRX24_SETUP_RAMDAC(fb);
-
+
/* change fb->id temporarily to fool SETUP_FB() */
saved_id = fb->id;
fb->id = CRX24_OVERLAY_PLANES;
@@ -565,7 +565,7 @@ setNgleLutBltCtl(struct stifb_info *fb, int offsetWithinLut, int length)
lutBltCtl.all = 0x80000000;
lutBltCtl.fields.length = length;

- switch (fb->id)
+ switch (fb->id)
{
case S9000_ID_A1439A: /* CRX24 */
if (fb->var.bits_per_pixel == 8) {
@@ -576,12 +576,12 @@ setNgleLutBltCtl(struct stifb_info *fb, int offsetWithinLut, int length)
lutBltCtl.fields.lutOffset = 0 * 256;
}
break;
-
+
case S9000_ID_ARTIST:
lutBltCtl.fields.lutType = NGLE_CMAP_INDEXED0_TYPE;
lutBltCtl.fields.lutOffset = 0 * 256;
break;
-
+
default:
lutBltCtl.fields.lutType = NGLE_CMAP_INDEXED0_TYPE;
lutBltCtl.fields.lutOffset = 0;
@@ -596,7 +596,7 @@ setNgleLutBltCtl(struct stifb_info *fb, int offsetWithinLut, int length)
#endif

static NgleLutBltCtl
-setHyperLutBltCtl(struct stifb_info *fb, int offsetWithinLut, int length)
+setHyperLutBltCtl(struct stifb_info *fb, int offsetWithinLut, int length)
{
NgleLutBltCtl lutBltCtl;

@@ -633,7 +633,7 @@ static void hyperUndoITE(struct stifb_info *fb)

/* Hardware setup for full-depth write to "magic" location */
GET_FIFO_SLOTS(fb, nFreeFifoSlots, 7);
- NGLE_QUICK_SET_DST_BM_ACCESS(fb,
+ NGLE_QUICK_SET_DST_BM_ACCESS(fb,
BA(IndexedDcd, Otc04, Ots08, AddrLong,
BAJustPoint(0), BINovly, BAIndexBase(0)));
NGLE_QUICK_SET_IMAGE_BITMAP_OP(fb,
@@ -653,13 +653,13 @@ static void hyperUndoITE(struct stifb_info *fb)
NGLE_UNLOCK(fb);
}

-static void
+static void
ngleDepth8_ClearImagePlanes(struct stifb_info *fb)
{
/* FIXME! */
}

-static void
+static void
ngleDepth24_ClearImagePlanes(struct stifb_info *fb)
{
/* FIXME! */
@@ -675,7 +675,7 @@ ngleResetAttrPlanes(struct stifb_info *fb, unsigned int ctlPlaneReg)
NGLE_LOCK(fb);

GET_FIFO_SLOTS(fb, nFreeFifoSlots, 4);
- NGLE_QUICK_SET_DST_BM_ACCESS(fb,
+ NGLE_QUICK_SET_DST_BM_ACCESS(fb,
BA(IndexedDcd, Otc32, OtsIndirect,
AddrLong, BAJustPoint(0),
BINattr, BAIndexBase(0)));
@@ -713,22 +713,22 @@ ngleResetAttrPlanes(struct stifb_info *fb, unsigned int ctlPlaneReg)
/**** Finally, set the Control Plane Register back to zero: ****/
GET_FIFO_SLOTS(fb, nFreeFifoSlots, 1);
NGLE_QUICK_SET_CTL_PLN_REG(fb, 0);
-
+
NGLE_UNLOCK(fb);
}
-
+
static void
ngleClearOverlayPlanes(struct stifb_info *fb, int mask, int data)
{
int nFreeFifoSlots = 0;
u32 packed_dst;
u32 packed_len;
-
+
NGLE_LOCK(fb);

/* Hardware setup */
GET_FIFO_SLOTS(fb, nFreeFifoSlots, 8);
- NGLE_QUICK_SET_DST_BM_ACCESS(fb,
+ NGLE_QUICK_SET_DST_BM_ACCESS(fb,
BA(IndexedDcd, Otc04, Ots08, AddrLong,
BAJustPoint(0), BINovly, BAIndexBase(0)));

@@ -736,23 +736,23 @@ ngleClearOverlayPlanes(struct stifb_info *fb, int mask, int data)

NGLE_REALLY_SET_IMAGE_FG_COLOR(fb, data);
NGLE_REALLY_SET_IMAGE_PLANEMASK(fb, mask);
-
+
packed_dst = 0;
packed_len = (fb->info.var.xres << 16) | fb->info.var.yres;
NGLE_SET_DSTXY(fb, packed_dst);
-
- /* Write zeroes to overlay planes */
+
+ /* Write zeroes to overlay planes */
NGLE_QUICK_SET_IMAGE_BITMAP_OP(fb,
IBOvals(RopSrc, MaskAddrOffset(0),
BitmapExtent08, StaticReg(0),
DataDynamic, MaskOtc, BGx(0), FGx(0)));
-
+
SET_LENXY_START_RECFILL(fb, packed_len);

NGLE_UNLOCK(fb);
}

-static void
+static void
hyperResetPlanes(struct stifb_info *fb, int enable)
{
unsigned int controlPlaneReg;
@@ -783,7 +783,7 @@ hyperResetPlanes(struct stifb_info *fb, int enable)
ngleClearOverlayPlanes(fb, 0xff, 255);

/**************************************************
- ** Also need to counteract ITE settings
+ ** Also need to counteract ITE settings
**************************************************/
hyperUndoITE(fb);
break;
@@ -803,13 +803,13 @@ hyperResetPlanes(struct stifb_info *fb, int enable)
ngleResetAttrPlanes(fb, controlPlaneReg);
break;
}
-
+
NGLE_UNLOCK(fb);
}

/* Return pointer to in-memory structure holding ELK device-dependent ROM values. */

-static void
+static void
ngleGetDeviceRomData(struct stifb_info *fb)
{
#if 0
@@ -821,7 +821,7 @@ XXX: FIXME: !!!
char *pCard8;
int i;
char *mapOrigin = NULL;
-
+
int romTableIdx;

pPackedDevRomData = fb->ngle_rom;
@@ -888,7 +888,7 @@ SETUP_HCRX(struct stifb_info *fb)

/* Initialize Hyperbowl registers */
GET_FIFO_SLOTS(fb, nFreeFifoSlots, 7);
-
+
if (IS_24_DEVICE(fb)) {
hyperbowl = (fb->info.var.bits_per_pixel == 32) ?
HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE :
@@ -897,9 +897,9 @@ SETUP_HCRX(struct stifb_info *fb)
/* First write to Hyperbowl must happen twice (bug) */
WRITE_WORD(hyperbowl, fb, REG_40);
WRITE_WORD(hyperbowl, fb, REG_40);
-
+
WRITE_WORD(HYPERBOWL_MODE2_8_24, fb, REG_39);
-
+
WRITE_WORD(0x014c0148, fb, REG_42); /* Set lut 0 to be the direct color */
WRITE_WORD(0x404c4048, fb, REG_43);
WRITE_WORD(0x034c0348, fb, REG_44);
@@ -990,7 +990,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
0, /* Offset w/i LUT */
256); /* Load entire LUT */
NGLE_BINC_SET_SRCADDR(fb,
- NGLE_LONG_FB_ADDRESS(0, 0x100, 0));
+ NGLE_LONG_FB_ADDRESS(0, 0x100, 0));
/* 0x100 is same as used in WRITE_IMAGE_COLOR() */
START_COLORMAPLOAD(fb, lutBltCtl.all);
SETUP_FB(fb);
@@ -1028,7 +1028,7 @@ stifb_blank(int blank_mode, struct fb_info *info)
ENABLE_DISABLE_DISPLAY(fb, enable);
break;
}
-
+
SETUP_FB(fb);
return 0;
}
@@ -1114,15 +1114,15 @@ stifb_init_display(struct stifb_info *fb)

/* HCRX specific initialization */
SETUP_HCRX(fb);
-
+
/*
if (id == S9000_ID_HCRX)
hyperInitSprite(fb);
else
ngleInitSprite(fb);
*/
-
- /* Initialize the image planes. */
+
+ /* Initialize the image planes. */
switch (id) {
case S9000_ID_HCRX:
hyperResetPlanes(fb, ENABLE);
@@ -1194,7 +1194,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
fb = kzalloc(sizeof(*fb), GFP_ATOMIC);
if (!fb)
return -ENOMEM;
-
+
info = &fb->info;

/* set struct to a known state */
@@ -1235,7 +1235,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
dev_name, fb->id);
goto out_err0;
}
-
+
/* default to 8 bpp on most graphic chips */
bpp = 8;
xres = sti_onscreen_x(fb->sti);
@@ -1256,7 +1256,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
fb->id = S9000_ID_A1659A;
break;
case S9000_ID_TIMBER: /* HP9000/710 Any (may be a grayscale device) */
- if (strstr(dev_name, "GRAYSCALE") ||
+ if (strstr(dev_name, "GRAYSCALE") ||
strstr(dev_name, "Grayscale") ||
strstr(dev_name, "grayscale"))
var->grayscale = 1;
@@ -1295,16 +1295,16 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
case CRT_ID_VISUALIZE_EG:
case S9000_ID_ARTIST: /* Artist */
break;
- default:
+ default:
#ifdef FALLBACK_TO_1BPP
- printk(KERN_WARNING
+ printk(KERN_WARNING
"stifb: Unsupported graphics card (id=0x%08x) "
"- now trying 1bpp mode instead\n",
fb->id);
bpp = 1; /* default to 1 bpp */
break;
#else
- printk(KERN_WARNING
+ printk(KERN_WARNING
"stifb: Unsupported graphics card (id=0x%08x) "
"- skipping.\n",
fb->id);
@@ -1320,11 +1320,11 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
fix->line_length = (fb->sti->glob_cfg->total_x * bpp) / 8;
if (!fix->line_length)
fix->line_length = 2048; /* default */
-
+
/* limit fbsize to max visible screen size */
if (fix->smem_len > yres*fix->line_length)
fix->smem_len = ALIGN(yres*fix->line_length, 4*1024*1024);
-
+
fix->accel = FB_ACCEL_NONE;

switch (bpp) {
@@ -1350,7 +1350,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
default:
break;
}
-
+
var->xres = var->xres_virtual = xres;
var->yres = var->yres_virtual = yres;
var->bits_per_pixel = bpp;
@@ -1379,7 +1379,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
fix->smem_start, fix->smem_start+fix->smem_len);
goto out_err2;
}
-
+
if (!request_mem_region(fix->mmio_start, fix->mmio_len, "stifb mmio")) {
printk(KERN_ERR "stifb: cannot reserve sti mmio region 0x%04lx-0x%04lx\n",
fix->mmio_start, fix->mmio_start+fix->mmio_len);
@@ -1393,11 +1393,11 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)

fb_info(&fb->info, "%s %dx%d-%d frame buffer device, %s, id: %04x, mmio: 0x%04lx\n",
fix->id,
- var->xres,
+ var->xres,
var->yres,
var->bits_per_pixel,
dev_name,
- fb->id,
+ fb->id,
fix->mmio_start);

return 0;
@@ -1426,7 +1426,7 @@ static int __init stifb_init(void)
struct sti_struct *sti;
struct sti_struct *def_sti;
int i;
-
+
#ifndef MODULE
char *option = NULL;

@@ -1438,7 +1438,7 @@ static int __init stifb_init(void)
printk(KERN_INFO "stifb: disabled by \"stifb=off\" kernel parameter\n");
return -ENXIO;
}
-
+
def_sti = sti_get_rom(0);
if (def_sti) {
for (i = 1; i <= MAX_STI_ROMS; i++) {
@@ -1472,7 +1472,7 @@ stifb_cleanup(void)
{
struct sti_struct *sti;
int i;
-
+
for (i = 1; i <= MAX_STI_ROMS; i++) {
sti = sti_get_rom(i);
if (!sti)
@@ -1495,10 +1495,10 @@ int __init
stifb_setup(char *options)
{
int i;
-
+
if (!options || !*options)
return 1;
-
+
if (strncmp(options, "off", 3) == 0) {
stifb_disabled = 1;
options += 3;
--
2.40.0

2023-04-17 13:01:34

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 15/19] arch/powerpc: Implement <asm/fb.h> with generic helpers

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

Signed-off-by: Thomas Zimmermann <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Christophe Leroy <[email protected]>
Acked-by: Michael Ellerman <[email protected]>
---
arch/powerpc/include/asm/fb.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 6541ab77c5b9..5f1a2e5f7654 100644
--- a/arch/powerpc/include/asm/fb.h
+++ b/arch/powerpc/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 13:02:11

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 14/19] arch/parisc: Implement <asm/fb.h> with generic helpers

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)

Signed-off-by: Thomas Zimmermann <[email protected]>
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(-)

diff --git a/arch/parisc/include/asm/fb.h b/arch/parisc/include/asm/fb.h
index 0b9a38ced5c8..658a8a7dc531 100644
--- a/arch/parisc/include/asm/fb.h
+++ b/arch/parisc/include/asm/fb.h
@@ -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_ */
--
2.40.0

2023-04-17 13:02:33

by Thomas Zimmermann

[permalink] [raw]
Subject: [PATCH v3 19/19] arch/x86: Implement <asm/fb.h> with generic helpers

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

Signed-off-by: Thomas Zimmermann <[email protected]>
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(-)

diff --git a/arch/x86/include/asm/fb.h b/arch/x86/include/asm/fb.h
index ab4c960146e3..a3fb801f12f1 100644
--- a/arch/x86/include/asm/fb.h
+++ b/arch/x86/include/asm/fb.h
@@ -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 */
--
2.40.0

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

Hi Thomas!

On Mon, 2023-04-17 at 14:56 +0200, Thomas Zimmermann wrote:
> 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)
>
> Signed-off-by: Thomas Zimmermann <[email protected]>
> 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(-)
>
> diff --git a/arch/sh/include/asm/fb.h b/arch/sh/include/asm/fb.h
> index 9a0bca2686fd..19df13ee9ca7 100644
> --- a/arch/sh/include/asm/fb.h
> +++ b/arch/sh/include/asm/fb.h
> @@ -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);
> -}

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?

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

Thanks,
Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

2023-04-17 14:08:30

by Thomas Zimmermann

[permalink] [raw]
Subject: 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:
> Hi Thomas!
>
> On Mon, 2023-04-17 at 14:56 +0200, Thomas Zimmermann wrote:
>> 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)
>>
>> Signed-off-by: Thomas Zimmermann <[email protected]>
>> 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(-)
>>
>> diff --git a/arch/sh/include/asm/fb.h b/arch/sh/include/asm/fb.h
>> index 9a0bca2686fd..19df13ee9ca7 100644
>> --- a/arch/sh/include/asm/fb.h
>> +++ b/arch/sh/include/asm/fb.h
>> @@ -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);
>> -}
>
> 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

>
>> -static inline int fb_is_primary_device(struct fb_info *info)
>> -{
>> - return 0;
>> -}
>> +#include <asm-generic/fb.h>
>>
>> #endif /* _ASM_FB_H_ */
>
> Thanks,
> Adrian
>

--
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


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature

2023-04-17 14:08:43

by Thomas Zimmermann

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



Am 17.04.23 um 16:06 schrieb Thomas Zimmermann:
> Hi
>
> Am 17.04.23 um 15:02 schrieb John Paul Adrian Glaubitz:
>> Hi Thomas!
>>
>> On Mon, 2023-04-17 at 14:56 +0200, Thomas Zimmermann wrote:
>>> 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)
>>>
>>> Signed-off-by: Thomas Zimmermann <[email protected]>
>>> 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(-)
>>>
>>> diff --git a/arch/sh/include/asm/fb.h b/arch/sh/include/asm/fb.h
>>> index 9a0bca2686fd..19df13ee9ca7 100644
>>> --- a/arch/sh/include/asm/fb.h
>>> +++ b/arch/sh/include/asm/fb.h
>>> @@ -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);
>>> -}
>>
>> 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.

In case you didn't receive that patch:

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

>
> Best regards
> Thomas
>
>>
>>> -static inline int fb_is_primary_device(struct fb_info *info)
>>> -{
>>> -    return 0;
>>> -}
>>> +#include <asm-generic/fb.h>
>>>   #endif /* _ASM_FB_H_ */
>>
>> Thanks,
>> Adrian
>>
>

--
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


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature

2023-04-17 14:13:15

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v3 00/19] arch: Consolidate <asm/fb.h>

On Mon, Apr 17, 2023, at 14:56, Thomas Zimmermann wrote:
> 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,

Acked-by: Arnd Bergmann <[email protected]>

Arnd

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

Hi Thomas!

On Mon, 2023-04-17 at 16:06 +0200, Thomas Zimmermann wrote:
> Hi
>
> Am 17.04.23 um 15:02 schrieb John Paul Adrian Glaubitz:
> > Hi Thomas!
> >
> > On Mon, 2023-04-17 at 14:56 +0200, Thomas Zimmermann wrote:
> > > 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)
> > >
> > > Signed-off-by: Thomas Zimmermann <[email protected]>
> > > 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(-)
> > >
> > > diff --git a/arch/sh/include/asm/fb.h b/arch/sh/include/asm/fb.h
> > > index 9a0bca2686fd..19df13ee9ca7 100644
> > > --- a/arch/sh/include/asm/fb.h
> > > +++ b/arch/sh/include/asm/fb.h
> > > @@ -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);
> > > -}
> >
> > 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.
>

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

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

2023-04-17 14:22:59

by Thomas Zimmermann

[permalink] [raw]
Subject: 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:
> Hi Thomas!
>
> On Mon, 2023-04-17 at 16:06 +0200, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 17.04.23 um 15:02 schrieb John Paul Adrian Glaubitz:
>>> Hi Thomas!
>>>
>>> On Mon, 2023-04-17 at 14:56 +0200, Thomas Zimmermann wrote:
>>>> 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)
>>>>
>>>> Signed-off-by: Thomas Zimmermann <[email protected]>
>>>> 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(-)
>>>>
>>>> diff --git a/arch/sh/include/asm/fb.h b/arch/sh/include/asm/fb.h
>>>> index 9a0bca2686fd..19df13ee9ca7 100644
>>>> --- a/arch/sh/include/asm/fb.h
>>>> +++ b/arch/sh/include/asm/fb.h
>>>> @@ -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);
>>>> -}
>>>
>>> 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.
>>
>
> Ah, I missed that, thanks for the explanation. Let me check and Ack your patch

Thanks!

> 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

>
> Thanks,
> Adrian
>

--
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


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature
Subject: Re: [PATCH v3 16/19] arch/sh: Implement <asm/fb.h> with generic helpers

On Mon, 2023-04-17 at 14:56 +0200, Thomas Zimmermann wrote:
> 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)
>
> Signed-off-by: Thomas Zimmermann <[email protected]>
> 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(-)
>
> diff --git a/arch/sh/include/asm/fb.h b/arch/sh/include/asm/fb.h
> index 9a0bca2686fd..19df13ee9ca7 100644
> --- a/arch/sh/include/asm/fb.h
> +++ b/arch/sh/include/asm/fb.h
> @@ -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_ */

Acked-by: John Paul Adrian Glaubitz <[email protected]>

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

2023-04-18 07:46:55

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH v3 00/19] arch: Consolidate <asm/fb.h>

Hi

Am 17.04.23 um 16:12 schrieb Arnd Bergmann:
> On Mon, Apr 17, 2023, at 14:56, Thomas Zimmermann wrote:
>> 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,
>
> Acked-by: Arnd Bergmann <[email protected]>

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

>
> Arnd

--
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


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature

2023-04-19 17:26:22

by Helge Deller

[permalink] [raw]
Subject: Re: [PATCH v3 00/19] arch: Consolidate <asm/fb.h>

Hi Thomas,

> Am 17.04.23 um 16:12 schrieb Arnd Bergmann:>> On Mon, Apr 17, 2023, at 14:56, Thomas Zimmermann wrote:
>>> 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,
>>
>> Acked-by: Arnd Bergmann <[email protected]>
>
> 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:
Acked-by: Helge Deller <[email protected]>
to the series and take it through the drm tree.

Helge

2023-06-24 02:05:55

by Guenter Roeck

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

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 <[email protected]>
> Cc: "David S. Miller" <[email protected]>

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

2023-06-24 10:06:26

by Arnd Bergmann

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

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 <[email protected]>
>> Cc: "David S. Miller" <[email protected]>
>
> 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

2023-06-24 13:39:33

by Guenter Roeck

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

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 <[email protected]>
>>> Cc: "David S. Miller" <[email protected]>
>>
>> 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


2023-06-24 14:23:53

by Arnd Bergmann

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

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 <[email protected]>
>>>> Cc: "David S. Miller" <[email protected]>
>>>
>>> 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

2023-06-28 10:09:56

by Arnd Bergmann

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

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

Arnd

2023-06-28 10:59:08

by WANG Xuerui

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

Hi,

On 2023/4/17 20:56, Thomas Zimmermann wrote:
> 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)
>
> Signed-off-by: Thomas Zimmermann <[email protected]>
> Cc: Huacai Chen <[email protected]>
> Cc: WANG Xuerui <[email protected]>
> ---
> arch/loongarch/include/asm/fb.h | 15 +--------------
> 1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/arch/loongarch/include/asm/fb.h b/arch/loongarch/include/asm/fb.h
> index 3116bde8772d..ff82f20685c8 100644
> --- a/arch/loongarch/include/asm/fb.h
> +++ b/arch/loongarch/include/asm/fb.h
> @@ -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_ */

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

Reviewed-by: WANG Xuerui <[email protected]>

Thanks!

--
WANG "xen0n" Xuerui

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