Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5477461imm; Wed, 12 Sep 2018 06:37:29 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYfkczSNRw5acuO7RDkoviqnVIlJJyYc+j8Wix+0ynA5E1a6dohvlrAp8wWaLyGylCALldx X-Received: by 2002:a17:902:7246:: with SMTP id c6-v6mr2380605pll.28.1536759449428; Wed, 12 Sep 2018 06:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536759449; cv=none; d=google.com; s=arc-20160816; b=n6p9YeLh/fNV/xuJPCB0AuhUPqnyq74c1hU0zJI3lh5ogI8JK9eCDQZMWFWlE0B7Ja LHcHOJvCsrquzr8paeHeTpapIGUEtdSUdvh9Jg3Cb9ZFRO+6RbxYd7Uzer/nLAmXL0cW 6HyyZb+GCKr58AlMzuyleUj1boaXkn7FADmluvqvAOEyuii4JzFC4ZA/giyIGIDHM8WF lK5jY8Z/xLzpV3o7yZzfcLIJ8KT+F6FaSUem6vTF+/sre7hVlFujSxCkGDrJithJ0z0l 1BfOyc0LqqA5V1/lAkK4pBYtDzseDB9K0j5tf4ArBZ3kHQ/HUh5oR1XCqUfxRVf1Zhpc J0Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=YKUo1j70IrRbmsiff3AwkKJ7LU3BEDIpRi91Eg9blJY=; b=usxp9Ext8on3wTewo8yRSc3wvy9JGCm36YFTwZ26nsm28PMehiGrlSaoTlAyQ6f8P9 ox7csTN8AiQgjhZ45BoS+D3WZ9qSC+Vgi7sn3iKMl8nO/dsu21fWgMDFBpNLKgRS1sjl 19CO0bmfiUfTh2KqsC4RQaaO4100Z8ZUjlkT/PGiEyIFgyM+yyChbz28oA7wFaz0eVJZ d3mQMavexqOnE3Hh8tPkAHisbWZLnmZeK9UuOAoWWm0e2cQBhv2iVSikJc0vs25YLu2F BQGSIt2sBC/ddf0aLtSNlU2buaTZ5l7QXY7DNW1RRgYjLz+sxqaI1nIZJYL400PcRMN7 ap7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 85-v6si1199625pgh.381.2018.09.12.06.37.04; Wed, 12 Sep 2018 06:37:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727990AbeILSkc (ORCPT + 99 others); Wed, 12 Sep 2018 14:40:32 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:43881 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbeILSkb (ORCPT ); Wed, 12 Sep 2018 14:40:31 -0400 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1g05JB-0001Ap-JC; Wed, 12 Sep 2018 15:35:53 +0200 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Andy Lutomirski , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , kvm@vger.kernel.org, "Jason A. Donenfeld" , Rik van Riel , Sebastian Andrzej Siewior Subject: [RFC PATCH 02/10] kvm: x86: make kvm_{load|put}_guest_fpu() static Date: Wed, 12 Sep 2018 15:33:45 +0200 Message-Id: <20180912133353.20595-3-bigeasy@linutronix.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180912133353.20595-1-bigeasy@linutronix.de> References: <20180912133353.20595-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The functions kvm_load_guest_fpu() kvm_put_guest_fpu() are only used locally, make them static. This requires also that both functions are moved because they are used before their implementation. Those functions were exported (via EXPORT_SYMBOL) before commit e5bb40251a920 ("KVM: Drop kvm_{load,put}_guest_fpu() exports"). Signed-off-by: Sebastian Andrzej Siewior --- arch/x86/kvm/x86.c | 46 ++++++++++++++++++++-------------------- include/linux/kvm_host.h | 2 -- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 542f6315444d7..2d8b3c257e769 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7829,6 +7829,29 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu) return 0; } +/* Swap (qemu) user FPU context for the guest FPU context. */ +static void kvm_load_guest_fpu(struct kvm_vcpu *vcpu) +{ + preempt_disable(); + copy_fpregs_to_fpstate(&vcpu->arch.user_fpu); + /* PKRU is separately restored in kvm_x86_ops->run. */ + __copy_kernel_to_fpregs(&vcpu->arch.guest_fpu.state, + ~XFEATURE_MASK_PKRU); + preempt_enable(); + trace_kvm_fpu(1); +} + +/* When vcpu_run ends, restore user space FPU context. */ +static void kvm_put_guest_fpu(struct kvm_vcpu *vcpu) +{ + preempt_disable(); + copy_fpregs_to_fpstate(&vcpu->arch.guest_fpu); + copy_kernel_to_fpregs(&vcpu->arch.user_fpu.state); + preempt_enable(); + ++vcpu->stat.fpu_reload; + trace_kvm_fpu(0); +} + int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { int r; @@ -8406,29 +8429,6 @@ static void fx_init(struct kvm_vcpu *vcpu) vcpu->arch.cr0 |= X86_CR0_ET; } -/* Swap (qemu) user FPU context for the guest FPU context. */ -void kvm_load_guest_fpu(struct kvm_vcpu *vcpu) -{ - preempt_disable(); - copy_fpregs_to_fpstate(&vcpu->arch.user_fpu); - /* PKRU is separately restored in kvm_x86_ops->run. */ - __copy_kernel_to_fpregs(&vcpu->arch.guest_fpu.state, - ~XFEATURE_MASK_PKRU); - preempt_enable(); - trace_kvm_fpu(1); -} - -/* When vcpu_run ends, restore user space FPU context. */ -void kvm_put_guest_fpu(struct kvm_vcpu *vcpu) -{ - preempt_disable(); - copy_fpregs_to_fpstate(&vcpu->arch.guest_fpu); - copy_kernel_to_fpregs(&vcpu->arch.user_fpu.state); - preempt_enable(); - ++vcpu->stat.fpu_reload; - trace_kvm_fpu(0); -} - void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) { void *wbinvd_dirty_mask = vcpu->arch.wbinvd_dirty_mask; diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 0205aee44dedd..c926698040e0d 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -733,8 +733,6 @@ bool kvm_vcpu_wake_up(struct kvm_vcpu *vcpu); void kvm_vcpu_kick(struct kvm_vcpu *vcpu); int kvm_vcpu_yield_to(struct kvm_vcpu *target); void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu, bool usermode_vcpu_not_eligible); -void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); -void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); void kvm_flush_remote_tlbs(struct kvm *kvm); void kvm_reload_remote_mmus(struct kvm *kvm); -- 2.19.0