Skip to content

Commit 5661b45

Browse files
committed
Merge: drivers/video rebase (fbcon/fbdev) from v6.14
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6794 This update the drivers/video subsystem to v6.14. Focusing on fbcon/efifb changes JIRA: https://issues.redhat.com/browse/RHEL-75953 Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com> Approved-by: Robert Foss <rfoss@kernel.org> Approved-by: Mika Penttilä <mpenttil@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Jan Stancek <jstancek@redhat.com>
2 parents 808c350 + 7fd84e5 commit 5661b45

File tree

5 files changed

+93
-31
lines changed

5 files changed

+93
-31
lines changed

drivers/video/fbdev/core/fbcon.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
#include <linux/console.h>
6565
#include <linux/string.h>
6666
#include <linux/kd.h>
67+
#include <linux/panic.h>
68+
#include <linux/printk.h>
6769
#include <linux/slab.h>
6870
#include <linux/fb.h>
6971
#include <linux/fbcon.h>
@@ -270,12 +272,24 @@ static int fbcon_get_rotate(struct fb_info *info)
270272
return (ops) ? ops->rotate : 0;
271273
}
272274

275+
static bool fbcon_skip_panic(struct fb_info *info)
276+
{
277+
/* panic_cpu is not exported, and can't be used if built as module. Use
278+
* oops_in_progress instead, but non-fatal oops won't be printed.
279+
*/
280+
#if defined(MODULE)
281+
return (info->skip_panic && unlikely(oops_in_progress));
282+
#else
283+
return (info->skip_panic && unlikely(atomic_read(&panic_cpu) != PANIC_CPU_INVALID));
284+
#endif
285+
}
286+
273287
static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
274288
{
275289
struct fbcon_ops *ops = info->fbcon_par;
276290

277291
return (info->state != FBINFO_STATE_RUNNING ||
278-
vc->vc_mode != KD_TEXT || ops->graphics);
292+
vc->vc_mode != KD_TEXT || ops->graphics || fbcon_skip_panic(info));
279293
}
280294

281295
static int get_color(struct vc_data *vc, struct fb_info *info,
@@ -847,6 +861,8 @@ static int set_con2fb_map(int unit, int newidx, int user)
847861
return err;
848862

849863
fbcon_add_cursor_work(info);
864+
} else if (vc) {
865+
set_blitting_type(vc, info);
850866
}
851867

852868
con2fb_map[unit] = newidx;

drivers/video/fbdev/core/fbmem.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,36 @@ unregister_framebuffer(struct fb_info *fb_info)
544544
}
545545
EXPORT_SYMBOL(unregister_framebuffer);
546546

