diff --git a/debian/changelog b/debian/changelog index 872c40609..5aa280eb0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -402,6 +402,7 @@ linux (4.15.9-1) UNRELEASED; urgency=medium __flush_tlb_one_[user|kernel]()" to avoid an ABI change * [x86] Revert "x86/debug: Use UD2 for WARN()" to avoid an ABI change * drm/atomic: Avoid ABI change in 4.15.7 + * amdgpu: Abort probing if firmware is not installed, as we do in radeon [ Uwe Kleine-König ] * netfilter: enable NFT_FIB_NETDEV as module diff --git a/debian/patches/bugfix/all/radeon-firmware-is-required-for-drm-and-kms-on-r600-onward.patch b/debian/patches/bugfix/all/radeon-amdgpu-firmware-is-required-for-drm-and-kms-on-r600-onward.patch similarity index 60% rename from debian/patches/bugfix/all/radeon-firmware-is-required-for-drm-and-kms-on-r600-onward.patch rename to debian/patches/bugfix/all/radeon-amdgpu-firmware-is-required-for-drm-and-kms-on-r600-onward.patch index 4fa3f7e77..fe13c96b8 100644 --- a/debian/patches/bugfix/all/radeon-firmware-is-required-for-drm-and-kms-on-r600-onward.patch +++ b/debian/patches/bugfix/all/radeon-amdgpu-firmware-is-required-for-drm-and-kms-on-r600-onward.patch @@ -1,5 +1,5 @@ From: Ben Hutchings -Subject: radeon: Firmware is required for DRM and KMS on R600 onward +Subject: radeon, amdgpu: Firmware is required for DRM and KMS on R600 onward Date: Tue, 08 Jan 2013 03:25:52 +0000 Bug-Debian: https://bugs.debian.org/607194 Bug-Debian: https://bugs.debian.org/607471 @@ -20,8 +20,8 @@ the firmware is not available, but becomes unstable - the framebuffer and/or system memory may be corrupted, or the display may stay black. Therefore, perform a basic check for the existence of -/lib/firmware/radeon when a device is probed, and abort if it is -missing, except for the pre-R600 case. +/lib/firmware/{radeon,amdgpu} when a device is probed, and abort if it +is missing, except for the pre-R600 case. --- --- a/drivers/gpu/drm/radeon/radeon_drv.c @@ -77,3 +77,55 @@ missing, except for the pre-R600 case. /* Get rid of things like offb */ ret = radeon_kick_out_firmware_fb(pdev); if (ret) +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +@@ -40,6 +40,8 @@ + #include + #include + #include ++#include ++#include + + #include "amdgpu.h" + #include "amdgpu_irq.h" +@@ -545,6 +547,28 @@ MODULE_DEVICE_TABLE(pci, pciidlist); + + static struct drm_driver kms_driver; + ++/* Test that /lib/firmware/amdgpu is a directory (or symlink to a ++ * directory). We could try to match the udev search path, but let's ++ * keep it simple. ++ */ ++static bool amdgpu_firmware_installed(void) ++{ ++#if IS_BUILTIN(CONFIG_DRM_AMDGPU) ++ /* It may be too early to tell. Assume it's there. */ ++ return true; ++#else ++ struct path path; ++ ++ if (kern_path("/lib/firmware/amdgpu", LOOKUP_DIRECTORY | LOOKUP_FOLLOW, ++ &path) == 0) { ++ path_put(&path); ++ return true; ++ } ++ ++ return false; ++#endif ++} ++ + static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev) + { + struct apertures_struct *ap; +@@ -579,6 +603,11 @@ static int amdgpu_pci_probe(struct pci_d + return -ENODEV; + } + ++ if (!amdgpu_firmware_installed()) { ++ DRM_ERROR("amdgpu requires firmware installed\n"); ++ return -ENODEV; ++ } ++ + /* + * Initialize amdkfd before starting radeon. If it was not loaded yet, + * defer radeon probing diff --git a/debian/patches/debian/firmware_class-refer-to-debian-wiki-firmware-page.patch b/debian/patches/debian/firmware_class-refer-to-debian-wiki-firmware-page.patch index 191bde456..a8c1c361c 100644 --- a/debian/patches/debian/firmware_class-refer-to-debian-wiki-firmware-page.patch +++ b/debian/patches/debian/firmware_class-refer-to-debian-wiki-firmware-page.patch @@ -9,6 +9,10 @@ message referring to our wiki page about firmware. This will explain why some firmware is in non-free, or can't be packaged at all. Only do this once per boot. +Do something similar in the radeon and amdgpu drivers, where we have +an early check to avoid failing at a point where we cannot display +anything. + --- --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -36,3 +40,13 @@ do this once per boot. return -ENODEV; } +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +@@ -605,6 +605,7 @@ static int amdgpu_pci_probe(struct pci_d + + if (!amdgpu_firmware_installed()) { + DRM_ERROR("amdgpu requires firmware installed\n"); ++ pr_err_once("See https://wiki.debian.org/Firmware for information about missing firmware\n"); + return -ENODEV; + } + diff --git a/debian/patches/series b/debian/patches/series index 5601cd0e6..80105935d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -16,7 +16,7 @@ features/all/drivers-media-dvb-usb-af9005-request_firmware.patch debian/iwlwifi-do-not-request-unreleased-firmware.patch bugfix/all/firmware_class-log-every-success-and-failure.patch bugfix/all/firmware-remove-redundant-log-messages-from-drivers.patch -bugfix/all/radeon-firmware-is-required-for-drm-and-kms-on-r600-onward.patch +bugfix/all/radeon-amdgpu-firmware-is-required-for-drm-and-kms-on-r600-onward.patch debian/firmware_class-refer-to-debian-wiki-firmware-page.patch # Patches from aufs4 repository, imported with