All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Clear isVGA flag if current fb driver is mimicking VGA
@ 2018-11-23  9:28 Kairui Song
  2018-12-04 12:10 ` Dave Young
  2019-05-31  9:29 ` Simon Horman
  0 siblings, 2 replies; 6+ messages in thread
From: Kairui Song @ 2018-11-23  9:28 UTC (permalink / raw)
  To: kexec; +Cc: horms, dyoung, Kairui Song

Some device (eg. hyperv_fb) will mimic EFI (or VESA) VGA on first boot
up, but after the real driver is loaded, it will switch to new mode
and no longer compatible with EFI/VESA VGA. Keep setting
orig_video_isVGA to EFI/VESA VGA flag will get wrong driver loaded and
try to manipulate the framebuffer in a wrong way.

As we have already take care of "VESA VGA" and "EFI VGA", just set the
orig_video_isVGA to 0 for any other driver reports as EFI/VESA VGA but
is not EFI/VESA VGA.

Signed-off-by: Kairui Song <kasong@redhat.com>
---
 kexec/arch/i386/x86-linux-setup.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index dc785a2..a129812 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -152,6 +152,11 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
 		err = get_bootparam(&real_mode->orig_video_isVGA, offset, 1);
 		if (err)
 			goto out;
+
+		if (real_mode->orig_video_isVGA == 0x70 || real_mode->orig_video_isVGA == 0x23) {
+			/* Clear isVGA flag for fb drivers that mimic EFI/VESA VGA */
+			real_mode->orig_video_isVGA = 0;
+		}
 	}
 	close(fd);
 
-- 
2.19.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: Clear isVGA flag if current fb driver is mimicking VGA
  2018-11-23  9:28 [PATCH] x86: Clear isVGA flag if current fb driver is mimicking VGA Kairui Song
@ 2018-12-04 12:10 ` Dave Young
  2018-12-05  7:58   ` Kairui Song
  2019-05-31  9:29 ` Simon Horman
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Young @ 2018-12-04 12:10 UTC (permalink / raw)
  To: Kairui Song; +Cc: horms, kexec

On 11/23/18 at 05:28pm, Kairui Song wrote:
> Some device (eg. hyperv_fb) will mimic EFI (or VESA) VGA on first boot
> up, but after the real driver is loaded, it will switch to new mode
> and no longer compatible with EFI/VESA VGA. Keep setting
> orig_video_isVGA to EFI/VESA VGA flag will get wrong driver loaded and
> try to manipulate the framebuffer in a wrong way.
> 
> As we have already take care of "VESA VGA" and "EFI VGA", just set the
> orig_video_isVGA to 0 for any other driver reports as EFI/VESA VGA but
> is not EFI/VESA VGA.
> 
> Signed-off-by: Kairui Song <kasong@redhat.com>
> ---
>  kexec/arch/i386/x86-linux-setup.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> index dc785a2..a129812 100644
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -152,6 +152,11 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
>  		err = get_bootparam(&real_mode->orig_video_isVGA, offset, 1);
>  		if (err)
>  			goto out;
> +
> +		if (real_mode->orig_video_isVGA == 0x70 || real_mode->orig_video_isVGA == 0x23) {
> +			/* Clear isVGA flag for fb drivers that mimic EFI/VESA VGA */
> +			real_mode->orig_video_isVGA = 0;
> +		}

The blindly reuse original isVGA might be a problem like you said, but
it does work for me for i915 laptop even if later drm driver loaded.
With your patch it does not work anymore.

kexec reboot with earlyprintk=efi without initramfs looks just hang, but
previously I can see all the kernel console logs.

Probably you can make real_mode->orig_video_isVGA = 0 as default in the
else {} section, and introduce an extra x86 only argument for people to
reuse isVGA blindly. eg.

kexec --reuse-vga-type

>  	}
>  	close(fd);
>  
> -- 
> 2.19.1
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

Thanks
Dave

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: Clear isVGA flag if current fb driver is mimicking VGA
  2018-12-04 12:10 ` Dave Young
