nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone
d3c3ab
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d3c3ab
From: Diego Domingos <diegodo@linux.vnet.ibm.com>
d3c3ab
Date: Thu, 25 Aug 2022 11:37:56 -0400
d3c3ab
Subject: [PATCH] ieee1275: implement vec5 for cas negotiation
d3c3ab
d3c3ab
As a legacy support, if the vector 5 is not implemented, Power
d3c3ab
Hypervisor will consider the max CPUs as 64 instead 256 currently
d3c3ab
supported during client-architecture-support negotiation.
d3c3ab
d3c3ab
This patch implements the vector 5 and set the MAX CPUs to 256 while
d3c3ab
setting the others values to 0 (default).
d3c3ab
d3c3ab
Signed-off-by: Diego Domingos <diegodo@linux.vnet.ibm.com>
d3c3ab
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
d3c3ab
(cherry picked from commit f735c65b6da8a9d4251242b37774e1a517511253)
d3c3ab
---
d3c3ab
 grub-core/kern/ieee1275/init.c | 20 +++++++++++++++++++-
d3c3ab
 1 file changed, 19 insertions(+), 1 deletion(-)
d3c3ab
d3c3ab
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
d3c3ab
index ef55107467..6a51c9efab 100644
d3c3ab
--- a/grub-core/kern/ieee1275/init.c
d3c3ab
+++ b/grub-core/kern/ieee1275/init.c
d3c3ab
@@ -311,6 +311,18 @@ struct option_vector2 {
d3c3ab
   grub_uint8_t max_pft_size;
d3c3ab
 } __attribute__((packed));
d3c3ab
 
d3c3ab
+struct option_vector5 {
d3c3ab
+        grub_uint8_t byte1;
d3c3ab
+        grub_uint8_t byte2;
d3c3ab
+        grub_uint8_t byte3;
d3c3ab
+        grub_uint8_t cmo;
d3c3ab
+        grub_uint8_t associativity;
d3c3ab
+        grub_uint8_t bin_opts;
d3c3ab
+        grub_uint8_t micro_checkpoint;
d3c3ab
+        grub_uint8_t reserved0;
d3c3ab
+        grub_uint32_t max_cpus;
d3c3ab
+} __attribute__((packed));
d3c3ab
+
d3c3ab
 struct pvr_entry {
d3c3ab
   grub_uint32_t mask;
d3c3ab
   grub_uint32_t entry;
d3c3ab
@@ -329,6 +341,8 @@ struct cas_vector {
d3c3ab
   grub_uint16_t vec3;
d3c3ab
   grub_uint8_t vec4_size;
d3c3ab
   grub_uint16_t vec4;
d3c3ab
+  grub_uint8_t vec5_size;
d3c3ab
+  struct option_vector5 vec5;
d3c3ab
 } __attribute__((packed));
d3c3ab
 
d3c3ab
 /* Call ibm,client-architecture-support to try to get more RMA.
d3c3ab
@@ -349,7 +363,7 @@ grub_ieee1275_ibm_cas (void)
d3c3ab
   } args;
d3c3ab
   struct cas_vector vector = {
d3c3ab
     .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */
d3c3ab
-    .num_vecs = 4 - 1,
d3c3ab
+    .num_vecs = 5 - 1,
d3c3ab
     .vec1_size = 0,
d3c3ab
     .vec1 = 0x80, /* ignore */
d3c3ab
     .vec2_size = 1 + sizeof(struct option_vector2) - 2,
d3c3ab
@@ -360,6 +374,10 @@ grub_ieee1275_ibm_cas (void)
d3c3ab
     .vec3 = 0x00e0, // ask for FP + VMX + DFP but don't halt if unsatisfied
d3c3ab
     .vec4_size = 2 - 1,
d3c3ab
     .vec4 = 0x0001, // set required minimum capacity % to the lowest value
d3c3ab
+    .vec5_size = 1 + sizeof(struct option_vector5) - 2,
d3c3ab
+    .vec5 = {
d3c3ab
+	0, 0, 0, 0, 0, 0, 0, 0, 256
d3c3ab
+    }
d3c3ab
   };
d3c3ab
 
d3c3ab
   INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2);