From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBGHC-0003UK-83 for qemu-devel@nongnu.org; Fri, 10 Jun 2016 02:50:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBGH6-00036d-8M for qemu-devel@nongnu.org; Fri, 10 Jun 2016 02:50:41 -0400 Date: Fri, 10 Jun 2016 14:27:41 +1000 From: David Gibson Message-ID: <20160610042741.GO9226@voom.fritz.box> References: <1465520348-13964-1-git-send-email-bharata@linux.vnet.ibm.com> <1465520348-13964-4-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xPlWqmdJYj61cSlc" Content-Disposition: inline In-Reply-To: <1465520348-13964-4-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v4 3/9] spapr: Move spapr_cpu_init() to spapr_cpu_core.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao 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 --xPlWqmdJYj61cSlc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 >=20 > No functionality change in this patch. >=20 > Signed-off-by: Bharata B Rao 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(-) >=20 > 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 @@ > =20 > #define MIN_RMA_SLOF 128UL > =20 > -#define TIMEBASE_FREQ 512000000ULL > - > #define PHANDLE_XICP 0x00001111 > =20 > #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) > @@ -1181,26 +1179,6 @@ static void ppc_spapr_reset(void) > =20 > } > =20 > -static void spapr_cpu_reset(void *opaque) > -{ > - sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); > - PowerPCCPU *cpu =3D opaque; > - CPUState *cs =3D CPU(cpu); > - CPUPPCState *env =3D &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 =3D 1; > - > - env->spr[SPR_HIOR] =3D 0; > - > - ppc_hash64_set_external_hpt(cpu, spapr->htab, spapr->htab_shift, > - &error_fatal); > -} > - > static void spapr_create_nvram(sPAPRMachineState *spapr) > { > DeviceState *dev =3D qdev_create(&spapr->vio_bus->bus, "spapr-nvram"= ); > @@ -1606,31 +1584,6 @@ static void spapr_boot_set(void *opaque, const cha= r *boot_device, > machine->boot_order =3D g_strdup(boot_device); > } > =20 > -void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **e= rrp) > -{ > - CPUPPCState *env =3D &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 =3D 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 > #include "target-ppc/kvm_ppc.h" > +#include "hw/ppc/ppc.h" > +#include "target-ppc/mmu-hash64.h" > +#include > + > +static void spapr_cpu_reset(void *opaque) > +{ > + sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); > + PowerPCCPU *cpu =3D opaque; > + CPUState *cs =3D CPU(cpu); > + CPUPPCState *env =3D &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 =3D 1; > + > + env->spr[SPR_HIOR] =3D 0; > + > + ppc_hash64_set_external_hpt(cpu, spapr->htab, spapr->htab_shift, > + &error_fatal); > +} > + > +void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **e= rrp) > +{ > + CPUPPCState *env =3D &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 =3D 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); > +} > =20 > 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 > =20 > +#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; > =20 --=20 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 --xPlWqmdJYj61cSlc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXWkG9AAoJEGw4ysog2bOS2t8P/1ssaPmrtQZragDd4SIyFbqn f2Pn37lQdv7upCdWCgE3iJjtytaEIUvdwAj2r8trQva212gNukGbo90yIuHrAxAw I7BzBrsVlnCGpfNoK11h63sNa8TisjB/dzLkBn0BwSwFD6ST3mT+9aKPXcjkfqj7 pIr3bMFZyWX/TYCevywR3ON9SBLIebfWjNEg42X0OFW6QOugt/vbd97N8e5pq4EX +V+6tMDTJnsxxmWsSt6N9fGGGn1jXaR0DJY5jFHNxGreBgDbfmpEAKby+Oa8XeK3 raCc/EIKdQ/Qe4jprYqhfBnQSmlK2+BwiHi/3cnKYXNYVyPJXaUTO9U5A7kAE1+E ty+K/fNmxpdU2hDQSGgcSvblTxsqz0lEXm/F3V0kBbNqIsHtqAgojhjV2u6Qs0Lk 2poWoarx7+fejWeQsv//NXuZp10ItX49gcS9C2/W6zF2rgiJRWe8Sc35VRNlCj6w oIh69efXdfTfhuW6P1uLb1pUD66s9dXuVjcopAy7+gfrUHV65rpLDzRBIhjUUVkF lGFLrcB62uW5Mw//FGaE8BFUumckARzlrrkGwqbOWY1BQ83cDuO1uW9oi8OaYFn3 DCfK5+DDWXqrLH9lyZsoiTm+lx2tslp2EDhQI5e+//b7mrOSjNQWYgp8IVh0JZHg 6jUAB/D39Wy9Wd3nmgKs =YDw5 -----END PGP SIGNATURE----- --xPlWqmdJYj61cSlc--