From patchwork Fri Oct 30 21:56:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Smarduch X-Patchwork-Id: 7529451 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 BE18D9F37F for ; Fri, 30 Oct 2015 21:59:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E77212076F for ; Fri, 30 Oct 2015 21:59:17 +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 EB5142076E for ; Fri, 30 Oct 2015 21:59:16 +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 1ZsHg1-00050h-6n; Fri, 30 Oct 2015 21:57:37 +0000 Received: from mailout3.w2.samsung.com ([211.189.100.13] helo=usmailout3.samsung.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZsHfh-0004uv-AS for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2015 21:57:18 +0000 Received: from uscpsbgex1.samsung.com (u122.gpu85.samsung.co.kr [203.254.195.122]) by usmailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NX100JF8ZMV2K50@usmailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2015 17:56:55 -0400 (EDT) X-AuditID: cbfec37a-f79c96d000005f02-05-5633e7a7a567 Received: from usmmp1.samsung.com ( [203.254.195.77]) by uscpsbgex1.samsung.com (USCPEXMTA) with SMTP id 3E.5C.24322.7A7E3365; Fri, 30 Oct 2015 17:56:55 -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 <0NX1009KCZMVR060@usmmp1.samsung.com>; Fri, 30 Oct 2015 17:56:55 -0400 (EDT) Received: from mjsmard-530U3C-530U4C-532U3C.sisa.samsung.com (105.145.28.253) by SISAEX02SJ.sisa.samsung.com (105.144.21.116) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 30 Oct 2015 14:56:54 -0700 From: Mario Smarduch To: kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com Subject: [PATCH v3 1/3] KVM/arm: add hooks for armv7 fp/simd lazy switch support Date: Fri, 30 Oct 2015 14:56:31 -0700 Message-id: <1446242193-8424-2-git-send-email-m.smarduch@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1446242193-8424-1-git-send-email-m.smarduch@samsung.com> References: <1446242193-8424-1-git-send-email-m.smarduch@samsung.com> MIME-version: 1.0 X-Originating-IP: [105.145.28.253] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRmVeSWpSXmKPExsVy+t9hX93lz43DDNpvyFs03f/BavHi9T9G izlTCy0+njrObrHp8TVWi793/rE5sHmsmbeG0aPlyFtWjzvX9rB5nN+0htlj85J6j8+b5ALY orhsUlJzMstSi/TtErgyPu1rZC94xFOx4XpwA+MLri5GTg4JAROJs3MuM0PYYhIX7q1n62Lk 4hASWMYocXjrOhYIp4lJ4kPTc3aQKiGBi4wSx2/UgNhsAroS++9tBIuLCIRKTFn+mgmkgVmg lVHi1vL5LCAJYYEAiW3XH7J2MXJwsAioSkxolwcJ8wq4Skzetxdqs5zEyWOTwUo4BdwkprbU QaxylVhz7CY7RLmgxI/J91hASpgFJCSef1aCKFGV2HbzOSNIWEJASWLHdu0JjEKzkDTMQmhY wMi0ilGstDi5oDgpPbXCUK84Mbe4NC9dLzk/dxMjJOSrdjDe+WpziFGAg1GJh/fCFuMwIdbE suLK3EOMEhzMSiK8TFOBQrwpiZVVqUX58UWlOanFhxilOViUxHkXSMiFCgmkJ5akZqemFqQW wWSZODilGhhr7PWmOFuEKn2UjVuwLyl+UmWPSOXBTxM38CTOShf8nKu41mMyM9sSjpLFxh82 +HG/zLOd28V0gGVCXtnt/k/p7iYHZT6nMop9sJ/yIebRyUdyJx7VhJ1z0rjRrK4rcUDr2UpT jyAHx68t0y7/2FW1KeTo74h/vbpJ9Us+rrluFaSzSHvx63dKLMUZiYZazEXFiQAaGiobdQIA AA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151030_145717_510596_690CB937 X-CRM114-Status: GOOD ( 10.45 ) X-Spam-Score: -7.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, antonios.motakis@huawei.com, 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=-5.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 This patch adds vcpu fields to track lazy state, save host FPEXC, and offsets to fields. Signed-off-by: Mario Smarduch --- arch/arm/include/asm/kvm_host.h | 6 ++++++ arch/arm/kernel/asm-offsets.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 3df1e97..f1bf551 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h @@ -107,6 +107,12 @@ struct kvm_vcpu_arch { /* Interrupt related fields */ u32 irq_lines; /* IRQ and FIQ levels */ + /* fp/simd dirty flag true if guest accessed register file */ + bool vfp_dirty; + + /* Save host FPEXC register to later restore on vcpu put */ + u32 host_fpexc; + /* Exception Information */ struct kvm_vcpu_fault_info fault; diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index 871b826..9f79712 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c @@ -186,6 +186,8 @@ int main(void) DEFINE(VCPU_CPSR, offsetof(struct kvm_vcpu, arch.regs.usr_regs.ARM_cpsr)); DEFINE(VCPU_HCR, offsetof(struct kvm_vcpu, arch.hcr)); DEFINE(VCPU_IRQ_LINES, offsetof(struct kvm_vcpu, arch.irq_lines)); + DEFINE(VCPU_VFP_DIRTY, offsetof(struct kvm_vcpu, arch.vfp_dirty)); + DEFINE(VCPU_VFP_HOST_FPEXC, offsetof(struct kvm_vcpu, arch.host_fpexc)); DEFINE(VCPU_HSR, offsetof(struct kvm_vcpu, arch.fault.hsr)); DEFINE(VCPU_HxFAR, offsetof(struct kvm_vcpu, arch.fault.hxfar)); DEFINE(VCPU_HPFAR, offsetof(struct kvm_vcpu, arch.fault.hpfar));