hv: ivshmem: map SHM BAR with PAT ignored

ACRN does not support the variable range vMTRR. The default
memory type of vMTRR is UC. With this vMTRR emulation guest VM
such as Linux refuses to map the MMIO address space as WB. In
order to get better performance SHM BAR of ivshmem is mapped
with PAT ignored and memory type of SHM BAR is fixed to WB.

Tracked-On: #6389
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Jian Jun Chen 2021-08-05 17:24:32 +08:00 committed by wenlingz
parent 2205dd393a
commit 9d650ccdf0
2 changed files with 6 additions and 1 deletions

View File

@ -252,7 +252,7 @@ static void ivshmem_vbar_map(struct pci_vdev *vdev, uint32_t idx)
if ((idx == IVSHMEM_SHM_BAR) && (vbar->base_hpa != INVALID_HPA) && (vbar->base_gpa != 0UL)) {
ept_add_mr(vm, (uint64_t *)vm->arch_vm.nworld_eptp, vbar->base_hpa,
vbar->base_gpa, vbar->size, EPT_RD | EPT_WR | EPT_WB);
vbar->base_gpa, vbar->size, EPT_RD | EPT_WR | EPT_WB | EPT_IGNORE_PAT);
} else if ((idx == IVSHMEM_MMIO_BAR) && (vbar->base_gpa != 0UL)) {
(void)memset(&ivs_dev->mmio, 0U, sizeof(ivs_dev->mmio));
register_mmio_emulation_handler(vm, ivshmem_mmio_handler, vbar->base_gpa,

View File

@ -104,6 +104,11 @@
*/
#define EPT_WB (6UL << EPT_MT_SHIFT)
/**
* @brief Ignore PAT memory type.
*/
#define EPT_IGNORE_PAT (1UL << 6U)
/**
* @}
*/