-
Notifications
You must be signed in to change notification settings - Fork 50
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
vhost-device-spi: Add initial implementation #640
Conversation
@HaixuCui sorry, I'm a bit confused, this PR is named "vhost-device-console: Add initial implementation" and we already have another PR #601, but looking in the code and in the PR description it looks like this PR is not covering the console device. I suppose the PR title is wrong. Please, can you clarify? Can you also check the CI failures? (note: cargo-audit failure is expected, see #639 ) |
98f0c09
to
5d11c40
Compare
@stefano-garzarella Yes the title was wrong, I have changed, it's vhost-user-spi, thanks |
d665491
to
18f5cb4
Compare
Hi all, my CI only has two jobs and both failed with the error log: git clone -v -- https://github.com/rust-vmm/vhost-device.git . Could you please give me some clue, what should I do to resolve this? Thank you very much. |
It looks like this is unrelated. I'll check what is going on with our CI. |
@HaixuCui please, can you commit the changes to |
18f5cb4
to
24f38da
Compare
Hello @stefano-garzarella , I add vhost-user-spi package in Cargo.lock. Thanks! |
Hi @stefano-garzarella, I found the CI was workable before my last commit, and after I commit the Cargo.lock, it failed again with the same error I mentioned before. |
@HaixuCui sorry about that, but we have problems with CI that we are investigating. For a moment it ran again because we manually removed the problematic file. We're figuring out why, I'll keep you updated. |
The SPI_IOC_RD_MODE32 definition leads to such CI error: literal out of range for But now the type of SPI_IOC_RD_MODE32 is libc::c_int, it's signed and defined explicitly, why the compiler treat its value 0x80046b05 as unsigned, and try to fit Solution:
Do you have any suggestions? Thank you very much. |
What about using the ioctl macros from vmm-sys-util? For example we used in https://github.com/rust-vmm/vhost/blob/2a89b283fad40047adb991ae3f5b958e5b4270d7/vhost/src/vhost_kern/vhost_binding.rs#L46 We build vhost for musl and glibc without issues, so I guess it already handles it internally. |
1877bb6
to
db61a97
Compare
Hello @stefano-garzarella, many thanks for your support, the CI errors are resolved. Now there are two errors, cargo-audit-x86_64 and coverage-x86_64. Are they expected? As you mentioned before cargo-audit is an known issue. Can the review process begin now, or need to wait for the cargo audit fixed? Thank you so much, again |
Great!
I just opened #641 for the cargo-audit issue. About coverage, it should be green, so you have 2 ways, add more tests or adapt the value in
It can start, but I'm not sure if I have time this week, sorry :-( |
557d3fe
to
ae5d38f
Compare
673484d
to
b821f91
Compare
2726ea9
to
0dd17b6
Compare
Hi @stefano-garzarella , @epilys I add some test cases, but the coverage only improved slightly. I cannot add testcase to cover Another point is that, after using reader/writer mode of
Now I have no testcase in mind, and there is still 0.55% deviation. Do you have any idea about improving the coverage? Thank you very much. |
I haven't had time to check, but don't worry, 0.55% deviation is acceptable, go ahead and edit |
It could be mocked but for such a low percentile point we could ignore it for now.
We have that issue in this repository generally, it'd be nice to have mocking with error condition checks but it's a project on its own, out of the scope of this PR! So let's ignore that for now too. |
68071be
to
058cec6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HaixuCui could you rebase on top of main
? I don't have access to the CodeLinaro
organisation otherwise I'd do it myself.
This program is a vhost-user backend that emulates a VirtIO SPI bus. This program takes the layout of the spi bus and its devices on the host OS and then talks to them via the /dev/spidevX.Y interface when a request comes from the guest OS for a SPI device. The implementation corresponds with the specification: https://github.com/oasis-tcs/virtio-spec/tree/virtio-1.4/device-types/spi Signed-off-by: Haixu Cui <[email protected]>
Summary of the PR
This program is a vhost-user backend that emulates a VirtIO SPI bus. This program takes the layout of the spi bus and its devices on the host OS and then talks to them via the /dev/spidevX.Y interface when a request comes from the guest OS for a SPI device.
The implementation corresponds with the specification: https://github.com/oasis-tcs/virtio-spec/tree/virtio-1.4/device-types/spi
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s
), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafe
code is properly documented.