diff options
author | Paul Mackerras <paulus@samba.org> | 2014-06-02 05:03:00 +0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-07-28 17:22:18 +0400 |
commit | ae2113a4f1a6cd5a3cd3d75f394547922758e9ac (patch) | |
tree | 59a1dbf6369d853d0ad76c62a0333c47bb8992d0 /arch/powerpc/kvm/book3s_hv_builtin.c | |
parent | 699a0ea0823d32030b0666b28ff8633960f7ffa7 (diff) | |
download | linux-ae2113a4f1a6cd5a3cd3d75f394547922758e9ac.tar.xz |
KVM: PPC: Book3S: Allow only implemented hcalls to be enabled or disabled
This adds code to check that when the KVM_CAP_PPC_ENABLE_HCALL
capability is used to enable or disable in-kernel handling of an
hcall, that the hcall is actually implemented by the kernel.
If not an EINVAL error is returned.
This also checks the default-enabled list of hcalls and prints a
warning if any hcall there is not actually implemented.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/book3s_hv_builtin.c')
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_builtin.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c index 7cde8a665205..3b41447482e5 100644 --- a/arch/powerpc/kvm/book3s_hv_builtin.c +++ b/arch/powerpc/kvm/book3s_hv_builtin.c @@ -212,3 +212,16 @@ bool kvm_hv_mode_active(void) { return atomic_read(&hv_vm_count) != 0; } + +extern int hcall_real_table[], hcall_real_table_end[]; + +int kvmppc_hcall_impl_hv_realmode(unsigned long cmd) +{ + cmd /= 4; + if (cmd < hcall_real_table_end - hcall_real_table && + hcall_real_table[cmd]) + return 1; + + return 0; +} +EXPORT_SYMBOL_GPL(kvmppc_hcall_impl_hv_realmode); |