[Intel-gfx] [PATCH 2/2] x86: add early quirk for reserving Intel graphics stolen memory v3

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 25 10:34:05 CEST 2013


On Thu, Jul 25, 2013 at 09:41:49AM +0200, Daniel Vetter wrote:
> On Wed, Jul 24, 2013 at 05:04:43PM -0700, Jesse Barnes wrote:
> Two bikesheds:
> - Can't we give the thing a better name like "Intel Graphics Stolen"?

Using a custom type and name seems simple enough and naturally leads it
to ending up in iomem_resource.

> - Can't we store the iomem region somewhere so that intel-gtt.ko and
>   i915.ko can get at it and we could drop the duplicated stolen detection
>   code?

The choice is then walking the resource list looking for our named
region or reading a couple of registers. Certainly walking the iomem makes
everything much clearer.
-Chris

diff --git a/arch/x86/include/uapi/asm/e820.h b/arch/x86/include/uapi/asm/e820.h
index bbae024..5e12db4 100644
--- a/arch/x86/include/uapi/asm/e820.h
+++ b/arch/x86/include/uapi/asm/e820.h
@@ -38,6 +38,7 @@
 #define E820_NVS	4
 #define E820_UNUSABLE	5
 
+#define E820_STOLEN_IGFX 6
 
 /*
  * reserved RAM used by kernel itself
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index d32abea..d8f0e4f 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -149,6 +149,10 @@ static void __init e820_print_type(u32 type)
 	case E820_UNUSABLE:
 		printk(KERN_CONT "unusable");
 		break;
+
+	case E820_STOLEN_IGFX:
+		printk(KERN_CONT "Intel Graphics Stolen");
+		break;
 	default:
 		printk(KERN_CONT "type %u", type);
 		break;
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index bff8a6f..27b6d17 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -350,18 +350,10 @@ static void __init intel_graphics_stolen(int num, int slot, int func)
 			size = stolen_size(num, slot, func);
 			start = intel_stolen_base(num, slot, func);
 			if (size && start)
-				goto found;
-			else
-				break;
+				e820_add_region(start, size, E820_STOLEN_IGFX);
+			return;
 		}
 	}
-
-	/* No match or invalid data, don't bother reserving */
-	return;
-found:
-	/* Mark this space as reserved */
-	e820_add_region(start, size, E820_RESERVED);
-	return;
 }
 
 #define QFLAG_APPLY_ONCE 	0x1

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list