From patchwork Thu Mar 13 21:39:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomohiro B Berry X-Patchwork-Id: 330132 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BD35D2C00C6 for ; Fri, 14 Mar 2014 08:39:55 +1100 (EST) Received: from localhost ([::1]:41757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WODM1-0001dw-7J for incoming@patchwork.ozlabs.org; Thu, 13 Mar 2014 17:39:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WODLW-0001do-I7 for qemu-devel@nongnu.org; Thu, 13 Mar 2014 17:39:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WODLL-0001TT-4W for qemu-devel@nongnu.org; Thu, 13 Mar 2014 17:39:22 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:50823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WODLK-0001T7-Qz for qemu-devel@nongnu.org; Thu, 13 Mar 2014 17:39:11 -0400 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Mar 2014 15:39:09 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 13 Mar 2014 15:39:07 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 8DAB719D8039 for ; Thu, 13 Mar 2014 15:39:04 -0600 (MDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by b03cxnp08027.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s2DLcaLI5374272 for ; Thu, 13 Mar 2014 22:38:36 +0100 Received: from d03av01.boulder.ibm.com (localhost [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s2DLd6J3016434 for ; Thu, 13 Mar 2014 15:39:07 -0600 Received: from d03nm112.boulder.ibm.com (d03nm112.boulder.ibm.com [9.63.33.70]) by d03av01.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s2DLd6uH016431; Thu, 13 Mar 2014 15:39:06 -0600 In-Reply-To: <8738iletj5.fsf@pixel.localdomain> References: <8738iletj5.fsf@pixel.localdomain> To: Mike Day MIME-Version: 1.0 X-KeepSent: C88420BA:F49B08A7-87257C9A:00760A20; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.5.3 September 15, 2011 Message-ID: From: Tomohiro B Berry Date: Thu, 13 Mar 2014 16:39:02 -0500 X-MIMETrack: Serialize by Router on D03NM112/03/M/IBM(Release 9.0.1IF1|November 26, 2013) at 03/13/2014 15:39:03, Serialize complete at 03/13/2014 15:39:03 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14031321-8236-0000-0000-000000C09148 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 32.97.110.149 Cc: Tony Breeds , Tom Musta , qemu-devel@nongnu.org, linuxram@linux.vnet.ibm.com Subject: Re: [Qemu-devel] qemu patch for adding functionality to rtas_ibm_get_system_parameter [Version 2] X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi again, I believe I have added the appropriate format changes and made a couple changes to the code. This patch should add functionality to the function rtas_ibm_get_system_parameter to return a string containing the values for partition_max_entitled_capacity and system_potential_processors. Regards, Tomo Berry Signed-off-by: Tomo Berry uint32_t nargs, target_ulong args, From: Mike Day To: Tomohiro B Berry/Austin/IBM@IBMUS, qemu-devel@nongnu.org, Date: 03/13/2014 03:24 PM Subject: Re: [Qemu-devel] qemu patch for adding functionality to rtas_ibm_get_system_parameter Tomohiro, Please follow the guidelines for submitting a patch to Qemu that are found in: http://wiki.qemu.org/Contribute/SubmitAPatch This patch has an inappropriate commit log, is missing a signed-off-by: tag, and some of the lines wrapped in my reader. These are explained in the document above. You should be able to fix these issues quickly and resubmit this patch. Mike Tomohiro B Berry writes: > Hi all, > > rtas_ibm_get_system_parameter did not previously have the functionality to > return the appropriate string when called with the > SPLPAR_CHARACTERISTICS_TOKEN. I am proposing the following patch to add > that functionality. I am including the cases for > CMO_CHARACTERISTICS_TOKEN and CEDE_LATENCY_TOKEN because the function gets > called with those tokens during the boot process, but I understand that > they are currently redundant with the default case. I just figured they > would be useful for future development, but if we don't want them in there > right now I think that would be okay, too. > > Regards, > Tomo Berry > > diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c > index 1cb276d..318fdcd 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,42 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU > *cpu, > ret = RTAS_OUT_SUCCESS; > } > break; > + case SPLPAR_CHARACTERISTICS_TOKEN: > + > + /* Create a string locally to copy to buffer */ > + > + local_buffer=(char*)malloc(length*sizeof(char)); > + memset(local_buffer,0,length); > + > + /* These are the current system parameters supported. The spaces > at the > + * start of the string are place holders for the string length. > */ > + > + snprintf(local_buffer,length," > MaxEntCap=%d,MaxPlatProcs=%d",max_cpus,smp_cpus); > + > + /* 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((uint16_t)strlen(&local_buffer[2])); > + > + /* Copy the string into buffer using rtas_st_buffer to > + * convert the addresses. */ > + > + rtas_st_buffer(buffer,length,(uint8_t*)local_buffer); > + > + /* Free the local buffer and return success. */ > + > + 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..87c039c 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); > } > > +/* This function will store a buffer 1 byte at a time into the > + * address at phys up to a maximum of phys_len bytes. */ > + > +static inline void rtas_st_buffer(target_ulong phys, target_ulong > phys_len, uint8_t* buffer){ > + uint32_t i; > + for(i=0;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, > diff --git a/pixman b/pixman > --- a/pixman > +++ b/pixman > @@ -1 +1 @@ > -Subproject commit 97336fad32acf802003855cd8bd6477fa49a12e3 > +Subproject commit 97336fad32acf802003855cd8bd6477fa49a12e3-dirty diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 1cb276d..931ba06 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,36 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu, ret = RTAS_OUT_SUCCESS; } break; + case SPLPAR_CHARACTERISTICS_TOKEN: + + /* Create a string of length bytes locally to copy to buffer */ + + local_buffer = calloc(length, 1); + + /* 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)); + + /* Copy the string into buffer using rtas_st_buffer to + * convert the addresses. */ + + rtas_st_buffer(buffer, length, (uint8_t *)local_buffer); + + 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..ee6ed2d 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -356,6 +356,18 @@ static inline void rtas_st(target_ulong phys, int n, uint32_t val) stl_be_phys(ppc64_phys_to_real(phys + 4*n), val); } +/* This function will store a buffer 1 byte at a time into the + * address at phys up to a maximum of phys_len bytes.*/ + +static inline void rtas_st_buffer(target_ulong phys, + target_ulong phys_len, + uint8_t *buffer) { + uint32_t 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,