bhyve: don't panic if e820 finds no available memory
The GVT-d emulation tries to allocate some specific memory. It could happen that this address doesn't exist. In that case, GVT-d will fall back to allocate any address. Nevertheless, this only works if the e820 fails with an error instead of exiting on an assertion. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D40034
This commit is contained in:
parent
bee3d4bf8e
commit
99aeb28b2f
@ -197,11 +197,17 @@ e820_add_entry(const uint64_t base, const uint64_t end,
|
||||
return (0);
|
||||
}
|
||||
|
||||
assert(element != NULL);
|
||||
/* Non system memory should be allocated inside system memory. */
|
||||
assert(element->type == E820_TYPE_MEMORY);
|
||||
/* New element should fit into existing system memory element. */
|
||||
assert(base >= element->base && end <= element->end);
|
||||
/*
|
||||
* If some one tries to allocate a specific address, it could happen, that
|
||||
* this address is not allocatable. Therefore, do some checks. If the
|
||||
* address is not allocatable, don't panic. The user may have a fallback and
|
||||
* tries to allocate another address. This is true for the GVT-d emulation
|
||||
* which tries to reuse the host address of the graphics stolen memory and
|
||||
* falls back to allocating the highest address below 4 GB.
|
||||
*/
|
||||
if (element == NULL || element->type != E820_TYPE_MEMORY ||
|
||||
(base < element->base || end > element->end))
|
||||
return (ENOMEM);
|
||||
|
||||
if (base == element->base) {
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user