Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(kernel-rolling) (FTBFS) gpu: Add Support for JM9100 GPU #170

Conversation

MingcongBai
Copy link
Contributor

@MingcongBai MingcongBai commented May 22, 2024

Picked and rebased from #102.

Introduce patches to support JMGPU JM9100 (MWV207).

This pull request requires porting to Kernel versions >= 6.7 due to changes in GPU memory management interfaces (logs pending).

Builds tested

  • amd64
  • arm64
  • loong64

@deepin-ci-robot
Copy link

Hi @MingcongBai. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign liujianqiang-niu for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@MingcongBai MingcongBai changed the title (kernel-rolling) (FTBFS) Add Support for JM9100 GPU (kernel-rolling) (FTBFS) gpu: Add Support for JM9100 GPU May 22, 2024
Add Jemoic JM9100 GPU driver support.

Signed-off-by: WangYuli <[email protected]>
The code styles of this driver is quite frightening.

These files are littered with unaligned comments,
redundant braces, misspellings and other inelegant and
undisciplined code which makes the whole driver has a
huge obstacle before becoming acceptable.

We cannot let this get the way of jemoic GPU.

Signed-off-by: WangYuli <[email protected]>
@MingcongBai MingcongBai force-pushed the bai/kernel-rolling/jm9100 branch from eb80712 to 2e8b96f Compare May 29, 2024 00:35
@MingcongBai
Copy link
Contributor Author

Fails to build on all architectures:

drivers/gpu/drm/mwv207/mwv207_sched.c: In functionmwv207_sched_create’:                                 
drivers/gpu/drm/mwv207/mwv207_sched.c:242:63: error: passing argument 3 ofdrm_sched_initmakes pointer from integer without a cast [-Werror=int-conversion]                                                       
  242 |         ret = drm_sched_init(&sched->base, &mwv207_sched_ops, hw_submission, hang_limit,          
      |                                                               ^~~~~~~~~~~~~                                                                                                                                  
      |                                                               |                                   
      |                                                               unsigned int
In file included from drivers/gpu/drm/mwv207/mwv207_sched.c:16:
./include/drm/gpu_scheduler.h:547:45: note: expectedstruct workqueue_struct *but argument is of type ‘unsigned int547 |                    struct workqueue_struct *submit_wq,
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
drivers/gpu/drm/mwv207/mwv207_submit.c: In functionmwv207_submit_ioctl’:
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/build_bug.h:5,
                 from ./include/linux/init.h:5,
                 from ./include/linux/moduleparam.h:5,
                 from drivers/gpu/drm/mwv207/mwv207_sched.c:15:
./include/linux/stddef.h:8:14: error: passing argument 6 ofdrm_sched_initmakes integer from pointer without a cast [-Werror=int-conversion]
    8 | #define NULL ((void *)0)
      |              ^~~~~~~~~~~
      |              |                               
      |              void *
drivers/gpu/drm/mwv207/mwv207_sched.c:244:25: note: in expansion of macroNULL244 |                         NULL, NULL,
      |                         ^~~~
./include/drm/gpu_scheduler.h:548:64: note: expected ‘unsigned intbut argument is of typevoid *548 |                    u32 num_rqs, u32 credit_limit, unsigned int hang_limit,
      |                                                   ~~~~~~~~~~~~~^~~~~~~~~~
./include/linux/stddef.h:8:14: error: passing argument 7 ofdrm_sched_initmakes integer from pointer without a cast [-Werror=int-conversion]
    8 | #define NULL ((void *)0)
      |              ^~~~~~~~~~~
      |              |                               
      |              void *
drivers/gpu/drm/mwv207/mwv207_sched.c:244:25: note: in expansion of macroNULL244 |                         NULL, NULL,
      |                         ^~~~
./include/drm/gpu_scheduler.h:548:64: note: expected ‘unsigned intbut argument is of typevoid *548 |                    u32 num_rqs, u32 credit_limit, unsigned int hang_limit,
      |                                                   ~~~~~~~~~~~~~^~~~~~~~~~
./include/linux/stddef.h:8:14: error: passing argument 7 ofdrm_sched_initmakes integer from pointer without a cast [-Werror=int-conversion]
    8 | #define NULL ((void *)0)
      |              ^~~~~~~~~~~
      |              |                               
      |              void *
drivers/gpu/drm/mwv207/mwv207_sched.c:244:31: note: in expansion of macroNULL244 |                         NULL, NULL,
      |                               ^~~~
./include/drm/gpu_scheduler.h:549:25: note: expected ‘long intbut argument is of typevoid *549 |                    long timeout, struct workqueue_struct *timeout_wq,
      |                    ~~~~~^~~~~~~
drivers/gpu/drm/mwv207/mwv207_submit.c:599:72: error: passing argument 3 ofdrm_sched_job_initmakes integer from pointer without a cast [-Werror=int-conversion]
  599 |         ret = drm_sched_job_init(&mjob->base, mjob->engine_entity, mjob->ctx);
      |                                                                    ~~~~^~~~~
      |                                                                        |
      |                                                                        struct mwv207_ctx *
drivers/gpu/drm/mwv207/mwv207_sched.c:245:29: error: passing argument 8 ofdrm_sched_initfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  245 |                         pipe->fname, jdev->dev);
      |                         ~~~~^~~~~~~
      |                             |
      |                             const char *
./include/drm/gpu_scheduler.h:549:59: note: expectedstruct workqueue_struct *but argument is of typeconst char *549 |                    long timeout, struct workqueue_struct *timeout_wq,
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/mwv207/mwv207_sched.h:17,
                 from drivers/gpu/drm/mwv207/mwv207_submit.c:20:
