From patchwork Fri Sep 18 01:05:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Smarduch X-Patchwork-Id: 7212071 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 CDF6E9F40A for ; Fri, 18 Sep 2015 01:07:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D2A7420766 for ; Fri, 18 Sep 2015 01:07:50 +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 EE52D20430 for ; Fri, 18 Sep 2015 01:07:49 +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 1Zck7l-0000QP-5g; Fri, 18 Sep 2015 01:06:01 +0000 Received: from mailout2.w2.samsung.com ([211.189.100.12] helo=usmailout2.samsung.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zck7i-0000K5-Rn for linux-arm-kernel@lists.infradead.org; Fri, 18 Sep 2015 01:05:59 +0000 Received: from uscpsbgex3.samsung.com (u124.gpu85.samsung.co.kr [203.254.195.124]) by mailout2.w2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NUU00BFMLPCC630@mailout2.w2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2015 21:05:36 -0400 (EDT) X-AuditID: cbfec37c-f796c6d000006809-30-55fb63603f87 Received: from usmmp1.samsung.com ( [203.254.195.77]) by uscpsbgex3.samsung.com (USCPEXMTA) with SMTP id BF.CF.26633.0636BF55; Thu, 17 Sep 2015 21:05:36 -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 <0NUU00HT9LPB7P20@usmmp1.samsung.com>; Thu, 17 Sep 2015 21:05:36 -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; Thu, 17 Sep 2015 18:05:35 -0700 From: Mario Smarduch To: kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com Subject: [PATCH 1/2] KVM/arm: add hooks for armv7 fp/simd lazy switch support Date: Thu, 17 Sep 2015 18:05:16 -0700 Message-id: <1442538317-13618-2-git-send-email-m.smarduch@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1442538317-13618-1-git-send-email-m.smarduch@samsung.com> References: <1442538317-13618-1-git-send-email-m.smarduch@samsung.com> MIME-version: 1.0 X-Originating-IP: [105.145.28.253] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsVy+t9hX92E5N+hBi/WiVu8eP2P0WLO1EKL j6eOs1tsenyN1eLvnX9sDqwea+atYfS4c20Pm8f5TWuYPTYvqff4vEkugDWKyyYlNSezLLVI 3y6BK2PB00PsBRsFKjqufmRsYOzm62Lk5JAQMJE4uPUAG4QtJnHh3nogm4tDSGAZo8SWpw1Q ThOTxJwND5kgnIuMEvs+dTKDtLAJ6Ersv7eRHcQWEQiVmLL8NROIzSyQITH76T+wuLCAr8SO 25sYQWwWAVWJ9qufwOK8Am4Sn6a3sEOslpM4eWwyK4jNKeAuseLuSjBbCKjmz6SLrBD1ghI/ Jt9j6WLkAJovIfH8sxJEiarEtpvPGUHCEgJKEju2a09gFJqFpGEWQsMCRqZVjGKlxckFxUnp qRXGesWJucWleel6yfm5mxghQV6zg/HeV5tDjAIcjEo8vB4ev0OFWBPLiitzDzFKcDArifCe iwYK8aYkVlalFuXHF5XmpBYfYpTmYFES55WQlAsVEkhPLEnNTk0tSC2CyTJxcEo1MOpMW/G8 77Kh2lU7npIP6qmnFdx6XrG3aO/cJ+3f/tfmQxojt8relYHVlg2azhp7XnAmygpYnPJZr7Jo U9Gxlw4B79iD3fa93Lhs3/kP1sr2R3c4bHyw4ID8VJEjLI+2HFJqEfCR37HFPsxqO//H2l8r PbfcszHv9fyS7uHL+aO+lOmXV5STihJLcUaioRZzUXEiAJ73dnFuAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150917_180559_000263_EBAAD81B X-CRM114-Status: GOOD ( 11.89 ) 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, T_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 Basic hooks are added 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/arm/include/asm/kvm_asm.h | 1 + arch/arm/include/asm/kvm_host.h | 3 +++ arch/arm/kernel/asm-offsets.c | 1 + 3 files changed, 5 insertions(+) diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h index 194c91b..4b45d79 100644 --- a/arch/arm/include/asm/kvm_asm.h +++ b/arch/arm/include/asm/kvm_asm.h @@ -97,6 +97,7 @@ extern char __kvm_hyp_code_end[]; 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); #endif diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index dcba0fa..4858f6c 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h @@ -111,6 +111,9 @@ struct kvm_vcpu_arch { /* Interrupt related fields */ u32 irq_lines; /* IRQ and FIQ levels */ + /* Track fp/simd lazy switch */ + u32 vfp_lazy; + /* 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..4a80802f 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c @@ -191,6 +191,7 @@ int main(void) DEFINE(VCPU_HPFAR, offsetof(struct kvm_vcpu, arch.fault.hpfar)); DEFINE(VCPU_HYP_PC, offsetof(struct kvm_vcpu, arch.fault.hyp_pc)); DEFINE(VCPU_VGIC_CPU, offsetof(struct kvm_vcpu, arch.vgic_cpu)); + DEFINE(VCPU_VFP_LAZY, offsetof(struct kvm_vcpu, arch.vfp_lazy)); DEFINE(VGIC_V2_CPU_HCR, offsetof(struct vgic_cpu, vgic_v2.vgic_hcr)); DEFINE(VGIC_V2_CPU_VMCR, offsetof(struct vgic_cpu, vgic_v2.vgic_vmcr)); DEFINE(VGIC_V2_CPU_MISR, offsetof(struct vgic_cpu, vgic_v2.vgic_misr));