qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] target-ppc: Adding Functionality to rtas_ibm_get_sy


From: Tomo Berry
Subject: [Qemu-devel] [PATCH] target-ppc: Adding Functionality to rtas_ibm_get_system_parameter.
Date: Tue, 17 Jun 2014 16:04:14 -0400

This patch adds the functionality for
rtas_ibm_get_system_parameter to return a string containing
the values for partition_max_entitled_capacity and
system_potential_processors.

Signed-off-by: Tomo Berry <address@hidden>
---
 hw/ppc/spapr_rtas.c    | 29 +++++++++++++++++++++++++++++
 include/hw/ppc/spapr.h | 10 ++++++++++
 2 files changed, 39 insertions(+)

diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 1cb276d..c45049d 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -225,6 +225,9 @@ static void rtas_stop_self(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
 }
 
 #define DIAGNOSTICS_RUN_MODE        42
+#define SPLPAR_CHARACTERISTICS_TOKEN 20
+#define CMO_CHARACTERISTICS_TOKEN 44
+#define CEDE_LATENCY_TOKEN 45
 
 static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu,
                                           sPAPREnvironment *spapr,
@@ -236,6 +239,7 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu,
     target_ulong buffer = rtas_ld(args, 1);
     target_ulong length = rtas_ld(args, 2);
     target_ulong ret = RTAS_OUT_NOT_SUPPORTED;
+    char *local_buffer;
 
     switch (parameter) {
     case DIAGNOSTICS_RUN_MODE:
@@ -244,6 +248,31 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu,
             ret = RTAS_OUT_SUCCESS;
         }
         break;
+    case SPLPAR_CHARACTERISTICS_TOKEN:
+        local_buffer = g_malloc0(length);
+
+        /*  These are the current system parameters supported.  The first
+         *  16 bits of the buffer must contain the length of the string.
+         *  These 16 bits are not included in the length of the string.
+         */
+
+        ((uint16_t *)local_buffer)[0] = cpu_to_be16(snprintf(local_buffer + 2,
+             length - 2, "MaxEntCap=%d,MaxPlatProcs=%d", max_cpus, smp_cpus));
+
+        rtas_st_buffer(buffer, length, (uint8_t *)local_buffer);
+
+        g_free(local_buffer);
+        ret = RTAS_OUT_SUCCESS;
+        break;
+    case CMO_CHARACTERISTICS_TOKEN:
+        ret = RTAS_OUT_NOT_SUPPORTED;
+        break;
+    case CEDE_LATENCY_TOKEN:
+        ret = RTAS_OUT_NOT_SUPPORTED;
+        break;
+    default:
+        ret = RTAS_OUT_NOT_SUPPORTED;
+        break;
     }
 
     rtas_st(rets, 0, ret);
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index b2f11e9..c54a2e4 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -356,6 +356,16 @@ static inline void rtas_st(target_ulong phys, int n, 
uint32_t val)
     stl_be_phys(ppc64_phys_to_real(phys + 4*n), val);
 }
 
+static inline void rtas_st_buffer(target_ulong phys,
+                                  target_ulong phys_len,
+                                  uint8_t *buffer)
+{
+    int i;
+    for (i = 0; i < phys_len; i++) {
+        stb_phys(ppc64_phys_to_real(phys + i), buffer[i]);
+    }
+}
+
 typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, sPAPREnvironment *spapr,
                               uint32_t token,
                               uint32_t nargs, target_ulong args,
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]