Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 2 | #ifndef _XEN_XEN_H |
| 3 | #define _XEN_XEN_H |
| 4 | |
| 5 | enum 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 |
| 12 | extern enum xen_domain_type xen_domain_type; |
| 13 | #else |
| 14 | #define xen_domain_type XEN_NATIVE |
| 15 | #endif |
| 16 | |
Juergen Gross | b4feaeb | 2017-07-27 17:11:58 +0200 | [diff] [blame] | 17 | #ifdef CONFIG_XEN_PVH |
| 18 | extern bool xen_pvh; |
| 19 | #else |
| 20 | #define xen_pvh 0 |
| 21 | #endif |
| 22 | |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 23 | #define xen_domain() (xen_domain_type != XEN_NATIVE) |
Juergen Gross | b4feaeb | 2017-07-27 17:11:58 +0200 | [diff] [blame] | 24 | #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 Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 27 | |
Roger Pau Monne | 1fe8388 | 2018-06-08 10:40:38 +0200 | [diff] [blame] | 28 | #include <linux/types.h> |
| 29 | |
| 30 | extern uint32_t xen_start_flags; |
| 31 | |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 32 | #ifdef CONFIG_XEN_DOM0 |
| 33 | #include <xen/interface/xen.h> |
| 34 | #include <asm/xen/hypervisor.h> |
| 35 | |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 36 | #define xen_initial_domain() (xen_domain() && \ |
Roger Pau Monne | 1fe8388 | 2018-06-08 10:40:38 +0200 | [diff] [blame] | 37 | (xen_start_flags & SIF_INITDOMAIN)) |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 38 | #else /* !CONFIG_XEN_DOM0 */ |
| 39 | #define xen_initial_domain() (0) |
| 40 | #endif /* CONFIG_XEN_DOM0 */ |
| 41 | |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 42 | #endif /* _XEN_XEN_H */ |