]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(drm): add privacy screen modules to the initrd
authorHans de Goede <hdegoede@redhat.com>
Thu, 9 Dec 2021 15:35:11 +0000 (16:35 +0100)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Fri, 10 Dec 2021 12:40:17 +0000 (12:40 +0000)
Starting with kernel 5.17 the kernel supports the builtin privacy screens
built into the LCD panel of some new laptop models.

This means that the drm drivers will now return -EPROBE_DEFER from their
probe() method on models with a builtin privacy screen when the privacy
screen provider driver has not been loaded yet.

Make dracut add the privacy screen providing drivers to the initrd
(when necessary for hostmode=yes), so that drm drivers on affected
drivers can probe() successfully.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
modules.d/50drm/module-setup.sh

index aca01505cc7f501c63f2ed98e03dd051b2d46dfe..cff0550c98fd678c7926e6ecb688edcfbef1b7b6 100755 (executable)
@@ -29,6 +29,8 @@ installkernel() {
     # as we could e.g. be in the installer; nokmsboot boot parameter will disable
     # loading of the driver if needed
     if [[ $hostonly ]]; then
+        local i modlink modname
+
         for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
             [[ -e $i ]] || continue
             [[ -n $(< "$i") ]] || continue
@@ -39,7 +41,19 @@ installkernel() {
                 fi
             fi
         done
+        # if there is a privacy screen then its driver must be loaded before the
+        # kms driver will bind, otherwise its probe() will return -EPROBE_DEFER
+        # note privacy screens always register, even with e.g. nokmsboot
+        for i in /sys/class/drm/privacy_screen-*/device/driver/module; do
+            [[ -L $i ]] || continue
+            modlink=$(readlink "$i")
+            modname=$(basename "$modlink")
+            instmods "$modname"
+        done
     else
         dracut_instmods -o -s "drm_crtc_init|drm_dev_register|drm_encoder_init" "=drivers/gpu/drm" "=drivers/staging"
+        # also include privacy screen providers (see above comment)
+        # atm all providers live under drivers/platform/x86
+        dracut_instmods -o -s "drm_privacy_screen_register" "=drivers/platform/x86"
     fi
 }