WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] iomem: Prevent Dom0 pci bus from allocating RAM as I/O space
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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