@@ -13,6 +13,7 @@ use vmm_test_macros::openvmm_test;
1313use vmm_test_macros:: openvmm_test_no_agent;
1414use vmm_test_macros:: vmm_test_no_agent;
1515
16+ #[ derive( Debug ) ]
1617struct ExpectedNvmeDeviceProperties {
1718 save_restore_supported : bool ,
1819 qsize : u64 ,
@@ -32,18 +33,22 @@ struct ExpectedNvmeDeviceProperties {
3233async fn nvme_relay_test_core (
3334 config : PetriVmBuilder < OpenVmmPetriBackend > ,
3435 openhcl_cmdline : & str ,
36+ processor_topology : Option < ProcessorTopology > ,
37+ vtl2_base_address_type : Option < hvlite_defs:: config:: Vtl2BaseAddressType > ,
3538 props : Option < ExpectedNvmeDeviceProperties > ,
3639) -> Result < ( ) , anyhow:: Error > {
3740 let ( vm, agent) = config
3841 . with_openhcl_command_line ( openhcl_cmdline)
3942 . with_vmbus_redirect ( true )
40- . with_processor_topology ( ProcessorTopology {
43+ . with_processor_topology ( processor_topology . unwrap_or ( ProcessorTopology {
4144 vp_count : 4 , // Ideally, with 16GB RAM to match D4v5
4245 ..Default :: default ( )
43- } )
44- . with_vtl2_base_address_type ( hvlite_defs:: config:: Vtl2BaseAddressType :: Vtl2Allocate {
45- size : Some ( 512 * 1024 * 1024 ) , // 512MB to be more than what is defined in the dev manifest json
46- } )
46+ } ) )
47+ . with_vtl2_base_address_type ( vtl2_base_address_type. unwrap_or (
48+ hvlite_defs:: config:: Vtl2BaseAddressType :: Vtl2Allocate {
49+ size : Some ( 512 * 1024 * 1024 ) , // 512MB to be more than what is defined in the dev manifest json
50+ } ,
51+ ) )
4752 . run ( )
4853 . await ?;
4954
@@ -152,7 +157,7 @@ async fn nvme_relay_test_core(
152157/// linux, with vmbus relay. This should expose a disk to VTL0 via vmbus.
153158#[ openvmm_test( openhcl_uefi_x64[ nvme] ( vhd( ubuntu_2504_server_x64) ) ) ]
154159async fn nvme_relay ( config : PetriVmBuilder < OpenVmmPetriBackend > ) -> Result < ( ) , anyhow:: Error > {
155- nvme_relay_test_core ( config, "" , None ) . await
160+ nvme_relay_test_core ( config, "" , None , None , None ) . await
156161}
157162
158163/// Test an OpenHCL uefi VM with a NVME disk assigned to VTL2 that boots
@@ -167,6 +172,69 @@ async fn nvme_relay_private_pool(
167172 nvme_relay_test_core (
168173 config,
169174 "OPENHCL_ENABLE_VTL2_GPA_POOL=512" ,
175+ None ,
176+ None ,
177+ Some ( ExpectedNvmeDeviceProperties {
178+ save_restore_supported : true ,
179+ qsize : 256 , // private pool should allow contiguous allocations.
180+ nvme_keepalive : false ,
181+ } ) ,
182+ )
183+ . await
184+ }
185+
186+ /// Test an OpenHCL uefi VM with a NVME disk assigned to VTL2 that boots
187+ /// linux, with vmbus relay. This should expose a disk to VTL0 via vmbus.
188+ ///
189+ /// There _should_ be enough private pool memory for the NVMe driver to
190+ /// allocate all of its buffers contiguously.
191+ #[ cfg( not( debug_assertions) ) ]
192+ #[ openvmm_test( openhcl_uefi_x64[ nvme] ( vhd( ubuntu_2504_server_x64) ) ) ]
193+ async fn nvme_relay_private_16vp_256mb (
194+ config : PetriVmBuilder < OpenVmmPetriBackend > ,
195+ ) -> Result < ( ) , anyhow:: Error > {
196+ nvme_relay_test_core (
197+ config,
198+ "" ,
199+ Some ( ProcessorTopology {
200+ vp_count : 16 ,
201+ ..Default :: default ( )
202+ } ) ,
203+ Some ( hvlite_defs:: config:: Vtl2BaseAddressType :: Vtl2Allocate {
204+ size : Some ( 256 * 1024 * 1024 ) ,
205+ } ) ,
206+ Some ( ExpectedNvmeDeviceProperties {
207+ save_restore_supported : true ,
208+ qsize : 256 , // private pool should allow contiguous allocations.
209+ nvme_keepalive : false ,
210+ } ) ,
211+ )
212+ . await
213+ }
214+
215+ /// Test an OpenHCL uefi VM with a NVME disk assigned to VTL2 that boots
216+ /// linux, with vmbus relay. This should expose a disk to VTL0 via vmbus.
217+ ///
218+ /// There _should_ be enough private pool memory for the NVMe driver to
219+ /// allocate all of its buffers contiguously.
220+ ///
221+ /// This test uses 500MB of private pool memory, which does *not* match any
222+ /// of the heuristics exactly, but there should still be private pool memory.
223+ #[ cfg( not( debug_assertions) ) ]
224+ #[ openvmm_test( openhcl_uefi_x64[ nvme] ( vhd( ubuntu_2504_server_x64) ) ) ]
225+ async fn nvme_relay_private_32vp_500mb (
226+ config : PetriVmBuilder < OpenVmmPetriBackend > ,
227+ ) -> Result < ( ) , anyhow:: Error > {
228+ nvme_relay_test_core (
229+ config,
230+ "" ,
231+ Some ( ProcessorTopology {
232+ vp_count : 32 ,
233+ ..Default :: default ( )
234+ } ) ,
235+ Some ( hvlite_defs:: config:: Vtl2BaseAddressType :: Vtl2Allocate {
236+ size : Some ( 500 * 1024 * 1024 ) ,
237+ } ) ,
170238 Some ( ExpectedNvmeDeviceProperties {
171239 save_restore_supported : true ,
172240 qsize : 256 , // private pool should allow contiguous allocations.
0 commit comments