2019-05-27 14:55:01 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2005-08-03 12:40:16 +08:00
|
|
|
/*
|
|
|
|
* Extracted from cputable.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
|
|
|
|
*
|
|
|
|
* Modifications for ppc64:
|
|
|
|
* Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
|
|
|
|
* Copyright (C) 2005 Stephen Rothwell, IBM Corporation
|
|
|
|
*/
|
|
|
|
|
powerpc: fix implicit use of cache.h in kernel/firmware.c
This file only needs export.h to get EXPORT_SYMBOL, but in doing
so, it uncovers an implicit use of linux/cache.h as follows:
CC arch/powerpc/kernel/firmware.o
arch/powerpc/kernel/firmware.c:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__read_mostly'
arch/powerpc/kernel/firmware.c:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__used'
make[2]: *** [arch/powerpc/kernel/firmware.o] Error 1
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-07-23 03:07:20 +08:00
|
|
|
#include <linux/export.h>
|
|
|
|
#include <linux/cache.h>
|
2020-07-26 11:51:55 +08:00
|
|
|
#include <linux/of.h>
|
2005-08-03 12:40:16 +08:00
|
|
|
|
|
|
|
#include <asm/firmware.h>
|
2020-12-02 13:04:53 +08:00
|
|
|
#include <asm/kvm_guest.h>
|
2005-08-03 12:40:16 +08:00
|
|
|
|
2020-07-26 11:51:55 +08:00
|
|
|
#ifdef CONFIG_PPC64
|
2010-02-07 21:07:36 +08:00
|
|
|
unsigned long powerpc_firmware_features __read_mostly;
|
2006-03-27 11:26:25 +08:00
|
|
|
EXPORT_SYMBOL_GPL(powerpc_firmware_features);
|
2020-07-26 11:51:55 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_KVM_GUEST)
|
2020-12-02 13:04:55 +08:00
|
|
|
DEFINE_STATIC_KEY_FALSE(kvm_guest);
|
2020-12-02 13:04:54 +08:00
|
|
|
bool check_kvm_guest(void)
|
2020-07-26 11:51:55 +08:00
|
|
|
{
|
|
|
|
struct device_node *hyper_node;
|
|
|
|
|
|
|
|
hyper_node = of_find_node_by_path("/hypervisor");
|
|
|
|
if (!hyper_node)
|
2020-12-02 13:04:54 +08:00
|
|
|
return false;
|
2020-07-26 11:51:55 +08:00
|
|
|
|
|
|
|
if (!of_device_is_compatible(hyper_node, "linux,kvm"))
|
2020-12-02 13:04:54 +08:00
|
|
|
return false;
|
2020-07-26 11:51:55 +08:00
|
|
|
|
2020-12-02 13:04:55 +08:00
|
|
|
static_branch_enable(&kvm_guest);
|
2020-12-02 13:04:54 +08:00
|
|
|
return true;
|
2020-07-26 11:51:55 +08:00
|
|
|
}
|
|
|
|
#endif
|