From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: [V0 PATCH 1/6] AMD-PVH: construct vmcb changes Date: Fri, 12 Dec 2014 18:58:22 -0800 Message-ID: <1418439507-16027-2-git-send-email-mukesh.rathor@oracle.com> References: <1418439507-16027-1-git-send-email-mukesh.rathor@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xzcut-00051N-M0 for xen-devel@lists.xenproject.org; Sat, 13 Dec 2014 02:58:47 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id sBD2whnH020514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 13 Dec 2014 02:58:44 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id sBD2whtD007048 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 13 Dec 2014 02:58:43 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userz7022.oracle.com (8.14.5+Sun/8.14.4) with ESMTP id sBD2wgCP021449 for ; Sat, 13 Dec 2014 02:58:42 GMT In-Reply-To: <1418439507-16027-1-git-send-email-mukesh.rathor@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: boris.ostrovsky@oracle.com, elena.ufimtseva@oracle.com Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org PVH guest starts in Long 64bit paging mode. This patch modifies construct_vmcb for that. Signed-off-by: Mukesh Rathor --- xen/arch/x86/hvm/svm/vmcb.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c index 21292bb..5df5f36 100644 --- a/xen/arch/x86/hvm/svm/vmcb.c +++ b/xen/arch/x86/hvm/svm/vmcb.c @@ -138,6 +138,8 @@ static int construct_vmcb(struct vcpu *v) /* Guest EFER. */ v->arch.hvm_vcpu.guest_efer = 0; + if ( is_pvh_vcpu(v) ) + v->arch.hvm_vcpu.guest_efer |= EFER_LMA; /* PVH 32bitfixme */ hvm_update_guest_efer(v); /* Guest segment limits. */ @@ -162,7 +164,12 @@ static int construct_vmcb(struct vcpu *v) vmcb->ds.attr.bytes = 0xc93; vmcb->fs.attr.bytes = 0xc93; vmcb->gs.attr.bytes = 0xc93; - vmcb->cs.attr.bytes = 0xc9b; /* exec/read, accessed */ + + if ( is_pvh_vcpu(v) ) + /* CS.L == 1, exec, read/write, accessed. PVH 32bitfixme. */ + vmcb->cs.attr.bytes = 0xa9b; + else + vmcb->cs.attr.bytes = 0xc9b; /* exec/read, accessed */ /* Guest IDT. */ vmcb->idtr.base = 0; @@ -184,12 +191,17 @@ static int construct_vmcb(struct vcpu *v) vmcb->tr.limit = 0xff; v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_PE | X86_CR0_ET; + /* PVH domains start in paging mode */ + if ( is_pvh_vcpu(v) ) + v->arch.hvm_vcpu.guest_cr[0] |= X86_CR0_PG; hvm_update_guest_cr(v, 0); - v->arch.hvm_vcpu.guest_cr[4] = 0; + v->arch.hvm_vcpu.guest_cr[4] = is_pvh_vcpu(v) ? X86_CR4_PAE : 0; hvm_update_guest_cr(v, 4); - paging_update_paging_modes(v); + /* For pvh, paging mode is updated by arch_set_info_guest(). */ + if ( is_hvm_vcpu(v) ) + paging_update_paging_modes(v); vmcb->_exception_intercepts = HVM_TRAP_MASK -- 1.8.3.1