diff options
| author | Doug Moore <dougm@FreeBSD.org> | 2022-06-09 04:14:28 +0000 |
|---|---|---|
| committer | Doug Moore <dougm@FreeBSD.org> | 2022-06-09 04:14:28 +0000 |
| commit | 30031172534c22695ab7b26a9420bda7b20b0824 (patch) | |
| tree | 9072557d03f91285e0579519a423ac65162fc943 /sys/dev/iommu | |
| parent | 1d2e46d40861aff2e4f3147e7a242e7bc808978e (diff) | |
Diffstat (limited to 'sys/dev/iommu')
| -rw-r--r-- | sys/dev/iommu/iommu_gas.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index 78dd86c1f255..5b589e999926 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -377,14 +377,6 @@ iommu_gas_lowermatch(struct iommu_gas_match_args *a, struct iommu_map_entry *ent { struct iommu_map_entry *child; - child = RB_RIGHT(entry, rb_entry); - if (child != NULL && entry->end < a->common->lowaddr && - iommu_gas_match_one(a, entry->end, child->first, - a->common->lowaddr)) { - iommu_gas_match_insert(a); - return (0); - } - /* * If the subtree doesn't have free space for the requested allocation * plus two guard pages, give up. @@ -393,16 +385,22 @@ iommu_gas_lowermatch(struct iommu_gas_match_args *a, struct iommu_map_entry *ent return (ENOMEM); if (entry->first >= a->common->lowaddr) return (ENOMEM); - child = RB_LEFT(entry, rb_entry); + child = RB_RIGHT(entry, rb_entry); if (child != NULL && 0 == iommu_gas_lowermatch(a, child)) return (0); + if (child != NULL && entry->end < a->common->lowaddr && + iommu_gas_match_one(a, entry->end, child->first, + a->common->lowaddr)) { + iommu_gas_match_insert(a); + return (0); + } + child = RB_LEFT(entry, rb_entry); if (child != NULL && child->last < a->common->lowaddr && iommu_gas_match_one(a, child->last, entry->start, a->common->lowaddr)) { iommu_gas_match_insert(a); return (0); } - child = RB_RIGHT(entry, rb_entry); if (child != NULL && 0 == iommu_gas_lowermatch(a, child)) return (0); return (ENOMEM); |
