From patchwork Mon Sep 21 21:26:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Smarduch X-Patchwork-Id: 7234271 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 1F0A39F372 for ; Mon, 21 Sep 2015 21:29:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6890206F5 for ; Mon, 21 Sep 2015 21:29:41 +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 D4F17206F4 for ; Mon, 21 Sep 2015 21:29:40 +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 1Ze8cJ-0001No-DU; Mon, 21 Sep 2015 21:27:19 +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 1Ze8cG-0001Hd-0N for linux-arm-kernel@lists.infradead.org; Mon, 21 Sep 2015 21:27:16 +0000 Received: from uscpsbgex4.samsung.com (u125.gpu85.samsung.co.kr [203.254.195.125]) by usmailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NV100EBDQ8UIZC0@usmailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 21 Sep 2015 17:26:54 -0400 (EDT) X-AuditID: cbfec37d-f79746d0000068cf-8a-5600761e279c Received: from usmmp2.samsung.com ( [203.254.195.78]) by uscpsbgex4.samsung.com (USCPEXMTA) with SMTP id 11.66.26831.E1670065; Mon, 21 Sep 2015 17:26:54 -0400 (EDT) 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 <0NV10041MQ8T6BC0@usmmp2.samsung.com>; Mon, 21 Sep 2015 17:26:54 -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; Mon, 21 Sep 2015 14:26:53 -0700 From: Mario Smarduch To: kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com Subject: [RFT - PATCH 1/2] KVM/arm64: add hooks for armv8 fp/simd lazy switch support Date: Mon, 21 Sep 2015 14:26:22 -0700 Message-id: <1442870783-30752-2-git-send-email-m.smarduch@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1442870783-30752-1-git-send-email-m.smarduch@samsung.com> References: <1442870783-30752-1-git-send-email-m.smarduch@samsung.com> MIME-version: 1.0 X-Originating-IP: [105.145.28.253] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t9hP125MoYwg0+3RC1evP7HaDFnaqHF x1PH2S02Pb7GavH3zj82B1aPNfPWMHrcubaHzeP8pjXMHpuX1Ht83iQXwBrFZZOSmpNZllqk b5fAlfFw6VTWghbBik1PVzM3MN7m62Lk5JAQMJH4M/cuI4QtJnHh3nq2LkYuDiGBZYwSzTMv sUM4TUwSizY+ZIFwLjJKPHxxkw2khU1AV2L/vY3sILaIQKjElOWvmUBsZoEMidlP/4HFhQXC Je5+XAlmswioShz7+BxoHQcHr4CbxKPZJhCb5SROHpvMCmJzCrhL9N67A1YuBFRy9M9XsJG8 AoISPybfYwFpZRaQkHj+WQmiRFVi202IiRICShI7tmtPYBSahaRhFkLDAkamVYxipcXJBcVJ 6akVJnrFibnFpXnpesn5uZsYISFeu4Px/lebQ4wCHIxKPLwzhP6HCrEmlhVX5h5ilOBgVhLh Pc7PECbEm5JYWZValB9fVJqTWnyIUZqDRUmcN0JSLlRIID2xJDU7NbUgtQgmy8TBKdXAGD/h 963Fp1ekMp8Q4r880/DAlmT7iZn73nj/Ll855/KRozauXA9CGoSUPd6mFPpYz5bws7l0ctLf tX8uSgAdJbvsseOCWQsUimoXFB7TTrg0d0mq739RY0V/NZk7kWoLlr09PXvngQUzfmofzlLa mnx2lm9MEn/5zmvH08p6d6jOfjfVqvXIZyWW4oxEQy3mouJEAElNadptAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150921_142716_282909_CD46E5DD X-CRM114-Status: GOOD ( 12.16 ) 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 This patch adds hooks to support fp/simd lazy switch. A vcpu flag to track fp/simd state, offset into the vcpu structure and switch prototype function. Signed-off-by: Mario Smarduch --- arch/arm64/include/asm/kvm_asm.h | 1 + arch/arm64/include/asm/kvm_host.h | 3 +++ arch/arm64/kernel/asm-offsets.c | 1 + 3 files changed, 5 insertions(+) diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h index 67fa0de..7d9936b 100644 --- a/arch/arm64/include/asm/kvm_asm.h +++ b/arch/arm64/include/asm/kvm_asm.h @@ -119,6 +119,7 @@ extern char __kvm_hyp_vector[]; extern void __kvm_flush_vm_context(void); extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); extern void __kvm_tlb_flush_vmid(struct kvm *kvm); +extern void __kvm_restore_host_vfp_state(struct kvm_vcpu *vcpu); extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 415938d..f4665e5 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -161,6 +161,9 @@ struct kvm_vcpu_arch { /* Interrupt related fields */ u64 irq_lines; /* IRQ and FIQ levels */ + /* Track fp/simd lazy switch */ + u32 vfp_lazy; + /* Cache some mmu pages needed inside spinlock regions */ struct kvm_mmu_memory_cache mmu_page_cache; diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index 8d89cf8..d6edd65 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -124,6 +124,7 @@ int main(void) DEFINE(VCPU_HCR_EL2, offsetof(struct kvm_vcpu, arch.hcr_el2)); DEFINE(VCPU_MDCR_EL2, offsetof(struct kvm_vcpu, arch.mdcr_el2)); DEFINE(VCPU_IRQ_LINES, offsetof(struct kvm_vcpu, arch.irq_lines)); + DEFINE(VCPU_VFP_LAZY, offsetof(struct kvm_vcpu, arch.vfp_lazy)); DEFINE(VCPU_HOST_CONTEXT, offsetof(struct kvm_vcpu, arch.host_cpu_context)); DEFINE(VCPU_HOST_DEBUG_STATE, offsetof(struct kvm_vcpu, arch.host_debug_state)); DEFINE(VCPU_TIMER_CNTV_CTL, offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_ctl));