From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yu, Zhang" Subject: Re: [PATCH v7 2/3] Differentiate IO/mem resources tracked by ioreq server Date: Fri, 21 Aug 2015 18:25:45 +0800 Message-ID: <55D6FCA9.3030305@linux.intel.com> References: <1440127855-18979-1-git-send-email-yu.c.zhang@linux.intel.com> <1440127855-18979-3-git-send-email-yu.c.zhang@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Tian, Kevin" , "xen-devel@lists.xen.org" , "Paul.Durrant@citrix.com" , "ian.jackson@eu.citrix.com" , "stefano.stabellini@eu.citrix.com" , "ian.campbell@citrix.com" , "wei.liu2@citrix.com" , "keir@xen.org" , "jbeulich@suse.com" , "andrew.cooper3@citrix.com" Cc: "Lv, Zhiyuan" List-Id: xen-devel@lists.xenproject.org On 8/21/2015 2:35 PM, Tian, Kevin wrote: >> From: Yu Zhang [mailto:yu.c.zhang@linux.intel.com] >> Sent: Friday, August 21, 2015 11:31 AM >> >> Currently in ioreq server, guest write-protected ram pages are >> tracked in the same rangeset with device mmio resources. Yet >> unlike device mmio, which can be in big chunks, the guest write- >> protected pages may be discrete ranges with 4K bytes each. This >> patch uses a seperate rangeset for the guest ram pages. >> >> Note: Previously, a new hypercall or subop was suggested to map >> write-protected pages into ioreq server. However, it turned out >> handler of this new hypercall would be almost the same with the >> existing pair - HVMOP_[un]map_io_range_to_ioreq_server, and there's >> already a type parameter in this hypercall. So no new hypercall >> defined, only a new type is introduced. >> >> Signed-off-by: Yu Zhang >> --- >> tools/libxc/include/xenctrl.h | 31 ++++++++++++++++++++ >> tools/libxc/xc_domain.c | 61 >> ++++++++++++++++++++++++++++++++++++++++ >> xen/arch/x86/hvm/hvm.c | 23 ++++++++++++++- >> xen/include/asm-x86/hvm/domain.h | 4 +-- >> xen/include/public/hvm/hvm_op.h | 1 + >> 5 files changed, 117 insertions(+), 3 deletions(-) >> >> diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h >> index de3c0ad..eb1a526 100644 >> --- a/tools/libxc/include/xenctrl.h >> +++ b/tools/libxc/include/xenctrl.h >> @@ -2010,6 +2010,37 @@ int >> xc_hvm_unmap_io_range_from_ioreq_server(xc_interface *xch, >> int is_mmio, >> uint64_t start, >> uint64_t end); >> +/** >> + * This function registers a range of write-protected memory for emulation. >> + * >> + * @parm xch a handle to an open hypervisor interface. >> + * @parm domid the domain id to be serviced >> + * @parm id the IOREQ Server id. >> + * @parm start start of range >> + * @parm end end of range (inclusive). >> + * @return 0 on success, -1 on failure. >> + */ >> +int xc_hvm_map_mem_range_to_ioreq_server(xc_interface *xch, >> + domid_t domid, >> + ioservid_t id, >> + xen_pfn_t start, >> + xen_pfn_t end); >> + >> +/** >> + * This function deregisters a range of write-protected memory for emulation. >> + * s>> + * @parm xch a handle to an open hypervisor interface. >> + * @parm domid the domain id to be serviced >> + * @parm id the IOREQ Server id. >> + * @parm start start of range >> + * @parm end end of range (inclusive). >> + * @return 0 on success, -1 on failure. >> + */ >> +int xc_hvm_unmap_mem_range_from_ioreq_server(xc_interface *xch, >> + domid_t domid, >> + ioservid_t id, >> + xen_pfn_t start, >> + xen_pfn_t end); >> >> /** >> * This function registers a PCI device for config space emulation. >> diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c >> index 2ee26fb..34f138d 100644 >> --- a/tools/libxc/xc_domain.c >> +++ b/tools/libxc/xc_domain.c >> @@ -1552,6 +1552,67 @@ int >> xc_hvm_unmap_io_range_from_ioreq_server(xc_interface *xch, domid_t domid, >> return rc; >> } >> >> +int xc_hvm_map_mem_range_to_ioreq_server(xc_interface *xch, >> + domid_t domid, >> + ioservid_t id, >> + xen_pfn_t start, >> + xen_pfn_t end) >> +{ > > Given that this memory range is write-protected, it might be clearer > to have wp in function name. Otherwise it's easy to mistake the > interface as both r/w covered for the range. Or if you want this > interface to be more generic, then a flag parameter would be required > to further specify wp attribute. > > Thanks > Kevin > Thanks, Kevin. Maybe xc_hvm_[un]map_wp_mem_range_to_ioreq_server is clearer. Yu > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel > >