Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions openhcl/openhcl_boot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,10 @@ fn build_kernel_command_line(
write!(cmdline, "{p} ")?;
}

const HARDWARE_ISOLATED_KERNEL_PARAMETERS: &[&str] = &[
// Even with iommu=off, the SWIOTLB is still allocated on AARCH64
// (iommu=off ignored entirely), and CVMs (memory encryption forces it
// on). Set it to a single area in 8MB. The first parameter controls the
// area size in slabs (2KB per slab), the second controls the number of
// areas (default is # of CPUs).
//
// This is set to 8MB on hardware isolated VMs since there are some
// scenarios, such as provisioning over DVD, which require a larger size
// since the buffer is being used.
// Set SWIOTLB to 8MB for all isolated VMs. Hardware-isolated VMs
// (TDX/SNP) need it for memory encryption, and VBS-isolated VMs need
// it because VTL2 private memory is not accessible from VTL0.
const ISOLATED_KERNEL_PARAMETERS: &[&str] = &[
"swiotlb=4096,1",
];

Expand All @@ -247,8 +241,8 @@ fn build_kernel_command_line(
"swiotlb=1,1",
];

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.

for p in ISOLATED_KERNEL_PARAMETERS {
write!(cmdline, "{p} ")?;
}
} else {
Expand Down
Loading