]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 13:24:28 +0000 (14:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 13:24:28 +0000 (14:24 +0100)
added patches:
console-delete-dummy-con_font_set-and-con_font_default-callback-implementations.patch
console-delete-unused-con_font_copy-callback-implementations.patch
fbcon-avoid-using-fntcharcnt-and-hard-coded-built-in-font-charcount.patch
fonts-add-charcount-field-to-font_desc.patch
parisc-sticore-avoid-hard-coding-built-in-font-charcount.patch
virtio_console-fix-order-of-fields-cols-and-rows.patch

queue-5.10/console-delete-dummy-con_font_set-and-con_font_default-callback-implementations.patch [new file with mode: 0644]
queue-5.10/console-delete-unused-con_font_copy-callback-implementations.patch [new file with mode: 0644]
queue-5.10/fbcon-avoid-using-fntcharcnt-and-hard-coded-built-in-font-charcount.patch [new file with mode: 0644]
queue-5.10/fonts-add-charcount-field-to-font_desc.patch [new file with mode: 0644]
queue-5.10/parisc-sticore-avoid-hard-coding-built-in-font-charcount.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/virtio_console-fix-order-of-fields-cols-and-rows.patch [new file with mode: 0644]

diff --git a/queue-5.10/console-delete-dummy-con_font_set-and-con_font_default-callback-implementations.patch b/queue-5.10/console-delete-dummy-con_font_set-and-con_font_default-callback-implementations.patch
new file mode 100644 (file)
index 0000000..33f71ee
--- /dev/null
@@ -0,0 +1,94 @@
+From 259a252c1f4e19045b06660f81014fb51e17f3f6 Mon Sep 17 00:00:00 2001
+From: Peilin Ye <yepeilin.cs@gmail.com>
+Date: Thu, 12 Nov 2020 07:11:20 -0500
+Subject: console: Delete dummy con_font_set() and con_font_default() callback implementations
+
+From: Peilin Ye <yepeilin.cs@gmail.com>
+
+commit 259a252c1f4e19045b06660f81014fb51e17f3f6 upstream.
+
+.con_font_set and .con_font_default callbacks should not pass `struct
+console_font *` as a parameter, since `struct console_font` is a UAPI
+structure.
+
+We are trying to let them use our new kernel font descriptor, `struct
+font_desc` instead. To make that work slightly easier, first delete all of
+their no-op implementations used by dummy consoles.
+
+This will make KD_FONT_OP_SET and KD_FONT_OP_SET_DEFAULT ioctl() requests
+on dummy consoles start to fail and return `-ENOSYS`, which is intended,
+since no user should ever expect such operations to succeed on dummy
+consoles.
+
+Suggested-by: Daniel Vetter <daniel@ffwll.ch>
+Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: https://patchwork.freedesktop.org/patch/msgid/9952c7538d2a32bb1a82af323be482e7afb3dedf.1605169912.git.yepeilin.cs@gmail.com
+Cc: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/misc/sisusbvga/sisusb_con.c |   15 ---------------
+ drivers/video/console/dummycon.c        |   14 --------------
+ 2 files changed, 29 deletions(-)
+
+--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
++++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
+@@ -1345,19 +1345,6 @@ static int sisusbdummycon_blank(struct v
+       return 0;
+ }
+-static int sisusbdummycon_font_set(struct vc_data *vc,
+-                                 struct console_font *font,
+-                                 unsigned int flags)
+-{
+-      return 0;
+-}
+-
+-static int sisusbdummycon_font_default(struct vc_data *vc,
+-                                     struct console_font *font, char *name)
+-{
+-      return 0;
+-}
+-
+ static const struct consw sisusb_dummy_con = {
+       .owner =                THIS_MODULE,
+       .con_startup =          sisusbdummycon_startup,
+@@ -1370,8 +1357,6 @@ static const struct consw sisusb_dummy_c
+       .con_scroll =           sisusbdummycon_scroll,
+       .con_switch =           sisusbdummycon_switch,
+       .con_blank =            sisusbdummycon_blank,
+-      .con_font_set =         sisusbdummycon_font_set,
+-      .con_font_default =     sisusbdummycon_font_default,
+ };
+ int
+--- a/drivers/video/console/dummycon.c
++++ b/drivers/video/console/dummycon.c
+@@ -124,18 +124,6 @@ static int dummycon_switch(struct vc_dat
+       return 0;
+ }
+-static int dummycon_font_set(struct vc_data *vc, struct console_font *font,
+-                           unsigned int flags)
+-{
+-      return 0;
+-}
+-
+-static int dummycon_font_default(struct vc_data *vc,
+-                               struct console_font *font, char *name)
+-{
+-      return 0;
+-}
+-
+ /*
+  *  The console `switch' structure for the dummy console
+  *
+@@ -154,7 +142,5 @@ const struct consw dummy_con = {
+       .con_scroll =   dummycon_scroll,
+       .con_switch =   dummycon_switch,
+       .con_blank =    dummycon_blank,
+-      .con_font_set = dummycon_font_set,
+-      .con_font_default =     dummycon_font_default,
+ };
+ EXPORT_SYMBOL_GPL(dummy_con);
diff --git a/queue-5.10/console-delete-unused-con_font_copy-callback-implementations.patch b/queue-5.10/console-delete-unused-con_font_copy-callback-implementations.patch
new file mode 100644 (file)
index 0000000..3182c49
--- /dev/null
@@ -0,0 +1,122 @@
+From 7a089ec7d77fe7d50f6bb7b178fa25eec9fd822b Mon Sep 17 00:00:00 2001
+From: Peilin Ye <yepeilin.cs@gmail.com>
+Date: Thu, 12 Nov 2020 07:04:03 -0500
+Subject: console: Delete unused con_font_copy() callback implementations
+
+From: Peilin Ye <yepeilin.cs@gmail.com>
+
+commit 7a089ec7d77fe7d50f6bb7b178fa25eec9fd822b upstream.
+
+Recently in commit 3c4e0dff2095 ("vt: Disable KD_FONT_OP_COPY") we
+disabled the KD_FONT_OP_COPY ioctl() option. Delete all the
+con_font_copy() callbacks, since we no longer use them.
+
+Mark KD_FONT_OP_COPY as "obsolete" in include/uapi/linux/kd.h, just like
+what we have done for PPPIOCDETACH in commit af8d3c7c001a ("ppp: remove
+the PPPIOCDETACH ioctl").
+
+Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: https://patchwork.freedesktop.org/patch/msgid/c8d28007edf50de4387e1532eb3eb736db716f73.1605169912.git.yepeilin.cs@gmail.com
+Cc: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/misc/sisusbvga/sisusb_con.c |    6 ------
+ drivers/video/console/dummycon.c        |    6 ------
+ drivers/video/fbdev/core/fbcon.c        |   11 -----------
+ include/linux/console.h                 |    1 -
+ include/uapi/linux/kd.h                 |    2 +-
+ 5 files changed, 1 insertion(+), 25 deletions(-)
+
+--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
++++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
+@@ -1358,11 +1358,6 @@ static int sisusbdummycon_font_default(s
+       return 0;
+ }
+-static int sisusbdummycon_font_copy(struct vc_data *vc, int con)
+-{
+-      return 0;
+-}
+-
+ static const struct consw sisusb_dummy_con = {
+       .owner =                THIS_MODULE,
+       .con_startup =          sisusbdummycon_startup,
+@@ -1377,7 +1372,6 @@ static const struct consw sisusb_dummy_c
+       .con_blank =            sisusbdummycon_blank,
+       .con_font_set =         sisusbdummycon_font_set,
+       .con_font_default =     sisusbdummycon_font_default,
+-      .con_font_copy =        sisusbdummycon_font_copy,
+ };
+ int
+--- a/drivers/video/console/dummycon.c
++++ b/drivers/video/console/dummycon.c
+@@ -136,11 +136,6 @@ static int dummycon_font_default(struct
+       return 0;
+ }
+-static int dummycon_font_copy(struct vc_data *vc, int con)
+-{
+-      return 0;
+-}
+-
+ /*
+  *  The console `switch' structure for the dummy console
+  *
+@@ -161,6 +156,5 @@ const struct consw dummy_con = {
+       .con_blank =    dummycon_blank,
+       .con_font_set = dummycon_font_set,
+       .con_font_default =     dummycon_font_default,
+-      .con_font_copy =        dummycon_font_copy,
+ };
+ EXPORT_SYMBOL_GPL(dummy_con);
+--- a/drivers/video/fbdev/core/fbcon.c
++++ b/drivers/video/fbdev/core/fbcon.c
+@@ -2471,16 +2471,6 @@ static int fbcon_do_set_font(struct vc_d
+       return 0;
+ }
+-static int fbcon_copy_font(struct vc_data *vc, int con)
+-{
+-      struct fbcon_display *od = &fb_display[con];
+-      struct console_font *f = &vc->vc_font;
+-
+-      if (od->fontdata == f->data)
+-              return 0;       /* already the same font... */
+-      return fbcon_do_set_font(vc, f->width, f->height, od->fontdata, od->userfont);
+-}
+-
+ /*
+  *  User asked to set font; we are guaranteed that
+  *    a) width and height are in range 1..32
+@@ -3174,7 +3164,6 @@ static const struct consw fb_con = {
+       .con_font_set           = fbcon_set_font,
+       .con_font_get           = fbcon_get_font,
+       .con_font_default       = fbcon_set_def_font,
+-      .con_font_copy          = fbcon_copy_font,
+       .con_set_palette        = fbcon_set_palette,
+       .con_invert_region      = fbcon_invert_region,
+       .con_screen_pos         = fbcon_screen_pos,
+--- a/include/linux/console.h
++++ b/include/linux/console.h
+@@ -62,7 +62,6 @@ struct consw {
+       int     (*con_font_get)(struct vc_data *vc, struct console_font *font);
+       int     (*con_font_default)(struct vc_data *vc,
+                       struct console_font *font, char *name);
+-      int     (*con_font_copy)(struct vc_data *vc, int con);
+       int     (*con_resize)(struct vc_data *vc, unsigned int width,
+                       unsigned int height, unsigned int user);
+       void    (*con_set_palette)(struct vc_data *vc,
+--- a/include/uapi/linux/kd.h
++++ b/include/uapi/linux/kd.h
+@@ -173,7 +173,7 @@ struct console_font {
+ #define KD_FONT_OP_SET                0       /* Set font */
+ #define KD_FONT_OP_GET                1       /* Get font */
+ #define KD_FONT_OP_SET_DEFAULT        2       /* Set font to default, data points to name / NULL */
+-#define KD_FONT_OP_COPY               3       /* Copy from another console */
++#define KD_FONT_OP_COPY               3       /* Obsolete, do not use */
+ #define KD_FONT_FLAG_DONT_RECALC      1       /* Don't recalculate hw charcell size [compat] */
diff --git a/queue-5.10/fbcon-avoid-using-fntcharcnt-and-hard-coded-built-in-font-charcount.patch b/queue-5.10/fbcon-avoid-using-fntcharcnt-and-hard-coded-built-in-font-charcount.patch
new file mode 100644 (file)
index 0000000..1e9934b
--- /dev/null
@@ -0,0 +1,312 @@
+From a1ac250a82a5e97db71f14101ff7468291a6aaef Mon Sep 17 00:00:00 2001
+From: Peilin Ye <yepeilin.cs@gmail.com>
+Date: Thu, 12 Nov 2020 07:15:22 -0500
+Subject: fbcon: Avoid using FNTCHARCNT() and hard-coded built-in font charcount
+
+From: Peilin Ye <yepeilin.cs@gmail.com>
+
+commit a1ac250a82a5e97db71f14101ff7468291a6aaef upstream.
+
+For user-provided fonts, the framebuffer layer is using a magic
+negative-indexing macro, FNTCHARCNT(), to keep track of their number of
+characters:
+
+       #define FNTCHARCNT(fd)  (((int *)(fd))[-3])
+
+For built-in fonts, it is using hard-coded values (256). This results in
+something like the following:
+
+               map.length = (ops->p->userfont) ?
+                       FNTCHARCNT(ops->p->fontdata) : 256;
+
+This is unsatisfactory. In fact, there is already a `charcount` field in
+our virtual console descriptor (see `struct console_font` inside `struct
+vc_data`), let us use it:
+
+               map.length = vc->vc_font.charcount;
+
+Recently we added a `charcount` field to `struct font_desc`. Use it to set
+`vc->vc_font.charcount` properly. The idea is:
+
+  - We only use FNTCHARCNT() on `vc->vc_font.data` and `p->fontdata`.
+    Assume FNTCHARCNT() is working as intended;
+  - Whenever `vc->vc_font.data` is set, also set `vc->vc_font.charcount`
+    properly;
+  - We can now replace `FNTCHARCNT(vc->vc_font.data)` with
+    `vc->vc_font.charcount`;
+  - Since `p->fontdata` always point to the same font data buffer with
+    `vc->vc_font.data`, we can also replace `FNTCHARCNT(p->fontdata)` with
+    `vc->vc_font.charcount`.
+
+In conclusion, set `vc->vc_font.charcount` properly in fbcon_startup(),
+fbcon_init(), fbcon_set_disp() and fbcon_do_set_font(), then replace
+FNTCHARCNT() with `vc->vc_font.charcount`. No more if-else between
+negative-indexing macros and hard-coded values.
+
+Do not include <linux/font.h> in fbcon_rotate.c and tileblit.c, since they
+no longer need it.
+
+Depends on patch "Fonts: Add charcount field to font_desc".
+
+Suggested-by: Daniel Vetter <daniel@ffwll.ch>
+Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: https://patchwork.freedesktop.org/patch/msgid/e460a5780e54e3022661d5f09555144583b4cc59.1605169912.git.yepeilin.cs@gmail.com
+Cc: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/video/fbdev/core/fbcon.c        |   57 +++++++++++---------------------
+ drivers/video/fbdev/core/fbcon_rotate.c |    3 -
+ drivers/video/fbdev/core/tileblit.c     |    4 --
+ 3 files changed, 23 insertions(+), 41 deletions(-)
+
+--- a/drivers/video/fbdev/core/fbcon.c
++++ b/drivers/video/fbdev/core/fbcon.c
+@@ -1006,7 +1006,7 @@ static const char *fbcon_startup(void)
+               vc->vc_font.width = font->width;
+               vc->vc_font.height = font->height;
+               vc->vc_font.data = (void *)(p->fontdata = font->data);
+-              vc->vc_font.charcount = 256; /* FIXME  Need to support more fonts */
++              vc->vc_font.charcount = font->charcount;
+       } else {
+               p->fontdata = vc->vc_font.data;
+       }
+@@ -1034,7 +1034,7 @@ static void fbcon_init(struct vc_data *v
+       struct vc_data **default_mode = vc->vc_display_fg;
+       struct vc_data *svc = *default_mode;
+       struct fbcon_display *t, *p = &fb_display[vc->vc_num];
+-      int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256;
++      int logo = 1, new_rows, new_cols, rows, cols;
+       int cap, ret;
+       if (WARN_ON(info_idx == -1))
+@@ -1070,6 +1070,7 @@ static void fbcon_init(struct vc_data *v
+                                                   fvc->vc_font.data);
+                       vc->vc_font.width = fvc->vc_font.width;
+                       vc->vc_font.height = fvc->vc_font.height;
++                      vc->vc_font.charcount = fvc->vc_font.charcount;
+                       p->userfont = t->userfont;
+                       if (p->userfont)
+@@ -1085,17 +1086,13 @@ static void fbcon_init(struct vc_data *v
+                       vc->vc_font.width = font->width;
+                       vc->vc_font.height = font->height;
+                       vc->vc_font.data = (void *)(p->fontdata = font->data);
+-                      vc->vc_font.charcount = 256; /* FIXME  Need to
+-                                                      support more fonts */
++                      vc->vc_font.charcount = font->charcount;
+               }
+       }
+-      if (p->userfont)
+-              charcnt = FNTCHARCNT(p->fontdata);
+-
+       vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
+       vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
+-      if (charcnt == 256) {
++      if (vc->vc_font.charcount == 256) {
+               vc->vc_hi_font_mask = 0;
+       } else {
+               vc->vc_hi_font_mask = 0x100;
+@@ -1367,7 +1364,7 @@ static void fbcon_set_disp(struct fb_inf
+       struct vc_data **default_mode, *vc;
+       struct vc_data *svc;
+       struct fbcon_ops *ops = info->fbcon_par;
+-      int rows, cols, charcnt = 256;
++      int rows, cols;
+       p = &fb_display[unit];
+@@ -1387,12 +1384,11 @@ static void fbcon_set_disp(struct fb_inf
+               vc->vc_font.data = (void *)(p->fontdata = t->fontdata);
+               vc->vc_font.width = (*default_mode)->vc_font.width;
+               vc->vc_font.height = (*default_mode)->vc_font.height;
++              vc->vc_font.charcount = (*default_mode)->vc_font.charcount;
+               p->userfont = t->userfont;
+               if (p->userfont)
+                       REFCOUNT(p->fontdata)++;
+       }
+-      if (p->userfont)
+-              charcnt = FNTCHARCNT(p->fontdata);
+       var->activate = FB_ACTIVATE_NOW;
+       info->var.activate = var->activate;
+@@ -1402,7 +1398,7 @@ static void fbcon_set_disp(struct fb_inf
+       ops->var = info->var;
+       vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
+       vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
+-      if (charcnt == 256) {
++      if (vc->vc_font.charcount == 256) {
+               vc->vc_hi_font_mask = 0;
+       } else {
+               vc->vc_hi_font_mask = 0x100;
+@@ -2047,7 +2043,7 @@ static int fbcon_resize(struct vc_data *
+                */
+               if (pitch <= 0)
+                       return -EINVAL;
+-              size = CALC_FONTSZ(vc->vc_font.height, pitch, FNTCHARCNT(vc->vc_font.data));
++              size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount);
+               if (size > FNTSIZE(vc->vc_font.data))
+                       return -EINVAL;
+       }
+@@ -2095,7 +2091,7 @@ static int fbcon_switch(struct vc_data *
+       struct fbcon_ops *ops;
+       struct fbcon_display *p = &fb_display[vc->vc_num];
+       struct fb_var_screeninfo var;
+-      int i, ret, prev_console, charcnt = 256;
++      int i, ret, prev_console;
+       info = registered_fb[con2fb_map[vc->vc_num]];
+       ops = info->fbcon_par;
+@@ -2172,10 +2168,7 @@ static int fbcon_switch(struct vc_data *
+       vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
+       vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
+-      if (p->userfont)
+-              charcnt = FNTCHARCNT(vc->vc_font.data);
+-
+-      if (charcnt > 256)
++      if (vc->vc_font.charcount > 256)
+               vc->vc_complement_mask <<= 1;
+       updatescrollmode(p, info, vc);
+@@ -2425,31 +2418,27 @@ static void set_vc_hi_font(struct vc_dat
+       }
+ }
+-static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
++static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,
+                            const u8 * data, int userfont)
+ {
+       struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
+       struct fbcon_ops *ops = info->fbcon_par;
+       struct fbcon_display *p = &fb_display[vc->vc_num];
+       int resize;
+-      int cnt;
+       char *old_data = NULL;
+       resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
+       if (p->userfont)
+               old_data = vc->vc_font.data;
+-      if (userfont)
+-              cnt = FNTCHARCNT(data);
+-      else
+-              cnt = 256;
+       vc->vc_font.data = (void *)(p->fontdata = data);
+       if ((p->userfont = userfont))
+               REFCOUNT(data)++;
+       vc->vc_font.width = w;
+       vc->vc_font.height = h;
+-      if (vc->vc_hi_font_mask && cnt == 256)
++      vc->vc_font.charcount = charcount;
++      if (vc->vc_hi_font_mask && charcount == 256)
+               set_vc_hi_font(vc, false);
+-      else if (!vc->vc_hi_font_mask && cnt == 512)
++      else if (!vc->vc_hi_font_mask && charcount == 512)
+               set_vc_hi_font(vc, true);
+       if (resize) {
+@@ -2531,9 +2520,10 @@ static int fbcon_set_font(struct vc_data
+       if (!new_data)
+               return -ENOMEM;
++      memset(new_data, 0, FONT_EXTRA_WORDS * sizeof(int));
++
+       new_data += FONT_EXTRA_WORDS * sizeof(int);
+       FNTSIZE(new_data) = size;
+-      FNTCHARCNT(new_data) = charcount;
+       REFCOUNT(new_data) = 0; /* usage counter */
+       for (i=0; i< charcount; i++) {
+               memcpy(new_data + i*h*pitch, data +  i*32*pitch, h*pitch);
+@@ -2559,7 +2549,7 @@ static int fbcon_set_font(struct vc_data
+                       break;
+               }
+       }
+-      return fbcon_do_set_font(vc, font->width, font->height, new_data, 1);
++      return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1);
+ }
+ static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, char *name)
+@@ -2575,7 +2565,7 @@ static int fbcon_set_def_font(struct vc_
+       font->width = f->width;
+       font->height = f->height;
+-      return fbcon_do_set_font(vc, f->width, f->height, f->data, 0);
++      return fbcon_do_set_font(vc, f->width, f->height, f->charcount, f->data, 0);
+ }
+ static u16 palette_red[16];
+@@ -3072,7 +3062,6 @@ void fbcon_get_requirement(struct fb_inf
+                          struct fb_blit_caps *caps)
+ {
+       struct vc_data *vc;
+-      struct fbcon_display *p;
+       if (caps->flags) {
+               int i, charcnt;
+@@ -3081,11 +3070,9 @@ void fbcon_get_requirement(struct fb_inf
+                       vc = vc_cons[i].d;
+                       if (vc && vc->vc_mode == KD_TEXT &&
+                           info->node == con2fb_map[i]) {
+-                              p = &fb_display[i];
+                               caps->x |= 1 << (vc->vc_font.width - 1);
+                               caps->y |= 1 << (vc->vc_font.height - 1);
+-                              charcnt = (p->userfont) ?
+-                                      FNTCHARCNT(p->fontdata) : 256;
++                              charcnt = vc->vc_font.charcount;
+                               if (caps->len < charcnt)
+                                       caps->len = charcnt;
+                       }
+@@ -3095,11 +3082,9 @@ void fbcon_get_requirement(struct fb_inf
+               if (vc && vc->vc_mode == KD_TEXT &&
+                   info->node == con2fb_map[fg_console]) {
+-                      p = &fb_display[fg_console];
+                       caps->x = 1 << (vc->vc_font.width - 1);
+                       caps->y = 1 << (vc->vc_font.height - 1);
+-                      caps->len = (p->userfont) ?
+-                              FNTCHARCNT(p->fontdata) : 256;
++                      caps->len = vc->vc_font.charcount;
+               }
+       }
+ }
+--- a/drivers/video/fbdev/core/fbcon_rotate.c
++++ b/drivers/video/fbdev/core/fbcon_rotate.c
+@@ -14,7 +14,6 @@
+ #include <linux/fb.h>
+ #include <linux/vt_kern.h>
+ #include <linux/console.h>
+-#include <linux/font.h>
+ #include <asm/types.h>
+ #include "fbcon.h"
+ #include "fbcon_rotate.h"
+@@ -33,7 +32,7 @@ static int fbcon_rotate_font(struct fb_i
+       src = ops->fontdata = vc->vc_font.data;
+       ops->cur_rotate = ops->p->con_rotate;
+-      len = (!ops->p->userfont) ? 256 : FNTCHARCNT(src);
++      len = vc->vc_font.charcount;
+       s_cellsize = ((vc->vc_font.width + 7)/8) *
+               vc->vc_font.height;
+       d_cellsize = s_cellsize;
+--- a/drivers/video/fbdev/core/tileblit.c
++++ b/drivers/video/fbdev/core/tileblit.c
+@@ -13,7 +13,6 @@
+ #include <linux/fb.h>
+ #include <linux/vt_kern.h>
+ #include <linux/console.h>
+-#include <linux/font.h>
+ #include <asm/types.h>
+ #include "fbcon.h"
+@@ -178,8 +177,7 @@ void fbcon_set_tileops(struct vc_data *v
+               map.width = vc->vc_font.width;
+               map.height = vc->vc_font.height;
+               map.depth = 1;
+-              map.length = (ops->p->userfont) ?
+-                      FNTCHARCNT(ops->p->fontdata) : 256;
++              map.length = vc->vc_font.charcount;
+               map.data = ops->p->fontdata;
+               info->tileops->fb_settile(info, &map);
+       }
diff --git a/queue-5.10/fonts-add-charcount-field-to-font_desc.patch b/queue-5.10/fonts-add-charcount-field-to-font_desc.patch
new file mode 100644 (file)
index 0000000..74e51bc
--- /dev/null
@@ -0,0 +1,177 @@
+From 4ee573086bd88ff3060dda07873bf755d332e9ba Mon Sep 17 00:00:00 2001
+From: Peilin Ye <yepeilin.cs@gmail.com>
+Date: Thu, 12 Nov 2020 07:13:34 -0500
+Subject: Fonts: Add charcount field to font_desc
+
+From: Peilin Ye <yepeilin.cs@gmail.com>
+
+commit 4ee573086bd88ff3060dda07873bf755d332e9ba upstream.
+
+Subsystems are hard-coding the number of characters of our built-in fonts
+as 256. Include that information in our kernel font descriptor, `struct
+font_desc`.
+
+Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
+Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: https://patchwork.freedesktop.org/patch/msgid/65952296d1d9486093bd955d1536f7dcd11112c6.1605169912.git.yepeilin.cs@gmail.com
+Cc: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/font.h       |    1 +
+ lib/fonts/font_10x18.c     |    1 +
+ lib/fonts/font_6x10.c      |    1 +
+ lib/fonts/font_6x11.c      |    1 +
+ lib/fonts/font_6x8.c       |    1 +
+ lib/fonts/font_7x14.c      |    1 +
+ lib/fonts/font_8x16.c      |    1 +
+ lib/fonts/font_8x8.c       |    1 +
+ lib/fonts/font_acorn_8x8.c |    1 +
+ lib/fonts/font_mini_4x6.c  |    1 +
+ lib/fonts/font_pearl_8x8.c |    1 +
+ lib/fonts/font_sun12x22.c  |    1 +
+ lib/fonts/font_sun8x16.c   |    1 +
+ lib/fonts/font_ter16x32.c  |    1 +
+ 14 files changed, 14 insertions(+)
+
+--- a/include/linux/font.h
++++ b/include/linux/font.h
+@@ -17,6 +17,7 @@ struct font_desc {
+     int idx;
+     const char *name;
+     unsigned int width, height;
++    unsigned int charcount;
+     const void *data;
+     int pref;
+ };
+--- a/lib/fonts/font_10x18.c
++++ b/lib/fonts/font_10x18.c
+@@ -5137,6 +5137,7 @@ const struct font_desc font_10x18 = {
+       .name   = "10x18",
+       .width  = 10,
+       .height = 18,
++      .charcount = 256,
+       .data   = fontdata_10x18.data,
+ #ifdef __sparc__
+       .pref   = 5,
+--- a/lib/fonts/font_6x10.c
++++ b/lib/fonts/font_6x10.c
+@@ -3083,6 +3083,7 @@ const struct font_desc font_6x10 = {
+       .name   = "6x10",
+       .width  = 6,
+       .height = 10,
++      .charcount = 256,
+       .data   = fontdata_6x10.data,
+       .pref   = 0,
+ };
+--- a/lib/fonts/font_6x11.c
++++ b/lib/fonts/font_6x11.c
+@@ -3346,6 +3346,7 @@ const struct font_desc font_vga_6x11 = {
+       .name   = "ProFont6x11",
+       .width  = 6,
+       .height = 11,
++      .charcount = 256,
+       .data   = fontdata_6x11.data,
+       /* Try avoiding this font if possible unless on MAC */
+       .pref   = -2000,
+--- a/lib/fonts/font_6x8.c
++++ b/lib/fonts/font_6x8.c
+@@ -2571,6 +2571,7 @@ const struct font_desc font_6x8 = {
+       .name   = "6x8",
+       .width  = 6,
+       .height = 8,
++      .charcount = 256,
+       .data   = fontdata_6x8.data,
+       .pref   = 0,
+ };
+--- a/lib/fonts/font_7x14.c
++++ b/lib/fonts/font_7x14.c
+@@ -4113,6 +4113,7 @@ const struct font_desc font_7x14 = {
+       .name   = "7x14",
+       .width  = 7,
+       .height = 14,
++      .charcount = 256,
+       .data   = fontdata_7x14.data,
+       .pref   = 0,
+ };
+--- a/lib/fonts/font_8x16.c
++++ b/lib/fonts/font_8x16.c
+@@ -4627,6 +4627,7 @@ const struct font_desc font_vga_8x16 = {
+       .name   = "VGA8x16",
+       .width  = 8,
+       .height = 16,
++      .charcount = 256,
+       .data   = fontdata_8x16.data,
+       .pref   = 0,
+ };
+--- a/lib/fonts/font_8x8.c
++++ b/lib/fonts/font_8x8.c
+@@ -2578,6 +2578,7 @@ const struct font_desc font_vga_8x8 = {
+       .name   = "VGA8x8",
+       .width  = 8,
+       .height = 8,
++      .charcount = 256,
+       .data   = fontdata_8x8.data,
+       .pref   = 0,
+ };
+--- a/lib/fonts/font_acorn_8x8.c
++++ b/lib/fonts/font_acorn_8x8.c
+@@ -270,6 +270,7 @@ const struct font_desc font_acorn_8x8 =
+       .name   = "Acorn8x8",
+       .width  = 8,
+       .height = 8,
++      .charcount = 256,
+       .data   = acorndata_8x8.data,
+ #ifdef CONFIG_ARCH_ACORN
+       .pref   = 20,
+--- a/lib/fonts/font_mini_4x6.c
++++ b/lib/fonts/font_mini_4x6.c
+@@ -2152,6 +2152,7 @@ const struct font_desc font_mini_4x6 = {
+       .name   = "MINI4x6",
+       .width  = 4,
+       .height = 6,
++      .charcount = 256,
+       .data   = fontdata_mini_4x6.data,
+       .pref   = 3,
+ };
+--- a/lib/fonts/font_pearl_8x8.c
++++ b/lib/fonts/font_pearl_8x8.c
+@@ -2582,6 +2582,7 @@ const struct font_desc font_pearl_8x8 =
+       .name   = "PEARL8x8",
+       .width  = 8,
+       .height = 8,
++      .charcount = 256,
+       .data   = fontdata_pearl8x8.data,
+       .pref   = 2,
+ };
+--- a/lib/fonts/font_sun12x22.c
++++ b/lib/fonts/font_sun12x22.c
+@@ -6156,6 +6156,7 @@ const struct font_desc font_sun_12x22 =
+       .name   = "SUN12x22",
+       .width  = 12,
+       .height = 22,
++      .charcount = 256,
+       .data   = fontdata_sun12x22.data,
+ #ifdef __sparc__
+       .pref   = 5,
+--- a/lib/fonts/font_sun8x16.c
++++ b/lib/fonts/font_sun8x16.c
+@@ -268,6 +268,7 @@ const struct font_desc font_sun_8x16 = {
+       .name   = "SUN8x16",
+       .width  = 8,
+       .height = 16,
++      .charcount = 256,
+       .data   = fontdata_sun8x16.data,
+ #ifdef __sparc__
+       .pref   = 10,
+--- a/lib/fonts/font_ter16x32.c
++++ b/lib/fonts/font_ter16x32.c
+@@ -2062,6 +2062,7 @@ const struct font_desc font_ter_16x32 =
+       .name   = "TER16x32",
+       .width  = 16,
+       .height = 32,
++      .charcount = 256,
+       .data   = fontdata_ter16x32.data,
+ #ifdef __sparc__
+       .pref   = 5,
diff --git a/queue-5.10/parisc-sticore-avoid-hard-coding-built-in-font-charcount.patch b/queue-5.10/parisc-sticore-avoid-hard-coding-built-in-font-charcount.patch
new file mode 100644 (file)
index 0000000..2f657e8
--- /dev/null
@@ -0,0 +1,65 @@
+From 4497364e5f61f9e8d4a6252bc6deb9597d68bbac Mon Sep 17 00:00:00 2001
+From: Peilin Ye <yepeilin.cs@gmail.com>
+Date: Thu, 12 Nov 2020 07:14:21 -0500
+Subject: parisc/sticore: Avoid hard-coding built-in font charcount
+
+From: Peilin Ye <yepeilin.cs@gmail.com>
+
+commit 4497364e5f61f9e8d4a6252bc6deb9597d68bbac upstream.
+
+sti_select_fbfont() and sti_cook_fonts() are hard-coding the number of
+characters of our built-in fonts as 256. Recently, we included that
+information in our kernel font descriptor `struct font_desc`, so use
+`fbfont->charcount` instead of hard-coded values.
+
+Depends on patch "Fonts: Add charcount field to font_desc".
+
+Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
+Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: https://patchwork.freedesktop.org/patch/msgid/037186fb50cf3d17bb7bc9482357635b9df6076e.1605169912.git.yepeilin.cs@gmail.com
+Cc: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/video/console/sticore.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/video/console/sticore.c
++++ b/drivers/video/console/sticore.c
+@@ -507,7 +507,7 @@ sti_select_fbfont(struct sti_cooked_rom
+                       fbfont->width, fbfont->height, fbfont->name);
+                       
+       bpc = ((fbfont->width+7)/8) * fbfont->height; 
+-      size = bpc * 256;
++      size = bpc * fbfont->charcount;
+       size += sizeof(struct sti_rom_font);
+       nf = kzalloc(size, STI_LOWMEM);
+@@ -515,7 +515,7 @@ sti_select_fbfont(struct sti_cooked_rom
+               return NULL;
+       nf->first_char = 0;
+-      nf->last_char = 255;
++      nf->last_char = fbfont->charcount - 1;
+       nf->width = fbfont->width;
+       nf->height = fbfont->height;
+       nf->font_type = STI_FONT_HPROMAN8;
+@@ -526,7 +526,7 @@ sti_select_fbfont(struct sti_cooked_rom
+       dest = nf;
+       dest += sizeof(struct sti_rom_font);
+-      memcpy(dest, fbfont->data, bpc*256);
++      memcpy(dest, fbfont->data, bpc * fbfont->charcount);
+       cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
+       if (!cooked_font) {
+@@ -661,7 +661,7 @@ static int sti_cook_fonts(struct sti_coo
+ void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f)
+ {
+       unsigned char *n, *p, *q;
+-      int size = f->raw->bytes_per_char * 256 + sizeof(struct sti_rom_font);
++      int size = f->raw->bytes_per_char * (f->raw->last_char + 1) + sizeof(struct sti_rom_font);
+       struct sti_rom_font *old_font;
+       if (sti->wordmode)
index e77a075235e009149573bf7060e399ba62752517..b8b50f167be02c1fec342160bbfe6d0617ffb975 100644 (file)
@@ -336,3 +336,9 @@ net-macb-relocate-mog_init_rings-callback-from-macb_mac_link_up-to-macb_open.pat
 drm-msm-a6xx-fix-out-of-bound-io-access-in-a6xx_get_gmu_registers.patch
 drm-nouveau-dispnv50-don-t-call-drm_atomic_get_crtc_state-in-prepare_fb.patch
 rdma-core-fix-kasan-slab-use-after-free-read-in-ib_register_device-problem.patch
+virtio_console-fix-order-of-fields-cols-and-rows.patch
+console-delete-unused-con_font_copy-callback-implementations.patch
+console-delete-dummy-con_font_set-and-con_font_default-callback-implementations.patch
+fonts-add-charcount-field-to-font_desc.patch
+parisc-sticore-avoid-hard-coding-built-in-font-charcount.patch
+fbcon-avoid-using-fntcharcnt-and-hard-coded-built-in-font-charcount.patch
diff --git a/queue-5.10/virtio_console-fix-order-of-fields-cols-and-rows.patch b/queue-5.10/virtio_console-fix-order-of-fields-cols-and-rows.patch
new file mode 100644 (file)
index 0000000..fdbeef3
--- /dev/null
@@ -0,0 +1,36 @@
+From 5326ab737a47278dbd16ed3ee7380b26c7056ddd Mon Sep 17 00:00:00 2001
+From: Maximilian Immanuel Brandtner <maxbr@linux.ibm.com>
+Date: Mon, 24 Mar 2025 15:42:46 +0100
+Subject: virtio_console: fix order of fields cols and rows
+
+From: Maximilian Immanuel Brandtner <maxbr@linux.ibm.com>
+
+commit 5326ab737a47278dbd16ed3ee7380b26c7056ddd upstream.
+
+According to section 5.3.6.2 (Multiport Device Operation) of the virtio
+spec(version 1.2) a control buffer with the event VIRTIO_CONSOLE_RESIZE
+is followed by a virtio_console_resize struct containing cols then rows.
+The kernel implements this the wrong way around (rows then cols) resulting
+in the two values being swapped.
+
+Signed-off-by: Maximilian Immanuel Brandtner <maxbr@linux.ibm.com>
+Message-Id: <20250324144300.905535-1-maxbr@linux.ibm.com>
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Cc: Filip Hejsek <filip.hejsek@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/char/virtio_console.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/char/virtio_console.c
++++ b/drivers/char/virtio_console.c
+@@ -1617,8 +1617,8 @@ static void handle_control_message(struc
+               break;
+       case VIRTIO_CONSOLE_RESIZE: {
+               struct {
+-                      __virtio16 rows;
+                       __virtio16 cols;
++                      __virtio16 rows;
+               } size;
+               if (!is_console_port(port))