Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add support for soft reserved memory range
@ 2024-08-07  2:57 Jacek Tomaka
  2024-08-13 14:29 ` Simon Horman
  0 siblings, 1 reply; 7+ messages in thread
From: Jacek Tomaka @ 2024-08-07  2:57 UTC (permalink / raw)
  To: kexec; +Cc: dan.j.williams, horms

Essentially catch up with e820 related changes in the kernel.
Intel Sapphire Rapids MAX has high bandwidth memory which is
precious resource that is better not allocated by the kernel.

Userspace later can enable soft reserved range using daxctl.

Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
---
 include/x86/x86-linux.h               | 2 ++
 kexec/arch/i386/crashdump-x86.c       | 7 +++++++
 kexec/arch/i386/kexec-multiboot-x86.c | 1 +
 kexec/arch/i386/kexec-x86-common.c    | 5 +++++
 kexec/arch/i386/x86-linux-setup.c     | 3 +++
 kexec/firmware_memmap.c               | 2 ++
 kexec/kexec.h                         | 1 +
 7 files changed, 21 insertions(+)

diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
index 9646102835..fbde93df94 100644
--- a/include/x86/x86-linux.h
+++ b/include/x86/x86-linux.h
@@ -23,6 +23,8 @@ struct e820entry {
 #define E820_NVS 4
 #define E820_PMEM       7
 #define E820_PRAM       12
+#define E820_SOFT_RESERVED 0xefffffff
+
 } __attribute__((packed));
 #endif

diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index a01031e570..49108b2032 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -288,6 +288,10 @@ static int get_crash_memory_ranges(struct
memory_range **range, int *ranges,
  type = RANGE_RESERVED;
  } else if (memcmp(str, "Reserved\n", 9) == 0) {
  type = RANGE_RESERVED;
+ } else if (memcmp(str, "soft reserved\n", 14) == 0 ) {
+ type = RANGE_SOFT_RESERVED;
+ } else if (memcmp(str, "Soft Reserved\n", 14) == 0 ) {
+ type = RANGE_SOFT_RESERVED;
  } else if (memcmp(str, "GART\n", 5) == 0) {
  gart_start = start;
  gart_end = end;
@@ -615,6 +619,8 @@ static void cmdline_add_memmap_internal(char
*cmdline, unsigned long startk,
  strcat (str_mmap, "K@");
  else if (type == RANGE_RESERVED)
  strcat (str_mmap, "K$");
+ else if (type == RANGE_SOFT_RESERVED)
+ strcat (str_mmap, "K*");
  else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
  strcat (str_mmap, "K#");
  else if (type == RANGE_PRAM)
@@ -985,6 +991,7 @@ int load_crashdump_segments(struct kexec_info
*info, char* mod_cmdline,
  if ( !( mem_range[i].type == RANGE_ACPI
  || mem_range[i].type == RANGE_ACPI_NVS
  || mem_range[i].type == RANGE_RESERVED
+ || mem_range[i].type == RANGE_SOFT_RESERVED
  || mem_range[i].type == RANGE_PMEM
  || mem_range[i].type == RANGE_PRAM))
  continue;
diff --git a/kexec/arch/i386/kexec-multiboot-x86.c
b/kexec/arch/i386/kexec-multiboot-x86.c
index 33c885a2fa..49d57cb5ae 100644
--- a/kexec/arch/i386/kexec-multiboot-x86.c
+++ b/kexec/arch/i386/kexec-multiboot-x86.c
@@ -379,6 +379,7 @@ int multiboot_x86_load(int argc, char **argv,
const char *buf, off_t len,
  mmap[i].Type = 4;
  break;
  case RANGE_RESERVED:
+ case RANGE_SOFT_RESERVED:
  default:
  mmap[i].Type = 2;  /* Not RAM (reserved) */
  }
diff --git a/kexec/arch/i386/kexec-x86-common.c
b/kexec/arch/i386/kexec-x86-common.c
index ffc95a9e43..116c4f4fd3 100644
--- a/kexec/arch/i386/kexec-x86-common.c
+++ b/kexec/arch/i386/kexec-x86-common.c
@@ -99,6 +99,9 @@ static int get_memory_ranges_proc_iomem(struct
memory_range **range, int *ranges
  else if (strncasecmp(str, "reserved\n", 9) == 0) {
  type = RANGE_RESERVED;
  }
+ else if (strncasecmp(str, "soft reserved\n", 9) == 0) {
+ type = RANGE_SOFT_RESERVED;
+ }
  else if (memcmp(str, "ACPI Tables\n", 12) == 0) {
  type = RANGE_ACPI;
  }
@@ -170,6 +173,8 @@ unsigned xen_e820_to_kexec_type(uint32_t type)
  return RANGE_PMEM;
  case E820_PRAM:
  return RANGE_PRAM;
+ case E820_SOFT_RESERVED;
+ return RANGE_SOFT_RESERVED;
  case E820_RESERVED:
  default:
  return RANGE_RESERVED;
diff --git a/kexec/arch/i386/x86-linux-setup.c
b/kexec/arch/i386/x86-linux-setup.c
index 73251b9339..afc83fe729 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -755,6 +755,9 @@ static void add_e820_map_from_mr(struct
x86_linux_param_header *real_mode,
  case RANGE_PRAM:
  e820[i].type = E820_PRAM;
  break;
+ case RANGE_SOFT_RESERVED:
+ e820[i].type = E820_SOFT_RESERVED;
+ break;
  default:
  case RANGE_RESERVED:
  e820[i].type = E820_RESERVED;
diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c
index 457c3dc9a6..fa0c22140a 100644
--- a/kexec/firmware_memmap.c
+++ b/kexec/firmware_memmap.c
@@ -182,6 +182,8 @@ static int parse_memmap_entry(const char *entry,
struct memory_range *range)
  range->type = RANGE_RESERVED;
  else if (strcmp(type, "Reserved") == 0)
  range->type = RANGE_RESERVED;
+        else if (strcmp(type, "Soft Reserved") == 0)
+                range->type = RANGE_SOFT_RESERVED;
  else if (strcmp(type, "Unknown E820 type") == 0)
  range->type = RANGE_RESERVED;
  else if (strcmp(type, "ACPI Non-volatile Storage") == 0)
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 31c323f674..dbb27a7607 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -139,6 +139,7 @@ struct memory_range {
 #define RANGE_UNCACHED 4
 #define RANGE_PMEM 6
 #define RANGE_PRAM 11
+#define RANGE_SOFT_RESERVED 0xefffffff
 };

 struct memory_ranges {
-- 
2.17.0

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] Add support for soft reserved memory range
  2024-08-07  2:57 Jacek Tomaka
@ 2024-08-13 14:29 ` Simon Horman
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2024-08-13 14:29 UTC (permalink / raw)
  To: Jacek Tomaka; +Cc: kexec, dan.j.williams

