Skip to contentSkip to conversation

x86/e820: Add E820_RESERVED_GFX for graphics memory

RFC In review Joonas Lahtinen 2 participants 3 messages Apr 22, 2016 – Apr 25, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 x86/e820: Add E820_RESERVED_GFX for graphics memory

Add a type of memory alongside E820_RESERVED_KERN that is specifically reserved for graphics usage, E820_RESERVED_GFX. An example is Intel Gen graphics stolen memory.

---
 arch/x86/include/uapi/asm/e820.h | 5 +++++
 arch/x86/kernel/e820.c           | 8 +++++++-
 arch/x86/kernel/early-quirks.c   | 2 +-
 arch/x86/kernel/tboot.c          | 3 ++-
 arch/x86/mm/init_64.c            | 9 ++++++---
 5 files changed, 21 insertions(+), 6 deletions(-)
arch/x86/include/uapi/asm/e820.h +5 -0
index 9dafe59..f5324f4 100644
@@ -53,6 +53,11 @@
  */
 #define E820_RESERVED_KERN        128
 
+/*
+ * RAM to be reserved for graphics device use.
+ */
+#define E820_RESERVED_GFX         129
+
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
 struct e820entry {
arch/x86/kernel/e820.c +7 -1
index 621b501..9bbdbc0 100644
@@ -136,6 +136,7 @@ static void __init e820_print_type(u32 type)
 	switch (type) {
 	case E820_RAM:
 	case E820_RESERVED_KERN:
+	case E820_RESERVED_GFX:
 		printk(KERN_CONT "usable");
 		break;
 	case E820_RESERVED:
@@ -694,7 +695,9 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn)
 
 		pfn = PFN_DOWN(ei->addr + ei->size);
 
-		if (ei->type != E820_RAM && ei->type != E820_RESERVED_KERN)
+		if (ei->type != E820_RAM &&
+		    ei->type != E820_RESERVED_KERN &&
+		    ei->type != E820_RESERVED_GFX)
 			register_nosave_region(PFN_UP(ei->addr), pfn);
 
 		if (pfn >= limit_pfn)
@@ -916,6 +919,7 @@ static const char *e820_type_to_string(int e820_type)
 {
 	switch (e820_type) {
 	case E820_RESERVED_KERN:
+	case E820_RESERVED_GFX:
 	case E820_RAM:	return "System RAM";
 	case E820_ACPI:	return "ACPI Tables";
 	case E820_NVS:	return "ACPI Non-volatile Storage";
@@ -930,6 +934,7 @@ static unsigned long e820_type_to_iomem_type(int e820_type)
 {
 	switch (e820_type) {
 	case E820_RESERVED_KERN:
+	case E820_RESERVED_GFX:
 	case E820_RAM:
 		return IORESOURCE_SYSTEM_RAM;
 	case E820_ACPI:
@@ -954,6 +959,7 @@ static unsigned long e820_type_to_iores_desc(int e820_type)
 	case E820_PRAM:
 		return IORES_DESC_PERSISTENT_MEMORY_LEGACY;
 	case E820_RESERVED_KERN:
+	case E820_RESERVED_GFX:
 	case E820_RAM:
 	case E820_UNUSABLE:
 	default:
arch/x86/kernel/early-quirks.c +1 -1
index d2f75b4..7c87b2f 100644
@@ -539,7 +539,7 @@ intel_graphics_stolen(int num, int slot, int func,
 	       "0x%llx-0x%llx\n", base, base + size - 1);
 
 	/* Mark this space as reserved */
-	e820_add_region(base, size, E820_RESERVED);
+	e820_add_region(base, size, E820_RESERVED_GFX);
 	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
 }
 
arch/x86/kernel/tboot.c +2 -1
index e72a07f..077d0c7 100644
@@ -196,7 +196,8 @@ static int tboot_setup_sleep(void)
 
 	for (i = 0; i < e820.nr_map; i++) {
 		if ((e820.map[i].type != E820_RAM)
-		 && (e820.map[i].type != E820_RESERVED_KERN))
+		 && (e820.map[i].type != E820_RESERVED_KERN)
+		 && (e820.map[i].type != E820_RESERVED_GFX))
 			continue;
 
 		add_mac_region(e820.map[i].addr, e820.map[i].size);
arch/x86/mm/init_64.c +6 -3
index 214afda..d426fae 100644
@@ -415,7 +415,8 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end,
 		if (addr >= end) {
 			if (!after_bootmem &&
 			    !e820_any_mapped(addr & PAGE_MASK, next, E820_RAM) &&
-			    !e820_any_mapped(addr & PAGE_MASK, next, E820_RESERVED_KERN))
+			    !e820_any_mapped(addr & PAGE_MASK, next, E820_RESERVED_KERN) &&
+			    !e820_any_mapped(addr & PAGE_MASK, next, E820_RESERVED_GFX))
 				set_pte(pte, __pte(0));
 			continue;
 		}
@@ -463,7 +464,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
 		if (address >= end) {
 			if (!after_bootmem &&
 			    !e820_any_mapped(address & PMD_MASK, next, E820_RAM) &&
-			    !e820_any_mapped(address & PMD_MASK, next, E820_RESERVED_KERN))
+			    !e820_any_mapped(address & PMD_MASK, next, E820_RESERVED_KERN) &&
+			    !e820_any_mapped(address & PMD_MASK, next, E820_RESERVED_GFX))
 				set_pmd(pmd, __pmd(0));
 			continue;
 		}
@@ -537,7 +539,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
 		if (addr >= end) {
 			if (!after_bootmem &&
 			    !e820_any_mapped(addr & PUD_MASK, next, E820_RAM) &&
-			    !e820_any_mapped(addr & PUD_MASK, next, E820_RESERVED_KERN))
+			    !e820_any_mapped(addr & PUD_MASK, next, E820_RESERVED_KERN) &&
+			    !e820_any_mapped(addr & PUD_MASK, next, E820_RESERVED_GFX))
 				set_pud(pud, __pud(0));
 			continue;
 		}
Signature · 6 lines
2.5.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for x86/e820: Add E820_RESERVED_GFX for graphics memory

== Series Details ==

== Series Details ==

Series: x86/e820: Add E820_RESERVED_GFX for graphics memory
URL : https://patchwork.freedesktop.org/series/6161/
State : failure

== Summary ==

Series 6161v1 x86/e820: Add E820_RESERVED_GFX for graphics memory
http://patchwork.freedesktop.org/api/1.0/series/6161/revisions/1/mbox/

Test drv_hangman:

        Subgroup error-state-basic:
                incomplete -> PASS       (snb-dellxps)
Test drv_module_reload_basic:
                pass       -> DMESG-WARN (bsw-nuc-2)
                pass       -> DMESG-WARN (skl-nuci5)
                pass       -> DMESG-WARN (hsw-gt2)
                pass       -> DMESG-WARN (bdw-ultra)
                pass       -> DMESG-WARN (skl-i7k-2)
                pass       -> DMESG-WARN (ivb-t430s)
                pass       -> DMESG-WARN (snb-x220t)
                pass       -> DMESG-FAIL (snb-dellxps)
                pass       -> DMESG-WARN (hsw-brixbox)
                pass       -> DMESG-WARN (ilk-hp8440p)
Test gem_exec_whisper:
        Subgroup basic:
                fail       -> PASS       (ilk-hp8440p)
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                fail       -> PASS       (bdw-ultra)
        Subgroup basic-plain-flip:
                pass       -> INCOMPLETE (ivb-t430s)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-a-frame-sequence:
                pass       -> TIMEOUT    (ivb-t430s)
        Subgroup read-crc-pipe-a-frame-sequence:
                pass       -> SKIP       (skl-nuci5)
        Subgroup suspend-read-crc-pipe-b:
                pass       -> SKIP       (skl-nuci5)
bdw-ultra        total:193  pass:169  dwarn:1   dfail:0   fail:0   skip:23 
bsw-nuc-2        total:192  pass:152  dwarn:1   dfail:0   fail:0   skip:39 
hsw-brixbox      total:193  pass:168  dwarn:1   dfail:0   fail:0   skip:24 
hsw-gt2          total:193  pass:173  dwarn:1   dfail:0   fail:0   skip:19 
ilk-hp8440p      total:193  pass:135  dwarn:1   dfail:0   fail:0   skip:57 
ivb-t430s        total:48   pass:39   dwarn:1   dfail:0   fail:0   skip:6  
skl-i7k-2        total:193  pass:167  dwarn:1   dfail:0   fail:0   skip:25 
skl-nuci5        total:193  pass:179  dwarn:1   dfail:0   fail:0   skip:13 
snb-dellxps      total:193  pass:154  dwarn:0   dfail:1   fail:0   skip:38 
snb-x220t        total:193  pass:154  dwarn:1   dfail:0   fail:1   skip:37 

byt-nuc failed to connect after reboot

Results at /archive/results/CI_IGT_test/Patchwork_2059/

2725e5c353b4628e3e37b3e3e26fc6e75222e692 drm-intel-nightly: 2016y-04m-25d-10h-31m-27s UTC integration manifest b0ea401 x86/e820: Add E820_RESERVED_GFX for graphics memory

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Joonas Lahtinen

(Correcting the bad CC's.)

What do others think?

This failed in the CI due to i915 driver not being able to claim RESERVED_GFX memory as it's handled like RESERVED_KERN in all places. So that'll need some tweaking, still.

Regards, Joonas

Quoted 138 lines · Joonas Lahtinen

Add a type of memory alongside E820_RESERVED_KERN that is specifically reserved for graphics usage, E820_RESERVED_GFX. An example is Intel Gen graphics stolen memory.

---
 arch/x86/include/uapi/asm/e820.h | 5 +++++
 arch/x86/kernel/e820.c           | 8 +++++++-
 arch/x86/kernel/early-quirks.c   | 2 +-
 arch/x86/kernel/tboot.c          | 3 ++-
 arch/x86/mm/init_64.c            | 9 ++++++---

 5 files changed, 21 insertions(+), 6 deletions(-)
arch/x86/include/uapi/asm/e820.h +0 -0
index 9dafe59..f5324f4 100644
@@ -53,6 +53,11 @@
   */
  #define E820_RESERVED_KERN        128

arch/x86/include/uapi/asm/e820.h +5 -0
+/*
+ * RAM to be reserved for graphics device use.
+ */
+#define E820_RESERVED_GFX         129
+

 #ifndef __ASSEMBLY__
 #include
 struct e820entry {

arch/x86/kernel/e820.c +0 -0
index 621b501..9bbdbc0 100644
@@ -136,6 +136,7 @@ static void __init e820_print_type(u32 type)
  	switch (type) {

  case E820_RAM:
  case E820_RESERVED_KERN:

arch/x86/kernel/e820.c +1 -0
+	case E820_RESERVED_GFX:

  printk(KERN_CONT "usable");
  break;
  case E820_RESERVED:

arch/x86/kernel/e820.c +0 -0
@@ -694,7 +695,9 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn)


  pfn = PFN_DOWN(ei->addr + ei->size);

arch/x86/kernel/e820.c +3 -1
-		if (ei->type != E820_RAM && ei->type != E820_RESERVED_KERN)
+		if (ei->type != E820_RAM &&
+		    ei->type != E820_RESERVED_KERN &&
+		    ei->type != E820_RESERVED_GFX)

  register_nosave_region(PFN_UP(ei->addr), pfn);
  if (pfn >= limit_pfn)

arch/x86/kernel/e820.c +0 -0
@@ -916,6 +919,7 @@ static const char *e820_type_to_string(int e820_type)
  {
  	switch (e820_type) {

  case E820_RESERVED_KERN:

arch/x86/kernel/e820.c +1 -0
+	case E820_RESERVED_GFX:

  case E820_RAM: return "System RAM";
  case E820_ACPI: return "ACPI Tables";
  case E820_NVS: return "ACPI Non-volatile Storage";

arch/x86/kernel/e820.c +0 -0
@@ -930,6 +934,7 @@ static unsigned long e820_type_to_iomem_type(int e820_type)
  {
  	switch (e820_type) {

  case E820_RESERVED_KERN:

arch/x86/kernel/e820.c +1 -0
+	case E820_RESERVED_GFX:

  case E820_RAM:
  return IORESOURCE_SYSTEM_RAM;
  case E820_ACPI:

arch/x86/kernel/e820.c +0 -0
@@ -954,6 +959,7 @@ static unsigned long e820_type_to_iores_desc(int e820_type)

  case E820_PRAM:
  return IORES_DESC_PERSISTENT_MEMORY_LEGACY; case E820_RESERVED_KERN:

arch/x86/kernel/e820.c +1 -0
+	case E820_RESERVED_GFX:

  case E820_RAM:
  case E820_UNUSABLE:
  default:

arch/x86/kernel/early-quirks.c +0 -0
index d2f75b4..7c87b2f 100644
@@ -539,7 +539,7 @@ intel_graphics_stolen(int num, int slot, int func,
  	       "0x%llx-0x%llx\n", base, base + size - 1);


  /* Mark this space as reserved */

arch/x86/kernel/early-quirks.c +1 -1
-	e820_add_region(base, size, E820_RESERVED);
+	e820_add_region(base, size, E820_RESERVED_GFX);

  sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); }

arch/x86/kernel/tboot.c +0 -0
index e72a07f..077d0c7 100644
@@ -196,7 +196,8 @@ static int tboot_setup_sleep(void)


  for (i = 0; i < e820.nr_map; i++) { if ((e820.map[i].type != E820_RAM)

arch/x86/kernel/tboot.c +2 -1
-		 && (e820.map[i].type != E820_RESERVED_KERN))
+		 && (e820.map[i].type != E820_RESERVED_KERN)
+		 && (e820.map[i].type != E820_RESERVED_GFX))

  continue;

  add_mac_region(e820.map[i].addr, e820.map[i].size);

arch/x86/mm/init_64.c +0 -0
index 214afda..d426fae 100644
@@ -415,7 +415,8 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end,
  		if (addr >= end) {

  if (!after_bootmem &&
      !e820_any_mapped(addr & PAGE_MASK, next, E820_RAM) &&

arch/x86/mm/init_64.c +2 -1
-			    !e820_any_mapped(addr & PAGE_MASK, next, E820_RESERVED_KERN))
+			    !e820_any_mapped(addr & PAGE_MASK, next, E820_RESERVED_KERN) &&
+			    !e820_any_mapped(addr & PAGE_MASK, next, E820_RESERVED_GFX))

  set_pte(pte, __pte(0)); continue;
  }

arch/x86/mm/init_64.c +0 -0
@@ -463,7 +464,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
  		if (address >= end) {

  if (!after_bootmem &&
      !e820_any_mapped(address & PMD_MASK, next, E820_RAM) &&

arch/x86/mm/init_64.c +2 -1
-			    !e820_any_mapped(address & PMD_MASK, next, E820_RESERVED_KERN))
+			    !e820_any_mapped(address & PMD_MASK, next, E820_RESERVED_KERN) &&
+			    !e820_any_mapped(address & PMD_MASK, next, E820_RESERVED_GFX))

  set_pmd(pmd, __pmd(0)); continue;
  }

arch/x86/mm/init_64.c +0 -0
@@ -537,7 +539,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
  		if (addr >= end) {

  if (!after_bootmem &&
      !e820_any_mapped(addr & PUD_MASK, next, E820_RAM) &&

arch/x86/mm/init_64.c +2 -1
-			    !e820_any_mapped(addr & PUD_MASK, next, E820_RESERVED_KERN))
+			    !e820_any_mapped(addr & PUD_MASK, next, E820_RESERVED_KERN) &&
+			    !e820_any_mapped(addr & PUD_MASK, next, E820_RESERVED_GFX))

  set_pud(pud, __pud(0)); continue;
  }

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx