From patchwork Fri Feb 7 12:57:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 24297 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 185CB202B2 for ; Fri, 7 Feb 2014 12:57:36 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id le5sf7483383vcb.3 for ; Fri, 07 Feb 2014 04:57:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=9vr6EIPBmVL6/vnzKingBCBUTOnuiw+359Q62O9mhyw=; b=NRC2vV/i4i/wk/5dVndq4EK1XxtPf24h2C19UgkI14cuzgojcTikCWGVhn/Dn6jsUH GDDA4FHe61j24VeTf2eul1h3ClJfLLnSj5CB4f4oHqvWdWWnmK4Vhil9sFRWdGcaf7IA r1kfn2p9C5dRu5fngDLISxNoK8pkVJ3S+h6E9pTWkrczeDXP4SeRAx/6lO4adfDdwoqt DaiwPtpaLkOxm5hPwPG1fBsi2u+M158+spWMYh1xX+ro8gNf0eqiBJ26fBHJ4aRLOoHE NCRVWwcF9XXR5bm2g0r2/Xuo8Rmw2oI1m0BhpPen7x6hu7n9oXp4HEduSPgT/dAK7Amz x8jQ== X-Gm-Message-State: ALoCoQkZpCl+0TS7dUHQtb/nArqSFF2lm1/esZvdbLzFlVM0ystuz9h00djlQVzhNFzV3jBR4JqO X-Received: by 10.58.238.199 with SMTP id vm7mr3825660vec.17.1391777856202; Fri, 07 Feb 2014 04:57:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.17.75 with SMTP id 69ls997553qgc.34.gmail; Fri, 07 Feb 2014 04:57:36 -0800 (PST) X-Received: by 10.53.13.44 with SMTP id ev12mr8627294vdd.17.1391777856142; Fri, 07 Feb 2014 04:57:36 -0800 (PST) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id qw5si1289290vcb.123.2014.02.07.04.57.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 04:57:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.169 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.169; Received: by mail-vc0-f169.google.com with SMTP id hq11so2638751vcb.0 for ; Fri, 07 Feb 2014 04:57:36 -0800 (PST) X-Received: by 10.58.66.137 with SMTP id f9mr10217481vet.11.1391777856053; Fri, 07 Feb 2014 04:57:36 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp101629vcz; Fri, 7 Feb 2014 04:57:35 -0800 (PST) X-Received: by 10.67.3.40 with SMTP id bt8mr7514001pad.78.1391777849098; Fri, 07 Feb 2014 04:57:29 -0800 (PST) Received: from mail-pb0-f51.google.com (mail-pb0-f51.google.com [209.85.160.51]) by mx.google.com with ESMTPS id va10si4968857pbc.248.2014.02.07.04.57.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 04:57:29 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.51 is neither permitted nor denied by best guess record for domain of pranavkumar@linaro.org) client-ip=209.85.160.51; Received: by mail-pb0-f51.google.com with SMTP id un15so3211639pbc.24 for ; Fri, 07 Feb 2014 04:57:28 -0800 (PST) X-Received: by 10.66.144.227 with SMTP id sp3mr7705682pab.100.1391777848643; Fri, 07 Feb 2014 04:57:28 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id eo11sm33034333pac.0.2014.02.07.04.57.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 04:57:28 -0800 (PST) From: Pranavkumar Sawargaonkar To: xen-devel@lists.xen.org Cc: ian.campbell@citrix.com, stefano.stabellini@citrix.com, julien.grall@linaro.org, patches@apm.com, patches@linaro.org, Pranavkumar Sawargaonkar , Anup Patel Subject: [PATCH V2] xen: arm: arm64: Fix memory cloberring issues during VFP save restore. Date: Fri, 7 Feb 2014 18:27:16 +0530 Message-Id: <1391777836-12260-1-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pranavkumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch addresses memory cloberring issue mentioed by Julien Grall with my earlier patch - Commit Id: 712eb2e04da2cbcd9908f74ebd47c6df60d6d12f Discussion related to this fix - http://www.gossamer-threads.com/lists/xen/devel/316247 V2: Incorporating comments received on V1. V1: Initial Patch Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Anup Patel Acked-by: Julien Grall --- xen/arch/arm/arm64/vfp.c | 68 +++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/xen/arch/arm/arm64/vfp.c b/xen/arch/arm/arm64/vfp.c index c09cf0c..3cd2b1b 100644 --- a/xen/arch/arm/arm64/vfp.c +++ b/xen/arch/arm/arm64/vfp.c @@ -8,23 +8,23 @@ void vfp_save_state(struct vcpu *v) if ( !cpu_has_fp ) return; - asm volatile("stp q0, q1, [%0, #16 * 0]\n\t" - "stp q2, q3, [%0, #16 * 2]\n\t" - "stp q4, q5, [%0, #16 * 4]\n\t" - "stp q6, q7, [%0, #16 * 6]\n\t" - "stp q8, q9, [%0, #16 * 8]\n\t" - "stp q10, q11, [%0, #16 * 10]\n\t" - "stp q12, q13, [%0, #16 * 12]\n\t" - "stp q14, q15, [%0, #16 * 14]\n\t" - "stp q16, q17, [%0, #16 * 16]\n\t" - "stp q18, q19, [%0, #16 * 18]\n\t" - "stp q20, q21, [%0, #16 * 20]\n\t" - "stp q22, q23, [%0, #16 * 22]\n\t" - "stp q24, q25, [%0, #16 * 24]\n\t" - "stp q26, q27, [%0, #16 * 26]\n\t" - "stp q28, q29, [%0, #16 * 28]\n\t" - "stp q30, q31, [%0, #16 * 30]\n\t" - :: "r" ((char *)(&v->arch.vfp.fpregs)): "memory"); + asm volatile("stp q0, q1, [%1, #16 * 0]\n\t" + "stp q2, q3, [%1, #16 * 2]\n\t" + "stp q4, q5, [%1, #16 * 4]\n\t" + "stp q6, q7, [%1, #16 * 6]\n\t" + "stp q8, q9, [%1, #16 * 8]\n\t" + "stp q10, q11, [%1, #16 * 10]\n\t" + "stp q12, q13, [%1, #16 * 12]\n\t" + "stp q14, q15, [%1, #16 * 14]\n\t" + "stp q16, q17, [%1, #16 * 16]\n\t" + "stp q18, q19, [%1, #16 * 18]\n\t" + "stp q20, q21, [%1, #16 * 20]\n\t" + "stp q22, q23, [%1, #16 * 22]\n\t" + "stp q24, q25, [%1, #16 * 24]\n\t" + "stp q26, q27, [%1, #16 * 26]\n\t" + "stp q28, q29, [%1, #16 * 28]\n\t" + "stp q30, q31, [%1, #16 * 30]\n\t" + : "=Q" (*v->arch.vfp.fpregs) : "r" (v->arch.vfp.fpregs)); v->arch.vfp.fpsr = READ_SYSREG32(FPSR); v->arch.vfp.fpcr = READ_SYSREG32(FPCR); @@ -36,23 +36,23 @@ void vfp_restore_state(struct vcpu *v) if ( !cpu_has_fp ) return; - asm volatile("ldp q0, q1, [%0, #16 * 0]\n\t" - "ldp q2, q3, [%0, #16 * 2]\n\t" - "ldp q4, q5, [%0, #16 * 4]\n\t" - "ldp q6, q7, [%0, #16 * 6]\n\t" - "ldp q8, q9, [%0, #16 * 8]\n\t" - "ldp q10, q11, [%0, #16 * 10]\n\t" - "ldp q12, q13, [%0, #16 * 12]\n\t" - "ldp q14, q15, [%0, #16 * 14]\n\t" - "ldp q16, q17, [%0, #16 * 16]\n\t" - "ldp q18, q19, [%0, #16 * 18]\n\t" - "ldp q20, q21, [%0, #16 * 20]\n\t" - "ldp q22, q23, [%0, #16 * 22]\n\t" - "ldp q24, q25, [%0, #16 * 24]\n\t" - "ldp q26, q27, [%0, #16 * 26]\n\t" - "ldp q28, q29, [%0, #16 * 28]\n\t" - "ldp q30, q31, [%0, #16 * 30]\n\t" - :: "r" ((char *)(&v->arch.vfp.fpregs)): "memory"); + asm volatile("ldp q0, q1, [%1, #16 * 0]\n\t" + "ldp q2, q3, [%1, #16 * 2]\n\t" + "ldp q4, q5, [%1, #16 * 4]\n\t" + "ldp q6, q7, [%1, #16 * 6]\n\t" + "ldp q8, q9, [%1, #16 * 8]\n\t" + "ldp q10, q11, [%1, #16 * 10]\n\t" + "ldp q12, q13, [%1, #16 * 12]\n\t" + "ldp q14, q15, [%1, #16 * 14]\n\t" + "ldp q16, q17, [%1, #16 * 16]\n\t" + "ldp q18, q19, [%1, #16 * 18]\n\t" + "ldp q20, q21, [%1, #16 * 20]\n\t" + "ldp q22, q23, [%1, #16 * 22]\n\t" + "ldp q24, q25, [%1, #16 * 24]\n\t" + "ldp q26, q27, [%1, #16 * 26]\n\t" + "ldp q28, q29, [%1, #16 * 28]\n\t" + "ldp q30, q31, [%1, #16 * 30]\n\t" + : : "Q" (*v->arch.vfp.fpregs), "r" (v->arch.vfp.fpregs)); WRITE_SYSREG32(v->arch.vfp.fpsr, FPSR); WRITE_SYSREG32(v->arch.vfp.fpcr, FPCR);