xref: /openbmc/linux/arch/powerpc/kernel/firmware.c (revision b1a3e75e)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  *  Extracted from cputable.c
4  *
5  *  Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
6  *
7  *  Modifications for ppc64:
8  *      Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
9  *  Copyright (C) 2005 Stephen Rothwell, IBM Corporation
10  */
11 
12 #include <linux/export.h>
13 #include <linux/cache.h>
14 #include <linux/of.h>
15 
16 #include <asm/firmware.h>
17 
18 #ifdef CONFIG_PPC64
19 unsigned long powerpc_firmware_features __read_mostly;
20 EXPORT_SYMBOL_GPL(powerpc_firmware_features);
21 #endif
22 
23 #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_KVM_GUEST)
24 bool is_kvm_guest(void)
25 {
26 	struct device_node *hyper_node;
27 
28 	hyper_node = of_find_node_by_path("/hypervisor");
29 	if (!hyper_node)
30 		return 0;
31 
32 	if (!of_device_is_compatible(hyper_node, "linux,kvm"))
33 		return 0;
34 
35 	return 1;
36 }
37 #endif
38