qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 23/33] sgx-epc: Add the reset interface for sgx-epc virt d


From: Paolo Bonzini
Subject: Re: [PATCH v4 23/33] sgx-epc: Add the reset interface for sgx-epc virt device
Date: Fri, 10 Sep 2021 17:13:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 19/07/21 13:21, Yang Zhong wrote:
+static void sgx_epc_del_subregion(DeviceState *dev)
+{
+    PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
+    SGXEPCState *sgx_epc = &pcms->sgx_epc;
+    SGXEPCDevice *epc = SGX_EPC(dev);
+
+    /* del subregion and related operations */
+    memory_region_del_subregion(&sgx_epc->mr,
+                                host_memory_backend_get_memory(epc->hostmem));
+    host_memory_backend_set_mapped(epc->hostmem, false);
+    g_free(sgx_epc->sections);
+    sgx_epc->sections = NULL;
+
+    /* multiple epc devices, only zero the first time */
+    if (epc_num == sgx_epc->nr_sections) {
+        sgx_epc->size = 0;
+        sgx_epc->nr_sections = 0;
+    }
+}

Can it just invoke a method on the memory devices, without reusing the code in sgx_epc_realize? In particular why is it necessary to update sgx_epc->size and sgx_epc->nr_sections?

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]