The assumption that all used ranges lie within the provided window bounds resulted in generation of free ranges beyond the limits and incorrect address assignment in guest. As used regions are collected without any knowledge about which limits will be applied later, some non-standard topologies with multiple expanders and devices break free ranges calculation. Skipping such used regions fixes the problem.
While at this fix potential uint64 wrap around if range->limit is equal to UINT64_MAX that can add extra free range at the beginning of the address space. Not sure this can really happen with some combination of virtual topology and firmware version, but this check doesn't look expensive and it's better to handle it now than spend hours debugging this strange case later. Signed-off-by: Anton Kuchin <[email protected]> --- Anton Kuchin (2): hw/acpi/aml-build: Ignore used ranges outside the requested window hw/acpi/aml-build: Avoid overflow when advancing the free_base cursor hw/acpi/aml-build.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- base-commit: ddb42c53b4d91d12511f49ee4428d9594eb5eb49 change-id: 20261106-users-antonkuchin-to-send-fix-crs-replace-with-free-ranges-761219313073 Best regards, -- Anton Kuchin <[email protected]>
