From 3dc410ae83e6cb76c81ea30a05d62596092b3165 Mon Sep 17 00:00:00 2001 From: Alexey Kardashevskiy Date: Mon, 27 Mar 2017 16:22:19 +1100 Subject: target-ppc/kvm: Enable in-kernel TCE acceleration for multi-tce This enables in-kernel handling of H_PUT_TCE_INDIRECT and H_STUFF_TCE hypercalls. The host kernel support is there since v4.6, in particular d3695aa4f452 ("KVM: PPC: Add support for multiple-TCE hcalls"). H_PUT_TCE is already accelerated and does not need any special enablement. Signed-off-by: Alexey Kardashevskiy Signed-off-by: David Gibson --- target/ppc/kvm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'target/ppc/kvm.c') diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index c959b90b59..8574c369e6 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2198,6 +2198,20 @@ bool kvmppc_spapr_use_multitce(void) return cap_spapr_multitce; } +int kvmppc_spapr_enable_inkernel_multitce(void) +{ + int ret; + + ret = kvm_vm_enable_cap(kvm_state, KVM_CAP_PPC_ENABLE_HCALL, 0, + H_PUT_TCE_INDIRECT, 1); + if (!ret) { + ret = kvm_vm_enable_cap(kvm_state, KVM_CAP_PPC_ENABLE_HCALL, 0, + H_STUFF_TCE, 1); + } + + return ret; +} + void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift, uint64_t bus_offset, uint32_t nb_table, int *pfd, bool need_vfio) -- cgit v1.2.3