From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v3 11/13] x86/altp2m: define and implement alternate p2m HVMOP types. Date: Mon, 6 Jul 2015 11:09:25 +0100 Message-ID: <559A53D5.5030209@citrix.com> References: <1435774177-6345-1-git-send-email-edmund.h.white@intel.com> <1435774177-6345-12-git-send-email-edmund.h.white@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1435774177-6345-12-git-send-email-edmund.h.white@intel.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: Ed White , xen-devel@lists.xen.org Cc: Ravi Sahita , Wei Liu , George Dunlap , Tim Deegan , Ian Jackson , Jan Beulich , tlengyel@novetta.com, Daniel De Graaf List-Id: xen-devel@lists.xenproject.org On 01/07/15 19:09, Ed White wrote: > Signed-off-by: Ed White I am still very much unconvinced by the argument against having a single HVMOP_altp2m and a set of subops. do_domctl() and do_sysctl() are examples of a subop style hypercall with different XSM settings for different subops. Furthermore, factoring out a do_altp2m_op() handler would allow things like the hvm_altp2m_supported() check to be made common. Factoring further to having a named common header of a subop and a domid at the head of every subop structure would allow all the domain rcu locking to become common outside of the subop switch. In addition, > + case HVMOP_altp2m_vcpu_enable_notify: > + { > + struct domain *curr_d = current->domain; > + struct vcpu *curr = current; > + struct xen_hvm_altp2m_vcpu_enable_notify a; > + p2m_type_t p2mt; > + > + if ( copy_from_guest(&a, arg, 1) ) > + return -EFAULT; > + > + if ( !is_hvm_domain(curr_d) || !hvm_altp2m_supported() || > + !curr_d->arch.altp2m_active || > + gfn_x(vcpu_altp2m(curr).veinfo_gfn) != INVALID_GFN) Brackets around the boolean operation on this line, and a space inside the final bracket. > +/* Notify that a page of memory is to have specific access types */ > +#define HVMOP_altp2m_set_mem_access 30 > +struct xen_hvm_altp2m_set_mem_access { > + /* Domain to be updated. */ > + domid_t domid; > + /* view */ > + uint16_t view; > + /* Memory type */ > + uint16_t hvmmem_access; /* xenmem_access_t */ Explicit padding bytes here please. > + /* gfn */ > + uint64_t gfn; > +}; > +typedef struct xen_hvm_altp2m_set_mem_access xen_hvm_altp2m_set_mem_access_t; > +DEFINE_XEN_GUEST_HANDLE(xen_hvm_altp2m_set_mem_access_t); > + > +/* Change a p2m entry to have a different gfn->mfn mapping */ > +#define HVMOP_altp2m_change_gfn 31 > +struct xen_hvm_altp2m_change_gfn { > + /* Domain to be updated. */ > + domid_t domid; > + /* view */ > + uint16_t view; And here. ~Andrew > + /* old gfn */ > + uint64_t old_gfn; > + /* new gfn, INVALID_GFN (~0UL) means revert */ > + uint64_t new_gfn; > +}; > +typedef struct xen_hvm_altp2m_change_gfn xen_hvm_altp2m_change_gfn_t; > +DEFINE_XEN_GUEST_HANDLE(xen_hvm_altp2m_change_gfn_t); > + > #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ > > /*