@@ -108,27 +108,6 @@ impl ResourceAllocator {
108108 pub fn allocate_gsi_msi ( & mut self , gsi_count : u32 ) -> Result < Vec < u32 > , vm_allocator:: Error > {
109109 allocate_many_ids ( & mut self . gsi_msi_allocator , gsi_count)
110110 }
111-
112- /// Allocate a memory range for system data
113- ///
114- /// If it succeeds, it returns the first address of the allocated range
115- ///
116- /// # Arguments
117- ///
118- /// * `size` - The size in bytes of the memory to allocate
119- /// * `alignment` - The alignment of the address of the first byte
120- /// * `policy` - A [`vm_allocator::AllocPolicy`] variant for determining the allocation policy
121- pub fn allocate_system_memory (
122- & mut self ,
123- size : u64 ,
124- alignment : u64 ,
125- policy : AllocPolicy ,
126- ) -> Result < u64 , vm_allocator:: Error > {
127- Ok ( self
128- . system_memory
129- . allocate ( size, alignment, policy) ?
130- . start ( ) )
131- }
132111}
133112
134113impl < ' a > Persist < ' a > for ResourceAllocator {
@@ -150,8 +129,6 @@ impl<'a> Persist<'a> for ResourceAllocator {
150129
151130#[ cfg( test) ]
152131mod tests {
153- use vm_allocator:: AllocPolicy ;
154-
155132 use super :: ResourceAllocator ;
156133 use crate :: arch:: { self , GSI_LEGACY_NUM , GSI_LEGACY_START , GSI_MSI_NUM , GSI_MSI_START } ;
157134 use crate :: snapshot:: Persist ;
@@ -263,23 +240,11 @@ mod tests {
263240 assert_eq ! ( irq_1, GSI_LEGACY_START + 1 ) ;
264241 let gsi_1 = allocator1. allocate_gsi_msi ( 1 ) . unwrap ( ) [ 0 ] ;
265242 assert_eq ! ( gsi_1, GSI_MSI_START + 1 ) ;
266- let system_mem = allocator1
267- . allocate_system_memory ( 0x42 , 1 , AllocPolicy :: FirstMatch )
268- . unwrap ( ) ;
269- assert_eq ! ( system_mem, arch:: SYSTEM_MEM_START ) ;
270243
271244 let mut allocator2 = clone_allocator ( & allocator1) ;
272- allocator2
273- . allocate_system_memory ( 0x42 , 1 , AllocPolicy :: ExactMatch ( system_mem) )
274- . unwrap_err ( ) ;
275-
276245 let irq_2 = allocator2. allocate_gsi_legacy ( 1 ) . unwrap ( ) [ 0 ] ;
277246 assert_eq ! ( irq_2, GSI_LEGACY_START + 2 ) ;
278247 let gsi_2 = allocator2. allocate_gsi_msi ( 1 ) . unwrap ( ) [ 0 ] ;
279248 assert_eq ! ( gsi_2, GSI_MSI_START + 2 ) ;
280- let system_mem = allocator1
281- . allocate_system_memory ( 0x42 , 1 , AllocPolicy :: FirstMatch )
282- . unwrap ( ) ;
283- assert_eq ! ( system_mem, arch:: SYSTEM_MEM_START + 0x42 ) ;
284249 }
285250}
0 commit comments