aboutsummaryrefslogtreecommitdiff
path: root/target/i386/kvm/xen-compat.h
blob: 7f30180cc2c576f545e833d5754018638cf9e763 (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
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * Xen HVM emulation support in KVM
 *
 * Copyright © 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * 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_I386_KVM_XEN_COMPAT_H
#define QEMU_I386_KVM_XEN_COMPAT_H

#include "hw/xen/interface/memory.h"

typedef uint32_t compat_pfn_t;
typedef uint32_t compat_ulong_t;
typedef uint32_t compat_ptr_t;

#define __DEFINE_COMPAT_HANDLE(name, type)      \
    typedef struct {                            \
        compat_ptr_t c;                         \
        type *_[0] __attribute__((packed));   \
    } __compat_handle_ ## name;                 \

#define DEFINE_COMPAT_HANDLE(name) __DEFINE_COMPAT_HANDLE(name, name)
#define COMPAT_HANDLE(name) __compat_handle_ ## name

DEFINE_COMPAT_HANDLE(compat_pfn_t);
DEFINE_COMPAT_HANDLE(compat_ulong_t);
DEFINE_COMPAT_HANDLE(int);

struct compat_xen_add_to_physmap {
    domid_t domid;
    uint16_t size;
    unsigned int space;
    compat_ulong_t idx;
    compat_pfn_t gpfn;
};

struct compat_xen_add_to_physmap_batch {
    domid_t domid;
    uint16_t space;
    uint16_t size;
    uint16_t extra;
    COMPAT_HANDLE(compat_ulong_t) idxs;
    COMPAT_HANDLE(compat_pfn_t) gpfns;
    COMPAT_HANDLE(int) errs;
};

struct compat_physdev_map_pirq {
    domid_t domid;
    uint16_t pad;
    /* IN */
    int type;
    /* IN (ignored for ..._MULTI_MSI) */
    int index;
    /* IN or OUT */
    int pirq;
    /* IN - high 16 bits hold segment for ..._MSI_SEG and ..._MULTI_MSI */
    int bus;
    /* IN */
    int devfn;
    /* IN (also OUT for ..._MULTI_MSI) */
    int entry_nr;
    /* IN */
    uint64_t table_base;
} __attribute__((packed));

#endif /* QEMU_I386_XEN_COMPAT_H */