NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/57035: On UEFI-booted NetBSD/amd64, genfb(4) freezes when WSDISPLAYIO_MODE_EMUL is set



>Number:         57035
>Category:       kern
>Synopsis:       On UEFI-booted NetBSD/amd64, genfb(4) freezes when WSDISPLAYIO_MODE_EMUL is set
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 29 14:35:00 +0000 2022
>Originator:     Ryo ONODERA
>Release:        NetBSD 9.99.100
>Organization:
Ryo ONODERA // ryo%tetera.org@localhost
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
>Environment:
	
	
System: NetBSD brownie 9.99.100 NetBSD 9.99.100 (DTRACE8) #8: Tue Sep 27 23:15:54 JST 2022 ryoon@brownie:/usr/world/9.99/amd64/obj/sys/arch/amd64/compile/DTRACE8 amd64
Architecture: x86_64
Machine: amd64
>Description:
On my Dell XPS 13 9300 (Intel Ice Lake internal GPU) and HP Envy 13-ay1052AU
laptops, genfb(4) freezes forever just after the following ioctl.

mode =  WSDISPLAYIO_MODE_EMUL;
ioctl(wd, WSDISPLAYIO_SMODE, &mode);

So xf86-video-wsfb from pkgsrc/x11/xf86-video-wsfb and mlterm-wscons from
pkgsrc/x11/mlterm cause blank screen after their exits.

Keyboard works fine even when screen is frozen.
You can reboot your machine with shutdown command.

The laptops have no BIOS/CSM boot mode. And I have no laptop with both of
BIOS/CSM and UEFI boots.

>How-To-Repeat:
Boot with genfb(4), for example 'disable i915drmkms' in kernel userconf is
specified, and run the following program. Your screen will get frozen.

=== === === === === === === === === === === === === === ===
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <string.h>
#include <dev/wscons/wsconsio.h>

#define WSDISPLAYDEV "/dev/ttyE0"

int
main(void)
{
        int mode;
        int wd;

        wd=open(WSDISPLAYDEV, O_RDWR);
        if(wd < 0)
        {
                printf("Cannot open wdsiaplay device: %s\n", strerror(errno));
        }
        mode =  WSDISPLAYIO_MODE_EMUL;
        if(ioctl(wd, WSDISPLAYIO_SMODE, &mode) == -1)
        {
                printf("Cannot change mode back to EMUL: %s\n", strerror(errno))
;
        }

        close(wd);
}
=== === === === === === === === === === === === === === ===

>Fix:
For my laptops, the following patch for genfb_pci.c fixes the problem.
However I have no idea how to detect whether current boot is BIOS/CMS or UEFI
in genfb_pci.c.

Index: sys/dev/pci/genfb_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/genfb_pci.c,v
retrieving revision 1.40
diff -u -r1.40 genfb_pci.c
--- sys/dev/pci/genfb_pci.c	7 Aug 2021 16:19:14 -0000	1.40
+++ sys/dev/pci/genfb_pci.c	27 Sep 2022 13:44:38 -0000
@@ -227,7 +227,9 @@
 		return wsdisplayio_busid_pci(sc->sc_gen.sc_dev, sc->sc_pc,
 		    sc->sc_pcitag, data);
 
-	case WSDISPLAYIO_SMODE: {
+	case WSDISPLAYIO_SMODE:
+#if 0
+		{
 		int new_mode = *(int*)data, i;
 		if (new_mode == WSDISPLAYIO_MODE_EMUL) {
 			for (i = 0; i < 9; i++)
@@ -237,6 +239,7 @@
 				     sc->sc_bars[i]);
 		}
 		}
+#endif
 		return 0;
 	}
 

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index