From: "Jan Beulich" Subject: Re: [PATCH 1/2] pvh: clearly specify used parameters in vcpu_guest_context Date: Tue, 19 Nov 2013 13:32:44 +0000 Message-ID: <528B768C0200007800104810@nat28.tlf.novell.com> References: <1384864488-5194-1-git-send-email-roger.pau@citrix.com> <1384864488-5194-2-git-send-email-roger.pau@citrix.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 1VilQ7-00037t-NY for xen-devel@lists.xenproject.org; Tue, 19 Nov 2013 13:32:47 +0000 In-Reply-To: <1384864488-5194-2-git-send-email-roger.pau@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau Monne Cc: George Dunlap , xen-devel@lists.xenproject.org, Keir Fraser , Tim Deegan List-Id: xen-devel@lists.xenproject.org >>> On 19.11.13 at 13:34, Roger Pau Monne wrote: > @@ -704,9 +705,13 @@ int arch_set_info_guest( > /* PVH 32bitfixme */ > ASSERT(!compat); > > - if ( c(ctrlreg[1]) || c(ldt_base) || c(ldt_ents) || > + if ( (c(ctrlreg[0]) & HVM_CR0_GUEST_RESERVED_BITS) || > + (c(ctrlreg[4]) & HVM_CR4_GUEST_RESERVED_BITS(v)) || > + c(ctrlreg[1]) || c(ctrlreg[2]) || c(ctrlreg[5]) || > + c(ctrlreg[6]) || c(ctrlreg[7]) || c(ldt_base) || c(ldt_ents) || > c(user_regs.cs) || c(user_regs.ss) || c(user_regs.es) || > c(user_regs.ds) || c(user_regs.fs) || c(user_regs.gs) || > + c(kernel_ss) || c(kernel_sp) || c.nat->gs_base_kernel || > c.nat->gdt_ents || c.nat->fs_base || c.nat->gs_base_user ) > return -EINVAL; > } Still no checking of debugreg[]? > @@ -745,17 +750,21 @@ int arch_set_info_guest( > > if ( has_hvm_container_vcpu(v) ) > { > - /* > - * NB: TF_kernel_mode is set unconditionally for HVM guests, > - * so we always use the gs_base_kernel here. If we change this > - * function to imitate the PV functionality, we'll need to > - * make it pay attention to the kernel bit. > - */ > - hvm_set_info_guest(v, compat ? 0 : c.nat->gs_base_kernel); > + hvm_set_info_guest(v); > > if ( is_hvm_vcpu(v) || v->is_initialised ) > goto out; > > + if ( c.nat->ctrlreg[0] ) { Coding style. > + v->arch.hvm_vcpu.guest_cr[0] |= c.nat->ctrlreg[0]; Did you really mean |= here? I would expect to simply fail a request when certain required bits aren't set. Also, by now honoring CR0 and CR4 settings, you again move towards the hybrid model (some fields honored, some refused) that was (I think by you) previously described as unacceptable. Jan