blob: 9d4340c907d17d0c2ecacdd6762e36d7c9d6def5 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Jeremy Fitzhardinge1ccbf532009-10-06 15:11:14 -07002#ifndef _XEN_XEN_H
3#define _XEN_XEN_H
4
5enum xen_domain_type {
6 XEN_NATIVE, /* running on bare hardware */
7 XEN_PV_DOMAIN, /* running in a PV domain */
8 XEN_HVM_DOMAIN, /* running in a Xen hvm domain */
9};
10
11#ifdef CONFIG_XEN
12extern enum xen_domain_type xen_domain_type;
13#else
14#define xen_domain_type XEN_NATIVE
15#endif
16
Juergen Grossb4feaeb2017-07-27 17:11:58 +020017#ifdef CONFIG_XEN_PVH
18extern bool xen_pvh;
19#else
20#define xen_pvh 0
21#endif
22
Jeremy Fitzhardinge1ccbf532009-10-06 15:11:14 -070023#define xen_domain() (xen_domain_type != XEN_NATIVE)
Juergen Grossb4feaeb2017-07-27 17:11:58 +020024#define xen_pv_domain() (xen_domain_type == XEN_PV_DOMAIN)
25#define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN)
26#define xen_pvh_domain() (xen_pvh)
Jeremy Fitzhardinge1ccbf532009-10-06 15:11:14 -070027
28#ifdef CONFIG_XEN_DOM0
29#include <xen/interface/xen.h>
30#include <asm/xen/hypervisor.h>
31
Stefano Stabellini4c071ee2012-09-14 13:53:39 +000032#define xen_initial_domain() (xen_domain() && \
Stefano Stabellini4ed59782012-10-03 18:08:52 +010033 xen_start_info && xen_start_info->flags & SIF_INITDOMAIN)
Jeremy Fitzhardinge1ccbf532009-10-06 15:11:14 -070034#else /* !CONFIG_XEN_DOM0 */
35#define xen_initial_domain() (0)
36#endif /* CONFIG_XEN_DOM0 */
37
Jeremy Fitzhardinge1ccbf532009-10-06 15:11:14 -070038#endif /* _XEN_XEN_H */