diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2017-03-27 16:22:19 +1100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2017-04-26 12:00:41 +1000 |
commit | 3dc410ae83e6cb76c81ea30a05d62596092b3165 (patch) | |
tree | 80df255985a95fb0b93fa8edb97e78353cef8565 /target | |
parent | e957f6a9b92439a222ecd4ff1c8cdc9700710c72 (diff) |
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 <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target')
-rw-r--r-- | target/ppc/kvm.c | 14 | ||||
-rw-r--r-- | target/ppc/kvm_ppc.h | 6 |
2 files changed, 20 insertions, 0 deletions
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) diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index 4b2fd9a609..f48243d13f 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -39,6 +39,7 @@ target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu, #ifndef CONFIG_USER_ONLY off_t kvmppc_alloc_rma(void **rma); bool kvmppc_spapr_use_multitce(void); +int kvmppc_spapr_enable_inkernel_multitce(void); 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); @@ -180,6 +181,11 @@ static inline bool kvmppc_spapr_use_multitce(void) return false; } +static inline int kvmppc_spapr_enable_inkernel_multitce(void) +{ + return -1; +} + static inline void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift, uint64_t bus_offset, uint32_t nb_table, |