From patchwork Sat Dec 26 21:54:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Smarduch X-Patchwork-Id: 7922541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 02E94BEEE5 for ; Sat, 26 Dec 2015 21:57:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0EFC620212 for ; Sat, 26 Dec 2015 21:57:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2CD44202D1 for ; Sat, 26 Dec 2015 21:57:27 +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 1aCwor-00017t-Dm; Sat, 26 Dec 2015 21:56:09 +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 1aCwoS-0000py-HS for linux-arm-kernel@lists.infradead.org; Sat, 26 Dec 2015 21:55:46 +0000 Received: from uscpsbgex3.samsung.com (u124.gpu85.samsung.co.kr [203.254.195.124]) by usmailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NZZ00CQYJKH1T20@usmailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Sat, 26 Dec 2015 16:55:29 -0500 (EST) X-AuditID: cbfec37c-f79276d00000048f-4e-567f0cd1144b Received: from usmmp2.samsung.com ( [203.254.195.78]) by uscpsbgex3.samsung.com (USCPEXMTA) with SMTP id CB.1E.01167.1DC0F765; Sat, 26 Dec 2015 16:55:29 -0500 (EST) Received: from sisasmtp.sisa.samsung.com ([105.144.21.116]) by usmmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NZZ00CX6JKGCB00@usmmp2.samsung.com>; Sat, 26 Dec 2015 16:55:29 -0500 (EST) Received: from localhost.localdomain (105.160.5.6) by SISAEX02SJ.sisa.samsung.com (105.144.21.116) with Microsoft SMTP Server (TLS) id 14.3.224.2; Sat, 26 Dec 2015 13:55:27 -0800 From: Mario Smarduch To: kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com Subject: [PATCH v6 2/6] arm: KVM: Introduce host fp/simd context switch function Date: Sat, 26 Dec 2015 13:54:56 -0800 Message-id: <1451166900-3711-3-git-send-email-m.smarduch@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1451166900-3711-1-git-send-email-m.smarduch@samsung.com> References: <1451166900-3711-1-git-send-email-m.smarduch@samsung.com> MIME-version: 1.0 X-Originating-IP: [105.160.5.6] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsVy+t9hP92LPPVhBgtX8lq8eP2P0WLO1EKL j6eOs1tsenyN1eLvnX9sDqwea+atYfS4c20Pm8f5TWuYPTYvqff4vEkugDWKyyYlNSezLLVI 3y6BK2PFgZWsBUeFK85v6GRrYJwr0MXIySEhYCLx51MXC4QtJnHh3nq2LkYuDiGBZYwS+9Zs ZIVwmpgkXi35wQZSJSSwjVFizZlyEJtNQFdi/72N7CC2iECoxJTlr5lAbGaBDInZT/+BxYUF AiS2n2pjBrFZBFQl2lY2gtm8Aq4Sa/4sgNosJ3Hy2GRWEJtTwE3i9pInzBC7XCXWTjsCVS8o 8WPyPaB6DqD5EhLPPytBlKhKbLv5nBFijLzElu1t7BMYhWYh6ZiF0LGAkWkVo1hpcXJBcVJ6 aoWxXnFibnFpXrpecn7uJkZIkNfsYLz31eYQowAHoxIP7+RntWFCrIllxZW5hxglOJiVRHgr r9aFCfGmJFZWpRblxxeV5qQWH2KU5mBREueVkJQLFRJITyxJzU5NLUgtgskycXBKNTCy3577 ah/D0Z4N85fsm3Zf7kGImP1vC5dX6adertxW+PLUpFOX1rxscdT8aBnUK7Ir7pHTwpvL/vaW bWUtNAnlkl+mwSI+7VNzdl1J5nRhkTZnxyj/Cduk1qf2zl2f5PM4svHK/9s116//ElX++3T/ NjM+5WNRVq3hYUcnKBxMTQhdLveQrfSXEktxRqKhFnNRcSIAVvwno24CAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151226_135544_856041_DB8F649E X-CRM114-Status: GOOD ( 14.15 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Mario Smarduch Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 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 Add fp/simd context switch function callable from host kernel mode. Signed-off-by: Mario Smarduch Reviewed-by: Christoffer Dall --- arch/arm/kvm/Makefile | 2 +- arch/arm/kvm/fpsimd_switch.S | 47 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 arch/arm/kvm/fpsimd_switch.S diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile index c5eef02c..411b3e4 100644 --- a/arch/arm/kvm/Makefile +++ b/arch/arm/kvm/Makefile @@ -19,7 +19,7 @@ kvm-arm-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o $(KVM)/eventfd.o $(KVM)/vf obj-y += kvm-arm.o init.o interrupts.o obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o -obj-y += coproc.o coproc_a15.o coproc_a7.o mmio.o psci.o perf.o +obj-y += coproc.o coproc_a15.o coproc_a7.o mmio.o psci.o perf.o fpsimd_switch.o obj-y += $(KVM)/arm/vgic.o obj-y += $(KVM)/arm/vgic-v2.o obj-y += $(KVM)/arm/vgic-v2-emul.o diff --git a/arch/arm/kvm/fpsimd_switch.S b/arch/arm/kvm/fpsimd_switch.S new file mode 100644 index 0000000..7e48c16 --- /dev/null +++ b/arch/arm/kvm/fpsimd_switch.S @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2015 - Samsung - Open Source Group + * Author: Mario Smarduch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "interrupts_head.S" + + .text +/** + * void vcpu_restore_host_vfp_state(struct vcpu *vcpu) - + * This function is called from host to save the guest, and restore host + * fp/simd hardware context. + */ +ENTRY(vcpu_restore_host_vfp_state) +#ifdef CONFIG_VFPv3 + push {r4-r7} + + add r7, r0, #VCPU_VFP_GUEST + store_vfp_state r7 + + add r7, r0, #VCPU_VFP_HOST + ldr r7, [r7] + restore_vfp_state r7 + + pop {r4-r7} +#endif + bx lr +ENDPROC(vcpu_restore_host_vfp_state)