Skip to content

Fix: Update Config structures to accurately reflect TCBs#314

Merged
tylerfanelli merged 1 commit into
virtee:mainfrom
DGonzalezVillal:commit-fix
Jul 28, 2025
Merged

Fix: Update Config structures to accurately reflect TCBs#314
tylerfanelli merged 1 commit into
virtee:mainfrom
DGonzalezVillal:commit-fix

Conversation

@DGonzalezVillal

@DGonzalezVillal DGonzalezVillal commented Jul 15, 2025

Copy link
Copy Markdown
Member

When we updated the TCB structure, we overlooked modifying the config-related structures to account for differences in TCB layout across CPU generations.
This commit ensures that raw TCB bytes are correctly constructed for the FFI layer, and that conversions from the user-level structure to the FFI format use the appropriate TCB structure based on the processor generation.

Comment thread src/firmware/host/mod.rs Outdated
@DGonzalezVillal DGonzalezVillal force-pushed the commit-fix branch 3 times, most recently from f4afa2f to ab943c0 Compare July 21, 2025 22:06
@DGonzalezVillal

Copy link
Copy Markdown
Member Author

@tylerfanelli Returned it to original api functionality, let me know how it looks

Comment thread src/firmware/host/types/snp.rs Outdated
@DGonzalezVillal DGonzalezVillal changed the title Fix: Update Commit structures to accurately reflect TCBs Fix: Update CoNFIG structures to accurately reflect TCBs Jul 22, 2025
@DGonzalezVillal DGonzalezVillal changed the title Fix: Update CoNFIG structures to accurately reflect TCBs Fix: Update Config structures to accurately reflect TCBs Jul 22, 2025
When we updated the TCB structure, we overlooked modifying the
commit-related structures to account for differences in TCB layout
across CPU generations.
This commit ensures that raw TCB bytes are correctly constructed for
the FFI layer, and that conversions from the user-level structure to the
FFI format use the appropriate TCB structure based on the processor
generation.
The API snp_set_config function remains the same, it will tell the CPU
generation using a CPUID call.

Signed-off-by: DGonzalezVillal <Diego.GonzalezVillalobos@amd.com>

#[cfg(feature = "snp")]
/// TryFrom to FFI Config when manually passing in the CPU generation
impl TryFrom<(Config, Generation)> for FFI::types::SnpSetConfig {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is this used?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created both implementations in the previous version of the commit: one where we don’t retrieve the CPU generation automatically, and the user provides it manually. I kept this implementation in case we ever want to change the API or if a user wants to create configurations for hosts that are not their current machine.

I'm not sure if these are reasonable use cases. This implementation is currently unused in the library—if you think it’s unnecessary, I’m happy to remove it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I guess it doesn't hurt to include.


#[cfg(feature = "snp")]
/// TryFrom from FFI Config type when CPU Generation is manually passed in
impl TryFrom<(FFI::types::SnpSetConfig, Generation)> for Config {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This as well. In what context is this used?

@tylerfanelli tylerfanelli merged commit d9ffcc7 into virtee:main Jul 28, 2025
123 checks passed
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.

3 participants