From: George Dunlap <george.dunlap@eu.citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>,
Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Cc: patches@apm.com, patches@linaro.org,
stefano.stabellini@citrix.com, Anup Patel <anup.patel@linaro.org>,
xen-devel@lists.xen.org
Subject: Re: [PATCH] xen: arm: arm64: Adding VFP save/restore support.
Date: Thu, 6 Feb 2014 10:53:58 +0000 [thread overview]
Message-ID: <52F369C6.5020108@eu.citrix.com> (raw)
In-Reply-To: <1391681714.23098.35.camel@kazak.uk.xensource.com>
On 02/06/2014 10:15 AM, Ian Campbell wrote:
> On Thu, 2014-02-06 at 12:58 +0530, Pranavkumar Sawargaonkar wrote:
>> This patch adds VFP save/restore support form arm64 across context switch.
>>
>> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
>> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> This should go in for 4.4 -- not context switching floating point
> registers is obviously a big problem. (bit embarrassed that I forgot
> about this...)
Yes, absolutely.
Release-acked-by: George Dunlap <george.dunlap@eu.citrix.com>
>
>> ---
>> xen/arch/arm/arm64/vfp.c | 49 +++++++++++++++++++++++++++++++++++++++
>> xen/include/asm-arm/arm64/vfp.h | 4 ++++
>> 2 files changed, 53 insertions(+)
>>
>> diff --git a/xen/arch/arm/arm64/vfp.c b/xen/arch/arm/arm64/vfp.c
>> index 74e6a50..8c1479a 100644
>> --- a/xen/arch/arm/arm64/vfp.c
>> +++ b/xen/arch/arm/arm64/vfp.c
>> @@ -1,13 +1,62 @@
>> #include <xen/sched.h>
>> #include <asm/processor.h>
>> +#include <asm/cpufeature.h>
>> #include <asm/vfp.h>
>>
>> void vfp_save_state(struct vcpu *v)
>> {
>> /* TODO: implement it */
> You can probably remove this comment, and the one in restore, unless
> there is something still left to do?
>
> Actually, I'll do it on commit, so:
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
>
>> + 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");
>> +
>> + v->arch.vfp.fpsr = READ_SYSREG32(FPSR);
>> + v->arch.vfp.fpcr = READ_SYSREG32(FPCR);
>> + v->arch.vfp.fpexc32_el2 = READ_SYSREG32(FPEXC32_EL2);
>> }
>>
>> void vfp_restore_state(struct vcpu *v)
>> {
>> /* TODO: implement it */
>> + 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");
>> +
>> + WRITE_SYSREG32(v->arch.vfp.fpsr, FPSR);
>> + WRITE_SYSREG32(v->arch.vfp.fpcr, FPCR);
>> + WRITE_SYSREG32(v->arch.vfp.fpexc32_el2, FPEXC32_EL2);
>> }
>> diff --git a/xen/include/asm-arm/arm64/vfp.h b/xen/include/asm-arm/arm64/vfp.h
>> index 3733d2c..373f156 100644
>> --- a/xen/include/asm-arm/arm64/vfp.h
>> +++ b/xen/include/asm-arm/arm64/vfp.h
>> @@ -3,6 +3,10 @@
>>
>> struct vfp_state
>> {
>> + uint64_t fpregs[64];
>> + uint32_t fpcr;
>> + uint32_t fpexc32_el2;
>> + uint32_t fpsr;
>> };
>>
>> #endif /* _ARM_ARM64_VFP_H */
>
next prev parent reply other threads:[~2014-02-06 10:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-06 7:28 [PATCH] xen: arm: arm64: Adding VFP save/restore support Pranavkumar Sawargaonkar
2014-02-06 10:15 ` Ian Campbell
2014-02-06 10:41 ` Pranavkumar Sawargaonkar
2014-02-06 10:50 ` Pranavkumar Sawargaonkar
2014-02-06 10:53 ` George Dunlap [this message]
2014-02-06 12:40 ` Ian Campbell
2014-02-06 12:44 ` Julien Grall
2014-02-06 12:57 ` Ian Campbell
2014-02-06 13:08 ` Julien Grall
2014-02-06 13:11 ` Ian Campbell
2014-02-07 5:31 ` Pranavkumar Sawargaonkar
2014-02-07 10:43 ` Pranavkumar Sawargaonkar
2014-02-07 15:28 ` George Dunlap
2014-02-07 15:33 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52F369C6.5020108@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=anup.patel@linaro.org \
--cc=patches@apm.com \
--cc=patches@linaro.org \
--cc=pranavkumar@linaro.org \
--cc=stefano.stabellini@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.