From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Viig3-0001G7-DF for qemu-devel@nongnu.org; Tue, 19 Nov 2013 05:37:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Viifx-0007ZC-8V for qemu-devel@nongnu.org; Tue, 19 Nov 2013 05:37:03 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1812\)) From: Alexander Graf In-Reply-To: <1384835335-15116-3-git-send-email-aik@ozlabs.ru> Date: Tue, 19 Nov 2013 11:36:03 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <33A8A9EF-36E8-45F1-9B42-43D5934E0E8C@suse.de> References: <1384835335-15116-1-git-send-email-aik@ozlabs.ru> <1384835335-15116-3-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH v3 2/2] spapr-rtas: add ibm, (get|set)-system-parameter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-ppc , QEMU Developers On 19.11.2013, at 05:28, Alexey Kardashevskiy wrote: > This adds very basic handlers for ibm,get-system-parameter and > ibm,set-system-parameter RTAS calls. >=20 > The only parameter handled at the moment is > "platform-processor-diagnostics-run-mode" which is always disabled and > does not support changing. This is expected to make > "ppc64_cpu --run-mode=3D1" happy. >=20 > Signed-off-by: Alexey Kardashevskiy > --- > Changes: > v3: > * reworked all return codes (in a separate patch) >=20 > v2: > * addressed comments from Alex Graf > --- > hw/ppc/spapr_rtas.c | 47 = +++++++++++++++++++++++++++++++++++++++++++++++ > include/hw/ppc/spapr.h | 2 ++ > 2 files changed, 49 insertions(+) >=20 > diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c > index f9897a5..d7b1f1d 100644 > --- a/hw/ppc/spapr_rtas.c > +++ b/hw/ppc/spapr_rtas.c > @@ -224,6 +224,49 @@ static void rtas_stop_self(PowerPCCPU *cpu, = sPAPREnvironment *spapr, > env->msr =3D 0; > } >=20 > +#define DIAGNOSTICS_RUN_MODE 42 > + > +static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu, > + sPAPREnvironment *spapr, > + uint32_t token, uint32_t = nargs, > + target_ulong args, > + uint32_t nret, target_ulong = rets) > +{ > + target_ulong papameter =3D rtas_ld(args, 0); Sorry, saw that one too late. What is a papameter? Is it related to the = pope? :) > + target_ulong buffer =3D rtas_ld(args, 1); > + target_ulong length =3D rtas_ld(args, 2); > + target_ulong ret =3D RTAS_OUT_NOT_SUPPORTED; > + > + switch (papameter) { > + case DIAGNOSTICS_RUN_MODE: > + if (length =3D=3D 1) { > + rtas_st(buffer, 0, 0); > + ret =3D RTAS_OUT_SUCCESS; > + } > + break; > + } > + > + rtas_st(rets, 0, ret); > +} > + > +static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu, > + sPAPREnvironment *spapr, > + uint32_t token, uint32_t = nargs, > + target_ulong args, > + uint32_t nret, target_ulong = rets) > +{ > + target_ulong papameter =3D rtas_ld(args, 0); Here too Alex > + target_ulong ret =3D RTAS_OUT_NOT_SUPPORTED; > + > + switch (papameter) { > + case DIAGNOSTICS_RUN_MODE: > + ret =3D RTAS_OUT_NOT_AUTHORIZED; > + break; > + } > + > + rtas_st(rets, 0, ret); > +} > + > static struct rtas_call { > const char *name; > spapr_rtas_fn fn; > @@ -345,6 +388,10 @@ static void core_rtas_register_types(void) > rtas_query_cpu_stopped_state); > spapr_rtas_register("start-cpu", rtas_start_cpu); > spapr_rtas_register("stop-self", rtas_stop_self); > + spapr_rtas_register("ibm,get-system-parameter", > + rtas_ibm_get_system_parameter); > + spapr_rtas_register("ibm,set-system-parameter", > + rtas_ibm_set_system_parameter); > } >=20 > type_init(core_rtas_register_types) > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index 085cfa7..b2f11e9 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -338,6 +338,8 @@ static inline int spapr_allocate_lsi(int hint) > #define RTAS_OUT_HW_ERROR -1 > #define RTAS_OUT_BUSY -2 > #define RTAS_OUT_PARAM_ERROR -3 > +#define RTAS_OUT_NOT_SUPPORTED -3 > +#define RTAS_OUT_NOT_AUTHORIZED -9002 >=20 > static inline uint64_t ppc64_phys_to_real(uint64_t addr) > { > --=20 > 1.8.4.rc4 >=20