Skip to content

Commit

Permalink
Extend TdInfo struct to add vcpu_index field
Browse files Browse the repository at this point in the history
Signed-off-by: OuyangHang33 <[email protected]>
  • Loading branch information
OuyangHang33 committed Jun 17, 2024
1 parent ac333c7 commit f1b9358
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion td-shim/src/bin/td-shim/td/tdx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn get_num_vcpus() -> u32 {
let td_info = tdx::tdcall_get_td_info().expect("Fail to get TDINFO");

log::info!("gpaw - {:?}\n", td_info.gpaw);
log::info!("num_vcpus - {:?}\n", td_info.num_vcpus);
log::info!("num_vcpus - {:?} \n", td_info.num_vcpus);

td_info.num_vcpus
}
Expand Down
4 changes: 3 additions & 1 deletion tdx-tdcall/src/tdx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ pub struct TdInfo {
pub attributes: u64,
pub max_vcpus: u32,
pub num_vcpus: u32,
pub rsvd: [u64; 3],
pub vcpu_index: u32,
pub rsvd: [u32; 5],
}

/// Virtualization exception information returned from TDG.VP.VEINFO.GET leaf
Expand Down Expand Up @@ -504,6 +505,7 @@ pub fn tdcall_get_td_info() -> Result<TdInfo, TdCallError> {
attributes: args.rdx,
max_vcpus: (args.r8 >> 32) as u32,
num_vcpus: args.r8 as u32,
vcpu_index: args.r9 as u32,
..Default::default()
};

Expand Down

0 comments on commit f1b9358

Please sign in to comment.