./include/drm/gpu_scheduler.h:555:28: note: expectedu32’ {aka ‘unsigned int’} but argument is of typestruct mwv207_ctx *555 |                        u32 credits, void *owner);
      |                        ~~~~^~~~~~~
drivers/gpu/drm/mwv207/mwv207_sched.c:245:42: error: passing argument 9 ofdrm_sched_initfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  245 |                         pipe->fname, jdev->dev);
      |                                      ~~~~^~~~~
      |                                          |
      |                                          struct device *
./include/drm/gpu_scheduler.h:550:30: note: expectedatomic_t *but argument is of typestruct device *550 |                    atomic_t *score, const char *name, struct device *dev);
      |                    ~~~~~~~~~~^~~~~
drivers/gpu/drm/mwv207/mwv207_sched.c:242:15: error: too few arguments to functiondrm_sched_init242 |         ret = drm_sched_init(&sched->base, &mwv207_sched_ops, hw_submission, hang_limit,
      |               ^~~~~~~~~~~~~~
./include/drm/gpu_scheduler.h:545:5: note: declared here
  545 | int drm_sched_init(struct drm_gpu_scheduler *sched,
      |     ^~~~~~~~~~~~~~                           
drivers/gpu/drm/mwv207/mwv207_submit.c:599:15: error: too few arguments to functiondrm_sched_job_init599 |         ret = drm_sched_job_init(&mjob->base, mjob->engine_entity, mjob->ctx);
      |               ^~~~~~~~~~~~~~~~~~
./include/drm/gpu_scheduler.h:553:5: note: declared here
  553 | int drm_sched_job_init(struct drm_sched_job *job,
      |     ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/mwv207/mwv207_sched.c: In functionmwv207_sched_suspend’:
drivers/gpu/drm/mwv207/mwv207_sched.c:276:48: error: ‘struct drm_gpu_schedulerhas no member namedhw_rq_count276 |                 if (atomic_read(&jdev->sched[i]->hw_rq_count))
      |                                                ^~
cc1: all warnings being treated as errors

@Avenger-285714 @opsiff

MingcongBai pushed a commit to MingcongBai/deepin-kernel that referenced this pull request Jun 17, 2024
[ Upstream commit 8ecf3c1 ]

Recent additions in BPF like cpu v4 instructions, test_bpf module
exhibits the following failures:

  test_bpf: deepin-community#82 ALU_MOVSX | BPF_B jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
  test_bpf: deepin-community#83 ALU_MOVSX | BPF_H jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
  test_bpf: deepin-community#84 ALU64_MOVSX | BPF_B jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
  test_bpf: deepin-community#85 ALU64_MOVSX | BPF_H jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
  test_bpf: deepin-community#86 ALU64_MOVSX | BPF_W jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)

  test_bpf: deepin-community#165 ALU_SDIV_X: -6 / 2 = -3 jited:1 ret 2147483645 != -3 (0x7ffffffd != 0xfffffffd)FAIL (1 times)
  test_bpf: deepin-community#166 ALU_SDIV_K: -6 / 2 = -3 jited:1 ret 2147483645 != -3 (0x7ffffffd != 0xfffffffd)FAIL (1 times)

  test_bpf: deepin-community#169 ALU_SMOD_X: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)
  test_bpf: deepin-community#170 ALU_SMOD_K: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)

  test_bpf: deepin-community#172 ALU64_SMOD_K: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)

  test_bpf: deepin-community#313 BSWAP 16: 0x0123456789abcdef -> 0xefcd
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 301 PASS
  test_bpf: deepin-community#314 BSWAP 32: 0x0123456789abcdef -> 0xefcdab89
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 555 PASS
  test_bpf: deepin-community#315 BSWAP 64: 0x0123456789abcdef -> 0x67452301
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 268 PASS
  test_bpf: deepin-community#316 BSWAP 64: 0x0123456789abcdef >> 32 -> 0xefcdab89
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 269 PASS
  test_bpf: deepin-community#317 BSWAP 16: 0xfedcba9876543210 -> 0x1032
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 460 PASS
  test_bpf: deepin-community#318 BSWAP 32: 0xfedcba9876543210 -> 0x10325476
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 320 PASS
  test_bpf: deepin-community#319 BSWAP 64: 0xfedcba9876543210 -> 0x98badcfe
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 222 PASS
  test_bpf: deepin-community#320 BSWAP 64: 0xfedcba9876543210 >> 32 -> 0x10325476
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 273 PASS

  test_bpf: deepin-community#344 BPF_LDX_MEMSX | BPF_B
  eBPF filter opcode 0091 (@5) unsupported
  jited:0 432 PASS
  test_bpf: deepin-community#345 BPF_LDX_MEMSX | BPF_H
  eBPF filter opcode 0089 (@5) unsupported
  jited:0 381 PASS
  test_bpf: deepin-community#346 BPF_LDX_MEMSX | BPF_W
  eBPF filter opcode 0081 (@5) unsupported
  jited:0 505 PASS

  test_bpf: deepin-community#490 JMP32_JA: Unconditional jump: if (true) return 1
  eBPF filter opcode 0006 (@1) unsupported
  jited:0 261 PASS

  test_bpf: Summary: 1040 PASSED, 10 FAILED, [924/1038 JIT'ed]

Fix them by adding missing processing.

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Christophe Leroy <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/91de862dda99d170697eb79ffb478678af7e0b27.1709652689.git.christophe.leroy@csgroup.eu
Signed-off-by: Sasha Levin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants