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

TDX: Support VTL0 IOMMU posted interrupts + interrupt relay #384

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

balajimc55
Copy link

Implements tdx: Implement posted-interrupt support for DDA devices + relaying device interrupts from VTL2 to VTL0 #362

(Needs kernel change to support interrupt remap IOCTL. Without that, this will break device interrupt delivery to vtl0)

@@ -119,12 +119,14 @@ pub struct hcl_run {
pub vtl_ret_action_size: u32,
pub flags: u32,
pub scan_proxy_irr: u8,
pub scan_device_irr: u8,
Copy link
Member

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.

/// 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>()) };
Copy link
Member

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

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

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.

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.

2 participants