On Tue, Mar 14, 2023 at 04:43:01AM -0600, bent...@openbsd.org wrote: > Jonathan Gray writes: > > On Mon, Mar 13, 2023 at 07:21:13PM -0600, bent...@openbsd.org wrote: > > > Hi, > > > > > > Since the Linux 6.1.2 drm update, the Valve Steam Deck no longer starts > > > amdgpu. Instead, these messages print, and X starts with wsfb instead. > > > > which firmware package do you have installed? > > amdgpu-firmware-20230310 > > Reverting to 20221109 shows the same behavior: same firmware errors with > a post-6.1.2 kernel, fancy framebuffer with pre-6.1.2.
It turns out this is a known problem https://gitlab.freedesktop.org/drm/amd/-/issues/2385 You have one of the BIOS versions known to be incompatible with indirect SRAM mode (F7A0113). a fix landed in the linux amd-staging-drm-next tree a day ago https://gitlab.freedesktop.org/agd5f/linux/-/commit/70163f822695350651dbd2092f31915b5282c92f.patch Here is that patch, with some additional changes to handle DMI_BIOS_VERSION. Index: sys/arch/amd64/amd64/bios.c =================================================================== RCS file: /cvs/src/sys/arch/amd64/amd64/bios.c,v retrieving revision 1.46 diff -u -p -r1.46 bios.c --- sys/arch/amd64/amd64/bios.c 16 Oct 2022 15:03:39 -0000 1.46 +++ sys/arch/amd64/amd64/bios.c 14 Mar 2023 11:15:25 -0000 @@ -63,6 +63,7 @@ const char *smbios_uninfo[] = { }; char smbios_bios_date[64]; +char smbios_bios_version[64]; char smbios_board_vendor[64]; char smbios_board_prod[64]; char smbios_board_serial[64]; @@ -138,9 +139,15 @@ bios_attach(struct device *parent, struc printf(" vendor %s", fixstring(scratch)); if ((smbios_get_string(&bios, sb->version, - scratch, sizeof(scratch))) != NULL) - printf(" version \"%s\"", - fixstring(scratch)); + scratch, sizeof(scratch))) != NULL) { + sminfop = fixstring(scratch); + if (sminfop != NULL) { + strlcpy(smbios_bios_version, + sminfop, + sizeof(smbios_bios_version)); + printf(" version \"%s\"", sminfop); + } + } if ((smbios_get_string(&bios, sb->release, scratch, sizeof(scratch))) != NULL) { sminfop = fixstring(scratch); Index: sys/arch/i386/i386/bios.c =================================================================== RCS file: /cvs/src/sys/arch/i386/i386/bios.c,v retrieving revision 1.128 diff -u -p -r1.128 bios.c --- sys/arch/i386/i386/bios.c 30 Jan 2023 10:49:04 -0000 1.128 +++ sys/arch/i386/i386/bios.c 14 Mar 2023 11:24:40 -0000 @@ -125,6 +125,7 @@ const char *smbios_uninfo[] = { char smbios_bios_date[64]; +char smbios_bios_version[64]; char smbios_board_vendor[64]; char smbios_board_prod[64]; char smbios_board_serial[64]; @@ -291,9 +292,16 @@ biosattach(struct device *parent, struct printf(" vendor %s", fixstring(scratch)); if ((smbios_get_string(&bios, sb->version, - scratch, sizeof(scratch))) != NULL) - printf(" version \"%s\"", - fixstring(scratch)); + scratch, sizeof(scratch))) != NULL) { + sminfop = fixstring(scratch); + if (sminfop != NULL) { + strlcpy(smbios_bios_version, + sminfop, + sizeof(smbios_bios_version)); + printf(" version \"%s\"", + sminfop); + } + } if ((smbios_get_string(&bios, sb->release, scratch, sizeof(scratch))) != NULL) { sminfop = fixstring(scratch); Index: sys/dev/pci/drm/drm_linux.c =================================================================== RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.c,v retrieving revision 1.96 diff -u -p -r1.96 drm_linux.c --- sys/dev/pci/drm/drm_linux.c 10 Feb 2023 14:34:16 -0000 1.96 +++ sys/dev/pci/drm/drm_linux.c 14 Mar 2023 11:16:04 -0000 @@ -490,15 +490,21 @@ dmi_first_match(const struct dmi_system_ #if NBIOS > 0 extern char smbios_bios_date[]; +extern char smbios_bios_version[]; #endif const char * dmi_get_system_info(int slot) { - WARN_ON(slot != DMI_BIOS_DATE); #if NBIOS > 0 - if (slot == DMI_BIOS_DATE) + switch (slot) { + case DMI_BIOS_DATE: return smbios_bios_date; + case DMI_BIOS_VERSION: + return smbios_bios_version; + default: + printf("%s slot %d not handled\n", __func__, slot); + } #endif return NULL; } Index: sys/dev/pci/drm/amd/amdgpu/amdgpu_vcn.c =================================================================== RCS file: /cvs/src/sys/dev/pci/drm/amd/amdgpu/amdgpu_vcn.c,v retrieving revision 1.8 diff -u -p -r1.8 amdgpu_vcn.c --- sys/dev/pci/drm/amd/amdgpu/amdgpu_vcn.c 1 Jan 2023 01:34:35 -0000 1.8 +++ sys/dev/pci/drm/amd/amdgpu/amdgpu_vcn.c 14 Mar 2023 11:07:50 -0000 @@ -26,6 +26,7 @@ #include <linux/firmware.h> #include <linux/module.h> +#include <linux/dmi.h> #include <linux/pci.h> #include <linux/debugfs.h> #include <drm/drm_drv.h> @@ -220,6 +221,24 @@ int amdgpu_vcn_sw_init(struct amdgpu_dev release_firmware(adev->vcn.fw); adev->vcn.fw = NULL; return r; + } + + /* + * Some Steam Deck's BIOS versions are incompatible with the + * indirect SRAM mode, leading to amdgpu being unable to get + * properly probed (and even potentially crashing the kernel). + * Hence, check for these versions here - notice this is + * restricted to Vangogh (Deck's APU). + */ + if (adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 0, 2)) { + const char *bios_ver = dmi_get_system_info(DMI_BIOS_VERSION); + + if (bios_ver && (!strncmp("F7A0113", bios_ver, 7) || + !strncmp("F7A0114", bios_ver, 7))) { + adev->vcn.indirect_sram = false; + dev_info(adev->dev, + "Steam Deck quirk: indirect SRAM disabled on BIOS %s\n", bios_ver); + } } hdr = (const struct common_firmware_header *)adev->vcn.fw->data;