ecd2258
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
ecd2258
From: Avnish Chouhan <avnish@linux.vnet.ibm.com>
ecd2258
Date: Mon, 27 Mar 2023 12:25:40 +0530
ecd2258
Subject: [PATCH] kern/ieee1275/init: Extended support in Vec5
ecd2258
MIME-Version: 1.0
ecd2258
Content-Type: text/plain; charset=UTF-8
ecd2258
Content-Transfer-Encoding: 8bit
ecd2258
ecd2258
This patch enables multiple options in Vec5 which are required and
ecd2258
solves the boot issues seen on some machines which are looking for
ecd2258
these specific options.
ecd2258
ecd2258
1. LPAR: Client program supports logical partitioning and
ecd2258
   associated hcall()s.
ecd2258
2. SPLPAR: Client program supports the Shared
ecd2258
   Processor LPAR Option.
ecd2258
3. DYN_RCON_MEM: Client program supports the
ecd2258
   “ibm,dynamic-reconfiguration-memory” property and it may be
ecd2258
   presented in the device tree.
ecd2258
4. LARGE_PAGES: Client supports pages larger than 4 KB.
ecd2258
5. DONATE_DCPU_CLS: Client supports donating dedicated processor cycles.
ecd2258
6. PCI_EXP: Client supports PCI Express implementations
ecd2258
   utilizing Message Signaled Interrupts (MSIs).
ecd2258
ecd2258
7. CMOC: Enables the Cooperative Memory Over-commitment Option.
ecd2258
8. EXT_CMO: Enables the Extended Cooperative Memory Over-commit Option.
ecd2258
ecd2258
9. ASSOC_REF: Enables “ibm,associativity” and
ecd2258
   “ibm,associativity-reference-points” properties.
ecd2258
10. AFFINITY: Enables Platform Resource Reassignment Notification.
ecd2258
11. NUMA: Supports NUMA Distance Lookup Table Option.
ecd2258
ecd2258
12. HOTPLUG_INTRPT: Supports Hotplug Interrupts.
ecd2258
13. HPT_RESIZE: Enable Hash Page Table Resize Option.
ecd2258
ecd2258
14. MAX_CPU: Defines maximum number of CPUs supported.
ecd2258
ecd2258
15. PFO_HWRNG: Supports Random Number Generator.
ecd2258
16. PFO_HW_COMP: Supports Compression Engine.
ecd2258
17. PFO_ENCRYPT: Supports Encryption Engine.
ecd2258
ecd2258
18. SUB_PROCESSORS: Supports Sub-Processors.
ecd2258
ecd2258
19. DY_MEM_V2: Client program supports the “ibm,dynamic-memory-v2” property in the
ecd2258
    “ibm,dynamic-reconfiguration-memory” node and it may be presented in the device tree.
ecd2258
20. DRC_INFO: Client program supports the “ibm,drc-info” property definition and it may be
ecd2258
    presented in the device tree.
ecd2258
ecd2258
Signed-off-by: Avnish Chouhan <avnish@linux.vnet.ibm.com>
ecd2258
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
ecd2258
(cherry picked from commit 98d0df0351fbff7a4acc64c7594d538889a43e2d)
ecd2258
---
ecd2258
 grub-core/kern/ieee1275/init.c | 47 ++++++++++++++++++++++++++++++++++++------
ecd2258
 1 file changed, 41 insertions(+), 6 deletions(-)
ecd2258
ecd2258
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
ecd2258
index 5d79580341..3d4ad9d1f1 100644
ecd2258
--- a/grub-core/kern/ieee1275/init.c
ecd2258
+++ b/grub-core/kern/ieee1275/init.c
ecd2258
@@ -72,11 +72,41 @@ extern char _end[];
ecd2258
 grub_addr_t grub_ieee1275_original_stack;
ecd2258
 #endif
ecd2258
 
ecd2258
-#define LPAR     0x80
ecd2258
-#define SPLPAR   0x40
ecd2258
-#define BYTE2    (LPAR | SPLPAR)
ecd2258
-#define CMO      0x80
ecd2258
-#define MAX_CPU  256
ecd2258
+/* Options vector5 properties. */
ecd2258
+
ecd2258
+#define LPAR                0x80
ecd2258
+#define SPLPAR              0x40
ecd2258
+#define DYN_RCON_MEM        0x20
ecd2258
+#define LARGE_PAGES         0x10
ecd2258
+#define DONATE_DCPU_CLS     0x02
ecd2258
+#define PCI_EXP             0x01
ecd2258
+#define BYTE2               (LPAR | SPLPAR | DYN_RCON_MEM | LARGE_PAGES | DONATE_DCPU_CLS | PCI_EXP)
ecd2258
+
ecd2258
+#define CMOC                0x80
ecd2258
+#define EXT_CMO             0x40
ecd2258
+#define CMO                 (CMOC | EXT_CMO)
ecd2258
+
ecd2258
+#define ASSOC_REF           0x80
ecd2258
+#define AFFINITY            0x40
ecd2258
+#define NUMA                0x20
ecd2258
+#define ASSOCIATIVITY       (ASSOC_REF | AFFINITY | NUMA)
ecd2258
+
ecd2258
+#define HOTPLUG_INTRPT      0x04
ecd2258
+#define HPT_RESIZE          0x01
ecd2258
+#define BIN_OPTS            (HOTPLUG_INTRPT | HPT_RESIZE)
ecd2258
+
ecd2258
+#define MAX_CPU             256
ecd2258
+
ecd2258
+#define PFO_HWRNG           0x80000000
ecd2258
+#define PFO_HW_COMP         0x40000000
ecd2258
+#define PFO_ENCRYPT         0x20000000
ecd2258
+#define PLATFORM_FACILITIES (PFO_HWRNG | PFO_HW_COMP | PFO_ENCRYPT)
ecd2258
+
ecd2258
+#define SUB_PROCESSORS      1
ecd2258
+
ecd2258
+#define DY_MEM_V2           0x80
ecd2258
+#define DRC_INFO            0x40
ecd2258
+#define BYTE22              (DY_MEM_V2 | DRC_INFO)
ecd2258
 
ecd2258
 void
ecd2258
 grub_exit (int rc __attribute__((unused)))
ecd2258
@@ -519,6 +549,11 @@ struct option_vector5
ecd2258
   grub_uint8_t micro_checkpoint;
ecd2258
   grub_uint8_t reserved0;
ecd2258
   grub_uint32_t max_cpus;
ecd2258
+  grub_uint16_t base_papr;
ecd2258
+  grub_uint16_t mem_reference;
ecd2258
+  grub_uint32_t platform_facilities;
ecd2258
+  grub_uint8_t sub_processors;
ecd2258
+  grub_uint8_t byte22;
ecd2258
 } GRUB_PACKED;
ecd2258
 
ecd2258
 struct pvr_entry
ecd2258
@@ -581,7 +616,7 @@ grub_ieee1275_ibm_cas (void)
ecd2258
     .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */
ecd2258
     .vec5_size = 1 + sizeof (struct option_vector5) - 2,
ecd2258
     .vec5 = {
ecd2258
-      0, BYTE2, 0, CMO, 0, 0, 0, 0, MAX_CPU
ecd2258
+      0, BYTE2, 0, CMO, ASSOCIATIVITY, BIN_OPTS, 0, 0, MAX_CPU, 0, 0, PLATFORM_FACILITIES, SUB_PROCESSORS, BYTE22
ecd2258
     }
ecd2258
   };
ecd2258