From: Ian Campbell Subject: Re: [PATCH v2] xen/arm : emulation of arm's PSCI v0.2 standard Date: Wed, 2 Jul 2014 10:19:34 +0100 Message-ID: <1404292774.17692.5.camel@kazak.uk.xensource.com> References: <1403760382-1863-1-git-send-email-parth.dixit@linaro.org> <1403887420.3169.122.camel@kazak.uk.xensource.com> <1404123330.5000.44.camel@kazak.uk.xensource.com> <1404126692.14488.11.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Parth Dixit Cc: xen-devel , Julien Grall , tim@xen.org, Christoffer Dall , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Tue, 2014-07-01 at 14:11 +0530, Parth Dixit wrote: > Hi, > > On 30 June 2014 16:41, Ian Campbell wrote: > > On Mon, 2014-06-30 at 16:36 +0530, Parth Dixit wrote: > >> >> TBH given the relatively small number of PSCI calls maybe just > >> >> switching > >> >> to a C switch() statement would be best. > >> >> patchset v1 was based on switch case it was moved to if/else after > >> >> review comments, should i change it back to switch case? > >> > > >> > Sorry for not getting to this for v1. > >> > > >> > v1 had a switch statement to lookup fn_index, which it then looked up > >> > again in the op table. I think that approach was the worst of both > >> > worlds. > >> > > >> > What I was suggesting was a switch statement which actually dispatched > >> > the call to the appropriate handler directly, rather than having a > >> > second indirection via a table. > >> > > >> > The main thing I don't like is macro hoops you are jumping through in > >> > order to turn the spec mandated sparse function space into a compact one > >> > suitable for placing in an array. > >> > > >> > Another viable alternative would be to have separate tables for PSCI 0.1 > >> > and PSCSI 0.2 32- and 64-bit and look through each in turn. > >> > >> Sure, let me try the two table approach. > > > > NB: Three tables (0.1, 0.2-32bit, 0.2-64bit), unless you are planning > > something clever with multiple fn ids per table entry. > As i am using common functions for 32bit as well as 64 bit two tables > are sufficient 0.2, 64 bit table for 0.2 would be redundant. Oh, because the per-funciton offsets from the 32- vs. 64-bit base are all consistent. Yes I think that could work. > On second thought's i can also use the current table with single mask > something like > psci_call = arm_psci_table[PSCI_OP_REG(regs) & VERSION_MASK].fn; > what do you think? i'll wait for ur opinion Are the 0.1 and 0.2 fn numbers not overlapping? I suppose you control the 0.1 numbers so you could make it so if it isn't already. You would also need to validate that PSCI_OP_REG(regs) & ~VERSION_MASK was one of the acceptable base addresses. Ian