From patchwork Tue Jun 6 10:03:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 103146 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp1185870obh; Tue, 6 Jun 2017 03:05:20 -0700 (PDT) X-Received: by 10.36.54.14 with SMTP id l14mr12621581itl.81.1496743520582; Tue, 06 Jun 2017 03:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496743520; cv=none; d=google.com; s=arc-20160816; b=NtbiOoeie8pG5yHcMI6SZWKvgDsbtg2+qJ9PfV1cm2LzXgOG3DydQZOUS5yPlww+iw o1xGLIRukeSvICnEZM7pEENHSAToJwyEq373k0vwP6PirXCryMASrVlomsDd5Vc6JXaF yFnTW9+kXMPJ8ApIdLUwtUywjW+5EIPDFoAz19byHkxPo8h3sgvZTr5i3pulYO2HjFIT fgCuZ5nHfGID+dFT0MqGdsxsQbRQXwQ6TbLkVdk3UwwkOOhHxFepKUTt2EPm9yoOyxOa bFvYJPv5tUUY/95rLyoV3YlDZ4jQGKbRzajyOROG8wSy899MdGk4SiDUggR6LZjFkeQ9 Mb2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:message-id:date:to:from:dkim-signature :arc-authentication-results; bh=/1RCaGOD1B+XRNKEpIEn/iiIh2Ua4U2oNCo7NbVUC0A=; b=Cl9+dpWuB5eAQqeEUYz0ARwnH1HhXaeGzDK3JMxVWpVcLYIylptAUtswjgaL39YUjM EtV3XV5P/ekaLrib/JT8NHf+hJ/BlZ1wE1Jmb/i6qbimrQwtFqlz3mKKR1IgrTcBFSLe HNhME9XnFB+fwhtjmT/bujEC+6Sh9hY7JGuqKWVyO4KL9rB1H2kdoUuXw+q7TguPpGsa 8wPBvJtawgvr+xAQT8tKlW/k8/dYXe6+jDhCQgqHrRXxfjhHgMvJm/27qXq0UHMn48tp qY72Gm84OLXZT/l7lRAfmAnwj/i/hbFvMz5OUd30wL8DvkIgkNSXuJiSTOa5ewy8743Y r1FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n127si35871391iof.10.2017.06.06.03.05.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 03:05:20 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIBKr-0003j6-B7; Tue, 06 Jun 2017 10:03:37 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIBKp-0003iR-Lh for xen-devel@lists.xenproject.org; Tue, 06 Jun 2017 10:03:35 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id 84/A6-03696-6FD76395; Tue, 06 Jun 2017 10:03:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkkeJIrShJLcpLzFFi42Lxqg3W1v1WaxZ pcPyBsMX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmrHz/Hamgq3SFWdP32VvYHwq1sXIxSEkMINR 4t6XVkYQh0WgnVni1dNnLCCOhMA7Fol/fQfZuxg5gZw0iZfHNrNB2JUSW9YfZwWxhQS0JI6em s0KMWo/k8StmVOBGjg42ARMJGZ1SIDUiAgoSdxbNZkJpIZZYD6jRNOkXrBBwgIREpP/7WACsV kEVCVONrxlAbF5BbwlJh6YxAyxTE7i5rlO5gmMfAsYGVYxahSnFpWlFukamuolFWWmZ5TkJmb m6BoamOnlphYXJ6an5iQmFesl5+duYgQGCwMQ7GD8tizgEKMkB5OSKG9tglmkEF9SfkplRmJx RnxRaU5q8SFGGQ4OJQneSTVAOcGi1PTUirTMHGDYwqQlOHiURHiVK4HSvMUFibnFmekQqVOMu hyTDmz/wiTEkpeflyolzjsBZIYASFFGaR7cCFgMXWKUlRLmZQQ6SoinILUoN7MEVf4VozgHo5 Iw7zeQKTyZeSVwm14BHcEEdATfJROQI0oSEVJSDYyqrv5rWJqbRVJ6QraY7Jzye+6ke+4tpdX HH/6fvuq/7c7Qf5rfT7P39yrIZyhP2JSwY+8vgc0HDm0+a7rqxTNt+wxTswN8Dkm7lI7cj952 49jWqJI1d+4pCfWeKlTZllZe+IyjeG+sp2PD2T8Siz73/b8dtqRzwdTdPKeO/nHiOOyrfj7UJ U5GiaU4I9FQi7moOBEANG6y8JwCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-12.tower-27.messagelabs.com!1496743413!104790962!1 X-Originating-IP: [74.125.83.43] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42604 invoked from network); 6 Jun 2017 10:03:34 -0000 Received: from mail-pg0-f43.google.com (HELO mail-pg0-f43.google.com) (74.125.83.43) by server-12.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 6 Jun 2017 10:03:34 -0000 Received: by mail-pg0-f43.google.com with SMTP id a70so25949216pge.3 for ; Tue, 06 Jun 2017 03:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=z043AG2qSiT1hQEwsXl5IeQYcXGqWLwAsIAfHafvJXw=; b=g+b9NzeU4QEW/S8TtaMfGtlyPhoWFkzDqU59cUo4tOdE9TCrYPcOCFrS1643vnUo/T H/gLM3tjPZTclzTnZDe8sJhzsYaRqZTDvGvWSXQrK8qhhffY/DNfDO0bVRP8J02aXKl+ p8Wf2cC3wzeUWO8KP5NXCEgX5su+jYl1kCXfA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=z043AG2qSiT1hQEwsXl5IeQYcXGqWLwAsIAfHafvJXw=; b=ksIT+CNyOYeoNBwMvMvbj2PH7V2L5RmgxY4PPOGnpj5CY5sN0WZR2Xks585APe7ihR iw5X5h0kX55jdJq9XkBE23NoG5dhaEFEPi391Twe1eaOYZHeotOhp1scjLYIHYEC2Sju 8wnxhVNXU+bRZzpaTtMOlL4PubF6QZXEaSTBqaSsJTkeMII06xmjWqoF1pKmi0+8HLaR 0DESiK8kpnzz5cLBnJz1ZqmOrH48TvhDn7nKiyCnEOviTo5Hz00qf95XpBPpFCMvm27/ DkEC2Yc5/7Yn7DiAwto0d9dAWsbefEEmHiPG2U56TZLuBRzvYeUR5mjaK5M3KJ2K1B3s 3YRw== X-Gm-Message-State: AODbwcBnYI11lS8ZUpYl/zACKAvMsUNXtvZjtdz8DYuhuk2Crg8XA4eE uKiWrxCBg0E3iCTZqct1Mg== X-Received: by 10.98.77.129 with SMTP id a123mr4921420pfb.13.1496743412423; Tue, 06 Jun 2017 03:03:32 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id c23sm54770666pfh.131.2017.06.06.03.03.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jun 2017 03:03:32 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 6 Jun 2017 15:33:27 +0530 Message-Id: <1496743407-15682-1-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 05/14 v4] xen/arm: vpl011: Allocate a new GFN in the toolstack for vuart X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Allocate a new gfn to be used as a ring buffer between xenconsole and Xen for sending/receiving pl011 console data. Signed-off-by: Bhupinder Thakur --- Changes since v3: - Added a new helper function xc_get_vuart_gfn() to return the GFN allocated for vpl011. - Since a new function has been added in this patch, I have not included Stefano's reviewed-by and Wei's acked-by tags. Changes since v2: - Removed the DOMCTL call to set the GFN as now this information is passed in the DOMCTL call to initialize vpl011 emulation. tools/libxc/include/xc_dom.h | 3 +++ tools/libxc/xc_dom_arm.c | 12 +++++++++++- tools/libxc/xc_dom_boot.c | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h index ce47058..1cde2b7 100644 --- a/tools/libxc/include/xc_dom.h +++ b/tools/libxc/include/xc_dom.h @@ -216,6 +216,8 @@ struct xc_dom_image { /* Extra SMBIOS structures passed to HVMLOADER */ struct xc_hvm_firmware_module smbios_module; + + xen_pfn_t vuart_gfn; }; /* --- pluggable kernel loader ------------------------------------- */ @@ -334,6 +336,7 @@ int xc_dom_gnttab_seed(xc_interface *xch, domid_t domid, domid_t console_domid, domid_t xenstore_domid); bool xc_dom_translated(const struct xc_dom_image *dom); +xen_pfn_t xc_get_vuart_gfn(void); /* --- debugging bits ---------------------------------------------- */ diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index e7d4bd0..89d0d37 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -26,10 +26,11 @@ #include "xg_private.h" #include "xc_dom.h" -#define NR_MAGIC_PAGES 3 +#define NR_MAGIC_PAGES 4 #define CONSOLE_PFN_OFFSET 0 #define XENSTORE_PFN_OFFSET 1 #define MEMACCESS_PFN_OFFSET 2 +#define VUART_PFN_OFFSET 3 #define LPAE_SHIFT 9 @@ -64,6 +65,13 @@ static int setup_pgtables_arm(struct xc_dom_image *dom) /* ------------------------------------------------------------------------ */ +xen_pfn_t xc_get_vuart_gfn() +{ + const xen_pfn_t base = GUEST_MAGIC_BASE >> XC_PAGE_SHIFT; + + return base + VUART_PFN_OFFSET; +} + static int alloc_magic_pages(struct xc_dom_image *dom) { int rc, i; @@ -85,10 +93,12 @@ static int alloc_magic_pages(struct xc_dom_image *dom) dom->console_pfn = base + CONSOLE_PFN_OFFSET; dom->xenstore_pfn = base + XENSTORE_PFN_OFFSET; + dom->vuart_gfn = base + VUART_PFN_OFFSET; xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn); xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn); xc_clear_domain_page(dom->xch, dom->guest_domid, base + MEMACCESS_PFN_OFFSET); + xc_clear_domain_page(dom->xch, dom->guest_domid, base + VUART_PFN_OFFSET); xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_PFN, dom->console_pfn); xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_STORE_PFN, diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c index c3b44dd..8a376d0 100644 --- a/tools/libxc/xc_dom_boot.c +++ b/tools/libxc/xc_dom_boot.c @@ -226,6 +226,8 @@ int xc_dom_boot_image(struct xc_dom_image *dom) return rc; if ( (rc = clear_page(dom, dom->xenstore_pfn)) != 0 ) return rc; + if ( (rc = clear_page(dom, dom->vuart_gfn)) != 0 ) + return rc; /* start info page */ if ( dom->arch_hooks->start_info )