nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0503-powerpc-do-CAS-in-a-more-compatible-way.patch

f6e916
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f6e916
From: Daniel Axtens <dja@axtens.net>
f6e916
Date: Fri, 8 Apr 2022 12:35:28 +1000
f6e916
Subject: [PATCH] powerpc: do CAS in a more compatible way
f6e916
f6e916
I wrongly assumed that the most compatible way to perform CAS
f6e916
negotiation was to only set the minimum number of vectors required
f6e916
to ask for more memory. It turns out that this messes up booting
f6e916
if the minimum VP capacity would be less than the default 10% in
f6e916
vector 4.
f6e916
f6e916
Linux configures the minimum capacity to be 1%, so copy it for that
f6e916
and for vector 3 which we now need to specify as well.
f6e916
f6e916
Signed-off-by: Daniel Axtens <dja@axtens.net>
f6e916
(cherry picked from commit e6f02ad4e75cd995a8ee2954d28949c415b6cbfe)
f6e916
(cherry picked from commit 9f825ebc319c56ca503741e6dc1a0f27ff36fe2d)
f6e916
---
f6e916
 grub-core/kern/ieee1275/init.c | 54 ++++++++++++++++++++++++------------------
f6e916
 1 file changed, 31 insertions(+), 23 deletions(-)
f6e916
f6e916
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
f6e916
index adf4bd5a88..1414695cc6 100644
f6e916
--- a/grub-core/kern/ieee1275/init.c
f6e916
+++ b/grub-core/kern/ieee1275/init.c
f6e916
@@ -294,33 +294,37 @@ grub_ieee1275_total_mem (grub_uint64_t *total)
f6e916
 
f6e916
 /* Based on linux - arch/powerpc/kernel/prom_init.c */
f6e916
 struct option_vector2 {
f6e916
-	grub_uint8_t byte1;
f6e916
-	grub_uint16_t reserved;
f6e916
-	grub_uint32_t real_base;
f6e916
-	grub_uint32_t real_size;
f6e916
-	grub_uint32_t virt_base;
f6e916
-	grub_uint32_t virt_size;
f6e916
-	grub_uint32_t load_base;
f6e916
-	grub_uint32_t min_rma;
f6e916
-	grub_uint32_t min_load;
f6e916
-	grub_uint8_t min_rma_percent;
f6e916
-	grub_uint8_t max_pft_size;
f6e916
+  grub_uint8_t byte1;
f6e916
+  grub_uint16_t reserved;
f6e916
+  grub_uint32_t real_base;
f6e916
+  grub_uint32_t real_size;
f6e916
+  grub_uint32_t virt_base;
f6e916
+  grub_uint32_t virt_size;
f6e916
+  grub_uint32_t load_base;
f6e916
+  grub_uint32_t min_rma;
f6e916
+  grub_uint32_t min_load;
f6e916
+  grub_uint8_t min_rma_percent;
f6e916
+  grub_uint8_t max_pft_size;
f6e916
 } __attribute__((packed));
f6e916
 
f6e916
 struct pvr_entry {
f6e916
-	  grub_uint32_t mask;
f6e916
-	  grub_uint32_t entry;
f6e916
+  grub_uint32_t mask;
f6e916
+  grub_uint32_t entry;
f6e916
 };
f6e916
 
f6e916
 struct cas_vector {
f6e916
-    struct {
f6e916
-      struct pvr_entry terminal;
f6e916
-    } pvr_list;
f6e916
-    grub_uint8_t num_vecs;
f6e916
-    grub_uint8_t vec1_size;
f6e916
-    grub_uint8_t vec1;
f6e916
-    grub_uint8_t vec2_size;
f6e916
-    struct option_vector2 vec2;
f6e916
+  struct {
f6e916
+    struct pvr_entry terminal;
f6e916
+  } pvr_list;
f6e916
+  grub_uint8_t num_vecs;
f6e916
+  grub_uint8_t vec1_size;
f6e916
+  grub_uint8_t vec1;
f6e916
+  grub_uint8_t vec2_size;
f6e916
+  struct option_vector2 vec2;
f6e916
+  grub_uint8_t vec3_size;
f6e916
+  grub_uint16_t vec3;
f6e916
+  grub_uint8_t vec4_size;
f6e916
+  grub_uint16_t vec4;
f6e916
 } __attribute__((packed));
f6e916
 
f6e916
 /* Call ibm,client-architecture-support to try to get more RMA.
f6e916
@@ -341,13 +345,17 @@ grub_ieee1275_ibm_cas (void)
f6e916
   } args;
f6e916
   struct cas_vector vector = {
f6e916
     .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */
f6e916
-    .num_vecs = 2 - 1,
f6e916
+    .num_vecs = 4 - 1,
f6e916
     .vec1_size = 0,
f6e916
     .vec1 = 0x80, /* ignore */
f6e916
     .vec2_size = 1 + sizeof(struct option_vector2) - 2,
f6e916
     .vec2 = {
f6e916
       0, 0, -1, -1, -1, -1, -1, 512, -1, 0, 48
f6e916
     },
f6e916
+    .vec3_size = 2 - 1,
f6e916
+    .vec3 = 0x00e0, // ask for FP + VMX + DFP but don't halt if unsatisfied
f6e916
+    .vec4_size = 2 - 1,
f6e916
+    .vec4 = 0x0001, // set required minimum capacity % to the lowest value
f6e916
   };
f6e916
 
f6e916
   INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2);
f6e916
@@ -360,7 +368,7 @@ grub_ieee1275_ibm_cas (void)
f6e916
   args.ihandle = root;
f6e916
   args.cas_addr = (grub_ieee1275_cell_t)&vector;
f6e916
 
f6e916
-  grub_printf("Calling ibm,client-architecture-support...");
f6e916
+  grub_printf("Calling ibm,client-architecture-support from grub...");
f6e916
   IEEE1275_CALL_ENTRY_FN (&args);
f6e916
   grub_printf("done\n");
f6e916