From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqDmb-0004a1-0i for qemu-devel@nongnu.org; Thu, 07 May 2015 00:51:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqDmZ-0000zm-Lw for qemu-devel@nongnu.org; Thu, 07 May 2015 00:51:36 -0400 Date: Thu, 7 May 2015 14:40:23 +1000 From: David Gibson Message-ID: <20150507044023.GB29713@voom.redhat.com> References: <1430971024-27899-1-git-send-email-david@gibson.dropbear.id.au> <1430971024-27899-3-git-send-email-david@gibson.dropbear.id.au> <554AE64A.5050901@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aM3YZ0Iwxop3KEKx" Content-Disposition: inline In-Reply-To: <554AE64A.5050901@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH 2/4] spapr: Remove obsolete ram_limit field from sPAPRMachineState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: lvivier@redhat.com, thuth@redhat.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, agraf@suse.de, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, afaerber@suse.de --aM3YZ0Iwxop3KEKx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 07, 2015 at 02:12:58PM +1000, Alexey Kardashevskiy wrote: > On 05/07/2015 01:57 PM, David Gibson wrote: > >The ram_limit field was imported from sPAPREnvironment where it predates > >the machine's ram size being available generically from machine->ram_siz= e. > > > >Signed-off-by: David Gibson > >--- > > hw/ppc/spapr.c | 3 +-- > > hw/ppc/spapr_hcall.c | 3 ++- > > include/hw/ppc/spapr.h | 1 - > > 3 files changed, 3 insertions(+), 4 deletions(-) > > > >diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > >index 601c41b..1123358 100644 > >--- a/hw/ppc/spapr.c > >+++ b/hw/ppc/spapr.c > >@@ -1496,9 +1496,8 @@ static void ppc_spapr_init(MachineState *machine) > > } > > > > /* allocate RAM */ > >- sm->ram_limit =3D ram_size; >=20 >=20 >=20 > I had to look at the code to realize that ram_size is local and it can > actually be removed. Urgh.. it's actually worse than that. There's a global that's shadowed by the local. ppc_spapr_init() uses the local, spapr_populate_memory() uses the global. >=20 >=20 >=20 > > memory_region_allocate_system_memory(ram, NULL, "ppc_spapr.ram", > >- sm->ram_limit); > >+ machine->ram_size); > > memory_region_add_subregion(sysmem, 0, ram); > > > > if (rma_alloc_size && rma) { > >diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c > >index bf4b05a..e52983a 100644 > >--- a/hw/ppc/spapr_hcall.c > >+++ b/hw/ppc/spapr_hcall.c > >@@ -87,6 +87,7 @@ static inline bool valid_pte_index(CPUPPCState *env, t= arget_ulong pte_index) > > static target_ulong h_enter(PowerPCCPU *cpu, sPAPRMachineState *sm, > > target_ulong opcode, target_ulong *args) > > { > >+ MachineState *machine =3D MACHINE(sm); > > CPUPPCState *env =3D &cpu->env; > > target_ulong flags =3D args[0]; > > target_ulong pte_index =3D args[1]; > >@@ -118,7 +119,7 @@ static target_ulong h_enter(PowerPCCPU *cpu, sPAPRMa= chineState *sm, > > > > raddr =3D (ptel & HPTE64_R_RPN) & ~((1ULL << page_shift) - 1); > > > >- if (raddr < sm->ram_limit) { > >+ if (raddr < machine->ram_size) { > > /* Regular RAM - should have WIMG=3D0010 */ > > if ((ptel & HPTE64_R_WIMG) !=3D HPTE64_R_M) { > > return H_PARAMETER; > >diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > >index c3652aa..9e7cf0f 100644 > >--- a/include/hw/ppc/spapr.h > >+++ b/include/hw/ppc/spapr.h > >@@ -33,7 +33,6 @@ struct sPAPRMachineState { > > XICSState *icp; > > DeviceState *rtc; > > > >- hwaddr ram_limit; > > void *htab; > > uint32_t htab_shift; > > hwaddr rma_size; > > >=20 >=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 --aM3YZ0Iwxop3KEKx Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVSuy2AAoJEGw4ysog2bOSALUQAJ7yJAqgwXHHXO9xfB0MIorw g436Gtob1wpa14y9i5RsprYTcwqGCwGi+yxeGU9OXf0un3anf4Kwwk84C+H3+nCy v+izqiE26qlltgFjJ0CGzA7QwSSG6Z08F28cKITOYVUNogJTxMbZN9aF2qITZ0Ps 9tGyW/kJlWwm5ruOAXJvSQiManTK36zIKqH11QETVhaGDfShQxPkVv5gtN0trKZk pfTVNYPHLBLUv/CQBE/HQx4WGAhNAhBhwOdoF71A4FY3Lza67MffJ07Jw1VrEI9Q ukGRo1w/xlZpXPXHcNooOlMR3EPheCI42S5qWJspXwDATC+4tsIx4+WZjbOi1iGl IC5Ms7p5J4NzHenFsccIIyPSLvh/fOVhlebPt/dN85BskkxjUOZ8l7tfAgvdytFR QBqeBaKEYqZMG/riC07AV5/4dXOWG5rjG40b/eFNZcLx3RK2o/3+TOlFW2Siazzn PvXyyvAzZC6zuSSggBcouzZgu3CDcpP4LsNMYKUWuQ6Lqa/J3jUx9YU/sqRBgmQd Nf4RKEhDhP6XxDTPdIeaPg/SSQaOxg9yI0czAd42ghaQA3wWrxEt4aQUdzl92JP2 pO/OuTwWsC/mt7KPaGNskIngAS4g/jxHA7fz7zu5m6/+4pTfXfxpOL1wRz+U8QK3 VARAprAHC9Idlwbe90J/ =iubC -----END PGP SIGNATURE----- --aM3YZ0Iwxop3KEKx--