qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 4/4] spapr: Add RTAS sysparm SPLPAR C


From: Alexander Graf
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 4/4] spapr: Add RTAS sysparm SPLPAR Characteristics
Date: Tue, 24 Jun 2014 14:03:57 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0


On 24.06.14 02:22, Sam Bobroff wrote:
Add support for the SPLPAR Characteristics parameter to the emulated
RTAS call ibm,get-system-parameter.

The support provides just enough information to allow "cat
/proc/powerpc/lparcfg" to succeed without generating a kernel error
message.

Without this patch the above command will produce the following kernel
message: arch/powerpc/platforms/pseries/lparcfg.c \
parse_system_parameter_string Error calling get-system-parameter \
(0xfffffffd)

Signed-off-by: Sam Bobroff <address@hidden>
---
  hw/ppc/spapr_rtas.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)

diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 8d94845..4270e7a 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -224,6 +224,7 @@ static void rtas_stop_self(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
      env->msr = 0;
  }
+#define SPLPAR_CHARACTERISTICS 20
  #define DIAGNOSTICS_RUN_MODE        42
  #define UUID                        48
@@ -238,8 +239,20 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu,
      target_ulong length = rtas_ld(args, 2);
      target_ulong ret = RTAS_OUT_SUCCESS;
      uint8_t zero = 0;
+    uint8_t param_buf[64];
+    int param_len;
switch (parameter) {
+    case SPLPAR_CHARACTERISTICS:
+        param_len = snprintf((char *)param_buf, sizeof param_buf,
+                             "MaxEntCap=%d,MaxPlatProcs=%d",
+                             max_cpus, smp_cpus);

We have a nice g_strdup_printf() helper function that allocates memory for us automatically based on the printf size. Just use that one here ;).


Alex




reply via email to

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