mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 14:33:38 +00:00
dm: align bar base addr to PAGE_SIZE at least
PCI spec said that BAR base should be naturally aligned. But on ACRN if the bar size < PAGE_SIZE, BAR base should be aligned with PAGE_SIZE. This is because the minimal size that EPT can map/unmap is PAGE_SIZE. Tracked-On: #5717 Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com> Reviewed-by: Fei Li <fei1.li@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
parent
b7e360e5e5
commit
fad6a94030
@ -26,6 +26,7 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/user.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -564,6 +565,13 @@ pci_emul_alloc_resource(uint64_t *baseptr, uint64_t limit, uint64_t size,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PCI spec said that BAR base should be naturally aligned. On ACRN
|
||||||
|
* if the bar size < PAGE_SIZE, BAR base should be aligned with
|
||||||
|
* PAGE_SIZE. This is because the minimal size that EPT can map/unmap
|
||||||
|
* is PAGE_SIZE.
|
||||||
|
*/
|
||||||
|
if (size < PAGE_SIZE)
|
||||||
|
size = PAGE_SIZE;
|
||||||
base = roundup2(*baseptr, size);
|
base = roundup2(*baseptr, size);
|
||||||
|
|
||||||
/* TODO:Currently, we only reserve gvt mmio regions,
|
/* TODO:Currently, we only reserve gvt mmio regions,
|
||||||
|
Loading…
Reference in New Issue
Block a user