[Differential] D9686: fix UEFI VM's bootup on Hyper-V (i.e. Hyper-V Generation-2 VM)

marcel (Marcel Moolenaar) phabric-noreply at FreeBSD.org
Mon Feb 20 16:47:12 UTC 2017

marcel added a comment.

  Going for the workaround I see! :-)


> copy.c:56
> +	int i, ndesc;
> +	unsigned long aviable_pages;
> +

It's spelled "available" instead of "aviable" :-)

> copy.c:79-84
> +		if (KERNEL_PHYSICAL_BASE < start ||
> +		    KERNEL_PHYSICAL_BASE >= end)
> +			continue;
> +
> +		if (p->Type != EfiConventionalMemory)
> +			continue;

Please also handle existing allocations. If those allocations represent free/usable memory after boot services has exited, then they are for all practical purposes "conventional memory".

Also: please make sure that KERNEL_PHYSICAL_BASE is covered by usable memory to begin with.

As such, we may have multiple memory descriptors that overlap with [2MB..2MB+nr_pages*PAGE_SIZE]. As long as they are free to use after boot services has exited, we're ok. We can only reduce the staging size if [2MB..2MB+delta] is usable when [2MB+delta..2MB+nr_pages*PAGE_SIZE] isn't.
We can reduce the staging area to delta/PAGE_SIZE. But if 2MB isn't usable, we cannot reduce (or put differently we have to reduce to 0).



To: decui_microsoft.com, imp, jhb, will, kib, delphij, emaste, sepherosa_gmail.com, honzhan_microsoft.com, howard0su_gmail.com, marcel
Cc: freebsd-virtualization-list

More information about the freebsd-virtualization mailing list