On Tue, Aug 06, 2024 at 09:57:24PM -0500, Jacek Tomaka wrote:
> Essentially catch up with e820 related changes in the kernel.
> Intel Sapphire Rapids MAX has high bandwidth memory which is
> precious resource that is better not allocated by the kernel.
> 
> Userspace later can enable soft reserved range using daxctl.
> 
> Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>

Hi Jacek,

Unfortunately this patch does not apply - it looks like
somehow indentation white space has been collapsed.

Would it be possible for you to repost.
Perhaps using b4 or get format-patch + git send-email ?

Thanks!

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [PATCH] Add support for soft reserved memory range
       [not found] <20240814052024.25731-1-jacekt@dugeo.com>
@ 2024-08-14  5:33 ` Jacek Tomaka
  2024-08-24  2:06   ` Jacek Tomaka
  2024-08-30 14:45   ` Baoquan He
  0 siblings, 2 replies; 7+ messages in thread
From: Jacek Tomaka @ 2024-08-14  5:33 UTC (permalink / raw)
  To: kexec, horms, dan.j.williams; +Cc: Jacek Tomaka, Jacek Tomaka

Essentially catch up with e820 related changes in the kernel.
Intel Sapphire Rappids MAX has high bandwidth memory which is
precious resource that is better not allocated by the kernel.

Userspace later can enable soft reserved range using daxctl.

Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
---
 include/x86/x86-linux.h               | 2 ++
 kexec/arch/i386/crashdump-x86.c       | 7 +++++++
 kexec/arch/i386/kexec-multiboot-x86.c | 1 +
 kexec/arch/i386/kexec-x86-common.c    | 5 +++++
 kexec/arch/i386/x86-linux-setup.c     | 3 +++
 kexec/firmware_memmap.c               | 2 ++
 kexec/kexec.h                         | 1 +
 7 files changed, 21 insertions(+)

diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
index 9646102835..fbde93df94 100644
--- a/include/x86/x86-linux.h
+++ b/include/x86/x86-linux.h
@@ -23,6 +23,8 @@ struct e820entry {
 #define E820_NVS	4
 #define E820_PMEM       7
 #define E820_PRAM       12
+#define E820_SOFT_RESERVED 0xefffffff
+
 } __attribute__((packed));
 #endif
 
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index a01031e570..49108b2032 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -288,6 +288,10 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
 			type = RANGE_RESERVED;
 		} else if (memcmp(str, "Reserved\n", 9) == 0) {
 			type = RANGE_RESERVED;
+		} else if (memcmp(str, "soft reserved\n", 14) == 0 ) {
+			type = RANGE_SOFT_RESERVED;
+		} else if (memcmp(str, "Soft Reserved\n", 14) == 0 ) {
+			type = RANGE_SOFT_RESERVED;
 		} else if (memcmp(str, "GART\n", 5) == 0) {
 			gart_start = start;
 			gart_end = end;
@@ -615,6 +619,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
 		strcat (str_mmap, "K@");
 	else if (type == RANGE_RESERVED)
 		strcat (str_mmap, "K$");
+	else if (type == RANGE_SOFT_RESERVED)
+		strcat (str_mmap, "K*");
 	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
 		strcat (str_mmap, "K#");
 	else if (type == RANGE_PRAM)
@@ -985,6 +991,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 		if ( !( mem_range[i].type == RANGE_ACPI
 			|| mem_range[i].type == RANGE_ACPI_NVS
 			|| mem_range[i].type == RANGE_RESERVED
+			|| mem_range[i].type == RANGE_SOFT_RESERVED
 			|| mem_range[i].type == RANGE_PMEM
 			|| mem_range[i].type == RANGE_PRAM))
 			continue;
diff --git a/kexec/arch/i386/kexec-multiboot-x86.c b/kexec/arch/i386/kexec-multiboot-x86.c
index 33c885a2fa..49d57cb5ae 100644
--- a/kexec/arch/i386/kexec-multiboot-x86.c
+++ b/kexec/arch/i386/kexec-multiboot-x86.c
@@ -379,6 +379,7 @@ int multiboot_x86_load(int argc, char **argv, const char *buf, off_t len,
 			mmap[i].Type = 4;
 			break;
 		case RANGE_RESERVED:
+		case RANGE_SOFT_RESERVED:
 		default:
 			mmap[i].Type = 2;  /* Not RAM (reserved) */
 		}
diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
index ffc95a9e43..116c4f4fd3 100644
--- a/kexec/arch/i386/kexec-x86-common.c
+++ b/kexec/arch/i386/kexec-x86-common.c
@@ -99,6 +99,9 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
 		else if (strncasecmp(str, "reserved\n", 9) == 0) {
 			type = RANGE_RESERVED;
 		}
+		else if (strncasecmp(str, "soft reserved\n", 9) == 0) {
+			type = RANGE_SOFT_RESERVED;
+		}
 		else if (memcmp(str, "ACPI Tables\n", 12) == 0) {
 			type = RANGE_ACPI;
 		}
@@ -170,6 +173,8 @@ unsigned xen_e820_to_kexec_type(uint32_t type)
 			return RANGE_PMEM;
 		case E820_PRAM:
 			return RANGE_PRAM;
+		case E820_SOFT_RESERVED;
+			return RANGE_SOFT_RESERVED;
 		case E820_RESERVED:
 		default:
 			return RANGE_RESERVED;
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 73251b9339..afc83fe729 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -755,6 +755,9 @@ static void add_e820_map_from_mr(struct x86_linux_param_header *real_mode,
 			case RANGE_PRAM:
 				e820[i].type = E820_PRAM;
 				break;
+			case RANGE_SOFT_RESERVED:
+				e820[i].type = E820_SOFT_RESERVED;
+				break;
 			default:
 			case RANGE_RESERVED:
 				e820[i].type = E820_RESERVED;
diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c
index 457c3dc9a6..fa0c22140a 100644
--- a/kexec/firmware_memmap.c
+++ b/kexec/firmware_memmap.c
@@ -182,6 +182,8 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range)
 		range->type = RANGE_RESERVED;
 	else if (strcmp(type, "Reserved") == 0)
 		range->type = RANGE_RESERVED;
+        else if (strcmp(type, "Soft Reserved") == 0)
+                range->type = RANGE_SOFT_RESERVED;
 	else if (strcmp(type, "Unknown E820 type") == 0)
 		range->type = RANGE_RESERVED;
 	else if (strcmp(type, "ACPI Non-volatile Storage") == 0)
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 31c323f674..dbb27a7607 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -139,6 +139,7 @@ struct memory_range {
 #define RANGE_UNCACHED	4
 #define RANGE_PMEM		6
 #define RANGE_PRAM		11
+#define RANGE_SOFT_RESERVED 0xefffffff
 };
 
 struct memory_ranges {
-- 
2.17.0


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] Add support for soft reserved memory range
  2024-08-14  5:33 ` [PATCH] Add support for soft reserved memory range Jacek Tomaka
