From patchwork Sun Apr 11 21:07:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 91928 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3BLArQT031553 for ; Sun, 11 Apr 2010 21:10:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752978Ab0DKVKu (ORCPT ); Sun, 11 Apr 2010 17:10:50 -0400 Received: from va3ehsobe001.messaging.microsoft.com ([216.32.180.11]:50098 "EHLO VA3EHSOBE001.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752959Ab0DKVKt (ORCPT ); Sun, 11 Apr 2010 17:10:49 -0400 Received: from mail84-va3-R.bigfish.com (10.7.14.246) by VA3EHSOBE001.bigfish.com (10.7.40.21) with Microsoft SMTP Server id 8.1.340.0; Sun, 11 Apr 2010 21:10:46 +0000 Received: from mail84-va3 (localhost.localdomain [127.0.0.1]) by mail84-va3-R.bigfish.com (Postfix) with ESMTP id 9B80319A8256; Sun, 11 Apr 2010 21:10:46 +0000 (UTC) X-SpamScore: -4 X-BigFish: VPS-4(zz936eMab9bhzz1202hzzz32i2a8h6bh467h43h61h) X-Spam-TCS-SCL: 0:0 X-FB-SS: 5, Received: from mail84-va3 (localhost.localdomain [127.0.0.1]) by mail84-va3 (MessageSwitch) id 1271020244872808_6100; Sun, 11 Apr 2010 21:10:44 +0000 (UTC) Received: from VA3EHSMHS027.bigfish.com (unknown [10.7.14.235]) by mail84-va3.bigfish.com (Postfix) with ESMTP id C8DBDCD8001; Sun, 11 Apr 2010 21:10:44 +0000 (UTC) Received: from ausb3extmailp01.amd.com (163.181.251.8) by VA3EHSMHS027.bigfish.com (10.7.99.37) with Microsoft SMTP Server (TLS) id 14.0.482.39; Sun, 11 Apr 2010 21:10:43 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with SMTP id o3BL73ei022150; Sun, 11 Apr 2010 16:07:07 -0500 X-WSS-ID: 0L0QDHP-02-2EX-02 X-M-MSG: Received: from sausexhtp02.amd.com (sausexhtp02.amd.com [163.181.3.152]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2E04EC871C; Sun, 11 Apr 2010 16:10:37 -0500 (CDT) Received: from storexhtp01.amd.com (172.24.4.3) by sausexhtp02.amd.com (163.181.3.152) with Microsoft SMTP Server (TLS) id 8.2.234.1; Sun, 11 Apr 2010 16:10:38 -0500 Received: from storexbh1.amd.com (10.1.1.17) by storexhtp01.amd.com (172.24.4.3) with Microsoft SMTP Server id 8.2.234.1; Sun, 11 Apr 2010 14:10:37 -0700 Received: from sausexmb1.amd.com ([163.181.3.156]) by storexbh1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 11 Apr 2010 17:10:37 -0400 Received: from seurexmb1.amd.com ([165.204.9.130]) by sausexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 11 Apr 2010 16:10:35 -0500 Received: from gwo.osrc.amd.com ([165.204.16.204]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 11 Apr 2010 23:10:32 +0200 Received: from localhost.localdomain (tronje.osrc.amd.com [165.204.15.48]) by gwo.osrc.amd.com (Postfix) with ESMTP id C74FA49C131; Sun, 11 Apr 2010 22:10:32 +0100 (BST) From: Andre Przywara To: avi@redhat.com CC: kvm@vger.kernel.org, Andre Przywara Subject: [PATCH] svm: implement NEXTRIPsave SVM feature Date: Sun, 11 Apr 2010 23:07:28 +0200 Message-ID: <1271020048-10083-1-git-send-email-andre.przywara@amd.com> X-Mailer: git-send-email 1.6.4 X-OriginalArrivalTime: 11 Apr 2010 21:10:33.0070 (UTC) FILETIME=[6C3058E0:01CAD9BB] MIME-Version: 1.0 X-Reverse-DNS: unknown Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 11 Apr 2010 21:10:54 +0000 (UTC) diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index b26a38d..1d91d05 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -81,7 +81,9 @@ struct __attribute__ ((__packed__)) vmcb_control_area { u32 event_inj_err; u64 nested_cr3; u64 lbr_ctl; - u8 reserved_5[832]; + u64 reserved_5; + u64 next_rip; + u8 reserved_6[816]; }; diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index d04c7ad..7fff56c 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -43,11 +43,11 @@ MODULE_LICENSE("GPL"); #define SEG_TYPE_LDT 2 #define SEG_TYPE_BUSY_TSS16 3 -#define SVM_FEATURE_NPT (1 << 0) -#define SVM_FEATURE_LBRV (1 << 1) -#define SVM_FEATURE_SVML (1 << 2) -#define SVM_FEATURE_NRIP (1 << 3) -#define SVM_FEATURE_PAUSE_FILTER (1 << 10) +#define SVM_FEATURE_NPT (1 << 0) +#define SVM_FEATURE_LBRV (1 << 1) +#define SVM_FEATURE_SVML (1 << 2) +#define SVM_FEATURE_NRIP (1 << 3) +#define SVM_FEATURE_PAUSE_FILTER (1 << 10) #define NESTED_EXIT_HOST 0 /* Exit handled on host level */ #define NESTED_EXIT_DONE 1 /* Exit caused nested vmexit */ @@ -319,6 +319,9 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); + if (svm->vmcb->control.next_rip != 0) + svm->next_rip = svm->vmcb->control.next_rip; + if (!svm->next_rip) { if (emulate_instruction(vcpu, 0, 0, EMULTYPE_SKIP) != EMULATE_DONE)