main.c (8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17) main.c (d6d261bded8a57aed4faa12d08a5b193418d3aa4)
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2016-20 Intel Corporation. */
3
4#include <linux/file.h>
5#include <linux/freezer.h>
6#include <linux/highmem.h>
7#include <linux/kthread.h>
8#include <linux/miscdevice.h>

--- 458 unchanged lines hidden (view full) ---

467 if (list_empty(&node->free_page_list)) {
468 spin_unlock(&node->lock);
469 return NULL;
470 }
471
472 page = list_first_entry(&node->free_page_list, struct sgx_epc_page, list);
473 list_del_init(&page->list);
474 sgx_nr_free_pages--;
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2016-20 Intel Corporation. */
3
4#include <linux/file.h>
5#include <linux/freezer.h>
6#include <linux/highmem.h>
7#include <linux/kthread.h>
8#include <linux/miscdevice.h>

--- 458 unchanged lines hidden (view full) ---

467 if (list_empty(&node->free_page_list)) {
468 spin_unlock(&node->lock);
469 return NULL;
470 }
471
472 page = list_first_entry(&node->free_page_list, struct sgx_epc_page, list);
473 list_del_init(&page->list);
474 sgx_nr_free_pages--;
475 page->flags = 0;
475
476 spin_unlock(&node->lock);
477
478 return page;
479}
480
481/**
482 * __sgx_alloc_epc_page() - Allocate an EPC page

--- 138 unchanged lines hidden (view full) ---

621{
622 struct sgx_epc_section *section = &sgx_epc_sections[page->section];
623 struct sgx_numa_node *node = section->node;
624
625 spin_lock(&node->lock);
626
627 list_add_tail(&page->list, &node->free_page_list);
628 sgx_nr_free_pages++;
476
477 spin_unlock(&node->lock);
478
479 return page;
480}
481
482/**
483 * __sgx_alloc_epc_page() - Allocate an EPC page

--- 138 unchanged lines hidden (view full) ---

622{
623 struct sgx_epc_section *section = &sgx_epc_sections[page->section];
624 struct sgx_numa_node *node = section->node;
625
626 spin_lock(&node->lock);
627
628 list_add_tail(&page->list, &node->free_page_list);
629 sgx_nr_free_pages++;
630 page->flags = SGX_EPC_PAGE_IS_FREE;
629
630 spin_unlock(&node->lock);
631}
632
633static bool __init sgx_setup_epc_section(u64 phys_addr, u64 size,
634 unsigned long index,
635 struct sgx_epc_section *section)
636{

--- 207 unchanged lines hidden ---
631
632 spin_unlock(&node->lock);
633}
634
635static bool __init sgx_setup_epc_section(u64 phys_addr, u64 size,
636 unsigned long index,
637 struct sgx_epc_section *section)
638{

--- 207 unchanged lines hidden ---