From patchwork Thu Jun 25 03:30:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Smarduch X-Patchwork-Id: 6672031 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 25B419F399 for ; Thu, 25 Jun 2015 03:34:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 560D9205E7 for ; Thu, 25 Jun 2015 03:34:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 716C2205DF for ; Thu, 25 Jun 2015 03:34:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z7xsz-0004sW-HP; Thu, 25 Jun 2015 03:31:33 +0000 Received: from mailout4.w2.samsung.com ([211.189.100.14] helo=usmailout4.samsung.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z7xsX-0004km-Ne for linux-arm-kernel@lists.infradead.org; Thu, 25 Jun 2015 03:31:06 +0000 Received: from uscpsbgex1.samsung.com (u122.gpu85.samsung.co.kr [203.254.195.122]) by usmailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NQH00HXJDRTDW40@usmailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2015 23:31:05 -0400 (EDT) X-AuditID: cbfec37a-f79c96d000005f02-91-558b75f9d6af Received: from usmmp1.samsung.com ( [203.254.195.77]) by uscpsbgex1.samsung.com (USCPEXMTA) with SMTP id C4.32.24322.9F57B855; Wed, 24 Jun 2015 23:31:05 -0400 (EDT) Received: from sisasmtp.sisa.samsung.com ([105.144.21.116]) by usmmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NQH00IJKDRTOTA0@usmmp1.samsung.com>; Wed, 24 Jun 2015 23:31:05 -0400 (EDT) Received: from mjsmard-530U3C-530U4C-532U3C.sisa.samsung.com (105.160.11.3) by SISAEX02SJ.sisa.samsung.com (105.144.21.116) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 24 Jun 2015 20:31:04 -0700 From: Mario Smarduch To: kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, christoffer.dall@linaro.org Subject: [PATCH 3/3] arm: KVM: Add VFP lazy switch hooks in Host KVM Date: Wed, 24 Jun 2015 20:30:28 -0700 Message-id: <1435203028-23142-4-git-send-email-m.smarduch@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1435203028-23142-1-git-send-email-m.smarduch@samsung.com> References: <1435203028-23142-1-git-send-email-m.smarduch@samsung.com> MIME-version: 1.0 X-Originating-IP: [105.160.11.3] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLLMWRmVeSWpSXmKPExsVy+t9hX92fpd2hBusnyVm8X9bDaPHi9T9G izlTCy0+njrObrHp8TVWi793/rFZ7N/2j9Xi5ccTLA4cHmvmrWH0uHNtD5vH+U1rmD02L6n3 eL/vKpvH501yAWxRXDYpqTmZZalF+nYJXBlbtqcWNHFVLLhl08DYxtHFyMkhIWAi8eLENGYI W0ziwr31bF2MXBxCAssYJdrv74ZympgkZh1dxgThnGeU2L9nJgtIC5uArsT+exvZQWwRgVCJ 638bwYqYBdYySlzYfhJsrrCAi8T8e9OAGjg4WARUJW5PFwcJ8wq4SXxf9ZMJJCwhoCAxZ5IN SJhTwF3iy+YdbCC2EFDJjJ9TWCHKBSV+TL4HNoVZQELi+WcliBJViW03nzNCPKAg8XPVesYJ jEKzkHTMQuhYwMi0ilGstDi5oDgpPbXCUK84Mbe4NC9dLzk/dxMjJBKqdjDe+WpziFGAg1GJ h7fCtjtUiDWxrLgy9xCjBAezkghvYwBQiDclsbIqtSg/vqg0J7X4EKM0B4uSOO8CCblQIYH0 xJLU7NTUgtQimCwTB6dUA6N61yl5S+2pTy7e+/Fve5lw0/fWO/tmPbo5I4zfrJQtO/lNxKS2 M84HmauMl86vnHttudLDvEetc7rEj685GjD5TffCKwv2XUnbwfstzeJW8vpztfxHjkX4KR97 GDfrnMTkKRzR34odbRteKpftip5d8YylTD7X8PSNd4v2rVF6srVQae9TkfD1SizFGYmGWsxF xYkA7NtxvoACAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150624_203105_890771_A4CA667C X-CRM114-Status: GOOD ( 12.94 ) X-Spam-Score: -8.3 (--------) Cc: kvm@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, pbonzini@redhat.com, linux-arm-kernel@lists.infradead.org, Mario Smarduch X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch implements host KVM interface to Hyp mode VFP function to switch out guest and switch in host. Signed-off-by: Mario Smarduch --- 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 + */ +static void kvm_switch_fp_regs(struct kvm_vcpu *vcpu) +{ + 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