Skip to content

fix(openhcl_boot): enable swiotlb for VBS-isolated VMs#3752

Open
moor-coding wants to merge 1 commit into
microsoft:mainfrom
moor-coding:swiotlb-vbs-isolation
Open

fix(openhcl_boot): enable swiotlb for VBS-isolated VMs#3752
moor-coding wants to merge 1 commit into
microsoft:mainfrom
moor-coding:swiotlb-vbs-isolation

Conversation

@moor-coding

Copy link
Copy Markdown
Contributor

VBS-isolated VMs need swiotlb because VTL2 private memory is not accessible from VTL0, requiring bounce buffers for DMA. Previously swiotlb=4096,1 was only set for hardware-isolated VMs (TDX/SNP).

Change the condition from is_hardware_isolated() to IsolationType::None to cover all isolation types, including VBS.

VBS-isolated VMs need swiotlb because VTL2 private memory is not
accessible from VTL0, requiring bounce buffers for DMA. Previously
swiotlb=4096,1 was only set for hardware-isolated VMs (TDX/SNP).

Change the condition from is_hardware_isolated() to
IsolationType::None to cover all isolation types, including VBS.
Copilot AI review requested due to automatic review settings June 16, 2026 16:55
@moor-coding moor-coding requested a review from a team as a code owner June 16, 2026 16:55
@github-actions github-actions Bot added the unsafe Related to unsafe code label Jun 16, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon


if params.isolation_type.is_hardware_isolated() {
for p in HARDWARE_ISOLATED_KERNEL_PARAMETERS {
if params.isolation_type != IsolationType::None {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think IsolationType has an is_isolated helper we should use instead.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates openhcl_boot’s kernel command-line construction so SWIOTLB is enabled for all isolated partitions (not just hardware-isolated SNP/TDX), covering VBS isolation where VTL2 private memory is inaccessible to VTL0 DMA.

Changes:

  • Apply swiotlb=4096,1 when isolation_type != IsolationType::None (covers VBS + hardware isolation).
  • Rename/clarify the isolated-vs-non-isolated SWIOTLB parameter grouping (to match the new condition).

Comment on lines 236 to 241
const NON_HARDWARE_ISOLATED_KERNEL_PARAMETERS: &[&str] = &[
// Even with iommu=off, the SWIOTLB is still allocated on AARCH64
// (iommu=off ignored entirely). Set it to the minimum, saving ~63 MiB.
// The first parameter controls the area size, the second controls the
// number of areas (default is # of CPUs). Set them both to the minimum.
"swiotlb=1,1",
@smalis-msft

Copy link
Copy Markdown
Contributor

Just so I can fully understand, how do we give access to VTL 2 private memory to VTL 0 on TDX/SNP? Why can't we do the same on VBS?

@chris-oo

Copy link
Copy Markdown
Member

what device/etc are we enabling in VTL0? i'm confused on why we need this, as isn't swiotlb only for communication with the host, not with VTL0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants