1 /*
2  * Compat shims for use of 3rd party consumers of libxenctrl device model
3  * functionality which has been split into separate libraries.
4  */
5 
6 #define XC_WANT_COMPAT_DEVICEMODEL_API
7 #include "xc_private.h"
8 
xc_hvm_create_ioreq_server(xc_interface * xch,uint32_t domid,int handle_bufioreq,ioservid_t * id)9 int xc_hvm_create_ioreq_server(
10     xc_interface *xch, uint32_t domid, int handle_bufioreq,
11     ioservid_t *id)
12 {
13     return xendevicemodel_create_ioreq_server(xch->dmod, domid,
14                                               handle_bufioreq, id);
15 }
16 
xc_hvm_get_ioreq_server_info(xc_interface * xch,uint32_t domid,ioservid_t id,xen_pfn_t * ioreq_pfn,xen_pfn_t * bufioreq_pfn,evtchn_port_t * bufioreq_port)17 int xc_hvm_get_ioreq_server_info(
18     xc_interface *xch, uint32_t domid, ioservid_t id, xen_pfn_t *ioreq_pfn,
19     xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_port)
20 {
21     return xendevicemodel_get_ioreq_server_info(xch->dmod, domid, id,
22                                                 ioreq_pfn, bufioreq_pfn,
23                                                 bufioreq_port);
24 }
25 
xc_hvm_map_io_range_to_ioreq_server(xc_interface * xch,uint32_t domid,ioservid_t id,int is_mmio,uint64_t start,uint64_t end)26 int xc_hvm_map_io_range_to_ioreq_server(
27     xc_interface *xch, uint32_t domid, ioservid_t id, int is_mmio,
28     uint64_t start, uint64_t end)
29 {
30     return xendevicemodel_map_io_range_to_ioreq_server(xch->dmod, domid,
31                                                        id, is_mmio, start,
32                                                        end);
33 }
34 
xc_hvm_unmap_io_range_from_ioreq_server(xc_interface * xch,uint32_t domid,ioservid_t id,int is_mmio,uint64_t start,uint64_t end)35 int xc_hvm_unmap_io_range_from_ioreq_server(
36     xc_interface *xch, uint32_t domid, ioservid_t id, int is_mmio,
37     uint64_t start, uint64_t end)
38 {
39     return xendevicemodel_unmap_io_range_from_ioreq_server(xch->dmod, domid,
40                                                            id, is_mmio,
41                                                            start, end);
42 }
43 
xc_hvm_map_pcidev_to_ioreq_server(xc_interface * xch,uint32_t domid,ioservid_t id,uint16_t segment,uint8_t bus,uint8_t device,uint8_t function)44 int xc_hvm_map_pcidev_to_ioreq_server(
45     xc_interface *xch, uint32_t domid, ioservid_t id, uint16_t segment,
46     uint8_t bus, uint8_t device, uint8_t function)
47 {
48     return xendevicemodel_map_pcidev_to_ioreq_server(xch->dmod, domid, id,
49                                                      segment, bus, device,
50                                                      function);
51 }
52 
xc_hvm_unmap_pcidev_from_ioreq_server(xc_interface * xch,uint32_t domid,ioservid_t id,uint16_t segment,uint8_t bus,uint8_t device,uint8_t function)53 int xc_hvm_unmap_pcidev_from_ioreq_server(
54     xc_interface *xch, uint32_t domid, ioservid_t id, uint16_t segment,
55     uint8_t bus, uint8_t device, uint8_t function)
56 {
57     return xendevicemodel_unmap_pcidev_from_ioreq_server(xch->dmod, domid,
58                                                          id, segment, bus,
59                                                          device, function);
60 }
61 
xc_hvm_destroy_ioreq_server(xc_interface * xch,uint32_t domid,ioservid_t id)62 int xc_hvm_destroy_ioreq_server(
63     xc_interface *xch, uint32_t domid, ioservid_t id)
64 {
65     return xendevicemodel_destroy_ioreq_server(xch->dmod, domid, id);
66 }
67 
xc_hvm_set_ioreq_server_state(xc_interface * xch,uint32_t domid,ioservid_t id,int enabled)68 int xc_hvm_set_ioreq_server_state(
69     xc_interface *xch, uint32_t domid, ioservid_t id, int enabled)
70 {
71     return xendevicemodel_set_ioreq_server_state(xch->dmod, domid, id,
72                                                  enabled);
73 }
74 
xc_hvm_set_pci_intx_level(xc_interface * xch,uint32_t domid,uint16_t segment,uint8_t bus,uint8_t device,uint8_t intx,unsigned int level)75 int xc_hvm_set_pci_intx_level(
76     xc_interface *xch, uint32_t domid, uint16_t segment, uint8_t bus,
77     uint8_t device, uint8_t intx, unsigned int level)
78 {
79     return xendevicemodel_set_pci_intx_level(xch->dmod, domid, segment,
80                                              bus, device, intx, level);
81 }
82 
xc_hvm_set_isa_irq_level(xc_interface * xch,uint32_t domid,uint8_t irq,unsigned int level)83 int xc_hvm_set_isa_irq_level(
84     xc_interface *xch, uint32_t domid, uint8_t irq, unsigned int level)
85 {
86     return xendevicemodel_set_isa_irq_level(xch->dmod, domid, irq, level);
87 }
88 
xc_hvm_set_pci_link_route(xc_interface * xch,uint32_t domid,uint8_t link,uint8_t irq)89 int xc_hvm_set_pci_link_route(
90     xc_interface *xch, uint32_t domid, uint8_t link, uint8_t irq)
91 {
92     return xendevicemodel_set_pci_link_route(xch->dmod, domid, link, irq);
93 }
94 
xc_hvm_inject_msi(xc_interface * xch,uint32_t domid,uint64_t msi_addr,uint32_t msi_data)95 int xc_hvm_inject_msi(
96     xc_interface *xch, uint32_t domid, uint64_t msi_addr, uint32_t msi_data)
97 {
98     return xendevicemodel_inject_msi(xch->dmod, domid, msi_addr, msi_data);
99 }
100 
xc_hvm_track_dirty_vram(xc_interface * xch,uint32_t domid,uint64_t first_pfn,uint32_t nr,unsigned long * dirty_bitmap)101 int xc_hvm_track_dirty_vram(
102     xc_interface *xch, uint32_t domid, uint64_t first_pfn, uint32_t nr,
103     unsigned long *dirty_bitmap)
104 {
105     return xendevicemodel_track_dirty_vram(xch->dmod, domid, first_pfn,
106                                            nr, dirty_bitmap);
107 }
108 
xc_hvm_modified_memory(xc_interface * xch,uint32_t domid,uint64_t first_pfn,uint32_t nr)109 int xc_hvm_modified_memory(
110     xc_interface *xch, uint32_t domid, uint64_t first_pfn, uint32_t nr)
111 {
112     return xendevicemodel_modified_memory(xch->dmod, domid, first_pfn, nr);
113 }
114 
xc_hvm_set_mem_type(xc_interface * xch,uint32_t domid,hvmmem_type_t type,uint64_t first_pfn,uint32_t nr)115 int xc_hvm_set_mem_type(
116     xc_interface *xch, uint32_t domid, hvmmem_type_t type,
117     uint64_t first_pfn, uint32_t nr)
118 {
119     return xendevicemodel_set_mem_type(xch->dmod, domid, type, first_pfn,
120                                        nr);
121 }
122 
xc_hvm_inject_trap(xc_interface * xch,uint32_t domid,int vcpu,uint8_t vector,uint8_t type,uint32_t error_code,uint8_t insn_len,uint64_t cr2)123 int xc_hvm_inject_trap(
124     xc_interface *xch, uint32_t domid, int vcpu, uint8_t vector,
125     uint8_t type, uint32_t error_code, uint8_t insn_len, uint64_t cr2)
126 {
127     return xendevicemodel_inject_event(xch->dmod, domid, vcpu, vector,
128                                        type, error_code, insn_len, cr2);
129 }
130 
131 /*
132  * Local variables:
133  * mode: C
134  * c-file-style: "BSD"
135  * c-basic-offset: 4
136  * tab-width: 4
137  * indent-tabs-mode: nil
138  * End:
139  */
140