All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iomem: Prevent Dom0 pci bus from allocating RAM as I/O space
@ 2011-02-16 14:26 Zhang, Fengzhe
  2011-02-16 15:06 ` Konrad Rzeszutek Wilk
  2011-02-18 22:05 ` Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 16+ messages in thread
From: Zhang, Fengzhe @ 2011-02-16 14:26 UTC (permalink / raw)
  To: xen-devel; +Cc: Dong, Eddie, Li, Xin

[-- Attachment #1: Type: text/plain, Size: 1276 bytes --]

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@intel.com>

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 #2: pci_mem_bug.patch --]
[-- Type: application/octet-stream, Size: 1276 bytes --]

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@intel.com>

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 #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2011-02-22  4:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16 14:26 [PATCH] iomem: Prevent Dom0 pci bus from allocating RAM as I/O space Zhang, Fengzhe
2011-02-16 15:06 ` Konrad Rzeszutek Wilk
2011-02-16 15:20   ` Konrad Rzeszutek Wilk
2011-02-16 15:47     ` Konrad Rzeszutek Wilk
2011-02-17  5:32       ` Fengzhe Zhang
2011-02-17 14:23         ` [PATCH] iomem: Prevent Dom0 pci bus from allocating RAM as I/O space in 2.6.32.27 tree Konrad Rzeszutek Wilk
2011-02-17 15:07           ` Li, Xin
2011-02-17 15:35             ` Konrad Rzeszutek Wilk
2011-02-18 15:16         ` [PATCH] iomem: Prevent Dom0 pci bus from allocating RAM as I/O space Konrad Rzeszutek Wilk
2011-02-20 13:58           ` Fengzhe Zhang
2011-02-17  4:11   ` Fengzhe Zhang
2011-02-18 22:05 ` Konrad Rzeszutek Wilk
2011-02-20 14:14   ` Fengzhe Zhang
2011-02-21 10:35     ` Li, Xin
2011-02-21 19:20       ` Konrad Rzeszutek Wilk
2011-02-22  4:55         ` Li, Xin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.