amd/xdna-driver

amdxdna_ctx.c build errors

spaceotter opened this issue · 1 comments

I'm trying to refresh one of my machines that has Ryzen AI, I get these build errors:

/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c: In function ‘amdxdna_sched_job_init’:
/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:171:62: error: passing argument 3 of ‘drm_sched_job_init’ makes pointer from integer without a cast [-Werror=int-conversion]
  171 |         ret = drm_sched_job_init(&job->base, &hwctx->entity, 1, hwctx);
      |                                                              ^
      |                                                              |
      |                                                              int
In file included from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.h:11,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_drv.h:16,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:12:
./include/drm/gpu_scheduler.h:533:30: note: expected ‘void *’ but argument is of type ‘int’
  533 |                        void *owner);
      |                        ~~~~~~^~~~~
/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:171:15: error: too many arguments to function ‘drm_sched_job_init’
  171 |         ret = drm_sched_job_init(&job->base, &hwctx->entity, 1, hwctx);
      |               ^~~~~~~~~~~~~~~~~~
In file included from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.h:11,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_drv.h:16,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:12:
./include/drm/gpu_scheduler.h:531:5: note: declared here
  531 | int drm_sched_job_init(struct drm_sched_job *job,
      |     ^~~~~~~~~~~~~~~~~~
In file included from ./include/uapi/linux/posix_types.h:5,
                 from ./include/uapi/linux/types.h:14,
                 from ./include/linux/types.h:6,
                 from ./include/linux/kasan-checks.h:5,
                 from ./include/asm-generic/rwonce.h:26,
                 from ./arch/x86/include/generated/asm/rwonce.h:1,
                 from ./include/linux/compiler.h:251,
                 from ./include/linux/export.h:5,
                 from ./include/linux/linkage.h:7,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:56,
                 from ./include/linux/kref.h:16,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:7:
/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c: In function ‘amdxdna_hwctx_create’:
./include/linux/stddef.h:8:14: error: passing argument 3 of ‘drm_sched_init’ makes integer from pointer without a cast [-Werror=int-conversion]
    8 | #define NULL ((void *)0)
      |              ^~~~~~~~~~~
      |              |
      |              void *
/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:494:49: note: in expansion of macro ‘NULL’
  494 |         ret = drm_sched_init(sched, &sched_ops, NULL, DRM_SCHED_PRIORITY_COUNT,
      |                                                 ^~~~
In file included from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.h:11,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_drv.h:16,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:12:
./include/drm/gpu_scheduler.h:526:24: note: expected ‘u32’ {aka ‘unsigned int’} but argument is of type ‘void *’
  526 |                    u32 num_rqs, uint32_t hw_submission, unsigned int hang_limit,
      |                    ~~~~^~~~~~~
In file included from ./include/linux/limits.h:7,
                 from ./include/linux/kernel.h:17,
                 from ./arch/x86/include/asm/percpu.h:27,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from ./include/linux/preempt.h:79,
                 from ./include/linux/spinlock.h:56,
                 from ./include/linux/kref.h:16,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:7:
./include/vdso/limits.h:11:25: error: passing argument 7 of ‘drm_sched_init’ makes pointer from integer without a cast [-Werror=int-conversion]
   11 | #define LONG_MAX        ((long)(~0UL >> 1))
      |                         ^~~~~~~~~~~~~~~~~~~
      |                         |
      |                         long int
./include/linux/sched.h:296:41: note: in expansion of macro ‘LONG_MAX’
  296 | #define MAX_SCHEDULE_TIMEOUT            LONG_MAX
      |                                         ^~~~~~~~
/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:495:49: note: in expansion of macro ‘MAX_SCHEDULE_TIMEOUT’
  495 |                              HWCTX_MAX_CMDS, 0, MAX_SCHEDULE_TIMEOUT, NULL,
      |                                                 ^~~~~~~~~~~~~~~~~~~~
In file included from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.h:11,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_drv.h:16,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:12:
./include/drm/gpu_scheduler.h:527:59: note: expected ‘struct workqueue_struct *’ but argument is of type ‘long int’
  527 |                    long timeout, struct workqueue_struct *timeout_wq,
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:496:41: error: passing argument 10 of ‘drm_sched_init’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  496 |                              NULL, hwctx->name, &client->xdna->pdev->dev);
      |                                    ~~~~~^~~~~~
      |                                         |
      |                                         char *
In file included from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.h:11,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_drv.h:16,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:12:
./include/drm/gpu_scheduler.h:528:70: note: expected ‘struct device *’ but argument is of type ‘char *’
  528 |                    atomic_t *score, const char *name, struct device *dev);
      |                                                       ~~~~~~~~~~~~~~~^~~
/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:494:15: error: too many arguments to function ‘drm_sched_init’
  494 |         ret = drm_sched_init(sched, &sched_ops, NULL, DRM_SCHED_PRIORITY_COUNT,
      |               ^~~~~~~~~~~~~~
In file included from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.h:11,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_drv.h:16,
                 from /home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:12:
./include/drm/gpu_scheduler.h:524:5: note: declared here
  524 | int drm_sched_init(struct drm_gpu_scheduler *sched,
      |     ^~~~~~~~~~~~~~
/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c: In function ‘amdxdna_hwctx_destroy_rcu’:
/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:767:9: error: implicit declaration of function ‘drm_sched_wqueue_stop’; did you mean ‘drm_sched_stop’? [-Werror=implicit-function-declaration]
  767 |         drm_sched_wqueue_stop(&hwctx->sched);
      |         ^~~~~~~~~~~~~~~~~~~~~
      |         drm_sched_stop
/home/eric/src/xdna-driver/src/driver/amdxdna/amdxdna_ctx.c:777:9: error: implicit declaration of function ‘drm_sched_wqueue_start’; did you mean ‘drm_sched_start’? [-Werror=implicit-function-declaration]
  777 |         drm_sched_wqueue_start(&hwctx->sched);
      |         ^~~~~~~~~~~~~~~~~~~~~~
      |         drm_sched_start
cc1: all warnings being treated as errors

I guess this happens because there is a build-time dependency on the headers of whatever kernel is currently running, it doesn't happen if you boot with kernel 6.8.