]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: taint kernel when force probing unsupported devices
authorJani Nikula <jani.nikula@intel.com>
Thu, 4 May 2023 10:35:08 +0000 (13:35 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:33 +0000 (17:32 +0100)
[ Upstream commit 79c901c93562bdf1c84ce6c1b744fbbe4389a6eb ]

For development and testing purposes, the i915.force_probe module
parameter and DRM_I915_FORCE_PROBE kconfig option allow probing of
devices that aren't supported by the driver.

The i915.force_probe module parameter is "unsafe" and setting it taints
the kernel. However, using the kconfig option does not.

Always taint the kernel when force probing a device that is not
supported.

v2: Drop "depends on EXPERT" to avoid build breakage (kernel test robot)

Fixes: b427993cb545 ("drm/i915: add force_probe module parameter to replace alpha_support")
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Dave Airlie <airlied@gmail.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230504103508.1818540-1-jani.nikula@intel.com
(cherry picked from commit 3312bb4ad09ca6423bd4a5b15a94588a8962fb8e)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/i915/Kconfig
drivers/gpu/drm/i915/i915_pci.c

index e04715fa5bc4c56c9ed204a6ea96398a919dcff4..6b10868ec72ff288174ede496755e406b56df320 100644 (file)
@@ -60,10 +60,11 @@ config DRM_I915_FORCE_PROBE
          This is the default value for the i915.force_probe module
          parameter. Using the module parameter overrides this option.
 
-         Force probe the i915 for Intel graphics devices that are
-         recognized but not properly supported by this kernel version. It is
-         recommended to upgrade to a kernel version with proper support as soon
-         as it is available.
+         Force probe the i915 driver for Intel graphics devices that are
+         recognized but not properly supported by this kernel version. Force
+         probing an unsupported device taints the kernel. It is recommended to
+         upgrade to a kernel version with proper support as soon as it is
+         available.
 
          It can also be used to block the probe of recognized and fully
          supported devices.
@@ -73,7 +74,8 @@ config DRM_I915_FORCE_PROBE
          Use "<pci-id>[,<pci-id>,...]" to force probe the i915 for listed
          devices. For example, "4500" or "4500,4571".
 
-         Use "*" to force probe the driver for all known devices.
+         Use "*" to force probe the driver for all known devices. Not
+         recommended.
 
          Use "!" right before the ID to block the probe of the device. For
          example, "4500,!4571" forces the probe of 4500 and blocks the probe of
index 1fa4a5813683fda48368a2e6cc21b92c50bed416..efa80475fbfed05b65dbd0274f7b8250b26dffca 100644 (file)
@@ -1343,6 +1343,12 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                return -ENODEV;
        }
 
+       if (intel_info->require_force_probe) {
+               dev_info(&pdev->dev, "Force probing unsupported Device ID %04x, tainting kernel\n",
+                        pdev->device);
+               add_taint(TAINT_USER, LOCKDEP_STILL_OK);
+       }
+
        /* Only bind to function 0 of the device. Early generations
         * used function 1 as a placeholder for multi-head. This causes
         * us confusion instead, especially on the systems where both