Blame 0001-fix-drm-add-privacy-screen-modules-to-the-initrd.patch

76eb28
From 4f1d387b777425aead44232bd2c3d5c3517d4ff8 Mon Sep 17 00:00:00 2001
76eb28
From: Hans de Goede <hdegoede@redhat.com>
76eb28
Date: Thu, 9 Dec 2021 16:35:11 +0100
76eb28
Subject: [PATCH] fix(drm): add privacy screen modules to the initrd
76eb28
76eb28
Starting with kernel 5.17 the kernel supports the builtin privacy screens
76eb28
built into the LCD panel of some new laptop models.
76eb28
76eb28
This means that the drm drivers will now return -EPROBE_DEFER from their
76eb28
probe() method on models with a builtin privacy screen when the privacy
76eb28
screen provider driver has not been loaded yet.
76eb28
76eb28
Make dracut add the privacy screen providing drivers to the initrd
76eb28
(when necessary for hostmode=yes), so that drm drivers on affected
76eb28
drivers can probe() successfully.
76eb28
76eb28
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
76eb28
---
76eb28
 modules.d/50drm/module-setup.sh | 14 ++++++++++++++
76eb28
 1 file changed, 14 insertions(+)
76eb28
76eb28
diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh
76eb28
index aca01505..cff0550c 100755
76eb28
--- a/modules.d/50drm/module-setup.sh
76eb28
+++ b/modules.d/50drm/module-setup.sh
76eb28
@@ -29,6 +29,8 @@ installkernel() {
76eb28
     # as we could e.g. be in the installer; nokmsboot boot parameter will disable
76eb28
     # loading of the driver if needed
76eb28
     if [[ $hostonly ]]; then
76eb28
+        local i modlink modname
76eb28
+
76eb28
         for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
76eb28
             [[ -e $i ]] || continue
76eb28
             [[ -n $(< "$i") ]] || continue
76eb28
@@ -39,7 +41,19 @@ installkernel() {
76eb28
                 fi
76eb28
             fi
76eb28
         done
76eb28
+        # if there is a privacy screen then its driver must be loaded before the
76eb28
+        # kms driver will bind, otherwise its probe() will return -EPROBE_DEFER
76eb28
+        # note privacy screens always register, even with e.g. nokmsboot
76eb28
+        for i in /sys/class/drm/privacy_screen-*/device/driver/module; do
76eb28
+            [[ -L $i ]] || continue
76eb28
+            modlink=$(readlink "$i")
76eb28
+            modname=$(basename "$modlink")
76eb28
+            instmods "$modname"
76eb28
+        done
76eb28
     else
76eb28
         dracut_instmods -o -s "drm_crtc_init|drm_dev_register|drm_encoder_init" "=drivers/gpu/drm" "=drivers/staging"
76eb28
+        # also include privacy screen providers (see above comment)
76eb28
+        # atm all providers live under drivers/platform/x86
76eb28
+        dracut_instmods -o -s "drm_privacy_screen_register" "=drivers/platform/x86"
76eb28
     fi
76eb28
 }
76eb28
-- 
76eb28
2.33.1
76eb28