From: "Jan Beulich" Subject: [PATCH] kexec: add more pages to v1 environment Date: Tue, 09 Jun 2015 13:03:50 +0100 Message-ID: <5576F246020000780008295E@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartAB9F8536.1__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z2IG2-0004gp-Pw for xen-devel@lists.xenproject.org; Tue, 09 Jun 2015 12:03:54 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: David Vrabel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartAB9F8536.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Destination pages need mappings to be added to the page tables in the v1 case (where nothing else calls machine_kexec_add_page() for them). Further, without the tools mapping the low 1Mb (expected by at least some Linux version), we need to do so in the hypervisor in the v1 case. Suggested-by: David Vrabel Signed-off-by: Jan Beulich Tested-by: Alan Robinson --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -1003,6 +1003,24 @@ static int kexec_do_load_v1(xen_kexec_lo if ( ret < 0 ) goto error; =20 + if ( arch =3D=3D EM_386 || arch =3D=3D EM_X86_64 ) + { + /* + * Ensure 0 - 1 MiB is mapped and accessible by the image. + * + * This allows access to VGA memory and the region purgatory = copies + * in the crash case. + */ + unsigned long addr; + + for ( addr =3D 0; addr < (1UL << 20); addr +=3D PAGE_SIZE ) + { + ret =3D machine_kexec_add_page(kimage, addr, addr); + if ( ret < 0 ) + goto error; + } + } + ret =3D kexec_load_slot(kimage); if ( ret < 0 ) goto error; --- a/xen/common/kimage.c +++ b/xen/common/kimage.c @@ -923,6 +923,11 @@ int kimage_build_ind(struct kexec_image=20 ret =3D kimage_add_page(image, page_to_maddr(xen_page)); if ( ret < 0 ) goto done; + + ret =3D machine_kexec_add_page(image, dest, dest); + if ( ret < 0 ) + goto done; + dest +=3D PAGE_SIZE; break; } --=__PartAB9F8536.1__= Content-Type: text/plain; name="kexec-v1-more-pages.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="kexec-v1-more-pages.patch" kexec: add more pages to v1 environment=0A=0ADestination pages need = mappings to be added to the page tables in the=0Av1 case (where nothing = else calls machine_kexec_add_page() for them).=0A=0AFurther, without the = tools mapping the low 1Mb (expected by at least=0Asome Linux version), we = need to do so in the hypervisor in the v1 case.=0A=0ASuggested-by: David = Vrabel =0ASigned-off-by: Jan Beulich =0ATested-by: Alan Robinson =0A=0A--- = a/xen/common/kexec.c=0A+++ b/xen/common/kexec.c=0A@@ -1003,6 +1003,24 @@ = static int kexec_do_load_v1(xen_kexec_lo=0A if ( ret < 0 )=0A = goto error;=0A =0A+ if ( arch =3D=3D EM_386 || arch =3D=3D EM_X86_64 = )=0A+ {=0A+ /*=0A+ * Ensure 0 - 1 MiB is mapped and = accessible by the image.=0A+ *=0A+ * This allows access to = VGA memory and the region purgatory copies=0A+ * in the crash = case.=0A+ */=0A+ unsigned long addr;=0A+=0A+ for ( = addr =3D 0; addr < (1UL << 20); addr +=3D PAGE_SIZE )=0A+ {=0A+ = ret =3D machine_kexec_add_page(kimage, addr, addr);=0A+ = if ( ret < 0 )=0A+ goto error;=0A+ }=0A+ }=0A+=0A = ret =3D kexec_load_slot(kimage);=0A if ( ret < 0 )=0A goto = error;=0A--- a/xen/common/kimage.c=0A+++ b/xen/common/kimage.c=0A@@ -923,6 = +923,11 @@ int kimage_build_ind(struct kexec_image =0A ret =3D = kimage_add_page(image, page_to_maddr(xen_page));=0A if ( ret < = 0 )=0A goto done;=0A+=0A+ ret =3D machine_kexec_= add_page(image, dest, dest);=0A+ if ( ret < 0 )=0A+ = goto done;=0A+=0A dest +=3D PAGE_SIZE;=0A = break;=0A }=0A --=__PartAB9F8536.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartAB9F8536.1__=--