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

[Xen-devel] [PATCH] iomem: Prevent Dom0 pci bus from allocating RAM as I/O space


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Zhang, Fengzhe" <fengzhe.zhang@xxxxxxxxx>
  • Date: Wed, 16 Feb 2011 22:26:20 +0800
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Cc: "Dong, Eddie" <eddie.dong@xxxxxxxxx>, "Li, Xin" <xin.li@xxxxxxxxx>
  • Delivery-date: Wed, 16 Feb 2011 06:26:59 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcvN5XrtDyeHdgqET5OvAApOctapcA==
  • Thread-topic: [PATCH] iomem: Prevent Dom0 pci bus from allocating RAM as I/O space

iomem: Prevent Dom0 pci bus from allocating RAM as I/O space

In Dom0, pci bus dynamically allocates I/O address resources from memory hole 
within 4GB physical space, which can be RAM space not allocated to Dom0. This 
patch set physical RAM space to be unusable in Dom0 E820 map if they are not 
owned by Dom0 to prevent them from being misused as I/O address space. Dom0 is 
assumed to look for MMIO space only below 4GB. If this assumption is broken, 
additional fixes are required.

Signed-off-by: Fengzhe Zhang <fengzhe.zhang@xxxxxxxxx>

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 1a1934a..f1a3896 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -189,6 +189,16 @@ char * __init xen_memory_setup(void)
                        end -= delta;
 
                        extra_pages += PFN_DOWN(delta);
+
+                       /*
+                        * Set RAM below 4GB that are not owned by Dom0 to be 
unusable.
+                        * This prevents RAM-backed address space from being 
used as
+                        * I/O address in Dom0. Dom0 is assumed to look for MMIO
+                        * space only below 4GB. If this assumption is broken, 
additional
+                        * fixes are required.
+                        */
+                       if (delta && end < 0x100000000UL)
+                               e820_add_region(end, delta, E820_UNUSABLE);
                }
 
                if (map[i].size > 0 && end > xen_extra_mem_start)

Attachment: pci_mem_bug.patch
Description: pci_mem_bug.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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