From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8jEK-000887-NJ for qemu-devel@nongnu.org; Fri, 03 Jun 2016 03:09:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8jEI-000868-BK for qemu-devel@nongnu.org; Fri, 03 Jun 2016 03:09:15 -0400 Date: Fri, 3 Jun 2016 17:09:08 +1000 From: David Gibson Message-ID: <20160603070908.GR1087@voom.fritz.box> References: <1464932984-26623-1-git-send-email-bharata@linux.vnet.ibm.com> <201606030550.u535jnsX039604@mx0a-001b2d01.pphosted.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JKGvNdIvrY8Ovf7Z" Content-Disposition: inline In-Reply-To: <201606030550.u535jnsX039604@mx0a-001b2d01.pphosted.com> Subject: Re: [Qemu-devel] [RFC PATCH v1 2/3] spapr: Remove alignment gap b/n RAM and hotplug regions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, aik@au1.ibm.com, qemu-ppc@nongnu.org --JKGvNdIvrY8Ovf7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 03, 2016 at 11:19:43AM +0530, Bharata B Rao wrote: > Let the alignment b/n RAM and memory hotplug region be equal to > LMB size (256MB) so that there is no gap b/n RAM and hotplug region. > This new alignment is true for only pseries-2.7 onwards and the older > machine types continue to have the earlier 1GB alignment. >=20 > Suggested-by: David Gibson > Signed-off-by: Bharata B Rao Code looks fine, but the commit message needs to explain the rationale for this (IIUC it's essentially due to a guest bug processing the dt information describing the gap). > --- > hw/ppc/spapr.c | 11 ++++++++++- > include/hw/ppc/spapr.h | 5 ++--- > 2 files changed, 12 insertions(+), 4 deletions(-) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 30b9731..623c35f 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -1825,7 +1825,7 @@ static void ppc_spapr_init(MachineState *machine) > } > =20 > spapr->hotplug_memory.base =3D ROUND_UP(machine->ram_size, > - SPAPR_HOTPLUG_MEM_ALIGN); > + smc->hotplug_alignment); > memory_region_init(&spapr->hotplug_memory.mr, OBJECT(spapr), > "hotplug-memory", hotplug_mem_size); > memory_region_add_subregion(sysmem, spapr->hotplug_memory.base, > @@ -2294,6 +2294,7 @@ static void spapr_machine_class_init(ObjectClass *o= c, void *data) > mc->cpu_index_to_socket_id =3D spapr_cpu_index_to_socket_id; > =20 > smc->dr_lmb_enabled =3D true; > + smc->hotplug_alignment =3D SPAPR_MEMORY_BLOCK_SIZE; > fwc->get_dev_path =3D spapr_get_fw_dev_path; > nc->nmi_monitor_handler =3D spapr_nmi; > } > @@ -2369,8 +2370,16 @@ static void spapr_machine_2_6_instance_options(Mac= hineState *machine) > =20 > static void spapr_machine_2_6_class_options(MachineClass *mc) > { > + sPAPRMachineClass *smc =3D SPAPR_MACHINE_CLASS(mc); > + > spapr_machine_2_7_class_options(mc); > SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_6); > + > + /* > + * 2.6 and older types supported 1GB alignment gap b/n RAM > + * and hotplug memory region. > + */ > + smc->hotplug_alignment =3D G_BYTE; > } > =20 > DEFINE_SPAPR_MACHINE(2_6, "2.6", false); > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index 971df3d..b2aeb15 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -37,6 +37,8 @@ struct sPAPRMachineClass { > /*< public >*/ > bool dr_lmb_enabled; /* enable dynamic-reconfig/hotplug of LMB= s */ > bool use_ohci_by_default; /* use USB-OHCI instead of XHCI */ > + hwaddr hotplug_alignment; /* controls the alignment b/n RAM and hot= plug > + regions */ > }; > =20 > /** > @@ -610,9 +612,6 @@ int spapr_rng_populate_dt(void *fdt); > */ > #define SPAPR_MAX_RAM_SLOTS 32 > =20 > -/* 1GB alignment for hotplug memory region */ > -#define SPAPR_HOTPLUG_MEM_ALIGN (1ULL << 30) > - > /* > * Number of 32 bit words in each LMB list entry in ibm,dynamic-memory > * property under ibm,dynamic-reconfiguration-memory node. --=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 --JKGvNdIvrY8Ovf7Z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXUS0UAAoJEGw4ysog2bOSA7IP/jIFqarPlCSWjmMGk9hMnBBq Lenx3+ZyPDjkCU/OxhXaVVwWT2h6WZvAAzbLS1lPN80onZaT6eEDSLsavEl+e++u rP0Ox9JUzR9WJ6QZ/kCiwwWBBXT0X5Ih4R3cBxhxcIzUx7Yl6D2fsXglEErn8GeK TQkRL5eJdHEDw2y8j15ZZnSrr6ZQiVK4FxxfpOYrkbd7yxmbVkGuN+VSOGfphAR2 C7HNrFYSmPUnrfKXIn2qJT/+RrKdaNPrydG8/fz0Z9gkZ+iIG3g3659Mx2O7xKF0 hyBaKw3TH2wLI7B4R+8OZS8BrC8TnO6lfaz9Q5q4sjhhwQQZY9+Gwazopx094GS2 QkDkXb+ig3sx1kTPVfqvlt/CXuvm9nRnwfTEs/yFH94Q2UqqNI2ggAwk0O/q5jso Pa1ukEGMovHHwSGp2I+SeNGqaO6bPwNSXExVQFzck384/T6HtIihJxxp+GWaEY7h ILzJfHsfv8q4fo8T00NkKIcX4gz216Czeqly1zYslqvmOElMGphyatQWVhzSHvXc fRxMfa00sBFoSfDl8WcLy/vxmF/KROkNNPEf3xZGwIxoWNP63Yejd6YNMqsnkpw4 hmzU1Ja200omOMUVv7EMNIa9ybxV1hcabdV1/bjtrkX6/NfEzQk/Tj0klRjOn/u1 OAR5vOkHJjuQiFR+Bdel =ci9O -----END PGP SIGNATURE----- --JKGvNdIvrY8Ovf7Z--