@ 2024-08-24  2:06   ` Jacek Tomaka
  2024-08-30 14:45   ` Baoquan He
  1 sibling, 0 replies; 7+ messages in thread
From: Jacek Tomaka @ 2024-08-24  2:06 UTC (permalink / raw)
  To: kexec, horms, dan.j.williams; +Cc: Jacek Tomaka

A friendly ping.

On Wed, Aug 14, 2024 at 12:33 AM Jacek Tomaka <jacekt@dugeo.com> wrote:
>
> Essentially catch up with e820 related changes in the kernel.
> Intel Sapphire Rappids MAX has high bandwidth memory which is
> precious resource that is better not allocated by the kernel.
>
> Userspace later can enable soft reserved range using daxctl.
>
> Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
> ---
>  include/x86/x86-linux.h               | 2 ++
>  kexec/arch/i386/crashdump-x86.c       | 7 +++++++
>  kexec/arch/i386/kexec-multiboot-x86.c | 1 +
>  kexec/arch/i386/kexec-x86-common.c    | 5 +++++
>  kexec/arch/i386/x86-linux-setup.c     | 3 +++
>  kexec/firmware_memmap.c               | 2 ++
>  kexec/kexec.h                         | 1 +
>  7 files changed, 21 insertions(+)
>
> diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
> index 9646102835..fbde93df94 100644
> --- a/include/x86/x86-linux.h
> +++ b/include/x86/x86-linux.h
> @@ -23,6 +23,8 @@ struct e820entry {
>  #define E820_NVS       4
>  #define E820_PMEM       7
>  #define E820_PRAM       12
> +#define E820_SOFT_RESERVED 0xefffffff
> +
>  } __attribute__((packed));
>  #endif
>
> diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
> index a01031e570..49108b2032 100644
> --- a/kexec/arch/i386/crashdump-x86.c
> +++ b/kexec/arch/i386/crashdump-x86.c
> @@ -288,6 +288,10 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
>                         type = RANGE_RESERVED;
>                 } else if (memcmp(str, "Reserved\n", 9) == 0) {
>                         type = RANGE_RESERVED;
> +               } else if (memcmp(str, "soft reserved\n", 14) == 0 ) {
> +                       type = RANGE_SOFT_RESERVED;
> +               } else if (memcmp(str, "Soft Reserved\n", 14) == 0 ) {
> +                       type = RANGE_SOFT_RESERVED;
>                 } else if (memcmp(str, "GART\n", 5) == 0) {
>                         gart_start = start;
>                         gart_end = end;
> @@ -615,6 +619,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
>                 strcat (str_mmap, "K@");
>         else if (type == RANGE_RESERVED)
>                 strcat (str_mmap, "K$");
> +       else if (type == RANGE_SOFT_RESERVED)
> +               strcat (str_mmap, "K*");
>         else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
>                 strcat (str_mmap, "K#");
>         else if (type == RANGE_PRAM)
> @@ -985,6 +991,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
>                 if ( !( mem_range[i].type == RANGE_ACPI
>                         || mem_range[i].type == RANGE_ACPI_NVS
>                         || mem_range[i].type == RANGE_RESERVED
> +                       || mem_range[i].type == RANGE_SOFT_RESERVED
>                         || mem_range[i].type == RANGE_PMEM
>                         || mem_range[i].type == RANGE_PRAM))
>                         continue;
> diff --git a/kexec/arch/i386/kexec-multiboot-x86.c b/kexec/arch/i386/kexec-multiboot-x86.c
> index 33c885a2fa..49d57cb5ae 100644
> --- a/kexec/arch/i386/kexec-multiboot-x86.c
> +++ b/kexec/arch/i386/kexec-multiboot-x86.c
> @@ -379,6 +379,7 @@ int multiboot_x86_load(int argc, char **argv, const char *buf, off_t len,
>                         mmap[i].Type = 4;
>                         break;
>                 case RANGE_RESERVED:
> +               case RANGE_SOFT_RESERVED:
>                 default:
>                         mmap[i].Type = 2;  /* Not RAM (reserved) */
>                 }
> diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
> index ffc95a9e43..116c4f4fd3 100644
> --- a/kexec/arch/i386/kexec-x86-common.c
> +++ b/kexec/arch/i386/kexec-x86-common.c
> @@ -99,6 +99,9 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
>                 else if (strncasecmp(str, "reserved\n", 9) == 0) {
>                         type = RANGE_RESERVED;
>                 }
> +               else if (strncasecmp(str, "soft reserved\n", 9) == 0) {
> +                       type = RANGE_SOFT_RESERVED;
> +               }
>                 else if (memcmp(str, "ACPI Tables\n", 12) == 0) {
>                         type = RANGE_ACPI;
>                 }
> @@ -170,6 +173,8 @@ unsigned xen_e820_to_kexec_type(uint32_t type)
>                         return RANGE_PMEM;
>                 case E820_PRAM:
>                         return RANGE_PRAM;
> +               case E820_SOFT_RESERVED;
> +                       return RANGE_SOFT_RESERVED;
>                 case E820_RESERVED:
>                 default:
>                         return RANGE_RESERVED;
> diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> index 73251b9339..afc83fe729 100644
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -755,6 +755,9 @@ static void add_e820_map_from_mr(struct x86_linux_param_header *real_mode,
>                         case RANGE_PRAM:
>                                 e820[i].type = E820_PRAM;
>                                 break;
> +                       case RANGE_SOFT_RESERVED:
> +                               e820[i].type = E820_SOFT_RESERVED;
> +                               break;
>                         default:
>                         case RANGE_RESERVED:
>                                 e820[i].type = E820_RESERVED;
> diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c
> index 457c3dc9a6..fa0c22140a 100644
> --- a/kexec/firmware_memmap.c
> +++ b/kexec/firmware_memmap.c
> @@ -182,6 +182,8 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range)
>                 range->type = RANGE_RESERVED;
>         else if (strcmp(type, "Reserved") == 0)
>                 range->type = RANGE_RESERVED;
> +        else if (strcmp(type, "Soft Reserved") == 0)
> +                range->type = RANGE_SOFT_RESERVED;
>         else if (strcmp(type, "Unknown E820 type") == 0)
>                 range->type = RANGE_RESERVED;
>         else if (strcmp(type, "ACPI Non-volatile Storage") == 0)
> diff --git a/kexec/kexec.h b/kexec/kexec.h
> index 31c323f674..dbb27a7607 100644
> --- a/kexec/kexec.h
> +++ b/kexec/kexec.h
> @@ -139,6 +139,7 @@ struct memory_range {
>  #define RANGE_UNCACHED 4
>  #define RANGE_PMEM             6
>  #define RANGE_PRAM             11
> +#define RANGE_SOFT_RESERVED 0xefffffff
>  };
>
>  struct memory_ranges {
> --
> 2.17.0
>


-- 
Jacek Tomaka
Principal Software Engineer

76 Kings Park Road
West Perth 6005 WA, Australia
tel +61 8 9287 4143
jacekt@dug.com
www.dug.com
www.dug.comwww.dug.com

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] Add support for soft reserved memory range
  2024-08-14  5:33 ` [PATCH] Add support for soft reserved memory range Jacek Tomaka
  2024-08-24  2:06   ` Jacek Tomaka
@ 2024-08-30 14:45   ` Baoquan He
  2024-09-03  1:47     ` Jacek Tomaka
  1 sibling, 1 reply; 7+ messages in thread
From: Baoquan He @ 2024-08-30 14:45 UTC (permalink / raw)
  To: Jacek Tomaka; +Cc: kexec, horms, dan.j.williams, Jacek Tomaka

Hi,

On 08/14/24 at 01:33pm, Jacek Tomaka wrote:
> Essentially catch up with e820 related changes in the kernel.
> Intel Sapphire Rappids MAX has high bandwidth memory which is
> precious resource that is better not allocated by the kernel.

Wondering what use cases you have encountered and want to use this patch
to resolve. Could you say more about it?

> 
> Userspace later can enable soft reserved range using daxctl.
> 
> Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
> ---
>  include/x86/x86-linux.h               | 2 ++
>  kexec/arch/i386/crashdump-x86.c       | 7 +++++++
>  kexec/arch/i386/kexec-multiboot-x86.c | 1 +
>  kexec/arch/i386/kexec-x86-common.c    | 5 +++++
>  kexec/arch/i386/x86-linux-setup.c     | 3 +++
>  kexec/firmware_memmap.c               | 2 ++
>  kexec/kexec.h                         | 1 +
>  7 files changed, 21 insertions(+)
> 
> diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
> index 9646102835..fbde93df94 100644
> --- a/include/x86/x86-linux.h
> +++ b/include/x86/x86-linux.h
> @@ -23,6 +23,8 @@ struct e820entry {
>  #define E820_NVS	4
>  #define E820_PMEM       7
>  #define E820_PRAM       12
> +#define E820_SOFT_RESERVED 0xefffffff
> +
>  } __attribute__((packed));
>  #endif
>  
> diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
> index a01031e570..49108b2032 100644
> --- a/kexec/arch/i386/crashdump-x86.c
> +++ b/kexec/arch/i386/crashdump-x86.c
> @@ -288,6 +288,10 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
>  			type = RANGE_RESERVED;
>  		} else if (memcmp(str, "Reserved\n", 9) == 0) {
>  			type = RANGE_RESERVED;
> +		} else if (memcmp(str, "soft reserved\n", 14) == 0 ) {
> +			type = RANGE_SOFT_RESERVED;
> +		} else if (memcmp(str, "Soft Reserved\n", 14) == 0 ) {
> +			type = RANGE_SOFT_RESERVED;
>  		} else if (memcmp(str, "GART\n", 5) == 0) {
>  			gart_start = start;
>  			gart_end = end;
> @@ -615,6 +619,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
>  		strcat (str_mmap, "K@");
>  	else if (type == RANGE_RESERVED)
>  		strcat (str_mmap, "K$");
> +	else if (type == RANGE_SOFT_RESERVED)
> +		strcat (str_mmap, "K*");
>  	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
>  		strcat (str_mmap, "K#");
>  	else if (type == RANGE_PRAM)
> @@ -985,6 +991,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
>  		if ( !( mem_range[i].type == RANGE_ACPI
>  			|| mem_range[i].type == RANGE_ACPI_NVS
>  			|| mem_range[i].type == RANGE_RESERVED
> +			|| mem_range[i].type == RANGE_SOFT_RESERVED
>  			|| mem_range[i].type == RANGE_PMEM
>  			|| mem_range[i].type == RANGE_PRAM))
>  			continue;
> diff --git a/kexec/arch/i386/kexec-multiboot-x86.c b/kexec/arch/i386/kexec-multiboot-x86.c
> index 33c885a2fa..49d57cb5ae 100644
> --- a/kexec/arch/i386/kexec-multiboot-x86.c
> +++ b/kexec/arch/i386/kexec-multiboot-x86.c
> @@ -379,6 +379,7 @@ int multiboot_x86_load(int argc, char **argv, const char *buf, off_t len,
>  			mmap[i].Type = 4;
>  			break;
>  		case RANGE_RESERVED:
> +		case RANGE_SOFT_RESERVED:
>  		default:
>  			mmap[i].Type = 2;  /* Not RAM (reserved) */
>  		}
> diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
> index ffc95a9e43..116c4f4fd3 100644
> --- a/kexec/arch/i386/kexec-x86-common.c
> +++ b/kexec/arch/i386/kexec-x86-common.c
> @@ -99,6 +99,9 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
>  		else if (strncasecmp(str, "reserved\n", 9) == 0) {
>  			type = RANGE_RESERVED;
>  		}
> +		else if (strncasecmp(str, "soft reserved\n", 9) == 0) {
> +			type = RANGE_SOFT_RESERVED;
> +		}
>  		else if (memcmp(str, "ACPI Tables\n", 12) == 0) {
>  			type = RANGE_ACPI;
>  		}
> @@ -170,6 +173,8 @@ unsigned xen_e820_to_kexec_type(uint32_t type)
>  			return RANGE_PMEM;
>  		case E820_PRAM:
>  			return RANGE_PRAM;
> +		case E820_SOFT_RESERVED;
> +			return RANGE_SOFT_RESERVED;
>  		case E820_RESERVED:
>  		default:
>  			return RANGE_RESERVED;
> diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> index 73251b9339..afc83fe729 100644
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -755,6 +755,9 @@ static void add_e820_map_from_mr(struct x86_linux_param_header *real_mode,
>  			case RANGE_PRAM:
>  				e820[i].type = E820_PRAM;
>  				break;
> +			case RANGE_SOFT_RESERVED:
> +				e820[i].type = E820_SOFT_RESERVED;
> +				break;
>  			default:
>  			case RANGE_RESERVED:
>  				e820[i].type = E820_RESERVED;
> diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c
> index 457c3dc9a6..fa0c22140a 100644
> --- a/kexec/firmware_memmap.c
> +++ b/kexec/firmware_memmap.c
> @@ -182,6 +182,8 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range)
>  		range->type = RANGE_RESERVED;
>  	else if (strcmp(type, "Reserved") == 0)
>  		range->type = RANGE_RESERVED;
> +        else if (strcmp(type, "Soft Reserved") == 0)
> +                range->type = RANGE_SOFT_RESERVED;
>  	else if (strcmp(type, "Unknown E820 type") == 0)
>  		range->type = RANGE_RESERVED;
>  	else if (strcmp(type, "ACPI Non-volatile Storage") == 0)
> diff --git a/kexec/kexec.h b/kexec/kexec.h
> index 31c323f674..dbb27a7607 100644
> --- a/kexec/kexec.h
> +++ b/kexec/kexec.h
> @@ -139,6 +139,7 @@ struct memory_range {
>  #define RANGE_UNCACHED	4
>  #define RANGE_PMEM		6
>  #define RANGE_PRAM		11
> +#define RANGE_SOFT_RESERVED 0xefffffff
>  };
>  
>  struct memory_ranges {
> -- 
> 2.17.0
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] Add support for soft reserved memory range
  2024-08-30 14:45   ` Baoquan He
@ 2024-09-03  1:47     ` Jacek Tomaka
  2024-09-04  4:15       ` Baoquan He
  0 siblings, 1 reply; 7+ messages in thread
From: Jacek Tomaka @ 2024-09-03  1:47 UTC (permalink / raw)
  To: Baoquan He; +Cc: kexec, horms, dan.j.williams, Jacek Tomaka

Hi Boaquan,

> Wondering what use cases you have encountered and want to use this patch
> to resolve. Could you say more about it?

Sure, we are using genders to store kernel arguments for each machine
so that they are version controlled.
In order to apply them we boot buildroot kernel, download destination
kernel, read arguments to be passed,
then kexec.

In general it works fine, but some of our machines are Sapphire Rapids
Max and without kexec understanding soft
reservations we end up with 2GB less total memory, which in general
would not be a big deal but I think it is the
HBM memory that is wasted.

Regards.
Jacek Tomaka

On Fri, Aug 30, 2024 at 10:45 PM Baoquan He <bhe@redhat.com> wrote:
>
> Hi,
>
> On 08/14/24 at 01:33pm, Jacek Tomaka wrote:
> > Essentially catch up with e820 related changes in the kernel.
> > Intel Sapphire Rappids MAX has high bandwidth memory which is
> > precious resource that is better not allocated by the kernel.
>
> Wondering what use cases you have encountered and want to use this patch
> to resolve. Could you say more about it?
>
> >
> > Userspace later can enable soft reserved range using daxctl.
> >
> > Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
> > ---
> >  include/x86/x86-linux.h               | 2 ++
> >  kexec/arch/i386/crashdump-x86.c       | 7 +++++++
> >  kexec/arch/i386/kexec-multiboot-x86.c | 1 +
> >  kexec/arch/i386/kexec-x86-common.c    | 5 +++++
> >  kexec/arch/i386/x86-linux-setup.c     | 3 +++
> >  kexec/firmware_memmap.c               | 2 ++
> >  kexec/kexec.h                         | 1 +
> >  7 files changed, 21 insertions(+)
> >
> > diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
> > index 9646102835..fbde93df94 100644
> > --- a/include/x86/x86-linux.h
> > +++ b/include/x86/x86-linux.h
> > @@ -23,6 +23,8 @@ struct e820entry {
> >  #define E820_NVS     4
> >  #define E820_PMEM       7
> >  #define E820_PRAM       12
> > +#define E820_SOFT_RESERVED 0xefffffff
> > +
> >  } __attribute__((packed));
> >  #endif
> >
> > diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
> > index a01031e570..49108b2032 100644
> > --- a/kexec/arch/i386/crashdump-x86.c
> > +++ b/kexec/arch/i386/crashdump-x86.c
> > @@ -288,6 +288,10 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
> >                       type = RANGE_RESERVED;
> >               } else if (memcmp(str, "Reserved\n", 9) == 0) {
> >                       type = RANGE_RESERVED;
> > +             } else if (memcmp(str, "soft reserved\n", 14) == 0 ) {
> > +                     type = RANGE_SOFT_RESERVED;
> > +             } else if (memcmp(str, "Soft Reserved\n", 14) == 0 ) {
> > +                     type = RANGE_SOFT_RESERVED;
> >               } else if (memcmp(str, "GART\n", 5) == 0) {
> >                       gart_start = start;
> >                       gart_end = end;
> > @@ -615,6 +619,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
> >               strcat (str_mmap, "K@");
> >       else if (type == RANGE_RESERVED)
> >               strcat (str_mmap, "K$");
> > +     else if (type == RANGE_SOFT_RESERVED)
> > +             strcat (str_mmap, "K*");
> >       else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
> >               strcat (str_mmap, "K#");
> >       else if (type == RANGE_PRAM)
> > @@ -985,6 +991,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
> >               if ( !( mem_range[i].type == RANGE_ACPI
> >                       || mem_range[i].type == RANGE_ACPI_NVS
> >                       || mem_range[i].type == RANGE_RESERVED
> > +                     || mem_range[i].type == RANGE_SOFT_RESERVED
> >                       || mem_range[i].type == RANGE_PMEM
> >                       || mem_range[i].type == RANGE_PRAM))
> >                       continue;
> > diff --git a/kexec/arch/i386/kexec-multiboot-x86.c b/kexec/arch/i386/kexec-multiboot-x86.c
> > index 33c885a2fa..49d57cb5ae 100644
> > --- a/kexec/arch/i386/kexec-multiboot-x86.c
> > +++ b/kexec/arch/i386/kexec-multiboot-x86.c
> > @@ -379,6 +379,7 @@ int multiboot_x86_load(int argc, char **argv, const char *buf, off_t len,
> >                       mmap[i].Type = 4;
> >                       break;
> >               case RANGE_RESERVED:
> > +             case RANGE_SOFT_RESERVED:
> >               default:
> >                       mmap[i].Type = 2;  /* Not RAM (reserved) */
> >               }
> > diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
> > index ffc95a9e43..116c4f4fd3 100644
> > --- a/kexec/arch/i386/kexec-x86-common.c
> > +++ b/kexec/arch/i386/kexec-x86-common.c
> > @@ -99,6 +99,9 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
> >               else if (strncasecmp(str, "reserved\n", 9) == 0) {
> >                       type = RANGE_RESERVED;
> >               }
> > +             else if (strncasecmp(str, "soft reserved\n", 9) == 0) {
> > +                     type = RANGE_SOFT_RESERVED;
> > +             }
> >               else if (memcmp(str, "ACPI Tables\n", 12) == 0) {
> >                       type = RANGE_ACPI;
> >               }
> > @@ -170,6 +173,8 @@ unsigned xen_e820_to_kexec_type(uint32_t type)
> >                       return RANGE_PMEM;
> >               case E820_PRAM:
> >                       return RANGE_PRAM;
> > +             case E820_SOFT_RESERVED;
> > +                     return RANGE_SOFT_RESERVED;
> >               case E820_RESERVED:
> >               default:
> >                       return RANGE_RESERVED;
> > diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> > index 73251b9339..afc83fe729 100644
> > --- a/kexec/arch/i386/x86-linux-setup.c
> > +++ b/kexec/arch/i386/x86-linux-setup.c
> > @@ -755,6 +755,9 @@ static void add_e820_map_from_mr(struct x86_linux_param_header *real_mode,
> >                       case RANGE_PRAM:
> >                               e820[i].type = E820_PRAM;
> >                               break;
> > +                     case RANGE_SOFT_RESERVED:
> > +                             e820[i].type = E820_SOFT_RESERVED;
> > +                             break;
> >                       default:
> >                       case RANGE_RESERVED:
> >                               e820[i].type = E820_RESERVED;
> > diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c
> > index 457c3dc9a6..fa0c22140a 100644
> > --- a/kexec/firmware_memmap.c
> > +++ b/kexec/firmware_memmap.c
> > @@ -182,6 +182,8 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range)
> >               range->type = RANGE_RESERVED;
> >       else if (strcmp(type, "Reserved") == 0)
> >               range->type = RANGE_RESERVED;
> > +        else if (strcmp(type, "Soft Reserved") == 0)
> > +                range->type = RANGE_SOFT_RESERVED;
> >       else if (strcmp(type, "Unknown E820 type") == 0)
> >               range->type = RANGE_RESERVED;
> >       else if (strcmp(type, "ACPI Non-volatile Storage") == 0)
> > diff --git a/kexec/kexec.h b/kexec/kexec.h
> > index 31c323f674..dbb27a7607 100644
> > --- a/kexec/kexec.h
> > +++ b/kexec/kexec.h
> > @@ -139,6 +139,7 @@ struct memory_range {
> >  #define RANGE_UNCACHED       4
> >  #define RANGE_PMEM           6
> >  #define RANGE_PRAM           11
> > +#define RANGE_SOFT_RESERVED 0xefffffff
> >  };
> >
> >  struct memory_ranges {
> > --
> > 2.17.0
> >
> >
> > _______________________________________________
> > kexec mailing list
> > kexec@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/kexec
> >
>


-- 
Jacek Tomaka
Principal Software Engineer

76 Kings Park Road
West Perth 6005 WA, Australia
tel +61 8 9287 4143
jacekt@dug.com
www.dug.com
www.dug.comwww.dug.com

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] Add support for soft reserved memory range
  2024-09-03  1:47     ` Jacek Tomaka
@ 2024-09-04  4:15       ` Baoquan He
  0 siblings, 0 replies; 7+ messages in thread
From: Baoquan He @ 2024-09-04  4:15 UTC (permalink / raw)
  To: Jacek Tomaka; +Cc: kexec, horms, dan.j.williams, Jacek Tomaka

On 09/03/24 at 09:47am, Jacek Tomaka wrote:
> Hi Boaquan,
> 
> > Wondering what use cases you have encountered and want to use this patch
> > to resolve. Could you say more about it?
> 
> Sure, we are using genders to store kernel arguments for each machine
> so that they are version controlled.
> In order to apply them we boot buildroot kernel, download destination
> kernel, read arguments to be passed,
> then kexec.
> 
> In general it works fine, but some of our machines are Sapphire Rapids
> Max and without kexec understanding soft
> reservations we end up with 2GB less total memory, which in general
> would not be a big deal but I think it is the
> HBM memory that is wasted.

Ok, thanks for these details.

So you are using kexec_load interface, does kexec_file_load interface
work well in this case?

> 
> 
> On Fri, Aug 30, 2024 at 10:45 PM Baoquan He <bhe@redhat.com> wrote:
> >
> > Hi,
> >
> > On 08/14/24 at 01:33pm, Jacek Tomaka wrote:
> > > Essentially catch up with e820 related changes in the kernel.
> > > Intel Sapphire Rappids MAX has high bandwidth memory which is
> > > precious resource that is better not allocated by the kernel.
> >
> > Wondering what use cases you have encountered and want to use this patch
> > to resolve. Could you say more about it?
> >
> > >
> > > Userspace later can enable soft reserved range using daxctl.
> > >
> > > Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
> > > ---
> > >  include/x86/x86-linux.h               | 2 ++
> > >  kexec/arch/i386/crashdump-x86.c       | 7 +++++++
> > >  kexec/arch/i386/kexec-multiboot-x86.c | 1 +
> > >  kexec/arch/i386/kexec-x86-common.c    | 5 +++++
> > >  kexec/arch/i386/x86-linux-setup.c     | 3 +++
> > >  kexec/firmware_memmap.c               | 2 ++
> > >  kexec/kexec.h                         | 1 +
> > >  7 files changed, 21 insertions(+)
> > >
> > > diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
> > > index 9646102835..fbde93df94 100644
> > > --- a/include/x86/x86-linux.h
> > > +++ b/include/x86/x86-linux.h
> > > @@ -23,6 +23,8 @@ struct e820entry {
> > >  #define E820_NVS     4
> > >  #define E820_PMEM       7
> > >  #define E820_PRAM       12
> > > +#define E820_SOFT_RESERVED 0xefffffff
> > > +
> > >  } __attribute__((packed));
> > >  #endif
> > >
> > > diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
> > > index a01031e570..49108b2032 100644
> > > --- a/kexec/arch/i386/crashdump-x86.c
> > > +++ b/kexec/arch/i386/crashdump-x86.c
> > > @@ -288,6 +288,10 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
> > >                       type = RANGE_RESERVED;
> > >               } else if (memcmp(str, "Reserved\n", 9) == 0) {
> > >                       type = RANGE_RESERVED;
> > > +             } else if (memcmp(str, "soft reserved\n", 14) == 0 ) {
> > > +                     type = RANGE_SOFT_RESERVED;
> > > +             } else if (memcmp(str, "Soft Reserved\n", 14) == 0 ) {
> > > +                     type = RANGE_SOFT_RESERVED;
> > >               } else if (memcmp(str, "GART\n", 5) == 0) {
> > >                       gart_start = start;
> > >                       gart_end = end;
> > > @@ -615,6 +619,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
> > >               strcat (str_mmap, "K@");
> > >       else if (type == RANGE_RESERVED)
> > >               strcat (str_mmap, "K$");
> > > +     else if (type == RANGE_SOFT_RESERVED)
> > > +             strcat (str_mmap, "K*");
> > >       else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
> > >               strcat (str_mmap, "K#");
> > >       else if (type == RANGE_PRAM)
> > > @@ -985,6 +991,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
> > >               if ( !( mem_range[i].type == RANGE_ACPI
> > >                       || mem_range[i].type == RANGE_ACPI_NVS
> > >                       || mem_range[i].type == RANGE_RESERVED
> > > +                     || mem_range[i].type == RANGE_SOFT_RESERVED
> > >                       || mem_range[i].type == RANGE_PMEM
> > >                       || mem_range[i].type == RANGE_PRAM))
> > >                       continue;
> > > diff --git a/kexec/arch/i386/kexec-multiboot-x86.c b/kexec/arch/i386/kexec-multiboot-x86.c
> > > index 33c885a2fa..49d57cb5ae 100644
> > > --- a/kexec/arch/i386/kexec-multiboot-x86.c
> > > +++ b/kexec/arch/i386/kexec-multiboot-x86.c
> > > @@ -379,6 +379,7 @@ int multiboot_x86_load(int argc, char **argv, const char *buf, off_t len,
> > >                       mmap[i].Type = 4;
> > >                       break;
> > >               case RANGE_RESERVED:
> > > +             case RANGE_SOFT_RESERVED:
> > >               default:
> > >                       mmap[i].Type = 2;  /* Not RAM (reserved) */
> > >               }
> > > diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
> > > index ffc95a9e43..116c4f4fd3 100644
> > > --- a/kexec/arch/i386/kexec-x86-common.c
> > > +++ b/kexec/arch/i386/kexec-x86-common.c
> > > @@ -99,6 +99,9 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
> > >               else if (strncasecmp(str, "reserved\n", 9) == 0) {
> > >                       type = RANGE_RESERVED;
> > >               }
> > > +             else if (strncasecmp(str, "soft reserved\n", 9) == 0) {
> > > +                     type = RANGE_SOFT_RESERVED;
> > > +             }
> > >               else if (memcmp(str, "ACPI Tables\n", 12) == 0) {
> > >                       type = RANGE_ACPI;
> > >               }
> > > @@ -170,6 +173,8 @@ unsigned xen_e820_to_kexec_type(uint32_t type)
> > >                       return RANGE_PMEM;
> > >               case E820_PRAM:
> > >                       return RANGE_PRAM;
> > > +             case E820_SOFT_RESERVED;
> > > +                     return RANGE_SOFT_RESERVED;
> > >               case E820_RESERVED:
> > >               default:
> > >                       return RANGE_RESERVED;
> > > diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> > > index 73251b9339..afc83fe729 100644
> > > --- a/kexec/arch/i386/x86-linux-setup.c
> > > +++ b/kexec/arch/i386/x86-linux-setup.c
> > > @@ -755,6 +755,9 @@ static void add_e820_map_from_mr(struct x86_linux_param_header *real_mode,
> > >                       case RANGE_PRAM:
> > >                               e820[i].type = E820_PRAM;
> > >                               break;
> > > +                     case RANGE_SOFT_RESERVED:
> > > +                             e820[i].type = E820_SOFT_RESERVED;
> > > +                             break;
> > >                       default:
> > >                       case RANGE_RESERVED:
> > >                               e820[i].type = E820_RESERVED;
> > > diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c
> > > index 457c3dc9a6..fa0c22140a 100644
> > > --- a/kexec/firmware_memmap.c
> > > +++ b/kexec/firmware_memmap.c
> > > @@ -182,6 +182,8 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range)
> > >               range->type = RANGE_RESERVED;
> > >       else if (strcmp(type, "Reserved") == 0)
> > >               range->type = RANGE_RESERVED;
> > > +        else if (strcmp(type, "Soft Reserved") == 0)
> > > +                range->type = RANGE_SOFT_RESERVED;
> > >       else if (strcmp(type, "Unknown E820 type") == 0)
> > >               range->type = RANGE_RESERVED;
> > >       else if (strcmp(type, "ACPI Non-volatile Storage") == 0)
> > > diff --git a/kexec/kexec.h b/kexec/kexec.h
> > > index 31c323f674..dbb27a7607 100644
> > > --- a/kexec/kexec.h
> > > +++ b/kexec/kexec.h
> > > @@ -139,6 +139,7 @@ struct memory_range {
> > >  #define RANGE_UNCACHED       4
> > >  #define RANGE_PMEM           6
> > >  #define RANGE_PRAM           11
> > > +#define RANGE_SOFT_RESERVED 0xefffffff
> > >  };
> > >
> > >  struct memory_ranges {
> > > --
> > > 2.17.0
> > >
> > >
> > > _______________________________________________
> > > kexec mailing list
> > > kexec@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/kexec
> > >
> >
> 
> 
> -- 
> Jacek Tomaka
> Principal Software Engineer
> 
> 76 Kings Park Road
> West Perth 6005 WA, Australia
> tel +61 8 9287 4143
> jacekt@dug.com
> www.dug.com
> www.dug.comwww.dug.com
> 


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2024-09-04  4:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240814052024.25731-1-jacekt@dugeo.com>
2024-08-14  5:33 ` [PATCH] Add support for soft reserved memory range Jacek Tomaka
2024-08-24  2:06   ` Jacek Tomaka
2024-08-30 14:45   ` Baoquan He
2024-09-03  1:47     ` Jacek Tomaka
2024-09-04  4:15       ` Baoquan He
2024-08-07  2:57 Jacek Tomaka
2024-08-13 14:29 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox