From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzPSM-0004C4-2E for qemu-devel@nongnu.org; Tue, 24 Jun 2014 08:04:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzPSA-0000qe-SY for qemu-devel@nongnu.org; Tue, 24 Jun 2014 08:04:10 -0400 Message-ID: <53A9692D.50903@suse.de> Date: Tue, 24 Jun 2014 14:03:57 +0200 From: Alexander Graf MIME-Version: 1.0 References: <53A8C4DE.6090408@au1.ibm.com> In-Reply-To: <53A8C4DE.6090408@au1.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 4/4] spapr: Add RTAS sysparm SPLPAR Characteristics List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sam Bobroff , qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org 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 > --- > 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