From 38dc35cc337e5e079b2a222f9f43cabcab7a037f Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Sat, 7 Mar 2026 15:49:27 -0800 Subject: [PATCH] tests: Add PCI multiple segments test for confidential VMs Add test_pci_multiple_segments to the common_cvm integration test module to verify multiple PCI segment support in confidential guest environments. The test uses 8 PCI segments, which exceeds the Linux default of 6 and matches the maximum supported by the IGVM file for SEV-SNP guests. A test disk is placed on segment 5 to validate cross-segment device functionality. Signed-off-by: Muminul Islam --- cloud-hypervisor/tests/integration.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cloud-hypervisor/tests/integration.rs b/cloud-hypervisor/tests/integration.rs index 745128ce6..a064a5bbb 100644 --- a/cloud-hypervisor/tests/integration.rs +++ b/cloud-hypervisor/tests/integration.rs @@ -15006,4 +15006,16 @@ mod common_cvm { GuestFactory::new_confidential_guest_factory().create_guest(Box::new(disk_config)); _test_virtio_net_ctrl_queue(&guest); } + + #[test] + fn test_pci_multiple_segments() { + // Use 8 segments to test the multiple segment support since it's more than the default 6 + // supported by Linux + // IGVM file used by Sev-Snp Guest now support up to 8 segments, so we can use 8 segments for testing. + let num_pci_segments: u16 = 8; + let disk_config = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string()); + let guest = + GuestFactory::new_confidential_guest_factory().create_guest(Box::new(disk_config)); + _test_pci_multiple_segments(&guest, num_pci_segments, 5); + } }