[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 25/33] hostmem-epc: Make prealloc consistent with qemu cmdline
From: |
Yang Zhong |
Subject: |
[PATCH v4 25/33] hostmem-epc: Make prealloc consistent with qemu cmdline during reset |
Date: |
Mon, 19 Jul 2021 19:21:28 +0800 |
If qemu cmdline set the prealloc property for sgx epc and VM do the
reset the prealloc property will be different with cmdline settings.
This patch can make sure same prealloc property setting with cmdline.
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
---
backends/hostmem-epc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/backends/hostmem-epc.c b/backends/hostmem-epc.c
index 3bd1535d82..9836358841 100644
--- a/backends/hostmem-epc.c
+++ b/backends/hostmem-epc.c
@@ -60,6 +60,8 @@ void sgx_memory_backend_reset(HostMemoryBackend *backend, int
fd,
Error **errp)
{
MemoryRegion *mr = &backend->mr;
+ void *ptr;
+ uint64_t sz;
mr->enabled = false;
@@ -69,6 +71,14 @@ void sgx_memory_backend_reset(HostMemoryBackend *backend,
int fd,
}
sgx_epc_backend_memory_alloc(backend, errp);
+
+ ptr = memory_region_get_ram_ptr(&backend->mr);
+ sz = memory_region_size(&backend->mr);
+
+ if (backend->prealloc) {
+ os_mem_prealloc(memory_region_get_fd(&backend->mr), ptr, sz,
+ backend->prealloc_threads, errp);
+ }
}
static void sgx_epc_backend_instance_init(Object *obj)
- [PATCH v4 15/33] Adjust min CPUID level to 0x12 when SGX is enabled, (continued)
- [PATCH v4 15/33] Adjust min CPUID level to 0x12 when SGX is enabled, Yang Zhong, 2021/07/19
- [PATCH v4 16/33] hw/i386/fw_cfg: Set SGX bits in feature control fw_cfg accordingly, Yang Zhong, 2021/07/19
- [PATCH v4 17/33] hw/i386/pc: Account for SGX EPC sections when calculating device memory, Yang Zhong, 2021/07/19
- [PATCH v4 18/33] i386/pc: Add e820 entry for SGX EPC section(s), Yang Zhong, 2021/07/19
- [PATCH v4 19/33] i386: acpi: Add SGX EPC entry to ACPI tables, Yang Zhong, 2021/07/19
- [PATCH v4 20/33] q35: Add support for SGX EPC, Yang Zhong, 2021/07/19
- [PATCH v4 21/33] i440fx: Add support for SGX EPC, Yang Zhong, 2021/07/19
- [PATCH v4 22/33] hostmem-epc: Add the reset interface for EPC backend reset, Yang Zhong, 2021/07/19
- [PATCH v4 23/33] sgx-epc: Add the reset interface for sgx-epc virt device, Yang Zhong, 2021/07/19
- [PATCH v4 24/33] sgx-epc: Avoid bios reset during sgx epc initialization, Yang Zhong, 2021/07/19
- [PATCH v4 25/33] hostmem-epc: Make prealloc consistent with qemu cmdline during reset,
Yang Zhong <=
- [PATCH v4 26/33] qmp: Add query-sgx command, Yang Zhong, 2021/07/19
- [PATCH v4 27/33] hmp: Add 'info sgx' command, Yang Zhong, 2021/07/19
- [PATCH v4 28/33] i386: Add sgx_get_info() interface, Yang Zhong, 2021/07/19
- [PATCH v4 29/33] bitops: Support 32 and 64 bit mask macro, Yang Zhong, 2021/07/19
- [PATCH v4 30/33] qmp: Add the qmp_query_sgx_capabilities(), Yang Zhong, 2021/07/19
- [PATCH v4 31/33] Kconfig: Add CONFIG_SGX support, Yang Zhong, 2021/07/19
- [PATCH v4 32/33] sgx-epc: Add the fill_device_info() callback support, Yang Zhong, 2021/07/19
- [PATCH v4 33/33] doc: Add the SGX doc, Yang Zhong, 2021/07/19
- Re: [PATCH v4 00/33] Qemu SGX virtualization, Paolo Bonzini, 2021/07/28