nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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