[PATCH] drm: Harmonize CIK ASIC support in radeon and amdgpu (v2)

Felix Kuehling felix.kuehling at amd.com
Fri Apr 21 17:05:00 UTC 2017


__setup doesn't work in modules.

s8250_options is only compiled if the driver is not a module.

I came up with a different way to parse another module's options. But I
can't get the commandline that I would parse in that way:

@@ -787,12 +793,45 @@ long amdgpu_drm_ioctl(struct file *filp,
        .driver.pm = &amdgpu_pm_ops,
 };
 
-
+#if 0
+static int radeon_cik_support = 0;
+static int param_set(const char *val, const struct kernel_param *kp)
+{
+       return kstrtoint(val, 0, kp.arg);
+}
+static struct kernel_param_ops radeon_force_cik_param_ops = {
+       .flags = 0,
+       .set = param_set,
+       .get = NULL,
+       .free = NULL
+};
+static struct kernel_param radeon_cik_support_param = {
+       .name = "radeon.cik_support",
+       .mod = THIS_MODULE,
+       .ops = radeon_cik_support_param_ops,
+       .perm = 0444,
+       .level = -1,
+       .flags = 0,
+       .arg = &radeon_cik_support
+};
+#endif
 
 static int __init amdgpu_init(void)
 {
        int r;
 
+#if 0
+       /* Doesn't work because saved_command_line isn't exported to
+        * modules */
+       r = parse_args("amdgpu", saved_command_line,
+                      &radeon_cik_support_param, 1,
+                      -32768, 32767, NULL, NULL);
+       if (r)
+               return r;
+
+       amdgpu_cik_support = !radeon_cik_support;
+#endif
+
        r = amdgpu_sync_init();
        if (r)
                goto error_sync;

Regards,
  Felix

On 17-04-20 05:25 AM, Michel Dänzer wrote:
> On 20/04/17 03:59 AM, Felix Kuehling wrote:
>> On 17-04-11 10:23 PM, Michel Dänzer wrote:
>>> One possibility would be making each driver also parse the other
>>> driver's module parameter on the kernel command line. I.e. radeon would
>>> parse
>>>
>>>  amdgpu.enable_cik=0
>> I looked for a way to do this. I think I figured out the parsing part.
>> But I can't see where to get the kernel command line from. The command
>> line that is parsed by modules in load_module comes from user mode, and
>> I think it's pre-processed by modprobe to strip the "<module>." prefix
>> and only include the module-specific options.
>>
>> There is a global variable saved_command_line, which is what's used for
>> /proc/cmdline. But that variable is not exported to modules.
> I see two possibilities:
>
> Either use __module_param_call directly, like
> drivers/tty/serial/8250/8250_core.c:s8250_options().
>
> Or use __setup, like e.g.
> drivers/video/fbdev/core/fb_cmdline.c:video_setup().
>
> I'm leaning towards the former.
>
>
> Anyway, my offer to look into this as a follow-up change stands; the
> only issue that needs to be resolved for your patch to land is the
> Kconfig options.
>
>



More information about the amd-gfx mailing list