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

Introduce riscv64 ioctls #275

Merged
merged 17 commits into from
Oct 17, 2024

Conversation

TimePrinciple
Copy link

@TimePrinciple TimePrinciple commented Aug 16, 2024

Summary of the PR

Add basic support for riscv64 architecture.

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

@TimePrinciple TimePrinciple changed the title [WIP] Introduce riscv64 ioctls Introduce riscv64 ioctls Aug 25, 2024
@TimePrinciple TimePrinciple changed the title Introduce riscv64 ioctls [WIP] Introduce riscv64 ioctls Aug 26, 2024
@TimePrinciple TimePrinciple force-pushed the introduce-riscv-architecture branch from 82a9738 to 949d881 Compare September 9, 2024 08:42
@TimePrinciple TimePrinciple force-pushed the introduce-riscv-architecture branch 8 times, most recently from 196ed61 to 7af51e7 Compare September 26, 2024 02:31
@TimePrinciple
Copy link
Author

TimePrinciple commented Sep 26, 2024

How strange, I have no clue why test_pit2 suddenly fails to pass :(

@TimePrinciple TimePrinciple force-pushed the introduce-riscv-architecture branch from f25196d to 7af51e7 Compare September 26, 2024 05:37
@roypat roypat mentioned this pull request Sep 26, 2024
4 tasks
@TimePrinciple TimePrinciple force-pushed the introduce-riscv-architecture branch 7 times, most recently from 000ed57 to b91a622 Compare October 3, 2024 05:43
@TimePrinciple TimePrinciple force-pushed the introduce-riscv-architecture branch 2 times, most recently from 2672bac to 65c1aed Compare October 3, 2024 16:32
Copy link
Contributor

@rbradford rbradford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool - thanks!

src/ioctls/vcpu.rs Show resolved Hide resolved
src/ioctls/vcpu.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
rbradford
rbradford previously approved these changes Oct 7, 2024
Copy link
Collaborator

@roypat roypat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took me a while to get to this :(

I'm trusting Rob on his assessment of the riscv bits, my comments are largely about code organization

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/ioctls/device.rs Outdated Show resolved Hide resolved
src/ioctls/device.rs Outdated Show resolved Hide resolved
src/ioctls/vcpu.rs Show resolved Hide resolved
src/ioctls/vcpu.rs Outdated Show resolved Hide resolved
src/ioctls/vcpu.rs Outdated Show resolved Hide resolved
src/ioctls/vcpu.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
Limit `get_reg_list` doc example to run on ARM64 only, since
`get_reg_list` is for ARM64 and RISC-V64 but 500 registers are too big
for RISC-V (a value between 180~200).

Signed-off-by: Ruoqing He <[email protected]>
src/ioctls/device.rs Outdated Show resolved Hide resolved
src/ioctls/device.rs Outdated Show resolved Hide resolved
Originally `set_device_attr` uses VFIO device for testing, but that's
not available yet on RISC-V 64-bit platform, the QEMU patch [1] and
kernel patch [2] are not upstreamed. Disabling VFIO device test for
RISC-V at the time being.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://github.com/ventanamicro/linux/tree/dev-upstream

Signed-off-by: Ruoqing He <[email protected]>
Complete `create_device` doc test to create the creation of AIA device
on RISC-V 64-bit platform.

Signed-off-by: Ruoqing He <[email protected]>
RISC-V 64-bit requires an in-kernel interrupt chip (AIA) to be created
in advance of committing `gsi_routing_table`.

Signed-off-by: Ruoqing He <[email protected]>
Add assembly code which does dirty one page and forces MMIO exit on
RISC-V 64-bit platform to complete `get_dirty_log` doc test.

Signed-off-by: Ruoqing He <[email protected]>
Add example which triggers an MMIO exit after creating a dirty page.

Signed-off-by: Ruoqing He <[email protected]>
Add:

- `test_run_code`
- `mpstate_test`
- `test_faulty_vcpu_fd`
- `test_faulty_vcpu_fd_riscv64`
- `test_get_reg_list`
- `test_set_one_reg`
- `test_get_one_reg`

tests.

Signed-off-by: Ruoqing He <[email protected]>
@TimePrinciple TimePrinciple force-pushed the introduce-riscv-architecture branch from b84bee7 to 8dfb50a Compare October 15, 2024 07:16
@TimePrinciple TimePrinciple requested a review from roypat October 15, 2024 07:34
@TimePrinciple
Copy link
Author

@rbradford @roypat please take another look :)

Copy link
Contributor

@rbradford rbradford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking really good!

src/ioctls/device.rs Outdated Show resolved Hide resolved
src/ioctls/vm.rs Outdated Show resolved Hide resolved
Add `test_create_device` to verify that vAIA device works on riscv64.

Signed-off-by: Ruoqing He <[email protected]>
Add:

- `test_register_unregister_irqfd`
- `test_set_irq_line`
- `test_singal_msi_failure`
- `test_set_gsi_routing`

tests.

Signed-off-by: Ruoqing He <[email protected]>
Compilation would fail with previous code on other architectures don't
have `create_irq_chip` available. Repurpose this unit test to work on
all architectures.

Signed-off-by: Ruoqing He <[email protected]>
Add `.platform` to enable CI on riscv64 platform.

Signed-off-by: Ruoqing He <[email protected]>
Update `CHANGELOG.md` to document added riscv64 ioctls.

Signed-off-by: Ruoqing He <[email protected]>
Update `README.md` since riscv64 is introduced as experimental.

Signed-off-by: Ruoqing He <[email protected]>
@TimePrinciple TimePrinciple force-pushed the introduce-riscv-architecture branch from 8dfb50a to 51c092b Compare October 16, 2024 10:11
@rbradford rbradford merged commit b26d74c into rust-vmm:main Oct 17, 2024
23 checks passed
@TimePrinciple TimePrinciple deleted the introduce-riscv-architecture branch October 17, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants