Backport upstream changes for drm-privacy screen support in kernel >= 5.17

This commit is contained in:
Hans de Goede 2021-12-20 14:46:50 +01:00
parent 6333f807a7
commit 76eb28fc2e
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,57 @@
From 4f1d387b777425aead44232bd2c3d5c3517d4ff8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 9 Dec 2021 16:35:11 +0100
Subject: [PATCH] fix(drm): add privacy screen modules to the initrd
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 | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh
index aca01505..cff0550c 100755
--- a/modules.d/50drm/module-setup.sh
+++ b/modules.d/50drm/module-setup.sh
@@ -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
}
--
2.33.1

View File

@ -5,7 +5,7 @@
# strip the automatically generated dep here and instead co-own the
# directory.
%global __requires_exclude pkg-config
%define dist_free_release 7
%define dist_free_release 8
Name: dracut
Version: 055
@ -54,6 +54,9 @@ Patch5: 0001-fix-kernel-modules-add-blk_mq_alloc_disk-and-blk_cle.patch
Patch6: https://github.com/dracutdevs/dracut/pull/1611.patch#/0001-fix-network-manager-disable-tty-if-no-console.patch
# Add support for isp1760 usb device used as the boot drive on arm/corestone
Patch7: 0001-fix-90kernel-modules-add-isp1760-USB-controller.patch
# For new drm-privacy screen support in kernel >= 5.17, also see:
# https://hansdegoede.livejournal.com/25948.html
Patch8: 0001-fix-drm-add-privacy-screen-modules-to-the-initrd.patch
BuildRequires: bash
BuildRequires: git-core
@ -507,6 +510,9 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
%changelog
* Mon Dec 20 2021 Hans de Goede <hdegoede@redhat.com> - 055-8
- Backport upstream changes for drm-privacy screen support in kernel >= 5.17
* Thu Nov 4 2021 Jeremy Linton <jeremy.linton@arm.com> - 055-7
- Backport Upstream: 15398458 fix(90kernel-modules): add isp1760 USB controller