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>
This commit is contained in:
Nico Huber
2020-05-23 18:20:47 +02:00
committed by Martin Roth
parent 4060860942
commit ec7b31353f

View File

@@ -69,6 +69,10 @@ static void update_bridge_resource(const struct device *bridge, struct resource
if (!child_res->size) if (!child_res->size)
continue; continue;
/* Resources with 0 limit can't be assigned anything. */
if (!child_res->limit)
continue;
/* /*
* Propagate the resource alignment to the bridge resource. The * Propagate the resource alignment to the bridge resource. The
* condition can only be true for the first (largest) resource. For all * 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; bridge_res->align = child_res->align;
/* /*
* Propagate the resource limit to the bridge resource only if child * Propagate the resource limit to the bridge resource. If a downstream
* resource limit is non-zero. If a downstream device has stricter * device has stricter requirements w.r.t. limits for any resource, that
* requirements w.r.t. limits for any resource, that constraint needs to * constraint needs to be propagated back up to the downstream bridges
* be propagated back up to the downstream bridges of the domain. This * of the domain. This guarantees that the resource allocation which
* guarantees that the resource allocation which starts at the domain * starts at the domain level takes into account all these constraints
* level takes into account all these constraints thus working on a * thus working on a global view.
* 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; bridge_res->limit = child_res->limit;
/* /*