| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 3 | | - * it under the terms of the GNU General Public License, version 2, as |
|---|
| 4 | | - * published by the Free Software Foundation. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 7 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 8 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 9 | | - * GNU General Public License for more details. |
|---|
| 10 | | - * |
|---|
| 11 | | - * You should have received a copy of the GNU General Public License |
|---|
| 12 | | - * along with this program; if not, write to the Free Software |
|---|
| 13 | | - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|---|
| 14 | 3 | * |
|---|
| 15 | 4 | * Copyright IBM Corp. 2008 |
|---|
| 16 | 5 | * |
|---|
| .. | .. |
|---|
| 19 | 8 | #ifndef __POWERPC_KVM_PARA_H__ |
|---|
| 20 | 9 | #define __POWERPC_KVM_PARA_H__ |
|---|
| 21 | 10 | |
|---|
| 11 | +#include <asm/kvm_guest.h> |
|---|
| 12 | + |
|---|
| 22 | 13 | #include <uapi/asm/kvm_para.h> |
|---|
| 23 | 14 | |
|---|
| 24 | | -#ifdef CONFIG_KVM_GUEST |
|---|
| 25 | | - |
|---|
| 26 | | -#include <linux/of.h> |
|---|
| 27 | | - |
|---|
| 28 | 15 | static inline int kvm_para_available(void) |
|---|
| 29 | 16 | { |
|---|
| 30 | | - struct device_node *hyper_node; |
|---|
| 31 | | - |
|---|
| 32 | | - hyper_node = of_find_node_by_path("/hypervisor"); |
|---|
| 33 | | - if (!hyper_node) |
|---|
| 34 | | - return 0; |
|---|
| 35 | | - |
|---|
| 36 | | - if (!of_device_is_compatible(hyper_node, "linux,kvm")) |
|---|
| 37 | | - return 0; |
|---|
| 38 | | - |
|---|
| 39 | | - return 1; |
|---|
| 17 | + return IS_ENABLED(CONFIG_KVM_GUEST) && is_kvm_guest(); |
|---|
| 40 | 18 | } |
|---|
| 41 | | - |
|---|
| 42 | | -#else |
|---|
| 43 | | - |
|---|
| 44 | | -static inline int kvm_para_available(void) |
|---|
| 45 | | -{ |
|---|
| 46 | | - return 0; |
|---|
| 47 | | -} |
|---|
| 48 | | - |
|---|
| 49 | | -#endif |
|---|
| 50 | 19 | |
|---|
| 51 | 20 | static inline unsigned int kvm_arch_para_features(void) |
|---|
| 52 | 21 | { |
|---|