aboutsummaryrefslogtreecommitdiff
path: root/include/hw/i386/sgx-epc.h
blob: 83269972e05a717b651f05add6e9f99abfa20ed9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * SGX EPC device
 *
 * Copyright (C) 2019 Intel Corporation
 *
 * Authors:
 *   Sean Christopherson <sean.j.christopherson@intel.com>
 *
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 */
#ifndef QEMU_SGX_EPC_H
#define QEMU_SGX_EPC_H

#include "hw/i386/hostmem-epc.h"

#define TYPE_SGX_EPC "sgx-epc"
#define SGX_EPC(obj) \
    OBJECT_CHECK(SGXEPCDevice, (obj), TYPE_SGX_EPC)
#define SGX_EPC_CLASS(oc) \
    OBJECT_CLASS_CHECK(SGXEPCDeviceClass, (oc), TYPE_SGX_EPC)
#define SGX_EPC_GET_CLASS(obj) \
    OBJECT_GET_CLASS(SGXEPCDeviceClass, (obj), TYPE_SGX_EPC)

#define SGX_EPC_ADDR_PROP "addr"
#define SGX_EPC_SIZE_PROP "size"
#define SGX_EPC_MEMDEV_PROP "memdev"

/**
 * SGXEPCDevice:
 * @addr: starting guest physical address, where @SGXEPCDevice is mapped.
 *         Default value: 0, means that address is auto-allocated.
 * @hostmem: host memory backend providing memory for @SGXEPCDevice
 */
typedef struct SGXEPCDevice {
    /* private */
    DeviceState parent_obj;

    /* public */
    uint64_t addr;
    HostMemoryBackendEpc *hostmem;
} SGXEPCDevice;

/*
 * @base: address in guest physical address space where EPC regions start
 * @mr: address space container for memory devices
 */
typedef struct SGXEPCState {
    uint64_t base;
    uint64_t size;

    MemoryRegion mr;

    struct SGXEPCDevice **sections;
    int nr_sections;
} SGXEPCState;

#endif