qapi: allow unions to contain further unions
[qemu/armbru.git] / target / i386 / kvm / xen-compat.h
blob7f30180cc2c576f545e833d5754018638cf9e763
1 /*
2 * Xen HVM emulation support in KVM
4 * Copyright © 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
9 */
11 #ifndef QEMU_I386_KVM_XEN_COMPAT_H
12 #define QEMU_I386_KVM_XEN_COMPAT_H
14 #include "hw/xen/interface/memory.h"
16 typedef uint32_t compat_pfn_t;
17 typedef uint32_t compat_ulong_t;
18 typedef uint32_t compat_ptr_t;
20 #define __DEFINE_COMPAT_HANDLE(name, type) \
21 typedef struct { \
22 compat_ptr_t c; \
23 type *_[0] __attribute__((packed)); \
24 } __compat_handle_ ## name; \
26 #define DEFINE_COMPAT_HANDLE(name) __DEFINE_COMPAT_HANDLE(name, name)
27 #define COMPAT_HANDLE(name) __compat_handle_ ## name
29 DEFINE_COMPAT_HANDLE(compat_pfn_t);
30 DEFINE_COMPAT_HANDLE(compat_ulong_t);
31 DEFINE_COMPAT_HANDLE(int);
33 struct compat_xen_add_to_physmap {
34 domid_t domid;
35 uint16_t size;
36 unsigned int space;
37 compat_ulong_t idx;
38 compat_pfn_t gpfn;
41 struct compat_xen_add_to_physmap_batch {
42 domid_t domid;
43 uint16_t space;
44 uint16_t size;
45 uint16_t extra;
46 COMPAT_HANDLE(compat_ulong_t) idxs;
47 COMPAT_HANDLE(compat_pfn_t) gpfns;
48 COMPAT_HANDLE(int) errs;
51 struct compat_physdev_map_pirq {
52 domid_t domid;
53 uint16_t pad;
54 /* IN */
55 int type;
56 /* IN (ignored for ..._MULTI_MSI) */
57 int index;
58 /* IN or OUT */
59 int pirq;
60 /* IN - high 16 bits hold segment for ..._MSI_SEG and ..._MULTI_MSI */
61 int bus;
62 /* IN */
63 int devfn;
64 /* IN (also OUT for ..._MULTI_MSI) */
65 int entry_nr;
66 /* IN */
67 uint64_t table_base;
68 } __attribute__((packed));
70 #endif /* QEMU_I386_XEN_COMPAT_H */