From: David Gibson <david@gibson.dropbear.id.au>
To: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, paulus@samba.org
Subject: Re: [Qemu-devel] [PATCH] target/ppc/kvm: set vcpu as online/offline
Date: Mon, 23 Apr 2018 16:52:45 +1000 [thread overview]
Message-ID: <20180423065245.GH19804@umbus.fritz.box> (raw)
In-Reply-To: <20180423061302.24201-1-nikunj@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 4478 bytes --]
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: paulus@samba.org
> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>
> ---
>
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-04-23 6:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 6:13 [Qemu-devel] [PATCH] target/ppc/kvm: set vcpu as online/offline Nikunj A Dadhania
2018-04-23 6:52 ` David Gibson [this message]
2018-04-23 8:02 ` Nikunj A Dadhania
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180423065245.GH19804@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=nikunj@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).