Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  *  Extracted from cputable.c
0004  *
0005  *  Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
0006  *
0007  *  Modifications for ppc64:
0008  *      Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
0009  *  Copyright (C) 2005 Stephen Rothwell, IBM Corporation
0010  */
0011 
0012 #include <linux/export.h>
0013 #include <linux/cache.h>
0014 #include <linux/of.h>
0015 
0016 #include <asm/firmware.h>
0017 #include <asm/kvm_guest.h>
0018 
0019 #ifdef CONFIG_PPC64
0020 unsigned long powerpc_firmware_features __read_mostly;
0021 EXPORT_SYMBOL_GPL(powerpc_firmware_features);
0022 #endif
0023 
0024 #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_KVM_GUEST)
0025 DEFINE_STATIC_KEY_FALSE(kvm_guest);
0026 int __init check_kvm_guest(void)
0027 {
0028     struct device_node *hyper_node;
0029 
0030     hyper_node = of_find_node_by_path("/hypervisor");
0031     if (!hyper_node)
0032         return 0;
0033 
0034     if (of_device_is_compatible(hyper_node, "linux,kvm"))
0035         static_branch_enable(&kvm_guest);
0036 
0037     of_node_put(hyper_node);
0038     return 0;
0039 }
0040 core_initcall(check_kvm_guest); // before kvm_guest_init()
0041 #endif