[PATCH] drm/xe: Support 'nomodeset' kernel command-line option
Thomas Zimmermann
tzimmermann at suse.de
Wed Aug 21 14:34:08 UTC 2024
Hi
Am 21.08.24 um 16:24 schrieb Lucas De Marchi:
> On Wed, Aug 21, 2024 at 03:56:59PM GMT, Thomas Zimmermann wrote:
>> Setting 'nomodeset' on the kernel command line disables all graphics
>> drivers with modesetting capabilities; leaving only firmware drivers,
>> such as simpledrm or efifb.
>>
>> Most DRM drivers automatically support 'nomodeset' via DRM's module
>> helper macros. In xe, which uses regular module_init(), manually call
>> drm_firmware_drivers_only() to test for 'nomodeset'. Do not register
>> the driver if set.
>
> I see some drivers like i915 and radeon using an additional 'modeset'
> parameter... probably to be able to avoid modeset for that specific
> driver while still allowing for others?
These old per-module parameters are deprecated. We decided to keep them
around as there's external blogs and documentation that refer to them.
>
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
>> ---
>> drivers/gpu/drm/xe/xe_module.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_module.c
>> b/drivers/gpu/drm/xe/xe_module.c
>> index 923460119cec..60fb7dd26903 100644
>> --- a/drivers/gpu/drm/xe/xe_module.c
>> +++ b/drivers/gpu/drm/xe/xe_module.c
>> @@ -8,6 +8,8 @@
>> #include <linux/init.h>
>> #include <linux/module.h>
>>
>> +#include <drm/drm_module.h>
>> +
>> #include "xe_drv.h"
>> #include "xe_hw_fence.h"
>> #include "xe_pci.h"
>> @@ -92,6 +94,9 @@ static int __init xe_init(void)
>> {
>> int err, i;
>>
>> + if (drm_firmware_drivers_only())
>> + return -ENODEV;
>
> nit: being the first, without an .exit may be equivalent, but probably
> better for parity with i915 to use a xe_check_modeset() and add it as
> the first one in the table. We'd need to check for exit != NULL, though.
OK, sure. That's also how i915 works.
Best regards
Thomas
>
> Anyway,
>
> Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>
>
> thanks
> Lucas De Marchi
>
>> +
>> for (i = 0; i < ARRAY_SIZE(init_funcs); i++) {
>> err = init_funcs[i].init();
>> if (err) {
>> --
>> 2.46.0
>>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
More information about the dri-devel
mailing list