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, domid_t domid,
27                             bool is_default, int bufioreq_handling,
28                             ioservid_t *id);
29 int hvm_destroy_ioreq_server(struct domain *d, ioservid_t id);
30 int hvm_get_ioreq_server_info(struct domain *d, ioservid_t id,
31                               unsigned long *ioreq_gfn,
32                               unsigned long *bufioreq_gfn,
33                               evtchn_port_t *bufioreq_port);
34 int hvm_map_io_range_to_ioreq_server(struct domain *d, ioservid_t id,
35                                      uint32_t type, uint64_t start,
36                                      uint64_t end);
37 int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id,
38                                          uint32_t type, uint64_t start,
39                                          uint64_t end);
40 int hvm_map_mem_type_to_ioreq_server(struct domain *d, ioservid_t id,
41                                      uint32_t type, uint32_t flags);
42 int hvm_set_ioreq_server_state(struct domain *d, ioservid_t id,
43                                bool enabled);
44 
45 int hvm_all_ioreq_servers_add_vcpu(struct domain *d, struct vcpu *v);
46 void hvm_all_ioreq_servers_remove_vcpu(struct domain *d, struct vcpu *v);
47 void hvm_destroy_all_ioreq_servers(struct domain *d);
48 
49 int hvm_set_dm_domain(struct domain *d, domid_t domid);
50 
51 struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d,
52                                                  ioreq_t *p);
53 int hvm_send_ioreq(struct hvm_ioreq_server *s, ioreq_t *proto_p,
54                    bool buffered);
55 unsigned int hvm_broadcast_ioreq(ioreq_t *p, bool buffered);
56 
57 void hvm_ioreq_init(struct domain *d);
58 
59 #endif /* __ASM_X86_HVM_IOREQ_H__ */
60 
61 /*
62  * Local variables:
63  * mode: C
64  * c-file-style: "BSD"
65  * c-basic-offset: 4
66  * tab-width: 4
67  * indent-tabs-mode: nil
68  * End:
69  */
70