[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.3] x86: restore reserving of IO-APIC pages in XENMEM_machine_memory_map output



commit 687b232bb38e6de552ab95a944a52997ba3b8d4b
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Oct 17 16:04:40 2014 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Oct 17 16:04:40 2014 +0200

    x86: restore reserving of IO-APIC pages in XENMEM_machine_memory_map output
    
    Commit d1222afda4 ("x86: allow Dom0 read-only access to IO-APICs") had
    an unintended side effect: By no longer adding IO-APIC pages to Dom0's
    iomem_caps these also no longer get reported as reserved in the machine
    memory map presented to it (which got added there intentionally by
    commit b8a456caed ["x86: improve reporting through
    XENMEM_machine_memory_map"] because many BIOSes fail to add these).
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Tim Deegan <tim@xxxxxxx>
    master commit: 9d8edc5a8b4a0937193f80da72abdb44c5aeaec6
    master date: 2014-10-06 11:13:19 +0200
---
 xen/arch/x86/mm.c |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index aa13011..646b127 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -121,6 +121,7 @@
 #include <xen/trace.h>
 #include <asm/setup.h>
 #include <asm/fixmap.h>
+#include <asm/io_apic.h>
 #include <asm/pci.h>
 
 /* Mapping of the fixmap space needed early. */
@@ -4494,10 +4495,9 @@ struct memory_map_context
     struct xen_memory_map map;
 };
 
-static int handle_iomem_range(unsigned long s, unsigned long e, void *p)
+static int _handle_iomem_range(unsigned long s, unsigned long e,
+                               struct memory_map_context *ctxt)
 {
-    struct memory_map_context *ctxt = p;
-
     if ( s > ctxt->s )
     {
         e820entry_t ent;
@@ -4520,6 +4520,31 @@ static int handle_iomem_range(unsigned long s, unsigned 
long e, void *p)
     return 0;
 }
 
+static int handle_iomem_range(unsigned long s, unsigned long e, void *p)
+{
+    int err = 0;
+
+    do {
+        unsigned long low = -1UL;
+        unsigned int i;
+
+        for ( i = 0; i < nr_ioapics; ++i )
+        {
+            unsigned long mfn = paddr_to_pfn(mp_ioapics[i].mpc_apicaddr);
+
+            if ( mfn >= s && mfn <= e && mfn < low )
+                low = mfn;
+        }
+        if ( !(low + 1) )
+            break;
+        if ( s < low )
+            err = _handle_iomem_range(s, low - 1, p);
+        s = low + 1;
+    } while ( !err );
+
+    return err || s > e ? err : _handle_iomem_range(s, e, p);
+}
+
 static int xenmem_add_to_physmap_once(
     struct domain *d,
     const struct xen_add_to_physmap *xatp)
@@ -4828,7 +4853,7 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) 
arg)
         {
             unsigned long s = PFN_DOWN(e820.map[i].addr);
 
-            if ( s )
+            if ( s > ctxt.s )
             {
                 rc = rangeset_report_ranges(current->domain->iomem_caps,
                                             ctxt.s, s - 1,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.3

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.