iommu_gas: initialize start_gap as first node

In iommu_gas.c, domain->start_gap points to one of the nodes on either
side of the first free, unallocated range. In iommu_gas_init_domain,
it is initialized to point to the node after the single free
range. Change it to point to the node before that free range, so that,
when 'lowaddr' is within the initial free range, the first allocation
search for free space below 'lowaddr' does not begin and end at an
address above 'lowaddr'. This fixes problems on a machine with Intel
DMAR enabled.

Reported by:	jah
Reviewed by:	dougm
Tested by:	jah
Obtained from:	jah
Fixes:	commit db151ca0c3 iommu_gas: start space search from 1st free space
MFC after:	1 day
This commit is contained in:
Doug Moore 2023-02-08 11:04:13 -06:00
parent 8b418c83d1
commit 87d405eab9

View File

@ -264,7 +264,7 @@ iommu_gas_init_domain(struct iommu_domain *domain)
begin->flags = IOMMU_MAP_ENTRY_PLACE | IOMMU_MAP_ENTRY_UNMAPPED;
RB_INSERT_PREV(iommu_gas_entries_tree, &domain->rb_root, end, begin);
domain->start_gap = end;
domain->start_gap = begin;
domain->first_place = begin;
domain->last_place = end;
domain->flags |= IOMMU_DOMAIN_GAS_INITED;