]> xenbits.xensource.com Git - xen.git/commitdiff
x86: reserve pages when SandyBridge integrated graphics
authorXudong Hao <xudong.hao@intel.com>
Tue, 2 Apr 2013 10:33:47 +0000 (12:33 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 2 Apr 2013 10:33:47 +0000 (12:33 +0200)
SNB graphics devices have a bug that prevent them from accessing certain
memory ranges, namely anything below 1M and in the pages listed in the
table.

Xen does not initialize below 1MB to heap, i.e. below 1MB pages don't be
allocated, so it's unnecessary to reserve memory below the 1 MB mark
that has not already been reserved.

So reserve those pages listed in the table at xen boot if set detect a
SNB gfx device on the CPU to avoid GPU hangs.

Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: db537fe3023bf157b85c8246782cb72a6f989b31
master date: 2013-03-26 14:22:07 +0100

xen/arch/x86/mm.c
xen/common/page_alloc.c
xen/drivers/passthrough/vtd/quirks.c
xen/include/asm-x86/mm.h
xen/include/xen/pci.h

index ca2c8f83468940326727c1b3328b7193867bd26d..0ee088a41a929c46d79eb598bb571bd6845cb6ae 100644 (file)
 #include <public/memory.h>
 #include <public/sched.h>
 #include <xsm/xsm.h>
+#include <xen/pci.h>
 #include <xen/trace.h>
 #include <asm/setup.h>
 #include <asm/fixmap.h>
@@ -5693,6 +5694,25 @@ void memguard_unguard_stack(void *p)
     memguard_unguard_range(p, PAGE_SIZE);
 }
 
+const unsigned long *__init get_platform_badpages(unsigned int *array_size)
+{
+    u32 igd_id;
+    static unsigned long __initdata bad_pages[] = {
+        0x20050000,
+        0x20110000,
+        0x20130000,
+        0x20138000,
+        0x40004000,
+    };
+
+    *array_size = ARRAY_SIZE(bad_pages);
+    igd_id = pci_conf_read32(0, 2, 0, 0);
+    if ( !IS_SNB_GFX(igd_id) )
+        return NULL;
+
+    return bad_pages;
+}
+
 /*
  * Local variables:
  * mode: C
index 311b5ee2a4a2bee537104bb06fcaaed0c78be346..f0de320ec9144b8ce04ddea1986396f245f5c4c3 100644 (file)
@@ -144,6 +144,10 @@ void __init init_boot_pages(paddr_t ps, paddr_t pe)
 {
     unsigned long bad_spfn, bad_epfn;
     const char *p;
+#ifdef CONFIG_X86
+    const unsigned long *badpage = NULL;
+    unsigned int i, array_size;
+#endif
 
     ps = round_pgup(ps);
     pe = round_pgdown(pe);
@@ -154,6 +158,25 @@ void __init init_boot_pages(paddr_t ps, paddr_t pe)
 
     bootmem_region_add(ps >> PAGE_SHIFT, pe >> PAGE_SHIFT);
 
+#ifdef CONFIG_X86
+    /*
+     * Here we put platform-specific memory range workarounds, i.e.
+     * memory known to be corrupt or otherwise in need to be reserved on
+     * specific platforms.
+     * We get these certain pages and remove them from memory region list.
+     */
+    badpage = get_platform_badpages(&array_size);
+    if ( badpage )
+    {
+        for ( i = 0; i < array_size; i++ )
+        {
+            bootmem_region_zap(*badpage >> PAGE_SHIFT,
+                               (*badpage >> PAGE_SHIFT) + 1);
+            badpage++;
+        }
+    }
+#endif
+
     /* Check new pages against the bad-page list. */
     p = opt_badpage;
     while ( *p != '\0' )
index b540b9c39a0847be49a0a1f7e9dfb1cdf8ff8996..19c1a96f72354c4c0b4b647e9bca3dea3d6f6be9 100644 (file)
@@ -47,7 +47,6 @@
 #define IS_CTG(id)    (id == 0x2a408086)
 #define IS_ILK(id)    (id == 0x00408086 || id == 0x00448086 || id== 0x00628086 || id == 0x006A8086)
 #define IS_CPT(id)    (id == 0x01008086 || id == 0x01048086)
-#define IS_SNB_GFX(id) (id == 0x01068086 || id == 0x01168086 || id == 0x01268086 || id == 0x01028086 || id == 0x01128086 || id == 0x01228086 || id == 0x010A8086)
 
 u32 ioh_id;
 u32 igd_id;
index c93a022952f226a24247354fec2d70aeebf059f3..2013ba92804263e3399857da26e7b73ffcdc1f71 100644 (file)
@@ -329,6 +329,7 @@ int is_iomem_page(unsigned long mfn);
 
 void clear_superpage_mark(struct page_info *page);
 
+const unsigned long *get_platform_badpages(unsigned int *array_size);
 struct domain *page_get_owner_and_reference(struct page_info *page);
 void put_page(struct page_info *page);
 int  get_page(struct page_info *page, struct domain *domain);
index 3b8067ebbe931057a2312fadae368393a5e62e9d..ea514da91ba2a3a3db51b80de5c4389b95502f99 100644 (file)
@@ -127,4 +127,9 @@ int msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable);
 void msixtbl_pt_unregister(struct domain *d, int pirq);
 void pci_enable_acs(struct pci_dev *pdev);
 
+#define IS_SNB_GFX(id) (id == 0x01068086 || id == 0x01168086 \
+                        || id == 0x01268086 || id == 0x01028086 \
+                        || id == 0x01128086 || id == 0x01228086 \
+                        || id == 0x010A8086 )
+
 #endif /* __XEN_PCI_H__ */