1 /*
2  * hvm.h: Hardware virtual machine assist interface definitions.
3  *
4  * Copyright (c) 2016 Citrix Systems Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef __ASM_X86_HVM_IOREQ_H__
20 #define __ASM_X86_HVM_IOREQ_H__
21 
22 bool hvm_io_pending(struct vcpu *v);
23 bool handle_hvm_io_completion(struct vcpu *v);
24 bool is_ioreq_server_page(struct domain *d, const struct page_info *page);
25 
26 int hvm_create_ioreq_server(struct domain *d, int bufioreq_handling,
27                             ioservid_t *id);
28 int hvm_destroy_ioreq_server(struct domain *d, ioservid_t id);
29 int hvm_get_ioreq_server_info(struct domain *d, ioservid_t id,
30                               unsigned long *ioreq_gfn,
31                               unsigned long *bufioreq_gfn,
32                               evtchn_port_t *bufioreq_port);
33 int hvm_get_ioreq_server_frame(struct domain *d, ioservid_t id,
34                                unsigned long idx, mfn_t *mfn);
35 int hvm_map_io_range_to_ioreq_server(struct domain *d, ioservid_t id,
36                                      uint32_t type, uint64_t start,
37                                      uint64_t end);
38 int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id,
39                                          uint32_t type, uint64_t start,
40                                          uint64_t end);
41 int hvm_map_mem_type_to_ioreq_server(struct domain *d, ioservid_t id,
42                                      uint32_t type, uint32_t flags);
43 int hvm_set_ioreq_server_state(struct domain *d, ioservid_t id,
44                                bool enabled);
45 
46 int hvm_all_ioreq_servers_add_vcpu(struct domain *d, struct vcpu *v);
47 void hvm_all_ioreq_servers_remove_vcpu(struct domain *d, struct vcpu *v);
48 void hvm_destroy_all_ioreq_servers(struct domain *d);
49 
50 struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d,
51                                                  ioreq_t *p);
52 int hvm_send_ioreq(struct hvm_ioreq_server *s, ioreq_t *proto_p,
53                    bool buffered);
54 unsigned int hvm_broadcast_ioreq(ioreq_t *p, bool buffered);
55 
56 void hvm_ioreq_init(struct domain *d);
57 
58 #endif /* __ASM_X86_HVM_IOREQ_H__ */
59 
60 /*
61  * Local variables:
62  * mode: C
63  * c-file-style: "BSD"
64  * c-basic-offset: 4
65  * tab-width: 4
66  * indent-tabs-mode: nil
67  * End:
68  */
69