[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH] target/ppc/kvm: set vcpu as online/offline
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH] target/ppc/kvm: set vcpu as online/offline |
Date: |
Mon, 23 Apr 2018 16:52:45 +1000 |
User-agent: |
Mutt/1.9.2 (2017-12-15) |
On Mon, Apr 23, 2018 at 11:43:02AM +0530, Nikunj A Dadhania wrote:
> Set the newly added register(KVM_REG_PPC_ONLINE) to indicate if the vcpu is
> online(1) or offline(0)
>
> KVM will use this information to set the RWMR register, which controls the
> PURR
> and SPURR accumulation.
>
> CC: address@hidden
> Signed-off-by: Nikunj A Dadhania <address@hidden>
>
> ---
>
> http://patchwork.ozlabs.org/patch/901897/
> ---
> hw/ppc/spapr.c | 1 +
> hw/ppc/spapr_rtas.c | 4 ++++
> linux-headers/asm-powerpc/kvm.h | 1 +
The usual convention is to send updates to the imported headers, as a
general update to a specific kernel SHA, rather than folding just the
necessary parts into the patches that use them.
This will need to wait for 2.13.
> target/ppc/kvm.c | 9 +++++++++
> target/ppc/kvm_ppc.h | 6 ++++++
> 5 files changed, 21 insertions(+)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index a81570e7c8..48bafe3765 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1549,6 +1549,7 @@ static void spapr_machine_reset(void)
> first_ppc_cpu->env.gpr[5] = 0;
> first_cpu->halted = 0;
> first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
> + kvmppc_set_reg_ppc_online(first_ppc_cpu, 1);
>
> spapr->cas_reboot = false;
> }
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 0ec5fa4cfe..0874a746dd 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -33,6 +33,7 @@
> #include "sysemu/device_tree.h"
> #include "sysemu/cpus.h"
> #include "sysemu/kvm.h"
> +#include "kvm_ppc.h"
>
> #include "hw/ppc/spapr.h"
> #include "hw/ppc/spapr_vio.h"
> @@ -184,6 +185,8 @@ static void rtas_start_cpu(PowerPCCPU *cpu_,
> sPAPRMachineState *spapr,
> spapr_cpu_set_endianness(cpu);
> spapr_cpu_update_tb_offset(cpu);
>
> + kvmppc_set_reg_ppc_online(cpu, 1);
> +
> qemu_cpu_kick(cs);
>
> rtas_st(rets, 0, RTAS_OUT_SUCCESS);
> @@ -204,6 +207,7 @@ static void rtas_stop_self(PowerPCCPU *cpu,
> sPAPRMachineState *spapr,
> PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
>
> cs->halted = 1;
> + kvmppc_set_reg_ppc_online(cpu, 0);
> qemu_cpu_kick(cs);
>
> /* Disable Power-saving mode Exit Cause exceptions for the CPU.
> diff --git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kvm.h
> index 833ed9a16a..1b32b56a03 100644
> --- a/linux-headers/asm-powerpc/kvm.h
> +++ b/linux-headers/asm-powerpc/kvm.h
> @@ -633,6 +633,7 @@ struct kvm_ppc_cpu_char {
> #define KVM_REG_PPC_PSSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbd)
>
> #define KVM_REG_PPC_DEC_EXPIRY (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe)
> +#define KVM_REG_PPC_ONLINE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbf)
>
> /* Transactional Memory checkpointed state:
> * This is all GPRs, all VSX regs and a subset of SPRs
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 79a436a384..32a146f838 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -2877,3 +2877,12 @@ bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu)
>
> return !kvmppc_is_pr(cs->kvm_state);
> }
> +
> +void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu, unsigned int online)
> +{
> + CPUState *cs = CPU(cpu);
> +
> + if (kvm_enabled()) {
> + kvm_set_one_reg(cs, KVM_REG_PPC_ONLINE, &online);
> + }
> +}
> diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
> index 4d2789eef6..7a915fe422 100644
> --- a/target/ppc/kvm_ppc.h
> +++ b/target/ppc/kvm_ppc.h
> @@ -72,6 +72,7 @@ int kvmppc_resize_hpt_commit(PowerPCCPU *cpu, target_ulong
> flags, int shift);
> bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu);
>
> bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path);
> +void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu, unsigned int online);
>
> #else
>
> @@ -187,6 +188,11 @@ static inline target_ulong
> kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
> return 0;
> }
>
> +static inline void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu, unsigned int
> online)
> +{
> + return;
> +}
> +
> #ifndef CONFIG_USER_ONLY
> static inline off_t kvmppc_alloc_rma(void **rma)
> {
--
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
signature.asc
Description: PGP signature