Adding a new ioctl to nvidia-uvm library

Hello everyone,

I want to add a new ioctl to nvidia-uvm library. The modification I am doing in the uvm library is as follows:

  1. Created data structure in uvm_ioctl.h: “NEW_IOCTL”
  2. Defined the API in uvm_api.h: “NEW_API”
  3. Assigned the ioctl to the new API: UVM_ROUTE_CMD_STACK_INIT_CHECK(NEW_IOCTL, NEW_API)
  4. Implemented the API in uvm_va_block.c file;

Then I uninstalled the driver, and loaded the modified driver.

On host side, I called this api using ioctl() function:

define IOCTL_DEFINITION _IOC(0, 0, NEW_IOCTL, 0)

Inside main:

int g_uvm_fd = -1;
int ret;
NEW_IOCTL_PARAMS params;
ret = ioctl(g_uvm_fd, IOCTL_DEFINITION, &params);

However, the introduced ioctl doesn’t work.
Could someone explain what is wrong with this implementation? Or any resource I can follow?

Thanks.

1 Like

I checked the error code:
No such file or directory