From patchwork Tue Jan 14 17:32:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 23201 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D15520555 for ; Tue, 14 Jan 2014 17:35:09 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id le5sf1556512vcb.11 for ; Tue, 14 Jan 2014 09:35:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=m7WgRrsl0k4GmF5Pa2+0wLpB4oJ6Iunwzh036WhI3A4=; b=Q58x88zFlnQquT6Kt/kEHPLnrOQz9QEE9CQdsrsCTSF/TDJCRr+t6YUbvEqvCxRqjO CHaUksMe6qN5FE6beABApooAUoC4qBTrT4ToxB7V6CCF+Zs28wh4YzgedSVcxfLM36ns GAnz0ABEGEn3aMWk/Nq/+C4lkUdd+8pEW7zwpqG1JnRTsp3SGPdyypg+BCmWXjYVnHAw eAvn3iLL/DFGWbdONl4EGs5NclABwjJddNYrSpxEVodtvmxOUo4Oenwm46VzILnX309J d/DX4b5fqNwMNP5RH8hH3OqtwJK8RSg87Xf91tXleitUHU2re24qwhmHljKRCtWbp8xv k4rg== X-Gm-Message-State: ALoCoQmBUBXqF1sKDdm7xifqXdGpuSku3uxf7U85ONUxFshg976x0ynb0a1NcMom2pyhEvfoiS8N X-Received: by 10.58.242.70 with SMTP id wo6mr12415378vec.16.1389720908632; Tue, 14 Jan 2014 09:35:08 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.106.132 with SMTP id gu4ls226403qeb.8.gmail; Tue, 14 Jan 2014 09:35:08 -0800 (PST) X-Received: by 10.220.1.131 with SMTP id 3mr1386571vcf.4.1389720908501; Tue, 14 Jan 2014 09:35:08 -0800 (PST) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id x3si503768vcn.9.2014.01.14.09.35.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 09:35:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id la4so395433vcb.35 for ; Tue, 14 Jan 2014 09:35:08 -0800 (PST) X-Received: by 10.220.159.4 with SMTP id h4mr1343302vcx.1.1389720908427; Tue, 14 Jan 2014 09:35:08 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp218112ved; Tue, 14 Jan 2014 09:35:08 -0800 (PST) X-Received: by 10.52.157.38 with SMTP id wj6mr589099vdb.63.1389720908007; Tue, 14 Jan 2014 09:35:08 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id si2si480365vdc.142.2014.01.14.09.35.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 14 Jan 2014 09:35:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1W37rL-0007Qp-Kc; Tue, 14 Jan 2014 17:33:03 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1W37rH-0007Qi-GD for xen-devel@lists.xen.org; Tue, 14 Jan 2014 17:32:59 +0000 Received: from [193.109.254.147:58241] by server-13.bemta-14.messagelabs.com id 21/DE-19374-AC475D25; Tue, 14 Jan 2014 17:32:58 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1389720776!9354898!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.9.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14051 invoked from network); 14 Jan 2014 17:32:58 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-16.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 14 Jan 2014 17:32:58 -0000 X-IronPort-AV: E=Sophos;i="4.95,658,1384300800"; d="scan'208";a="90656417" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 14 Jan 2014 17:32:56 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.2.342.4; Tue, 14 Jan 2014 12:32:55 -0500 Received: from drall.uk.xensource.com ([10.80.16.71] helo=drall.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1W37rC-0008Op-Np; Tue, 14 Jan 2014 17:32:54 +0000 From: Ian Campbell To: Date: Tue, 14 Jan 2014 17:32:54 +0000 Message-ID: <1389720774-27931-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-DLP: MIA2 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH] xen: arm: correct guest PSCI handling on 64-bit hypervisor. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Using ->rN truncates the 64-bit registers to 32-bits, which on X-gene chops off the top bit of the entry address for PSCI_UP. Follow the pattern established in do_trap_hypercall. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- Release argument: Only supporting single vcpu guests on arm64 would be unfortunate. There is no risk to arm32 since the ifdef ensures the code remains the same. --- xen/arch/arm/traps.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index fdf9440..62c9df2 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1065,23 +1065,34 @@ static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code) } #endif +#ifdef CONFIG_ARM_64 +#define PSCI_OP_REG(r) (r)->x0 +#define PSCI_RESULT_REG(r) (r)->x0 +#define PSCI_ARGS(r) (r)->x1, (r)->x2 +#else +#define PSCI_OP_REG(r) (r)->r0 +#define PSCI_RESULT_REG(r) (r)->r0 +#define PSCI_ARGS(r) (r)->r1, (r)->r2 +#endif + static void do_trap_psci(struct cpu_user_regs *regs) { arm_psci_fn_t psci_call = NULL; - if ( regs->r0 >= ARRAY_SIZE(arm_psci_table) ) + if ( PSCI_OP_REG(regs) >= ARRAY_SIZE(arm_psci_table) ) { domain_crash_synchronous(); return; } - psci_call = arm_psci_table[regs->r0].fn; + psci_call = arm_psci_table[PSCI_OP_REG(regs)].fn; if ( psci_call == NULL ) { domain_crash_synchronous(); return; } - regs->r0 = psci_call(regs->r1, regs->r2); + + PSCI_RESULT_REG(regs) = psci_call(PSCI_ARGS(regs)); } #ifdef CONFIG_ARM_64