From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arianna Avanzini Subject: [RFC PATCH v2 3/3] tools, libxl: handle the iomem parameter with the memory_mapping hcall Date: Mon, 10 Mar 2014 09:25:53 +0100 Message-ID: <1394439953-5723-4-git-send-email-avanzini.arianna@gmail.com> References: <1394439953-5723-1-git-send-email-avanzini.arianna@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1394439953-5723-1-git-send-email-avanzini.arianna@gmail.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: xen-devel@lists.xen.org Cc: Ian.Campbell@eu.citrix.com, paolo.valente@unimore.it, stefano.stabellini@eu.citrix.com, dario.faggioli@citrix.com, Ian.Jackson@eu.citrix.com, julien.grall@citrix.com, etrudeau@broadcom.com, avanzini.arianna@gmail.com, viktor.kleinik@globallogic.com List-Id: xen-devel@lists.xenproject.org Currently, the configuration-parsing code concerning the handling of the iomem parameter only invokes the XEN_DOMCTL_iomem_permission hypercall. This commit lets the XEN_DOMCTL_memory_mapping hypercall be invoked after XEN_DOMCTL_iomem_permission when the iomem parameter is parsed from a domU configuration file, so that the address range can be mapped to the address space of the domU. NOTE: the added code is still common to both x86 and ARM; it also implements a simple 1:1 mapping that could clash with the domU's existing memory layout if the range is already in use in the guest's address space. Signed-off-by: Arianna Avanzini Cc: Dario Faggioli Cc: Paolo Valente Cc: Stefano Stabellini Cc: Julien Grall Cc: Ian Campbell Cc: Ian Jackson Cc: Eric Trudeau Cc: Viktor Kleinik --- tools/libxl/libxl_create.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index a604cd8..6c206c3 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1099,6 +1099,23 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, "failed give dom%d access to iomem range %"PRIx64"-%"PRIx64, domid, io->start, io->start + io->number - 1); ret = ERROR_FAIL; + } else { + /* + * NOTE: the following code is still common to both x86 + * and ARM; it also implements a simple 1:1 mapping + * that could clash with the domU's existing memory + * layout if the range is already in use in the + * guest's address space. + */ + ret = xc_domain_memory_mapping(CTX->xch, domid, + io->start, io->start, + io->number, 1); + if (ret < 0) { + LOGE(ERROR, + "failed to map to dom%d iomem range %"PRIx64"-%"PRIx64, + domid, io->start, io->start + io->number - 1); + ret = ERROR_FAIL; + } } } -- 1.9.0