547+
static void devm_unregister_framebuffer(void *data)
548+
{
549+
struct fb_info *info = data;
550+
551+
unregister_framebuffer(info);
552+
}
553+
554+
/**
555+
* devm_register_framebuffer - resource-managed frame buffer device registration
556+
* @dev: device the framebuffer belongs to
557+
* @fb_info: frame buffer info structure
558+
*
559+
* Registers a frame buffer device @fb_info to device @dev.
560+
*
561+
* Returns negative errno on error, or zero for success.
562+
*
563+
*/
564+
int
565+
devm_register_framebuffer(struct device *dev, struct fb_info *fb_info)
566+
{
567+
int ret;
568+
569+
ret = register_framebuffer(fb_info);
570+
if (ret)
571+
return ret;
572+
573+
return devm_add_action_or_reset(dev, devm_unregister_framebuffer, fb_info);
574+
}
575+
EXPORT_SYMBOL(devm_register_framebuffer);
576+
547577
/**
548578
* fb_set_suspend - low level driver signals suspend
549579
* @info: framebuffer affected

drivers/video/fbdev/efifb.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static const struct fb_ops efifb_ops = {
275275
.fb_setcolreg = efifb_setcolreg,
276276
};
277277

278-
static int efifb_setup(struct screen_info *si, char *options)
278+
static void efifb_setup(struct screen_info *si, char *options)
279279
{
280280
char *this_opt;
281281

@@ -299,8 +299,6 @@ static int efifb_setup(struct screen_info *si, char *options)
299299
use_bgrt = false;
300300
}
301301
}
302-
303-
return 0;
304302
}
305303

306304
static inline bool fb_base_is_valid(struct screen_info *si)
@@ -451,7 +449,6 @@ static int efifb_probe(struct platform_device *dev)
451449
err = -ENOMEM;
452450
goto err_release_mem;
453451
}
454-
platform_set_drvdata(dev, info);
455452
par = info->par;
456453
info->pseudo_palette = par->pseudo_palette;
457454

@@ -574,7 +571,7 @@ static int efifb_probe(struct platform_device *dev)
574571
pr_err("efifb: cannot acquire aperture\n");
575572
goto err_fb_dealloc_cmap;
576573
}
577-
err = register_framebuffer(info);
574+
err = devm_register_framebuffer(&dev->dev, info);
578575
if (err < 0) {
579576
pr_err("efifb: cannot register framebuffer\n");
580577
goto err_fb_dealloc_cmap;
@@ -597,21 +594,12 @@ static int efifb_probe(struct platform_device *dev)
597594
return err;
598595
}
599596

600-
static void efifb_remove(struct platform_device *pdev)
601-
{
602-
struct fb_info *info = platform_get_drvdata(pdev);
603-
604-
/* efifb_destroy takes care of info cleanup */
605-
unregister_framebuffer(info);
606-
}
607-
608597
static struct platform_driver efifb_driver = {
609598
.driver = {
610599
.name = "efi-framebuffer",
611600
.dev_groups = efifb_groups,
612601
},
613602
.probe = efifb_probe,
614-
.remove_new = efifb_remove,
615603
};
616604

617605
builtin_platform_driver(efifb_driver);

include/linux/fb.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ struct fb_info {
508508
void *par;
509509

510510
bool skip_vt_switch; /* no VT switch on suspend/resume required */
511+
bool skip_panic; /* Do not write to the fb after a panic */
511512
};
512513

513514
/* This will go away
@@ -599,6 +600,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
599600
/* fbmem.c */
600601
extern int register_framebuffer(struct fb_info *fb_info);
601602
extern void unregister_framebuffer(struct fb_info *fb_info);
603+
extern int devm_register_framebuffer(struct device *dev, struct fb_info *fb_info);
602604
extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
603605
extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
604606
u32 height, u32 shift_high, u32 shift_low, u32 mod);

include/video/vga.h

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,26 @@ struct vgastate {
197197
extern int save_vga(struct vgastate *state);
198198
extern int restore_vga(struct vgastate *state);
199199

200+
static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)
201+
{
202+
return readb (regbase + port);
203+
}
204+
205+
static inline void vga_mm_w (void __iomem *regbase, unsigned short port, unsigned char val)
206+
{
207+
writeb (val, regbase + port);
208+
}
209+
210+
static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port,
211+
unsigned char reg, unsigned char val)
212+
{
213+
writew (VGA_OUT16VAL (val, reg), regbase + port);
214+
}
215+
200216
/*
201217
* generic VGA port read/write
202218
*/
219+
#ifdef CONFIG_HAS_IOPORT
203220

