File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -423,7 +423,7 @@ static int viommu_add_resv_mem(struct viommu_endpoint *vdev,
423
423
size_t size ;
424
424
u64 start64 , end64 ;
425
425
phys_addr_t start , end ;
426
- struct iommu_resv_region * region = NULL ;
426
+ struct iommu_resv_region * region = NULL , * next ;
427
427
unsigned long prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO ;
428
428
429
429
start = start64 = le64_to_cpu (mem -> start );
@@ -454,7 +454,12 @@ static int viommu_add_resv_mem(struct viommu_endpoint *vdev,
454
454
if (!region )
455
455
return - ENOMEM ;
456
456
457
- list_add (& region -> list , & vdev -> resv_regions );
457
+ /* Keep the list sorted */
458
+ list_for_each_entry (next , & vdev -> resv_regions , list ) {
459
+ if (next -> start > region -> start )
460
+ break ;
461
+ }
462
+ list_add_tail (& region -> list , & next -> list );
458
463
return 0 ;
459
464
}
460
465
You can’t perform that action at this time.
0 commit comments