@ 2018-12-05  7:58   ` Kairui Song
  0 siblings, 0 replies; 6+ messages in thread
From: Kairui Song @ 2018-12-05  7:58 UTC (permalink / raw)
  To: Dave Young; +Cc: horms, kexec

Thanks for the feedback!
This didn't happen with my laptop with i915, blindly using previous vga type
is not working for it, so didn't expect it would break some i915 devices.
I tried with my home laptop (also use i915) again and this patch did
break the previous working vga.
Will adopt your suggestion and update the patch.
On Tue, Dec 4, 2018 at 8:10 PM Dave Young <dyoung@redhat.com> wrote:
>
> On 11/23/18 at 05:28pm, Kairui Song wrote:
> > Some device (eg. hyperv_fb) will mimic EFI (or VESA) VGA on first boot
> > up, but after the real driver is loaded, it will switch to new mode
> > and no longer compatible with EFI/VESA VGA. Keep setting
> > orig_video_isVGA to EFI/VESA VGA flag will get wrong driver loaded and
> > try to manipulate the framebuffer in a wrong way.
> >
> > As we have already take care of "VESA VGA" and "EFI VGA", just set the
> > orig_video_isVGA to 0 for any other driver reports as EFI/VESA VGA but
> > is not EFI/VESA VGA.
> >
> > Signed-off-by: Kairui Song <kasong@redhat.com>
> > ---
> >  kexec/arch/i386/x86-linux-setup.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> > index dc785a2..a129812 100644
> > --- a/kexec/arch/i386/x86-linux-setup.c
> > +++ b/kexec/arch/i386/x86-linux-setup.c
> > @@ -152,6 +152,11 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
> >               err = get_bootparam(&real_mode->orig_video_isVGA, offset, 1);
> >               if (err)
> >                       goto out;
> > +
> > +             if (real_mode->orig_video_isVGA == 0x70 || real_mode->orig_video_isVGA == 0x23) {
> > +                     /* Clear isVGA flag for fb drivers that mimic EFI/VESA VGA */
> > +                     real_mode->orig_video_isVGA = 0;
> > +             }
>
> The blindly reuse original isVGA might be a problem like you said, but
> it does work for me for i915 laptop even if later drm driver loaded.
> With your patch it does not work anymore.
>
> kexec reboot with earlyprintk=efi without initramfs looks just hang, but
> previously I can see all the kernel console logs.
>
> Probably you can make real_mode->orig_video_isVGA = 0 as default in the
> else {} section, and introduce an extra x86 only argument for people to
> reuse isVGA blindly. eg.
>
> kexec --reuse-vga-type
>
> >       }
> >       close(fd);
> >
> > --
> > 2.19.1
> >
> >
> > _______________________________________________
> > kexec mailing list
> > kexec@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/kexec
>
> Thanks
> Dave



--
Best Regards,
Kairui Song

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: Clear isVGA flag if current fb driver is mimicking VGA
  2018-11-23  9:28 [PATCH] x86: Clear isVGA flag if current fb driver is mimicking VGA Kairui Song
  2018-12-04 12:10 ` Dave Young
@ 2019-05-31  9:29 ` Simon Horman
  2019-05-31  9:38   ` Kairui Song
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Horman @ 2019-05-31  9:29 UTC (permalink / raw)
  To: Kairui Song; +Cc: dyoung, kexec

On Fri, Nov 23, 2018 at 05:28:01PM +0800, Kairui Song wrote:
> Some device (eg. hyperv_fb) will mimic EFI (or VESA) VGA on first boot
> up, but after the real driver is loaded, it will switch to new mode
> and no longer compatible with EFI/VESA VGA. Keep setting
> orig_video_isVGA to EFI/VESA VGA flag will get wrong driver loaded and
> try to manipulate the framebuffer in a wrong way.
> 
> As we have already take care of "VESA VGA" and "EFI VGA", just set the
> orig_video_isVGA to 0 for any other driver reports as EFI/VESA VGA but
> is not EFI/VESA VGA.
> 
> Signed-off-by: Kairui Song <kasong@redhat.com>

