Skip to content

Commit

Permalink
dkms: add module load parameters for i915_ag.ko
Browse files Browse the repository at this point in the history
nuclear_pageflip=1 enable_guc=0x7 max_vfs=7 modeset=1 fastboot=1

Tracked-On: OAM-126631
Signed-off-by: yiyang.wang <[email protected]>
  • Loading branch information
wangyiyanga authored and sysopenci committed Nov 7, 2024
1 parent 5c0bed1 commit 15c13ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions drivers/gpu/drm/i915/i915_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ static bool intel_mmio_bar_valid(struct pci_dev *pdev, struct intel_device_info
return i915_pci_resource_valid(pdev, intel_mmio_bar(intel_info->__runtime.graphics.ip.ver));
}

extern int gfx_load_module(void *buf, int len);
extern int gfx_load_module(void *buf, int len, const char *kargs);

static void gfx_out_of_tree_load(struct device *dev)
{
Expand All @@ -1039,7 +1039,7 @@ static void gfx_out_of_tree_load(struct device *dev)
}
buf = __vmalloc((unsigned long)fw->size, GFP_KERNEL | __GFP_NOWARN);
memcpy(buf, fw->data, fw->size);
gfx_load_module(buf, fw->size);
gfx_load_module(buf, fw->size, NULL);
DRM_INFO("compat loaded\n");

err = firmware_request_nowarn(&fw, "i915/intel_vsec.ko", dev);
Expand All @@ -1049,7 +1049,7 @@ static void gfx_out_of_tree_load(struct device *dev)
}
buf = __vmalloc((unsigned long)fw->size, GFP_KERNEL | __GFP_NOWARN);
memcpy(buf, fw->data, fw->size);
gfx_load_module(buf, fw->size);
gfx_load_module(buf, fw->size, NULL);
DRM_INFO("intel_vsec loaded\n");

err = firmware_request_nowarn(&fw, "i915/i915_ag.ko", dev);
Expand All @@ -1059,7 +1059,7 @@ static void gfx_out_of_tree_load(struct device *dev)
}
buf = __vmalloc((unsigned long)fw->size, GFP_KERNEL | __GFP_NOWARN);
memcpy(buf, fw->data, fw->size);
gfx_load_module(buf, fw->size);
gfx_load_module(buf, fw->size, "nuclear_pageflip=1 enable_guc=0x7 max_vfs=7 modeset=1 fastboot=1");
DRM_INFO("i915_ag loaded\n");
}

Expand Down
20 changes: 12 additions & 8 deletions kernel/module/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2739,7 +2739,7 @@ static int unknown_module_param_cb(char *param, char *val, const char *modname,
* zero, and we rely on this for optional sections.
*/
static int load_module(struct load_info *info, const char __user *uargs,
int flags, bool no_args)
const char *kargs, int flags, bool no_uargs)
{
struct module *mod;
long err = 0;
Expand Down Expand Up @@ -2866,7 +2866,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
flush_module_icache(mod);

/* Now copy in args */
if (!no_args) {
if (!no_uargs) {
mod->args = strndup_user(uargs, ~0UL >> 1);
if (IS_ERR(mod->args)) {
pr_debug("%s mod->args error\n", __func__);
Expand All @@ -2875,8 +2875,12 @@ static int load_module(struct load_info *info, const char __user *uargs,
}
pr_debug("%s mod->args: %llx \n", __func__, (u64)mod->args);
} else {
char *arg = "";
mod->args = kmemdup(arg, strlen(arg) + 1, GFP_KERNEL);
if (kargs)
mod->args = kmemdup(kargs, strlen(kargs) + 1, GFP_KERNEL);
else {
char *arg = "";
mod->args = kmemdup(arg, strlen(arg) + 1, GFP_KERNEL);
}
}

init_build_id(mod, info);
Expand Down Expand Up @@ -2989,7 +2993,7 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,
if (err)
return err;

return load_module(&info, uargs, 0, false);
return load_module(&info, uargs, NULL, 0, false);
}

SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
Expand Down Expand Up @@ -3025,15 +3029,15 @@ SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
info.len = len;
}

return load_module(&info, uargs, flags, false);
return load_module(&info, uargs, NULL, flags, false);
}

int gfx_load_module(void *buf, int len)
int gfx_load_module(void *buf, int len, const char *kargs)
{
struct load_info info = { };
info.hdr = buf;
info.len = len;
return load_module(&info, NULL, 0, true);
return load_module(&info, NULL, kargs, 0, true);
}

static inline int within(unsigned long addr, void *start, unsigned long size)
Expand Down

0 comments on commit 15c13ee

Please sign in to comment.