linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] arm: KVM: Add VFP lazy switch hooks in Host KVM
Date: Sun, 5 Jul 2015 21:37:45 +0200	[thread overview]
Message-ID: <20150705193745.GC3869@cbox> (raw)
In-Reply-To: <1435203028-23142-4-git-send-email-m.smarduch@samsung.com>

On Wed, Jun 24, 2015 at 08:30:28PM -0700, Mario Smarduch wrote:
> This patch implements host KVM interface to Hyp mode VFP function to 
> switch out guest and switch in host.
> 
> Signed-off-by: Mario Smarduch <m.smarduch@samsung.com>
> ---
>  arch/arm/kvm/arm.c |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
> index d9631ec..77b41f5 100644
> --- a/arch/arm/kvm/arm.c
> +++ b/arch/arm/kvm/arm.c
> @@ -105,6 +105,17 @@ void kvm_arch_check_processor_compat(void *rtn)
>  	*(int *)rtn = 0;
>  }
>  
> +/**
> + * kvm_switch_vp_regs() - switch guest/host VFP registers
> + * @vcpu:	pointer to vcpu structure.
> + *
> + * HYP interface functions to save guest and restore host VFP registers

Not sure I understand what you mean to say with this line, how about:

Calls an assembly routine in HYP mode to actually perform the state
save/restore.

However, why do we actually need to do this in hyp mode?  Can't we just
as well do this in SVC mode or are we changing some trap settings here?

> + */
> +static void kvm_switch_fp_regs(struct kvm_vcpu *vcpu)

should probalby be called kvm_vcpu_put_fp_regs

> +{
> +	if (vcpu->arch.vfp_guest_saved == 1)
> +		kvm_call_hyp(__kvm_restore_host_vfp_state, vcpu);
> +}
>  
>  /**
>   * kvm_arch_init_vm - initializes a VM data structure
> @@ -292,6 +303,10 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
>  
>  void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
>  {
> +
> +	/* Check if Guest accessed VFP registers */
> +	kvm_switch_fp_regs(vcpu);
> +
>  	/*
>  	 * The arch-generic KVM code expects the cpu field of a vcpu to be -1
>  	 * if the vcpu is no longer assigned to a cpu.  This is used for the
> -- 
> 1.7.9.5

How are we sure that the kernel never touches VFP registers between VCPU
exit and kvm_arch_vcpu_put?  Can a kernel-side memcpy implementation use
the FP regs or something like that?

Thanks,
-Christoffer

  reply	other threads:[~2015-07-05 19:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25  3:30 [PATCH 0/3] arm: KVM: VFP lazy switch in KVM Host Mode may save upto 98% Mario Smarduch
2015-06-25  3:30 ` [PATCH 1/3] arm: KVM: define headers and offsets to mange VFP state Mario Smarduch
2015-07-05 19:27   ` Christoffer Dall
2015-07-06 17:50     ` Mario Smarduch
2015-06-25  3:30 ` [PATCH 2/3] arm: KVM: Implement lazy VFP switching outside of Hyp Mode Mario Smarduch
2015-07-05 19:34   ` Christoffer Dall
2015-07-06 17:54     ` Mario Smarduch
2015-07-07 15:27       ` Christoffer Dall
2015-06-25  3:30 ` [PATCH 3/3] arm: KVM: Add VFP lazy switch hooks in Host KVM Mario Smarduch
2015-07-05 19:37   ` Christoffer Dall [this message]
2015-07-06 18:35     ` Mario Smarduch
2015-06-28 17:57 ` [PATCH 0/3] arm: KVM: VFP lazy switch in KVM Host Mode may save upto 98% Mario Smarduch
2015-07-05 19:37 ` Christoffer Dall
2015-07-06 18:43   ` Mario Smarduch

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=20150705193745.GC3869@cbox \
    --to=christoffer.dall@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).