Sorry for letting this slip through the cracks.
Please let me know if this is still relevant.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: Clear isVGA flag if current fb driver is mimicking VGA
  2019-05-31  9:29 ` Simon Horman
@ 2019-05-31  9:38   ` Kairui Song
  2019-06-04  9:20     ` Simon Horman
  0 siblings, 1 reply; 6+ messages in thread
From: Kairui Song @ 2019-05-31  9:38 UTC (permalink / raw)
  To: Simon Horman; +Cc: Dave Young, kexec

On Fri, May 31, 2019 at 5:29 PM Simon Horman <horms@verge.net.au> wrote:
>
> On Fri, Nov 23, 2018 at 05:28:01PM +0800, Kairui Song wrote:
> > Some device (eg. hyperv_fb) will mimic EFI (or VESA) VGA on first boot
> > up, but after the real driver is loaded, it will switch to new mode
> > and no longer compatible with EFI/VESA VGA. Keep setting
> > orig_video_isVGA to EFI/VESA VGA flag will get wrong driver loaded and
> > try to manipulate the framebuffer in a wrong way.
> >
> > As we have already take care of "VESA VGA" and "EFI VGA", just set the
> > orig_video_isVGA to 0 for any other driver reports as EFI/VESA VGA but
> > is not EFI/VESA VGA.
> >
> > Signed-off-by: Kairui Song <kasong@redhat.com>
>
> Sorry for letting this slip through the cracks.
> Please let me know if this is still relevant.

Hi Simon, after fb5a879 ("x86: Introduce a new option
--reuse-video-type") in kexec-tools, this patch is no longer needed.


--
Best Regards,
Kairui Song

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: Clear isVGA flag if current fb driver is mimicking VGA
  2019-05-31  9:38   ` Kairui Song
@ 2019-06-04  9:20     ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2019-06-04  9:20 UTC (permalink / raw)
  To: Kairui Song; +Cc: Dave Young, kexec

On Fri, May 31, 2019 at 05:38:25PM +0800, Kairui Song wrote:
> On Fri, May 31, 2019 at 5:29 PM Simon Horman <horms@verge.net.au> wrote:
> >
> > On Fri, Nov 23, 2018 at 05:28:01PM +0800, Kairui Song wrote:
> > > Some device (eg. hyperv_fb) will mimic EFI (or VESA) VGA on first boot
> > > up, but after the real driver is loaded, it will switch to new mode
> > > and no longer compatible with EFI/VESA VGA. Keep setting
> > > orig_video_isVGA to EFI/VESA VGA flag will get wrong driver loaded and
> > > try to manipulate the framebuffer in a wrong way.
> > >
> > > As we have already take care of "VESA VGA" and "EFI VGA", just set the
> > > orig_video_isVGA to 0 for any other driver reports as EFI/VESA VGA but
> > > is not EFI/VESA VGA.
> > >
> > > Signed-off-by: Kairui Song <kasong@redhat.com>
> >
> > Sorry for letting this slip through the cracks.
> > Please let me know if this is still relevant.
> 
> Hi Simon, after fb5a879 ("x86: Introduce a new option
> --reuse-video-type") in kexec-tools, this patch is no longer needed.

Hi Kairui,

thanks for the clarification.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-04  9:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-23  9:28 [PATCH] x86: Clear isVGA flag if current fb driver is mimicking VGA Kairui Song
2018-12-04 12:10 ` Dave Young
2018-12-05  7:58   ` Kairui Song
2019-05-31  9:29 ` Simon Horman
2019-05-31  9:38   ` Kairui Song
2019-06-04  9:20     ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.