204221
static inline unsigned char vga_io_r (unsigned short port)
205222
{
@@ -217,22 +234,6 @@ static inline void vga_io_w_fast (unsigned short port, unsigned char reg,
217234
outw(VGA_OUT16VAL (val, reg), port);
218235
}
219236

220-
static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)
221-
{
222-
return readb (regbase + port);
223-
}
224-
225-
static inline void vga_mm_w (void __iomem *regbase, unsigned short port, unsigned char val)
226-
{
227-
writeb (val, regbase + port);
228-
}
229-
230-
static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port,
231-
unsigned char reg, unsigned char val)
232-
{
233-
writew (VGA_OUT16VAL (val, reg), regbase + port);
234-
}
235-
236237
static inline unsigned char vga_r (void __iomem *regbase, unsigned short port)
237238
{
238239
if (regbase)
@@ -258,8 +259,25 @@ static inline void vga_w_fast (void __iomem *regbase, unsigned short port,
258259
else
259260
vga_io_w_fast (port, reg, val);
260261
}
262+
#else /* CONFIG_HAS_IOPORT */
263+
static inline unsigned char vga_r (void __iomem *regbase, unsigned short port)
264+
{
265+
return vga_mm_r (regbase, port);
266+
}
267+
268+
static inline void vga_w (void __iomem *regbase, unsigned short port, unsigned char val)
269+
{
270+
vga_mm_w (regbase, port, val);
271+
}
261272

262273

274+
static inline void vga_w_fast (void __iomem *regbase, unsigned short port,
275+
unsigned char reg, unsigned char val)
276+
{
277+
vga_mm_w_fast (regbase, port, reg, val);
278+
}
279+
#endif /* CONFIG_HAS_IOPORT */
280+
263281
/*
264282
* VGA CRTC register read/write
265283
*/
@@ -280,6 +298,7 @@ static inline void vga_wcrt (void __iomem *regbase, unsigned char reg, unsigned
280298
#endif /* VGA_OUTW_WRITE */
281299
}
282300

301+
#ifdef CONFIG_HAS_IOPORT
283302
static inline unsigned char vga_io_rcrt (unsigned char reg)
284303
{
285304
vga_io_w (VGA_CRT_IC, reg);
@@ -295,6 +314,7 @@ static inline void vga_io_wcrt (unsigned char reg, unsigned char val)
295314
vga_io_w (VGA_CRT_DC, val);
296315
#endif /* VGA_OUTW_WRITE */
297316
}
317+
#endif /* CONFIG_HAS_IOPORT */
298318

299319
static inline unsigned char vga_mm_rcrt (void __iomem *regbase, unsigned char reg)
300320
{
@@ -333,6 +353,7 @@ static inline void vga_wseq (void __iomem *regbase, unsigned char reg, unsigned
333353
#endif /* VGA_OUTW_WRITE */
334354
}
335355

356+
#ifdef CONFIG_HAS_IOPORT
336357
static inline unsigned char vga_io_rseq (unsigned char reg)
337358
{
338359
vga_io_w (VGA_SEQ_I, reg);
@@ -348,6 +369,7 @@ static inline void vga_io_wseq (unsigned char reg, unsigned char val)
348369
vga_io_w (VGA_SEQ_D, val);
349370
#endif /* VGA_OUTW_WRITE */
350371
}
372+
#endif /* CONFIG_HAS_IOPORT */
351373

352374
static inline unsigned char vga_mm_rseq (void __iomem *regbase, unsigned char reg)
353375
{
@@ -385,6 +407,7 @@ static inline void vga_wgfx (void __iomem *regbase, unsigned char reg, unsigned
385407
#endif /* VGA_OUTW_WRITE */
386408
}
387409

410+
#ifdef CONFIG_HAS_IOPORT
388411
static inline unsigned char vga_io_rgfx (unsigned char reg)
389412
{
390413
vga_io_w (VGA_GFX_I, reg);
@@ -400,6 +423,7 @@ static inline void vga_io_wgfx (unsigned char reg, unsigned char val)
400423
vga_io_w (VGA_GFX_D, val);
401424
#endif /* VGA_OUTW_WRITE */
402425
}
426+
#endif /* CONFIG_HAS_IOPORT */
403427

404428
static inline unsigned char vga_mm_rgfx (void __iomem *regbase, unsigned char reg)
405429
{
@@ -434,6 +458,7 @@ static inline void vga_wattr (void __iomem *regbase, unsigned char reg, unsigned
434458
vga_w (regbase, VGA_ATT_W, val);
435459
}
436460

461+
#ifdef CONFIG_HAS_IOPORT
437462
static inline unsigned char vga_io_rattr (unsigned char reg)
438463
{
439464
vga_io_w (VGA_ATT_IW, reg);
@@ -445,6 +470,7 @@ static inline void vga_io_wattr (unsigned char reg, unsigned char val)
445470
vga_io_w (VGA_ATT_IW, reg);
446471
vga_io_w (VGA_ATT_W, val);
447472
}
473+
#endif /* CONFIG_HAS_IOPORT */
448474

449475
static inline unsigned char vga_mm_rattr (void __iomem *regbase, unsigned char reg)
450476
{

0 commit comments

Comments
 (0)