-
Notifications
You must be signed in to change notification settings - Fork 14
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
Update get/set Standard Registers to use VP register page #183
Conversation
53c3cea
to
349a0b5
Compare
@jinankjain What do you think about arm64? I added the wrapper struct to lib.rs, I am open to add a similar regs.rs to arm64 and add the RegisterPage wrapper struct there. |
349a0b5
to
05d26e5
Compare
Yes there would be similar regs for ARM64, but I haven't finalized the set of registers we would need. |
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.
It looks like we need to handle the case where the register page is unavailable, e.g. in encrypted partitions.
5d883df
to
5a74c89
Compare
@NunoDasNeves Please take another look. |
If KVM supports a similar interface, can you check if they require the VMM to explicitly opt-in / enable to use this feature? We want to be careful here. The kernel may decide some day that it also wants to touch that page. |
I do not see any such feature in KVM. @NunoDasNeves What is the kernel scenario in our driver code. Can the driver change the page contents? |
It is all very nebulous in my head, but supposedly one day we may decide we want to do code emulation in Linux kernel, or make the kernel to directly inspect / modify guest register states. We need to be thorough here. If such use cases arise, we need to make sure correctness is maintained. With the current code, the VMM blindly maps the page. It may or may not be okay. I'm looking for the reasoning why the current scheme is okay; if not, what needs to be done. |
The whole purpose of this PR is to speed up the boot process. Mainly the emulation code is accessing GP and Control registers. If you move the emulation in the Kernel later we might remove this mapping from the VMM. |
Actually the code as-is already makes a case for gating that feature with a flag. Mapping the register page can be separated from the guest type.
In general, you should always provide a mechanism to discover features across component boundary. |
For encrypted guest, there is no register page in the driver. that means mmap will fail and we have to store None. |
Why this might be a problem from your POV? |
After a discussion with Wei, I think we need to have some feature sets returned from the Kernel driver and make appropriate features available in the VMM. As a result, I am making this PR draft and continue to work on the Kernel and resume here once Kernel implementation is done. |
When two entities modify the same page in an overlapping manner, there needs to be a way to synchronize them. We don't have a clear model yet. Having a mechanism to clearly denote what feature is available gives us some leeway if something happens in the future. |
ddd96b1
to
9176b81
Compare
9176b81
to
dd9c281
Compare
Generic 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.
LGTM
@liuw PTAL |
dd9c281
to
7a44f34
Compare
@jinankjain Could you please take a look and approve if there is no issue? |
Define a new struct RegisterPage with mutable pointer to hv_vp_register_page. Signed-off-by: Muminul Islam <[email protected]>
Include the register page in vcpu object for later use to read and write the VP registers. Signed-off-by: Muminul Islam <[email protected]>
One more API to VCPU implementation sin signature get_vp_reg_page, that return mutable reference to VP register page. This API could be used by VMM or other VCPU implementations. Signed-off-by: Muminul Islam <[email protected]>
This API use mapped VP register page to set the registers. Signed-off-by: Muminul Islam <[email protected]>
This API uses VP register page to populate the registers. Signed-off-by: Muminul Islam <[email protected]>
7a44f34
to
f98af94
Compare
Summary of the PR
Please summarize here why the changes in this PR are needed.
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.