xref: /kvm-unit-tests/lib/s390x/hardware.h (revision f489dfa5209ed88133b9e5b1f9e4fe33c6af5a3a)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Functions to retrieve information about the host system.
4  *
5  * Copyright (c) 2020 Red Hat Inc
6  * Copyright 2022 IBM Corp.
7  *
8  * Authors:
9  *  Claudio Imbrenda <imbrenda@linux.ibm.com>
10  */
11 
12 #ifndef _S390X_HARDWARE_H_
13 #define _S390X_HARDWARE_H_
14 #include <asm/arch_def.h>
15 
16 enum s390_host {
17 	HOST_IS_UNKNOWN,
18 	HOST_IS_LPAR,
19 	HOST_IS_KVM,
20 	HOST_IS_TCG
21 };
22 
23 enum s390_host detect_host(void);
24 
25 static inline bool host_is_tcg(void)
26 {
27 	return detect_host() == HOST_IS_TCG;
28 }
29 
30 static inline bool host_is_kvm(void)
31 {
32 	return detect_host() == HOST_IS_KVM;
33 }
34 
35 static inline bool host_is_lpar(void)
36 {
37 	return detect_host() == HOST_IS_LPAR;
38 }
39 
40 #endif  /* _S390X_HARDWARE_H_ */
41