-
Notifications
You must be signed in to change notification settings - Fork 151
TDX: Support VTL0 IOMMU posted interrupts + interrupt relay #384
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?
TDX: Support VTL0 IOMMU posted interrupts + interrupt relay #384
Conversation
openhcl/hcl/src/protocol.rs
Outdated
pub vtl_ret_action_size: u32, | ||
pub flags: u32, | ||
pub scan_proxy_irr: u8, | ||
pub scan_device_irr: u8, |
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.
we'd want these in the tdx specific portion of the struct, i think.
openhcl/hcl/src/ioctl.rs
Outdated
/// Update vtl0 device interrupt map | ||
pub fn set_device_irr_map(&self, remapped_vector: u8, target_vector: u8) { | ||
// update target(vtl0) to remaped(vtl2) vector mapping | ||
let device_irr_remapped_vector = unsafe { &*(addr_of!(self.device_irr_target_to_remapped_vector[target_vector as usize]).cast::<AtomicU8>()) }; |
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.
this unsafe will not fly - either declare it as atomic u8 upfront or we may need a different kind of data structure if we do expect multiple vps to access this, which is possible
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.
Agreed. do you have any suggestions on where the vector mapping information can be stored? Currently I am storing it in the Hcl struct.
We want to write to this structure from the intercept routine for retarget_interrupt hypercall but this does not have mutable access to Hcl structure.
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.
this is shared partition wide, right? let me think about it.
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.
Correct. It is partition wide. Update to the struct is needed only during device initialization but needs to be read during every device interrupt delivery.
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 way we can reuse the mechanisms for proxy_irr filtering, or would that not work? As long as we update the mapping table on each CPU before we issue the retarget hypercall, we should be fine right?
3428524
to
74f9200
Compare
openhcl/underhill_core/src/worker.rs
Outdated
// | ||
// This improves performance for VTL0 owned devices by avoiding exits to VMM for device | ||
// interrupt delivery. | ||
let use_posted_redirection = match isolation { |
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.
i thought we read the enlightenments already somewhere else?
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.
I found only one other query to read the hv enlightenment cpuid leaf, I pushed a cleanup that combines both queries to a single cpuid call.
entry, | ||
redirected_vector, | ||
multicast, | ||
target_processors, |
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.
do we need to tell the kernel which processors are going to get this interrupt, or will the mapping table be global?
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.
The mapping table (maintained in kernel) is only for VTL2 vector to VTL0 vector translation and that doesn't need to be processor specific.
Tagging @ricardon for any opens on kernel changes.
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.
Indeed, the table is global.
Can you rebase this change onto the latest main so I can review again? |
Done |
Implements tdx: Implement posted-interrupt support for DDA devices + relaying device interrupts from VTL2 to VTL0 #362
Has dependency on OHCL kernel and Hype-V changes