Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8fd4bd22 authored by Jesse Barnes's avatar Jesse Barnes Committed by Greg Kroah-Hartman
Browse files

vt/console: try harder to print output when panicing



Jesse's initial patch commit said:

"At panic time (i.e.  when oops_in_progress is set) we should try a bit
harder to update the screen and make sure output gets to the VT, since
some drivers are capable of flipping back to it.

So make sure we try to unblank and update the display if called from a
panic context."

I've enhanced this to add a flag to the vc that console layer can set to
indicate they want this behaviour to occur.  This also adds support to
fbcon for that flag and adds an fb flag for drivers to indicate they want
to use the support.  It enables this for KMS drivers.

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: default avatarJames Simmons <jsimmons@infradead.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 26df6d13
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -705,7 +705,10 @@ void redraw_screen(struct vc_data *vc, int is_switch)
			update_attr(vc);
			update_attr(vc);
			clear_buffer_attributes(vc);
			clear_buffer_attributes(vc);
		}
		}
		if (update && vc->vc_mode != KD_GRAPHICS)

		/* Forcibly update if we're panicing */
		if ((update && vc->vc_mode != KD_GRAPHICS) ||
		    vt_force_oops_output(vc))
			do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2);
			do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2);
	}
	}
	set_cursor(vc);
	set_cursor(vc);
@@ -743,6 +746,7 @@ static void visual_init(struct vc_data *vc, int num, int init)
	vc->vc_hi_font_mask = 0;
	vc->vc_hi_font_mask = 0;
	vc->vc_complement_mask = 0;
	vc->vc_complement_mask = 0;
	vc->vc_can_do_color = 0;
	vc->vc_can_do_color = 0;
	vc->vc_panic_force_write = false;
	vc->vc_sw->con_init(vc, init);
	vc->vc_sw->con_init(vc, init);
	if (!vc->vc_complement_mask)
	if (!vc->vc_complement_mask)
		vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
		vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
@@ -2506,7 +2510,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
		goto quit;
		goto quit;
	}
	}


	if (vc->vc_mode != KD_TEXT)
	if (vc->vc_mode != KD_TEXT && !vt_force_oops_output(vc))
		goto quit;
		goto quit;


	/* undraw cursor first */
	/* undraw cursor first */
@@ -3784,7 +3788,8 @@ void do_unblank_screen(int leaving_gfx)
		return;
		return;
	}
	}
	vc = vc_cons[fg_console].d;
	vc = vc_cons[fg_console].d;
	if (vc->vc_mode != KD_TEXT)
	/* Try to unblank in oops case too */
	if (vc->vc_mode != KD_TEXT && !vt_force_oops_output(vc))
		return; /* but leave console_blanked != 0 */
		return; /* but leave console_blanked != 0 */


	if (blankinterval) {
	if (blankinterval) {
@@ -3793,7 +3798,7 @@ void do_unblank_screen(int leaving_gfx)
	}
	}


	console_blanked = 0;
	console_blanked = 0;
	if (vc->vc_sw->con_blank(vc, 0, leaving_gfx))
	if (vc->vc_sw->con_blank(vc, 0, leaving_gfx) || vt_force_oops_output(vc))
		/* Low-level driver cannot restore -> do it ourselves */
		/* Low-level driver cannot restore -> do it ourselves */
		update_screen(vc);
		update_screen(vc);
	if (console_blank_hook)
	if (console_blank_hook)
+1 −3
Original line number Original line Diff line number Diff line
@@ -130,7 +130,7 @@ static int intelfb_create(struct intel_fbdev *ifbdev,


	strcpy(info->fix.id, "inteldrmfb");
	strcpy(info->fix.id, "inteldrmfb");


	info->flags = FBINFO_DEFAULT;
	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
	info->fbops = &intelfb_ops;
	info->fbops = &intelfb_ops;


	/* setup aperture base/size for vesafb takeover */
	/* setup aperture base/size for vesafb takeover */
@@ -148,8 +148,6 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
	info->fix.smem_start = dev->mode_config.fb_base + obj_priv->gtt_offset;
	info->fix.smem_start = dev->mode_config.fb_base + obj_priv->gtt_offset;
	info->fix.smem_len = size;
	info->fix.smem_len = size;


	info->flags = FBINFO_DEFAULT;

	info->screen_base = ioremap_wc(dev->agp->base + obj_priv->gtt_offset,
	info->screen_base = ioremap_wc(dev->agp->base + obj_priv->gtt_offset,
				       size);
				       size);
	if (!info->screen_base) {
	if (!info->screen_base) {
+1 −0
Original line number Original line Diff line number Diff line
@@ -250,6 +250,7 @@ nouveau_fbcon_create(struct nouveau_fbdev *nfbdev,
		info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
		info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
			      FBINFO_HWACCEL_FILLRECT |
			      FBINFO_HWACCEL_FILLRECT |
			      FBINFO_HWACCEL_IMAGEBLIT;
			      FBINFO_HWACCEL_IMAGEBLIT;
	info->flags |= FBINFO_CAN_FORCE_OUTPUT;
	info->fbops = &nouveau_fbcon_ops;
	info->fbops = &nouveau_fbcon_ops;
	info->fix.smem_start = dev->mode_config.fb_base + nvbo->bo.offset -
	info->fix.smem_start = dev->mode_config.fb_base + nvbo->bo.offset -
			       dev_priv->vm_vram_base;
			       dev_priv->vm_vram_base;
+1 −1
Original line number Original line Diff line number Diff line
@@ -224,7 +224,7 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev,


	drm_fb_helper_fill_fix(info, fb->pitch, fb->depth);
	drm_fb_helper_fill_fix(info, fb->pitch, fb->depth);


	info->flags = FBINFO_DEFAULT;
	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
	info->fbops = &radeonfb_ops;
	info->fbops = &radeonfb_ops;


	tmp = radeon_bo_gpu_offset(rbo) - rdev->mc.vram_start;
	tmp = radeon_bo_gpu_offset(rbo) - rdev->mc.vram_start;
+3 −1
Original line number Original line Diff line number Diff line
@@ -283,7 +283,8 @@ static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
	struct fbcon_ops *ops = info->fbcon_par;
	struct fbcon_ops *ops = info->fbcon_par;


	return (info->state != FBINFO_STATE_RUNNING ||
	return (info->state != FBINFO_STATE_RUNNING ||
		vc->vc_mode != KD_TEXT || ops->graphics);
		vc->vc_mode != KD_TEXT || ops->graphics) &&
		!vt_force_oops_output(vc);
}
}


static inline int get_color(struct vc_data *vc, struct fb_info *info,
static inline int get_color(struct vc_data *vc, struct fb_info *info,
@@ -1073,6 +1074,7 @@ static void fbcon_init(struct vc_data *vc, int init)
	if (p->userfont)
	if (p->userfont)
		charcnt = FNTCHARCNT(p->fontdata);
		charcnt = FNTCHARCNT(p->fontdata);


	vc->vc_panic_force_write = !!(info->flags & FBINFO_CAN_FORCE_OUTPUT);
	vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
	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;
	vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
	if (charcnt == 256) {
	if (charcnt == 256) {
Loading