From patchwork Fri Feb 7 10:38:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 24291 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CCDBE213BF for ; Fri, 7 Feb 2014 10:39:13 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id c41sf7911218yho.5 for ; Fri, 07 Feb 2014 02:39:12 -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=Rovd9zq7GVlrERq5T+KaxTCrllmoJBMXCBsBzq/6poM=; b=Aj07AaTpidRSVP7SoUpCo743ld4FGUJNgTJfLmgEjTD6Eo4M2ANUTHmnuvfNhbTppa /5qUgUMycQ/WEiKRqLW6jBd2zJgBC4XFe15iGhjLHipG5mKdEAi+kCqcSPa1XJ9WgP7Z 7zv0AeUPrE0mTfb9DdtgEqIwf9MHl6RPuNY5Q9u6MKlBy0xUfB/dWyxKtBdQcydYCvRR XDWkglDjnKLQymcJiQZJo9ioyt/G7ItP64/rlwFawS8rPi3kP5hitq21Gumbtf/XYF7w aHz1H18Fc8L9Hj4FeAsgbhgvheplhMmRE+9wW61w4gL2/Pj543+CETiq5XBR5xvx75H9 m4eQ== X-Gm-Message-State: ALoCoQkwEjQs4Wh/PFiPh17jdkqaxIp5J4RRLemDB2MbEtAv3NNUG/beSJn9yFlAAs0Qv0op2OL8 X-Received: by 10.58.189.73 with SMTP id gg9mr6029706vec.34.1391769552727; Fri, 07 Feb 2014 02:39:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.91.110 with SMTP id y101ls1035412qgd.0.gmail; Fri, 07 Feb 2014 02:39:12 -0800 (PST) X-Received: by 10.58.255.233 with SMTP id at9mr10044508ved.20.1391769552634; Fri, 07 Feb 2014 02:39:12 -0800 (PST) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id si3si1181344vcb.103.2014.02.07.02.39.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 02:39:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.174 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.174; Received: by mail-vc0-f174.google.com with SMTP id im17so2457378vcb.19 for ; Fri, 07 Feb 2014 02:39:12 -0800 (PST) X-Received: by 10.52.247.231 with SMTP id yh7mr4417793vdc.34.1391769552520; Fri, 07 Feb 2014 02:39:12 -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 u4csp92814vcz; Fri, 7 Feb 2014 02:39:11 -0800 (PST) X-Received: by 10.67.15.70 with SMTP id fm6mr7020511pad.32.1391769551111; Fri, 07 Feb 2014 02:39:11 -0800 (PST) Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) by mx.google.com with ESMTPS id ui8si4589436pac.3.2014.02.07.02.39.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 02:39:11 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.42 is neither permitted nor denied by best guess record for domain of pranavkumar@linaro.org) client-ip=209.85.160.42; Received: by mail-pb0-f42.google.com with SMTP id jt11so3090624pbb.29 for ; Fri, 07 Feb 2014 02:39:10 -0800 (PST) X-Received: by 10.66.163.164 with SMTP id yj4mr6882350pab.91.1391769550688; Fri, 07 Feb 2014 02:39:10 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id ja8sm12321206pbd.3.2014.02.07.02.39.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 02:39:10 -0800 (PST) From: Pranavkumar Sawargaonkar To: xen-devel@lists.xen.org Cc: ian.campbell@citrix.com, stefano.stabellini@citrix.com, patches@apm.com, patches@linaro.org, Pranavkumar Sawargaonkar , Anup Patel Subject: [PATCH] xen: arm: arm64: Fix memory cloberring issues during VFP save restore. Date: Fri, 7 Feb 2014 16:08:58 +0530 Message-Id: <1391769538-9091-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.174 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 - Ref: http://www.gossamer-threads.com/lists/xen/devel/316247 Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Anup Patel --- xen/arch/arm/arm64/vfp.c | 70 ++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/xen/arch/arm/arm64/vfp.c b/xen/arch/arm/arm64/vfp.c index c09cf0c..62f56a3 100644 --- a/xen/arch/arm/arm64/vfp.c +++ b/xen/arch/arm/arm64/vfp.c @@ -8,23 +8,24 @@ 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) + : "memory"); v->arch.vfp.fpsr = READ_SYSREG32(FPSR); v->arch.vfp.fpcr = READ_SYSREG32(FPCR); @@ -36,23 +37,24 @@ 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) + : "memory"); WRITE_SYSREG32(v->arch.vfp.fpsr, FPSR); WRITE_SYSREG32(v->arch.vfp.fpcr, FPCR);