Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41958 )
Change subject: device: Introduce RESOURCE_ALLOCATION_COMPAT ......................................................................
device: Introduce RESOURCE_ALLOCATION_COMPAT
Add a v3-compatibility mode to the v4.5 allocator. We avoid all space above 4G and then disable all remaining memranges but the biggest. It also forces top-down allocation.
Change-Id: I1c8512e4b6264f1967cf7018debdf9cabf11d84f Signed-off-by: Nico Huber nico.h@gmx.de --- M src/device/Kconfig M src/device/resource_allocator_v4.5.c 2 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/58/41958/1
diff --git a/src/device/Kconfig b/src/device/Kconfig index 35433b0..50e3857 100644 --- a/src/device/Kconfig +++ b/src/device/Kconfig @@ -825,4 +825,9 @@ bool "Allocate resources from top down" depends on RESOURCE_ALLOCATOR_V4 || RESOURCE_ALLOCATOR_V4_5
+config RESOURCE_ALLOCATION_COMPAT + bool "Resource allocator v3 compatibility mode" + depends on RESOURCE_ALLOCATOR_V4_5 + select RESOURCE_ALLOCATION_TOP_DOWN + endmenu diff --git a/src/device/resource_allocator_v4.5.c b/src/device/resource_allocator_v4.5.c index 4a03a23..34e9fdd 100644 --- a/src/device/resource_allocator_v4.5.c +++ b/src/device/resource_allocator_v4.5.c @@ -350,6 +350,28 @@
avoid_fixed_resources(ranges, domain, mask_match);
+ if (CONFIG(RESOURCE_ALLOCATION_COMPAT)) { + struct range_entry *r, *biggest = NULL; + + /* Don't allow allocations above 4G. */ + memranges_create_hole(ranges, POWER_OF_2(32), UINT64_MAX - POWER_OF_2(32) + 1); + + /* Set all but the biggest range's tag to 0. */ + memranges_each_entry(r, ranges) { + if (!biggest) { + biggest = r; + continue; + } + + if (range_entry_size(r) > range_entry_size(biggest)) { + range_entry_update_tag(biggest, 0); + biggest = r; + } else { + range_entry_update_tag(r, 0); + } + } + } + print_resource_ranges(domain, ranges); }
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41958 )
Change subject: device: Introduce RESOURCE_ALLOCATION_COMPAT ......................................................................
Patch Set 2: Code-Review+2
Attention is currently required from: Mike Banon, Michał Żygowski. Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41958 )
Change subject: device: Introduce RESOURCE_ALLOCATION_COMPAT ......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2: Would be interesting to see how this performs for the problematic AMD platforms. It's not a fix, though. So please only waste time with this if these platforms turn out to be hard to fix. The idea is to allocate in the same range that the old allocator used.
I don't recall right now why I put it on top of the v4.5 allocator. Maybe it's possible to have something similar for the already merged v4.
Attention is currently required from: Mike Banon, Michał Żygowski. Arthur Heymans has uploaded a new patch set (#3) to the change originally created by Nico Huber. ( https://review.coreboot.org/c/coreboot/+/41958 )
Change subject: device: Introduce RESOURCE_ALLOCATION_COMPAT ......................................................................
device: Introduce RESOURCE_ALLOCATION_COMPAT
Add a v3-compatibility mode to the v4.5 allocator. We avoid all space above 4G and then disable all remaining memranges but the biggest. It also forces top-down allocation.
Change-Id: I1c8512e4b6264f1967cf7018debdf9cabf11d84f Signed-off-by: Nico Huber nico.h@gmx.de --- M src/device/Kconfig M src/device/resource_allocator_v4.5.c 2 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/58/41958/3
Attention is currently required from: Arthur Heymans, Mike Banon, Nico Huber, Michał Żygowski. Matt DeVillier has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41958 )
Change subject: device: Introduce RESOURCE_ALLOCATION_COMPAT ......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS3: what problem is this attempting to fix?
Attention is currently required from: Mike Banon, Nico Huber, Michał Żygowski, Matt DeVillier. Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41958 )
Change subject: device: Introduce RESOURCE_ALLOCATION_COMPAT ......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS3:
what problem is this attempting to fix?
AMD platforms don't report fixed resources correctly. Assigning BARs below 4G and top down allows to work around this. The real fix is to report all fixed resources properly.
Nico Huber has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/41958?usp=email )
Change subject: device: Introduce RESOURCE_ALLOCATION_COMPAT ......................................................................
Abandoned
Superseded by making top-down allocation the default, CB:75102 and more...