WSL2-Linux-Kernel/drivers/gpu/drm/mgag200
Jocelyn Falempe 1d89cb2c72 mgag200 fix memmapsl configuration in GCTL6 register
commit 028a73e107 upstream.

On some servers with MGA G200_SE_A (rev 42), booting with Legacy BIOS,
the hardware hangs when using kdump and kexec into the kdump kernel.
This happens when the uncompress code tries to write "Decompressing Linux"
to the VGA Console.

It can be reproduced by writing to the VGA console (0xB8000) after
booting to graphic mode, it generates the following error:

kernel:NMI: PCI system error (SERR) for reason a0 on CPU 0.
kernel:Dazed and confused, but trying to continue

The root cause is the configuration of the MGA GCTL6 register

According to the GCTL6 register documentation:

bit 0 is gcgrmode:
    0: Enables alpha mode, and the character generator addressing system is
     activated.
    1: Enables graphics mode, and the character addressing system is not
     used.

bit 1 is chainodd even:
    0: The A0 signal of the memory address bus is used during system memory
     addressing.
    1: Allows A0 to be replaced by either the A16 signal of the system
     address (ifmemmapsl is ‘00’), or by the hpgoddev (MISC<5>, odd/even
     page select) field, described on page 3-294).

bit 3-2 are memmapsl:
    Memory map select bits 1 and 0. VGA.
    These bits select where the video memory is mapped, as shown below:
        00 => A0000h - BFFFFh
        01 => A0000h - AFFFFh
        10 => B0000h - B7FFFh
        11 => B8000h - BFFFFh

bit 7-4 are reserved.

Current code set it to 0x05 => memmapsl to b01 => 0xa0000 (graphic mode)
But on x86, the VGA console is at 0xb8000 (text mode)
In arch/x86/boot/compressed/misc.c debug strings are written to 0xb8000
As the driver doesn't use this mapping at 0xa0000, it is safe to set it to
0xb8000 instead, to avoid kernel hang on G200_SE_A rev42, with kexec/kdump.

Thus changing the value 0x05 to 0x0d

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Lyude Paul <lyude@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220119102905.1194787-1-jfalempe@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-08 14:23:00 +02:00
..
Kconfig drm/mgag200: Add support for G200 desktop cards 2020-08-03 09:43:00 +02:00
Makefile drm/mgag200: Abstract pixel PLL via struct mgag200_pll 2021-08-08 20:14:05 +02:00
mgag200_drv.c drm/mgag200: Extract device type and flags in mgag200_pci_probe() 2021-07-05 08:55:39 +02:00
mgag200_drv.h drm/mgag200: Compute PLL values during atomic check 2021-08-08 20:14:14 +02:00
mgag200_i2c.c drm/mgag200: Remove references to struct drm_device.pdev 2021-01-06 15:43:13 +01:00
mgag200_mm.c drm/mgag200: Remove references to struct drm_device.pdev 2021-01-06 15:43:13 +01:00
mgag200_mode.c mgag200 fix memmapsl configuration in GCTL6 register 2022-04-08 14:23:00 +02:00
mgag200_pll.c drm/mgag200: Fix PLL setup for g200wb and g200ew 2022-03-23 09:16:41 +01:00
mgag200_reg.h drm/mgag200: Select clock in PLL update functions 2021-08-08 20:13:10 +02:00