-
Notifications
You must be signed in to change notification settings - Fork 2
Add new crates iommufd-bindings and iommufd-ioctls
#1
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Bo Chen <[email protected]>
Signed-off-by: Bo Chen <[email protected]>
Signed-off-by: Bo Chen <[email protected]>
Signed-off-by: Bo Chen <[email protected]>
|
@up2wing @rbradford @liuw I think you might be interested. Please take a look. Thank you. |
liuw
left a comment
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.
Ignoring the bindings, the code itself is just provides very simple wrappers.
It looks to me the destroy function is missing.
| description = "Safe wrappers over IOMMUFD uAPIs" | ||
| repository = "https://github.com/cloud-hypervisor/iommufd" | ||
| readme = "README.md" | ||
| edition = "2021" |
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.
Is there a reason to stay on the 2021 edition?
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.
Good callout. Updating it to 2024 edition.
|
sgtm - probably want to setup some basic GH workflows to compile and cross compile for the usual suspects - can probably just copy acpi_tables verbatim: https://github.com/rust-vmm/acpi_tables/blob/main/.github/workflows/quality.yaml Might need to add |
|
Thanks a lot for letting me know. I suppose this is a great start, we can do a lot from here on. |
|
|
||
| [dependencies] | ||
| iommufd-bindings = { version = "0.1.0", path = "../iommufd-bindings" } | ||
| thiserror = "1.0" |
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.
thiserror in the main code version is 2.0.17, how about keep it consistent?
| // and we verify the return value. | ||
| let ret = unsafe { ioctl_with_ref(iommufd, IOMMU_IOAS_UNMAP(), unmap) }; | ||
| if ret < 0 { | ||
| Err(IommufdError::IommuIoasAlloc(SysError::last())) |
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.
IommufdError::IommuIoasMap/Unmap seems to be more clearly.
Right, that's my intention. I want to start with minimum and gradually extend based on what we need. The kernel interfaces are also not fully settled yet. For supporting vfio cdev, that's all what we need from iommufd. To support accelerated IOMMU and shared virtual addressing in the guest, we will need more and let's add them later.
We don't need it for now. Since no dynamic iommufd resource management is involved, we simply rely that all iommufd objects will be "destroyed" when the corresponding iommufd handle is closed. |
|
Thank you all for the fast turn around. I will address these comments later this week. |
The
iommufdworkspace hosts libraries related to Rust bindings and wrappers to the IOMMUFD subsystemfrom the Linux kernel. It currently consists of the following crates:
iommufd-bindings-> Rust FFI bindings to IOMMUFD generated using bindgeniommufd-ioctls-> Safe wrappers over IOMMUFD uAPIsThese crates will be used by the
vfio-ioctlscrate and also Cloud Hypervisor to support the new vfio cdev mode [1].[1] rust-vmm/vfio#92