@@ -472,6 +472,7 @@ static struct sgx_epc_page *__sgx_alloc_epc_page_from_node(int nid)
page = list_first_entry(&node->free_page_list, struct sgx_epc_page, list);
list_del_init(&page->list);
sgx_nr_free_pages--;
+ page->flags = SGX_EPC_PAGE_IN_USE;
spin_unlock(&node->lock);
@@ -626,6 +627,7 @@ void sgx_free_epc_page(struct sgx_epc_page *page)
list_add_tail(&page->list, &node->free_page_list);
sgx_nr_free_pages++;
+ page->flags = 0;
spin_unlock(&node->lock);
}
@@ -651,7 +653,7 @@ static bool __init sgx_setup_epc_section(u64 phys_addr, u64 size,
for (i = 0; i < nr_pages; i++) {
section->pages[i].section = index;
- section->pages[i].flags = 0;
+ section->pages[i].flags = SGX_EPC_PAGE_IN_USE;
section->pages[i].owner = NULL;
list_add_tail(§ion->pages[i].list, &sgx_dirty_page_list);
}
@@ -26,6 +26,9 @@
/* Pages, which are being tracked by the page reclaimer. */
#define SGX_EPC_PAGE_RECLAIMER_TRACKED BIT(0)
+/* Allocated pages */
+#define SGX_EPC_PAGE_IN_USE BIT(1)
+
struct sgx_epc_page {
unsigned int section;
unsigned int flags;