From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhAoU-00043W-ML for qemu-devel@nongnu.org; Wed, 30 Sep 2015 02:24:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhAoT-0000pA-Sx for qemu-devel@nongnu.org; Wed, 30 Sep 2015 02:24:26 -0400 Message-ID: <1443594247.2828.3.camel@kernel.crashing.org> From: Benjamin Herrenschmidt Date: Wed, 30 Sep 2015 16:24:07 +1000 In-Reply-To: <20150930060355.GE23574@voom> References: <1443335476.4610.2.camel@kernel.crashing.org> <20150930060355.GE23574@voom> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-ppc] [RFC/PATCH] monitor/ppc: Access all SPRs from the monitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: peter.maydell@linaro.org, qemu-ppc@nongnu.org, qemu-devel@nongnu.org On Wed, 2015-09-30 at 16:03 +1000, David Gibson wrote: > On Sun, Sep 27, 2015 at 04:31:16PM +1000, Benjamin Herrenschmidt wrote: > > We already have a table with all supported SPRs along with their names, > > so let's use that rather than a duplicate table that is perpetually > > out of sync in the monitor code. > > > > This adds a new monitor hook target_extra_monitor_def() which is called > > if nothing is found is the normal table. We still use the old mechanism > > for anything that isn't an SPR. > > > > Signed-off-by: Benjamin Herrenschmidt > > This looks like a good idea, but it seems to be a slightly different > approach from the one taken by some rather similar patches Alexey > posted recently. > > Would you care to co-ordinate on which of those approaches to go ahead > with? The code upstream has changed quite a bit... > [snip] > > @@ -253,3 +180,23 @@ const MonitorDef *target_monitor_defs(void) > > { > > return monitor_defs; > > } > > + > > +int target_extra_monitor_def(uint64_t *pval, const char *name) > > +{ > > + /* On ppc, search through the SPRs so we can print any of them */ > > + { > ^ > Also, this appears to be a redundant set of braces. Ah right, that used to be inside the caller (monitor_defs()) and I moved it to a hook and forgot to take out the extra braces. I'll respin. > + CPUArchState *env = mon_get_cpu_env(); > > + ppc_spr_t *spr_cb = env->spr_cb; > > + int i; > > + > > + for (i = 0; i < 1024; i++) { > > + if (!spr_cb[i].name || strcasecmp(name, spr_cb[i].name)) { > > + continue; > > + } > > + *pval = env->spr[i]; > > + return 0; > > + } > > + } > > + return -1; > > +} > > + > > > > > > >