From c6f9404f558bc0fa51e4f44d2dfad180ce8a86be Mon Sep 17 00:00:00 2001 From: Li Fei1 Date: Thu, 29 Oct 2020 22:47:37 +0800 Subject: [PATCH] hv: psram: add kconfig to enable psram Add two Kconfig pSRAM config: one for whether to enable the pSRAM on the platfrom or not; another for if the pSRAM is enabled on the platform whether to enable the pSRAM in the pre-launched RTVM. If we enable the pSRAM on the platform, we should remove the pSRAM EPT mapping from the SOS to prevent it could flush the pSRAM cache. Tracked-On: #5330 Signed-off-by: Qian Wang --- hypervisor/arch/x86/Kconfig | 9 +++++++++ hypervisor/arch/x86/guest/vm.c | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/hypervisor/arch/x86/Kconfig b/hypervisor/arch/x86/Kconfig index 20cb752de..11e485437 100644 --- a/hypervisor/arch/x86/Kconfig +++ b/hypervisor/arch/x86/Kconfig @@ -276,6 +276,15 @@ config CDP_ENABLED prioritization of code and data fetches to the L2 or L3 cache in a software configurable manner, depending on hardware support. +config PSRAM_ENABLED + bool "Enable pseudo-SRAM (pSRAM) support" + depends on !CDP_ENABLED + default n + help + This will enable RTVM to make use of pSRAM to improve the performance + of Real-Time applications. pSRAM essentially a block of cache, and is separated via + CAT and protected by some methods. pSRAM support and CDP support cannot co-exist. + config GPU_SBDF hex "Segment, Bus, Device, and function of the GPU" depends on ACPI_PARSE_ENABLED diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index 186059b63..3d725abb9 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -364,6 +364,11 @@ static void prepare_sos_vm_memmap(struct acrn_vm *vm) /* unmap PCIe MMCONFIG region since it's owned by hypervisor */ pci_mmcfg = get_mmcfg_region(); ept_del_mr(vm, (uint64_t *)vm->arch_vm.nworld_eptp, pci_mmcfg->address, get_pci_mmcfg_size(pci_mmcfg)); + + /* TODO: remove pSRAM from SOS prevent SOS to use clflush to flush the pSRAM cache. + * If we remove this EPT mapping from the SOS, the ACRN-DM can't do pSRAM EPT mapping + * because the SOS can't get the HPA of this memory region. + */ } /* Add EPT mapping of EPC reource for the VM */