From: "Jan Beulich" Subject: [PATCH] x86: make max_mfn returned from XENMEM_machphys_mapping dynamic Date: Wed, 03 Feb 2010 13:14:17 +0000 Message-ID: <4B6984B9020000780002D77C@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part85AFAAB9.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com 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. --=__Part85AFAAB9.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This helps debugging in the guest kernels, as then MFNs there can then be range checked based on the reported value. Signed-off-by: Jan Beulich --- 2010-01-27.orig/xen/arch/x86/mm.c 2010-01-06 11:22:26.000000000 = +0100 +++ 2010-01-27/xen/arch/x86/mm.c 2010-02-03 13:29:46.000000000 = +0100 @@ -4457,12 +4457,14 @@ long arch_memory_op(int op, XEN_GUEST_HA =20 case XENMEM_machphys_mapping: { - static const struct xen_machphys_mapping mapping =3D { + struct xen_machphys_mapping mapping =3D { .v_start =3D MACH2PHYS_VIRT_START, .v_end =3D MACH2PHYS_VIRT_END, .max_mfn =3D MACH2PHYS_NR_ENTRIES - 1 }; =20 + if ( !mem_hotplug ) + mapping.max_mfn =3D max_page - 1; if ( copy_to_guest(arg, &mapping, 1) ) return -EFAULT; =20 --=__Part85AFAAB9.0__= Content-Type: text/plain; name="x86-restrict-machphys-mapping.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-restrict-machphys-mapping.patch" This helps debugging in the guest kernels, as then MFNs there can = then=0Abe range checked based on the reported value.=0A=0ASigned-off-by: = Jan Beulich =0A=0A--- 2010-01-27.orig/xen/arch/x86/mm.= c 2010-01-06 11:22:26.000000000 +0100=0A+++ 2010-01-27/xen/arch/x86/m= m.c 2010-02-03 13:29:46.000000000 +0100=0A@@ -4457,12 +4457,14 @@ long = arch_memory_op(int op, XEN_GUEST_HA=0A =0A case XENMEM_machphys_mapping= :=0A {=0A- static const struct xen_machphys_mapping mapping =3D = {=0A+ struct xen_machphys_mapping mapping =3D {=0A = .v_start =3D MACH2PHYS_VIRT_START,=0A .v_end =3D MACH2PHYS_VI= RT_END,=0A .max_mfn =3D MACH2PHYS_NR_ENTRIES - 1=0A = };=0A =0A+ if ( !mem_hotplug )=0A+ mapping.max_mfn =3D = max_page - 1;=0A if ( copy_to_guest(arg, &mapping, 1) )=0A = return -EFAULT;=0A =0A --=__Part85AFAAB9.0__= 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.xensource.com http://lists.xensource.com/xen-devel --=__Part85AFAAB9.0__=--