* [Qemu-devel] [PATCH qemu] target-ppc/kvm: Enable in-kernel TCE acceleration for multi-tce
@ 2017-03-27 5:22 Alexey Kardashevskiy
2017-03-28 3:29 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Kardashevskiy @ 2017-03-27 5:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, David Gibson
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>
---
target/ppc/kvm_ppc.h | 6 ++++++
hw/ppc/spapr.c | 4 +++-
target/ppc/kvm.c | 14 ++++++++++++++
3 files changed, 23 insertions(+), 1 deletion(-)
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,
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 0e1c29bcf8..8027716f73 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2360,10 +2360,12 @@ static void ppc_spapr_init(MachineState *machine)
qemu_register_boot_set(spapr_boot_set, spapr);
- /* to stop and start vmclock */
if (kvm_enabled()) {
+ /* to stop and start vmclock */
qemu_add_vm_change_state_handler(cpu_ppc_clock_vm_state_change,
&spapr->tb);
+
+ kvmppc_spapr_enable_inkernel_multitce();
}
}
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 6dc39623e5..560ce655c7 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -2194,6 +2194,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)
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH qemu] target-ppc/kvm: Enable in-kernel TCE acceleration for multi-tce
2017-03-27 5:22 [Qemu-devel] [PATCH qemu] target-ppc/kvm: Enable in-kernel TCE acceleration for multi-tce Alexey Kardashevskiy
@ 2017-03-28 3:29 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2017-03-28 3:29 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: qemu-devel, qemu-ppc
[-- Attachment #1: Type: text/plain, Size: 3334 bytes --]
On Mon, Mar 27, 2017 at 04:22:19PM +1100, Alexey Kardashevskiy wrote:
> 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>
Applied to ppc-for-2.10.
> ---
> target/ppc/kvm_ppc.h | 6 ++++++
> hw/ppc/spapr.c | 4 +++-
> target/ppc/kvm.c | 14 ++++++++++++++
> 3 files changed, 23 insertions(+), 1 deletion(-)
>
> 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,
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 0e1c29bcf8..8027716f73 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2360,10 +2360,12 @@ static void ppc_spapr_init(MachineState *machine)
>
> qemu_register_boot_set(spapr_boot_set, spapr);
>
> - /* to stop and start vmclock */
> if (kvm_enabled()) {
> + /* to stop and start vmclock */
> qemu_add_vm_change_state_handler(cpu_ppc_clock_vm_state_change,
> &spapr->tb);
> +
> + kvmppc_spapr_enable_inkernel_multitce();
> }
> }
>
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 6dc39623e5..560ce655c7 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -2194,6 +2194,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)
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-28 4:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-27 5:22 [Qemu-devel] [PATCH qemu] target-ppc/kvm: Enable in-kernel TCE acceleration for multi-tce Alexey Kardashevskiy
2017-03-28 3:29 ` David Gibson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.