* [PATCH] drm/amd/amdgpu: Add modeset module parameter support
@ 2022-08-29 12:36 Zhen Ni
2022-08-29 13:47 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Zhen Ni @ 2022-08-29 12:36 UTC (permalink / raw)
To: airlied, daniel, evan.quan; +Cc: amd-gfx, dri-devel, linux-kernel, Zhen Ni
Nomodeset kernel parameter is for all graphics cards. Amdgpu cannot
be set separately in some scenarios, such as hybrid graphics(i + a).
Add modeset module parameter for amdgpu to set kernel mode separately.
Signed-off-by: Zhen Ni <nizhen@uniontech.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 429fcdf28836..856a70370e3c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -107,6 +107,7 @@
#define KMS_DRIVER_MINOR 48
#define KMS_DRIVER_PATCHLEVEL 0
+int amdgpu_modeset = -1;
int amdgpu_vram_limit;
int amdgpu_vis_vram_limit;
int amdgpu_gart_size = -1; /* auto */
@@ -199,6 +200,13 @@ struct amdgpu_watchdog_timer amdgpu_watchdog_timer = {
.period = 0x0, /* default to 0x0 (timeout disable) */
};
+/**
+ * DOC: modeset (int)
+ * Disable/Enable kernel modesetting (1 = enable, 0 = disable, -1 = auto (default)).
+ */
+MODULE_PARM_DESC(modeset, "Disable/Enable kernel modesetting");
+module_param_named(modeset, amdgpu_modeset, int, 0400);
+
/**
* DOC: vramlimit (int)
* Restrict the total amount of VRAM in MiB for testing. The default is 0 (Use full VRAM).
@@ -2753,7 +2761,10 @@ static int __init amdgpu_init(void)
{
int r;
- if (drm_firmware_drivers_only())
+ if (drm_firmware_drivers_only() && amdgpu_modeset == -1)
+ amdgpu_modeset = 0;
+
+ if (amdgpu_modeset == 0)
return -EINVAL;
r = amdgpu_sync_init();
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] drm/amd/amdgpu: Add modeset module parameter support
2022-08-29 12:36 [PATCH] drm/amd/amdgpu: Add modeset module parameter support Zhen Ni
@ 2022-08-29 13:47 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2022-08-29 13:47 UTC (permalink / raw)
To: Zhen Ni; +Cc: airlied, daniel, evan.quan, dri-devel, amd-gfx, linux-kernel
On Mon, Aug 29, 2022 at 9:43 AM Zhen Ni <nizhen@uniontech.com> wrote:
>
> Nomodeset kernel parameter is for all graphics cards. Amdgpu cannot
> be set separately in some scenarios, such as hybrid graphics(i + a).
> Add modeset module parameter for amdgpu to set kernel mode separately.
>
> Signed-off-by: Zhen Ni <nizhen@uniontech.com>
amdgpu didn't support this option since it never supported the legacy
drm mode that other older drivers did. If you just want the option to
keep the driver from loading, you can already do this by blacklisting
the driver. E.g.,
modprobe.blacklist=amdgpu
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 429fcdf28836..856a70370e3c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -107,6 +107,7 @@
> #define KMS_DRIVER_MINOR 48
> #define KMS_DRIVER_PATCHLEVEL 0
>
> +int amdgpu_modeset = -1;
> int amdgpu_vram_limit;
> int amdgpu_vis_vram_limit;
> int amdgpu_gart_size = -1; /* auto */
> @@ -199,6 +200,13 @@ struct amdgpu_watchdog_timer amdgpu_watchdog_timer = {
> .period = 0x0, /* default to 0x0 (timeout disable) */
> };
>
> +/**
> + * DOC: modeset (int)
> + * Disable/Enable kernel modesetting (1 = enable, 0 = disable, -1 = auto (default)).
> + */
> +MODULE_PARM_DESC(modeset, "Disable/Enable kernel modesetting");
> +module_param_named(modeset, amdgpu_modeset, int, 0400);
> +
> /**
> * DOC: vramlimit (int)
> * Restrict the total amount of VRAM in MiB for testing. The default is 0 (Use full VRAM).
> @@ -2753,7 +2761,10 @@ static int __init amdgpu_init(void)
> {
> int r;
>
> - if (drm_firmware_drivers_only())
> + if (drm_firmware_drivers_only() && amdgpu_modeset == -1)
> + amdgpu_modeset = 0;
> +
> + if (amdgpu_modeset == 0)
> return -EINVAL;
>
> r = amdgpu_sync_init();
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-29 13:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 12:36 [PATCH] drm/amd/amdgpu: Add modeset module parameter support Zhen Ni
2022-08-29 13:47 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®