Skip to contentSkip to conversation

x86: make max_mfn returned from XENMEM_machphys_mapping dynamic

PATCH New Jan Beulich 1 participant 1 message Feb 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: make max_mfn returned from XENMEM_machphys_mapping dynamic

This helps debugging in the guest kernels, as then MFNs there can then be range checked based on the reported value.

xen/arch/x86/mm.c +3 -1
@@ -4457,12 +4457,14 @@ long arch_memory_op(int op, XEN_GUEST_HA
 
     case XENMEM_machphys_mapping:
     {
-        static const struct xen_machphys_mapping mapping = {
+        struct xen_machphys_mapping mapping = {
             .v_start = MACH2PHYS_VIRT_START,
             .v_end   = MACH2PHYS_VIRT_END,
             .max_mfn = MACH2PHYS_NR_ENTRIES - 1
         };
 
+        if ( !mem_hotplug )
+            mapping.max_mfn = max_page - 1;
         if ( copy_to_guest(arg, &mapping, 1) )
             return -EFAULT;
 

This helps debugging in the guest kernels, as then MFNs there can then be range checked based on the reported value.

xen/arch/x86/mm.c +3 -1
@@ -4457,12 +4457,14 @@ long arch_memory_op(int op, XEN_GUEST_HA
 
     case XENMEM_machphys_mapping:
     {
-        static const struct xen_machphys_mapping mapping = {
+        struct xen_machphys_mapping mapping = {
             .v_start = MACH2PHYS_VIRT_START,
             .v_end   = MACH2PHYS_VIRT_END,
             .max_mfn = MACH2PHYS_NR_ENTRIES - 1
         };
 
+        if ( !mem_hotplug )
+            mapping.max_mfn = max_page - 1;
         if ( copy_to_guest(arg, &mapping, 1) )
             return -EFAULT;
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel