From patchwork Mon Dec 18 19:06:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Adalbert_Laz=C4=83r?= X-Patchwork-Id: 10121717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84A9C60390 for ; Mon, 18 Dec 2017 19:07:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73C2F28BCC for ; Mon, 18 Dec 2017 19:07:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68B1428C67; Mon, 18 Dec 2017 19:07:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A94128C56 for ; Mon, 18 Dec 2017 19:07:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934313AbdLRTH3 (ORCPT ); Mon, 18 Dec 2017 14:07:29 -0500 Received: from mx02.bbu.dsd.mx.bitdefender.com ([91.199.104.133]:54716 "EHLO mx02.buh.bitdefender.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760303AbdLRTHM (ORCPT ); Mon, 18 Dec 2017 14:07:12 -0500 Comment: DomainKeys? See http://domainkeys.sourceforge.net/ DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=ZIuCHG2MZfP3Epp8cUXSVKO5fHVeioc7ks8h3gUVnklack3i1JceB3amFP2EEtOqN9VfhsAMyIU7q0TGPWSIj3WH+v+9yher64/trGPHgdeuJFJgPxBPm1L7m/HgiaFs1i/Ln5QV8H7btCRJbIh9V5Hy+igq07g71lBMb1h2A/YEbgXrJSrdCwd8g8ctGxQRcwtxxCNORnidOsz1TWFY6B7q+b5H2HgIioeJydx0DWWUjpg5umEeYZlRJF66QyJ2zIHybWWba7VqYBGhszdRLl5kj/8/1jCDLLu29pEkW9ogdZewHGqr0vyoiGmjEzHD6hnqW8Fa9VK3DFlisUA4vQ==; h=Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding; DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bitdefender.com; h=from:to :cc:subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=default; bh=ctF2EwEvL pt03oXjxYx0rM656gs=; b=NndndlyUNOqNEXmWlTJwoRQu6lR9Y8+rJF10VoFGB cKYGfP6rMKhZNktRlrgFGEf3uP37XufyFN7Okb2wNLF9dvLt0uj3elIkLl2GXRG6 gU8i09/O/yx1TwmDiEX9zpWeaFoyE4ZUPC8B6d14XbPp8/3P5tyN3CaJnPvsju0e EU8cPsPDD0HNvD83D+JurkE2eJAJE6k8CNZc9u7d6X3XOVQXEbdTZR7lgca/tDKD kwXgJP2aoi6+2MXyKQMZ4c8nxH1ZUEsE5Xao671EMG9nFga8n3szwJJVnqH1YAFz 1B/7YuI0KLd0eokSed0Pjizecr044yg36H5AuHGwDkEEQ== Received: (qmail 30924 invoked from network); 18 Dec 2017 21:06:57 +0200 Received: from mx01robo.bbu.dsd.mx.bitdefender.com (10.17.80.60) by mx02.buh.bitdefender.com with AES128-GCM-SHA256 encrypted SMTP; 18 Dec 2017 21:06:57 +0200 Received: (qmail 31423 invoked from network); 18 Dec 2017 21:06:57 +0200 Received: from unknown (HELO host.bbu.bitdefender.biz) (10.10.193.111) by mx01robo.bbu.dsd.mx.bitdefender.com with SMTP; 18 Dec 2017 21:06:57 +0200 From: =?UTF-8?q?Adalber=20Laz=C4=83r?= To: kvm@vger.kernel.org Cc: linux-mm@kvack.org, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Xiao Guangrong , =?UTF-8?q?Mihai=20Don=C8=9Bu?= , Adalbert Lazar Subject: [RFC PATCH v4 15/18] kvm: x86: hook in kvmi_xsetbv_event() Date: Mon, 18 Dec 2017 21:06:39 +0200 Message-Id: <20171218190642.7790-16-alazar@bitdefender.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171218190642.7790-1-alazar@bitdefender.com> References: <20171218190642.7790-1-alazar@bitdefender.com> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Adalbert Lazar Notify the guest introspection tool that the extended control register has been changed. Signed-off-by: Mihai Donțu --- arch/x86/kvm/x86.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 8f5cc81c8760..284bb4c740fa 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -765,6 +765,9 @@ static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) { + if (xcr != vcpu->arch.xcr0) + kvmi_xsetbv_event(vcpu); + if (kvm_x86_ops->get_cpl(vcpu) != 0 || __kvm_set_xcr(vcpu, index, xcr)) { kvm_inject_gp(vcpu, 0);