nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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