From patchwork Sat Nov 14 22:12:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Smarduch X-Patchwork-Id: 7617581 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 2E8BF9F2E2 for ; Sat, 14 Nov 2015 22:15:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 418B92061D for ; Sat, 14 Nov 2015 22:15:00 +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 59BCA20615 for ; Sat, 14 Nov 2015 22:14:59 +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 1Zxj45-0003pK-A4; Sat, 14 Nov 2015 22:12:57 +0000 Received: from mailout1.w2.samsung.com ([211.189.100.11] helo=usmailout1.samsung.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zxj3t-0003lw-QP for linux-arm-kernel@lists.infradead.org; Sat, 14 Nov 2015 22:12:46 +0000 Received: from uscpsbgex4.samsung.com (u125.gpu85.samsung.co.kr [203.254.195.125]) by mailout1.w2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NXT00J1JSCR9N40@mailout1.w2.samsung.com> for linux-arm-kernel@lists.infradead.org; Sat, 14 Nov 2015 17:12:27 -0500 (EST) X-AuditID: cbfec37d-f79746d0000068cf-76-5647b1cb3136 Received: from usmmp2.samsung.com ( [203.254.195.78]) by uscpsbgex4.samsung.com (USCPEXMTA) with SMTP id FD.84.26831.BC1B7465; Sat, 14 Nov 2015 17:12:27 -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 <0NXT009BXSCQIJ50@usmmp2.samsung.com>; Sat, 14 Nov 2015 17:12:27 -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, 14 Nov 2015 14:12:26 -0800 From: Mario Smarduch To: kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com Subject: [PATCH v4 1/3] KVM/arm/arm64: add hooks for armv7 fp/simd lazy switch support Date: Sat, 14 Nov 2015 14:12:08 -0800 Message-id: <1447539130-4613-2-git-send-email-m.smarduch@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1447539130-4613-1-git-send-email-m.smarduch@samsung.com> References: <1447539130-4613-1-git-send-email-m.smarduch@samsung.com> MIME-version: 1.0 X-Originating-IP: [105.160.5.6] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGLMWRmVeSWpSXmKPExsVy+t9hP93TG93DDH4s5bJouv+D1eLF63+M FnOmFlp8PHWc3WLT42usFn/v/GNzYPNYM28No0fLkbesHneu7WHzOL9pDbPH5iX1Hp83yQWw RXHZpKTmZJalFunbJXBlfNrXyF7wiKdiw/XgBsYXXF2MnBwSAiYSv69fY4ewxSQu3FvP1sXI xSEksIxR4uu8fSwQThOTRMPUF4wQzjZGiflvnrGCtLAJ6Ersv7cRrF1EIFRiyvLXTCBFzAKt jBKzWz4xgySEBSIktjROZAGxWQRUJc6uuArWzCvgKnFz3StGiN1yEiePTQaLcwq4STzp2w5W LwRU87unlR2iXlDix+R7QHEOoAUSEs8/K0GUqEpsu/kcaoy8xJbtbewTGIVmIemYhdCxgJFp FaNYaXFyQXFSemqFiV5xYm5xaV66XnJ+7iZGSOjX7mC8/9XmEKMAB6MSD2+hj3uYEGtiWXFl 7iFGCQ5mJRHeme1AId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rwRknKhQgLpiSWp2ampBalFMFkm Dk6pBkZOs9BtBrnq+lsa/R87nHzHJPrl3BPPF0erRJdG7vPIviPi+0t0xp0nG29sYz2SmC2+ a+dDzhbe9Tvf7Wu+u+9c0cbnCwwFMo79vuj4b/7yV26MglzuvGJ8bD3tDx8LpR++vTS7dI/Y uuDk3uOXDh2UdOu4bVouGLB1Y8fHevGMx4ViS9WtFm1VYinOSDTUYi4qTgQAUF0cXHkCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151114_141245_941107_42FFCCC6 X-CRM114-Status: UNSURE ( 9.33 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -7.3 (-------) 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: antonios.motakis@huawei.com, 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.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 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));