From: Ian Campbell Subject: Re: [PATCH v6] xen/arm : emulation of arm's PSCI v0.2 standard Date: Wed, 30 Jul 2014 12:14:04 +0100 Message-ID: <1406718844.31718.0.camel@kazak.uk.xensource.com> References: <1406317971-8479-1-git-send-email-parth.dixit@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1406317971-8479-1-git-send-email-parth.dixit@linaro.org> 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: stefano.stabellini@eu.citrix.com, tim@xen.org, christoffer.dall@linaro.org, julien.grall@linaro.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Sat, 2014-07-26 at 01:22 +0530, Parth Dixit wrote: > + case PSCI_cpu_off: > + { > + uint32_t pstate = PSCI_ARG32(regs,1); > + PSCI_RESULT_REG(regs) = (int32_t) do_psci_cpu_off(pstate); do_psci_cpu_off returns int32_t, so no need for this cast. The same is true of all of the helpers, I think. Except perhaps MIGRATE_INFO_UP_CPU which differs between 32- and 64-bit. IOW I think this... > + case PSCI_0_2_FN_MIGRATE_INFO_UP_CPU: > + if ( psci_mode_check(current->domain, fid) ) > + PSCI_RESULT_REG(regs) = > + (uint32_t) do_psci_0_2_migrate_info_up_cpu(); ... is the only cast which might need to remain, and even there I'm not sure. do_psci_0_2_migrate_info_up_cpu() returns a register_t, which given the currently trivial implementation I think is likely to be sufficient without the cast. > +register_t do_psci_0_2_cpu_suspend(uint32_t power_state, register_t entry_point, > + register_t context_id) > +{ > + struct vcpu *v = current; > + > + /* affinity values are ignored in this implementation as > + * at present xen does not supports affinity level greater > + * than 0, for all affinity values passed we power down/ standby > + * the current core */ > + > + vcpu_block_unless_event_pending(v); > + > + /* if power down is requested context_id must be returned in x0/r0 > + * as the function return will be written in x0/r0 we return context_id > + * instead os success value */ The spec isn't clear on this, but I don't think this can be correct. I expect the requirement is that you either return PSCI_SUCCESS to the instruction after the smc or you return to entry_point with x0==context_id. I don't think it makes sense to return after the smc with the x0==context_id. This is implied by section 5.4.2 bullet #4 which talks about handling PSCI return codes. I'm going to ask ARM for clarification, please stand by. Ian.