All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: peter.maydell@linaro.org
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, lvivier@redhat.com,
	groug@kaod.org, clg@kaod.org, mark.cave-ayland@ilande.co.uk,
	Nikunj A Dadhania <nikunj@linux.ibm.com>,
	paulus@samba.org, David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PULL 13/14] target/ppc/kvm: set vcpu as online/offline
Date: Fri,  7 Sep 2018 17:31:54 +1000	[thread overview]
Message-ID: <20180907073155.26200-14-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au>

From: Nikunj A Dadhania <nikunj@linux.ibm.com>

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.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/spapr_cpu_core.c | 1 +
 hw/ppc/spapr_rtas.c     | 2 ++
 target/ppc/kvm.c        | 9 +++++++++
 target/ppc/kvm_ppc.h    | 7 +++++++
 4 files changed, 19 insertions(+)

diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index a73b244a3f..2398ce62c0 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -90,6 +90,7 @@ void spapr_cpu_set_entry_state(PowerPCCPU *cpu, target_ulong nip, target_ulong r
 
     env->nip = nip;
     env->gpr[3] = r3;
+    kvmppc_set_reg_ppc_online(cpu, 1);
     CPU(cpu)->halted = 0;
     /* Enable Power-saving mode Exit Cause exceptions */
     ppc_store_lpcr(cpu, env->spr[SPR_LPCR] | pcc->lpcr_pm);
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 4ac96bc94b..d6a0952154 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/hw_accel.h"
+#include "kvm_ppc.h"
 
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_vio.h"
@@ -207,6 +208,7 @@ static void rtas_stop_self(PowerPCCPU *cpu, sPAPRMachineState *spapr,
      * guest */
     ppc_store_lpcr(cpu, env->spr[SPR_LPCR] & ~pcc->lpcr_pm);
     cs->halted = 1;
+    kvmppc_set_reg_ppc_online(cpu, 0);
     qemu_cpu_kick(cs);
 }
 
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index ef63842217..30aeafa7de 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -2783,3 +2783,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 657582bb32..f696c6e498 100644
--- a/target/ppc/kvm_ppc.h
+++ b/target/ppc/kvm_ppc.h
@@ -72,6 +72,7 @@ bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu);
 
 bool kvmppc_hpt_needs_host_contiguous_pages(void);
 void kvm_check_mmu(PowerPCCPU *cpu, Error **errp);
+void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu, unsigned int online);
 
 #else
 
@@ -187,6 +188,12 @@ 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 bool kvmppc_spapr_use_multitce(void)
 {
-- 
2.17.1

  parent reply	other threads:[~2018-09-07  7:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-07  7:31 [Qemu-devel] [PULL 00/14] ppc-for-3.1 queue 20180907 David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 01/14] ppc: Remove deprecated ppcemb target David Gibson
2018-09-07 13:39   ` Eric Blake
2018-09-10  4:25     ` David Gibson
2018-09-10  6:32       ` Thomas Huth
2018-09-11  1:42         ` David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 02/14] spapr: fix leak of rev array David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 03/14] spapr_pci: fix potential NULL pointer dereference David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 04/14] macio: move MACIOIDEState type declarations to macio.h David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 05/14] macio: add macio bus to help with fw path generation David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 06/14] macio: add addr property to macio IDE object David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 07/14] grackle: set device fw_name and address for correct fw path generation David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 08/14] mac_oldworld: implement custom FWPathProvider David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 09/14] uninorth: add ofw-addr property to allow correct fw path generation David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 10/14] mac_newworld: implement custom FWPathProvider David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 11/14] spapr: Correct reference count on spapr-cpu-core David Gibson
2018-09-07  7:31 ` [Qemu-devel] [PULL 12/14] Fix a deadlock case in the CPU hotplug flow David Gibson
2018-09-07  7:31 ` David Gibson [this message]
2018-09-07  7:31 ` [Qemu-devel] [PULL 14/14] target-ppc: Extend HWCAP2 bits for ISA 3.0 David Gibson

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=20180907073155.26200-14-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=clg@kaod.org \
    --cc=groug@kaod.org \
    --cc=lvivier@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=nikunj@linux.ibm.com \
    --cc=paulus@samba.org \
    --cc=peter.maydell@linaro.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 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.