nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0559-ieee1275-implement-vec5-for-cas-negotiation.patch

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