From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 6/7] ppc: Introduce kvmppc_set_reg_tb_offset() helper
Date: Fri, 21 Jun 2019 21:58:15 +1000 [thread overview]
Message-ID: <20190621115815.GG8232@umbus.BigPond> (raw)
In-Reply-To: <156051055736.224162.11641594431517798715.stgit@bahia.lan>
[-- Attachment #1: Type: text/plain, Size: 2549 bytes --]
On Fri, Jun 14, 2019 at 01:09:17PM +0200, Greg Kurz wrote:
> Introduce a KVM helper and its stub instead of guarding the code with
> CONFIG_KVM.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
Applied, thanks.
> ---
> hw/ppc/ppc.c | 5 +----
> target/ppc/kvm.c | 9 +++++++++
> target/ppc/kvm_ppc.h | 5 +++++
> 3 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index 288196dfa67a..a9e508c496de 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -1034,10 +1034,7 @@ static void timebase_load(PPCTimebase *tb)
> CPU_FOREACH(cpu) {
> PowerPCCPU *pcpu = POWERPC_CPU(cpu);
> pcpu->env.tb_env->tb_offset = tb_off_adj;
> -#if defined(CONFIG_KVM)
> - kvm_set_one_reg(cpu, KVM_REG_PPC_TB_OFFSET,
> - &pcpu->env.tb_env->tb_offset);
> -#endif
> + kvmppc_set_reg_tb_offset(pcpu, pcpu->env.tb_env->tb_offset);
> }
> }
>
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index d4107dd70d21..cde39904510a 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -2939,3 +2939,12 @@ void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu, unsigned int online)
> kvm_set_one_reg(cs, KVM_REG_PPC_ONLINE, &online);
> }
> }
> +
> +void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset)
> +{
> + CPUState *cs = CPU(cpu);
> +
> + if (kvm_enabled()) {
> + kvm_set_one_reg(cs, KVM_REG_PPC_TB_OFFSET, &tb_offset);
> + }
> +}
> diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
> index 45776cad79d9..e642aaaf9226 100644
> --- a/target/ppc/kvm_ppc.h
> +++ b/target/ppc/kvm_ppc.h
> @@ -80,6 +80,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);
> +void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset);
>
> #else
>
> @@ -206,6 +207,10 @@ static inline void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu,
> return;
> }
>
> +static inline void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset)
> +{
> +}
> +
> #ifndef CONFIG_USER_ONLY
> static inline bool kvmppc_spapr_use_multitce(void)
> {
>
--
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:[~2019-06-21 12:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 11:08 [Qemu-devel] [PATCH 0/7] ppc: Get rid of some CONFIG_KVM guards Greg Kurz
2019-06-14 11:08 ` [Qemu-devel] [PATCH 1/7] spapr_pci: Drop useless CONFIG_KVM ifdefery Greg Kurz
2019-06-14 11:08 ` [Qemu-devel] [PATCH 2/7] hw/ppc/mac_oldworld: " Greg Kurz
2019-06-14 11:09 ` [Qemu-devel] [PATCH 3/7] hw/ppc/mac_newworld: " Greg Kurz
2019-06-14 11:09 ` [Qemu-devel] [PATCH 4/7] hw/ppc/prep: " Greg Kurz
2019-06-14 11:09 ` [Qemu-devel] [PATCH 5/7] hw/ppc: " Greg Kurz
2019-06-14 11:09 ` [Qemu-devel] [PATCH 6/7] ppc: Introduce kvmppc_set_reg_tb_offset() helper Greg Kurz
2019-06-21 11:58 ` David Gibson [this message]
2019-06-14 11:09 ` [Qemu-devel] [PATCH 7/7] target/ppc/machine: Add kvmppc_pvr_workaround_required() stub Greg Kurz
2019-06-21 11:59 ` David Gibson
2019-06-19 11:13 ` [Qemu-devel] [PATCH 0/7] ppc: Get rid of some CONFIG_KVM guards 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=20190621115815.GG8232@umbus.BigPond \
--to=david@gibson.dropbear.id.au \
--cc=groug@kaod.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).