summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2020-05-23 18:20:47 +0200
committerMartin Roth <martin.roth@amd.corp-partner.google.com>2022-08-31 16:41:59 +0000
commitec7b31353fe2bd4b7846235fd4ba56d0ceb08196 (patch)
tree4b13a9dd487476db5423c134d6218dfae120dce4 /src
parent4060860942c25872b4e1c8da8e0ab54633ee7f46 (diff)
allocator_v4: Completely ignore resources with 0 limit
It seems pass 1 and 2 were inconsistent. The first would account for resources with a limit of 0 even though the second can't assign anything for them. Change-Id: I86fb8edc8d4b3c9310517e07f29f73a6b859a7c4 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/65402 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/device/resource_allocator_v4.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/device/resource_allocator_v4.c b/src/device/resource_allocator_v4.c
index 18667b7623..2b62fc8e2f 100644
--- a/src/device/resource_allocator_v4.c
+++ b/src/device/resource_allocator_v4.c
@@ -69,6 +69,10 @@ static void update_bridge_resource(const struct device *bridge, struct resource
if (!child_res->size)
continue;
+ /* Resources with 0 limit can't be assigned anything. */
+ if (!child_res->limit)
+ continue;
+
/*
* Propagate the resource alignment to the bridge resource. The
* condition can only be true for the first (largest) resource. For all
@@ -84,15 +88,14 @@ static void update_bridge_resource(const struct device *bridge, struct resource
bridge_res->align = child_res->align;
/*
- * Propagate the resource limit to the bridge resource only if child
- * resource limit is non-zero. If a downstream device has stricter
- * requirements w.r.t. limits for any resource, that constraint needs to
- * be propagated back up to the downstream bridges of the domain. This
- * guarantees that the resource allocation which starts at the domain
- * level takes into account all these constraints thus working on a
- * global view.
+ * Propagate the resource limit to the bridge resource. If a downstream
+ * device has stricter requirements w.r.t. limits for any resource, that
+ * constraint needs to be propagated back up to the downstream bridges
+ * of the domain. This guarantees that the resource allocation which
+ * starts at the domain level takes into account all these constraints
+ * thus working on a global view.
*/
- if (child_res->limit && (child_res->limit < bridge_res->limit))
+ if (child_res->limit < bridge_res->limit)
bridge_res->limit = child_res->limit;
/*