From: David Gibson <david@gibson.dropbear.id.au>
To: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, imammedo@redhat.com,
thuth@redhat.com, aik@ozlabs.ru, agraf@suse.de,
pbonzini@redhat.com, ehabkost@redhat.com, pkrempa@redhat.com,
mdroth@linux.vnet.ibm.com, eblake@redhat.com,
mjrosato@linux.vnet.ibm.com, borntraeger@de.ibm.com
Subject: Re: [Qemu-devel] [PATCH v4 3/9] spapr: Move spapr_cpu_init() to spapr_cpu_core.c
Date: Fri, 10 Jun 2016 14:27:41 +1000 [thread overview]
Message-ID: <20160610042741.GO9226@voom.fritz.box> (raw)
In-Reply-To: <1465520348-13964-4-git-send-email-bharata@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 5407 bytes --]
On Fri, Jun 10, 2016 at 06:29:02AM +0530, Bharata B Rao wrote:
> Start consolidating CPU init related routines in spapr_cpu_core.c. As
> part of this, move spapr_cpu_init() and its dependencies from spapr.c
> to spapr_cpu_core.c
>
> No functionality change in this patch.
>
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
One nit..
> ---
> hw/ppc/spapr.c | 47 -----------------------------------------------
> hw/ppc/spapr_cpu_core.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
> include/hw/ppc/spapr.h | 2 ++
> 3 files changed, 50 insertions(+), 47 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 87f4e53..adaca42 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -89,8 +89,6 @@
>
> #define MIN_RMA_SLOF 128UL
>
> -#define TIMEBASE_FREQ 512000000ULL
> -
> #define PHANDLE_XICP 0x00001111
>
> #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift))
> @@ -1181,26 +1179,6 @@ static void ppc_spapr_reset(void)
>
> }
>
> -static void spapr_cpu_reset(void *opaque)
> -{
> - sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
> - PowerPCCPU *cpu = opaque;
> - CPUState *cs = CPU(cpu);
> - CPUPPCState *env = &cpu->env;
> -
> - cpu_reset(cs);
> -
> - /* All CPUs start halted. CPU0 is unhalted from the machine level
> - * reset code and the rest are explicitly started up by the guest
> - * using an RTAS call */
> - cs->halted = 1;
> -
> - env->spr[SPR_HIOR] = 0;
> -
> - ppc_hash64_set_external_hpt(cpu, spapr->htab, spapr->htab_shift,
> - &error_fatal);
> -}
> -
> static void spapr_create_nvram(sPAPRMachineState *spapr)
> {
> DeviceState *dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram");
> @@ -1606,31 +1584,6 @@ static void spapr_boot_set(void *opaque, const char *boot_device,
> machine->boot_order = g_strdup(boot_device);
> }
>
> -void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **errp)
> -{
> - CPUPPCState *env = &cpu->env;
> -
> - /* Set time-base frequency to 512 MHz */
> - cpu_ppc_tb_init(env, TIMEBASE_FREQ);
> -
> - /* Enable PAPR mode in TCG or KVM */
> - cpu_ppc_set_papr(cpu);
> -
> - if (cpu->max_compat) {
> - Error *local_err = NULL;
> -
> - ppc_set_compat(cpu, cpu->max_compat, &local_err);
> - if (local_err) {
> - error_propagate(errp, local_err);
> - return;
> - }
> - }
> -
> - xics_cpu_setup(spapr->icp, cpu);
> -
> - qemu_register_reset(spapr_cpu_reset, cpu);
> -}
> -
> /*
> * Reset routine for LMB DR devices.
> *
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index b8b97c9..e9eb754 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -14,6 +14,54 @@
> #include "qapi/error.h"
> #include <sysemu/cpus.h>
> #include "target-ppc/kvm_ppc.h"
> +#include "hw/ppc/ppc.h"
> +#include "target-ppc/mmu-hash64.h"
> +#include <sysemu/numa.h>
> +
> +static void spapr_cpu_reset(void *opaque)
> +{
> + sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
> + PowerPCCPU *cpu = opaque;
> + CPUState *cs = CPU(cpu);
> + CPUPPCState *env = &cpu->env;
> +
> + cpu_reset(cs);
> +
> + /* All CPUs start halted. CPU0 is unhalted from the machine level
> + * reset code and the rest are explicitly started up by the guest
> + * using an RTAS call */
> + cs->halted = 1;
> +
> + env->spr[SPR_HIOR] = 0;
> +
> + ppc_hash64_set_external_hpt(cpu, spapr->htab, spapr->htab_shift,
> + &error_fatal);
> +}
> +
> +void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **errp)
> +{
> + CPUPPCState *env = &cpu->env;
> +
> + /* Set time-base frequency to 512 MHz */
> + cpu_ppc_tb_init(env, TIMEBASE_FREQ);
> +
> + /* Enable PAPR mode in TCG or KVM */
> + cpu_ppc_set_papr(cpu);
> +
> + if (cpu->max_compat) {
> + Error *local_err = NULL;
> +
> + ppc_set_compat(cpu, cpu->max_compat, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + return;
> + }
> + }
> +
> + xics_cpu_setup(spapr->icp, cpu);
> +
> + qemu_register_reset(spapr_cpu_reset, cpu);
> +}
>
> static int spapr_cpu_core_realize_child(Object *child, void *opaque)
> {
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 4ff14d6..e372dae 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -16,6 +16,8 @@ typedef struct sPAPREventLogEntry sPAPREventLogEntry;
> #define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL
> #define SPAPR_ENTRY_POINT 0x100
>
> +#define TIMEBASE_FREQ 512000000ULL
> +
Since this is now in a header which could be included anywhere, this
really needs an SPAPR_PREFIX. I'll make that tweak myself when I
merge it.
> typedef struct sPAPRMachineClass sPAPRMachineClass;
> typedef struct sPAPRMachineState sPAPRMachineState;
>
--
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 --]
next prev parent reply other threads:[~2016-06-10 6:50 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-10 0:58 [Qemu-devel] [PATCH v4 0/9] Core based CPU hotplug for PowerPC sPAPR Bharata B Rao
2016-06-10 0:59 ` [Qemu-devel] [PATCH v4 1/9] qom: API to get instance_size of a type Bharata B Rao
2016-06-10 4:04 ` David Gibson
2016-06-10 7:38 ` Igor Mammedov
2016-06-15 5:48 ` David Gibson
2016-06-10 0:59 ` [Qemu-devel] [PATCH v4 2/9] spapr: Abstract CPU core device and type specific core devices Bharata B Rao
2016-06-10 4:24 ` David Gibson
2016-06-10 0:59 ` [Qemu-devel] [PATCH v4 3/9] spapr: Move spapr_cpu_init() to spapr_cpu_core.c Bharata B Rao
2016-06-10 4:27 ` David Gibson [this message]
2016-06-10 0:59 ` [Qemu-devel] [PATCH v4 4/9] spapr: convert boot CPUs into CPU core devices Bharata B Rao
2016-06-10 0:59 ` [Qemu-devel] [PATCH v4 5/9] spapr: CPU hotplug support Bharata B Rao
2016-06-10 0:59 ` [Qemu-devel] [PATCH v4 6/9] spapr: CPU hot unplug support Bharata B Rao
2016-06-10 0:59 ` [Qemu-devel] [PATCH v4 7/9] QMP: Add query-hotpluggable-cpus Bharata B Rao
2016-06-10 0:59 ` [Qemu-devel] [PATCH v4 8/9] hmp: Add 'info hotpluggable-cpus' HMP command Bharata B Rao
2016-06-10 8:34 ` David Gibson
2016-06-10 0:59 ` [Qemu-devel] [PATCH v4 9/9] spapr: implement query-hotpluggable-cpus callback Bharata B Rao
2016-06-10 5:14 ` [Qemu-devel] [PATCH v4 0/9] Core based CPU hotplug for PowerPC sPAPR David Gibson
2016-06-15 6:04 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-06-16 3:49 ` Bharata B Rao
2016-06-16 6:41 ` David Gibson
2016-06-16 11:49 ` Thomas Huth
2016-06-16 16:57 ` Igor Mammedov
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=20160610042741.GO9226@voom.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=bharata@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=eblake@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mjrosato@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.com \
/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.