From patchwork Tue Jun 6 17:25:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 103169 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp1536596qgd; Tue, 6 Jun 2017 10:27:39 -0700 (PDT) X-Received: by 10.107.20.145 with SMTP id 139mr26985095iou.11.1496770059304; Tue, 06 Jun 2017 10:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496770059; cv=none; d=google.com; s=arc-20160816; b=lBkkMWuOTCZeIZa+VeWfriTPtThlvK2DMH0uak+jYxxBlxjflUG9e2ZJi1w7X+BR+w XjifUvtXV/uOSXeq7huiO1950YzwmHAFKyHsyebp4QelpYXw4nTeBUr4uXWGh/WqUwof SeCHKGUuNxL2AF/bePGIbYYgo4UhSpNFPvFw9HCpEfaYwucjj2modZXI3LVRgdgraI3/ 05n7vpj6q1yY0068ogpzxYCq4VWzNXSGT3VYXmZHrZ+BszdRwkaGG009nQmdOt/Pf/Dp gBvyS1dXKO7LTyNHk7zTLIM6Kerj6y3RzpXCt0Z2RyKY79sQBRp+0J31eTjPna02XMkG RDzw== 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:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=bftm4WadwKfLG/hdPStLCu9Z4GlXQnB8jG6KxBrAROg=; b=J12VtKfYYWSiRH2BotpbPtlgANHeQgmn1tlkdpkRxNKNR+MF+dsUpdE17tuI5/Ffab b1jv0Bi3dK0Q39C9jcksJ4uyM2z4DnDK/1QIBdwa7CNVT/w4PyG2e2tiNj1HiVnGuDHu nGJBwbgsHgk7H/30oYObDai5HK5luVJSNZPtz63tnUbGxA9B5yzND72evRJqHpdkySdM 2jq8WR6vJd7VSrVlmMvZ40f3fIaQlYjKZzHCQISE5W64PwnzpwHVmf6s5ASdYkpAQEYc 5UR/Uio9CtRTbFk5V9g8L9gQKQxyY8ainMk2WPQKmkClLkBJZGg333J0AJsNWNNjhBgc dEgA== 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 t26si34727589ioi.151.2017.06.06.10.27.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 10:27:39 -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 1dIIEs-0001bp-Hl; Tue, 06 Jun 2017 17:25:54 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIIEr-0001ar-Om for xen-devel@lists.xenproject.org; Tue, 06 Jun 2017 17:25:53 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 70/46-02006-0A5E6395; Tue, 06 Jun 2017 17:25:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsVyMfTANt0FT80 iDb5c4bP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDM2fL3AWnBRuuLj31bWBsafYl2MXBxCAjMY JVa82swO4rAIzGOW2Dx3MjOIIyHQzyrRcaubpYuRE8hJk2jZvo8Nwq6S2Hy3hRXEFhLQkjh6a jYrxKhmJonV3VOAujk42ARMJGZ1SIDUiAgoSdxbNZkJpIZZYD6jRNOkXrBBwgIREpP/7WACqW cRUJWYNMMPJMwr4C2x92A3I8QuOYmb5zqZQWxOAR+JmeeXMELs9ZbY09DGOIFRYAEjwypGjeL UorLUIl0jM72kosz0jJLcxMwcXUMDU73c1OLixPTUnMSkYr3k/NxNjMDQqmdgYNzBeHuy3yFG SQ4mJVHeyEtmkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeCOfAOUEi1LTUyvSMnOAQQ6TluDgU RLhnfwAKM1bXJCYW5yZDpE6xWjMceXKui9MHFMObP/CJMSSl5+XKiXOuwJkkgBIaUZpHtwgWP RdYpSVEuZlZGBgEOIpSC3KzSxBlX/FKM7BqCTMmwIyhSczrwRu3yugU5iATuG7ZAJySkkiQkq qgdHrySYJj6enJ0utStrsvNvhvvEkEQbNQ8lXVT08VcW6b/3e889D1Nf5cVfKBalF//r3FizZ 2Nly7r3iU2uuk/veGtpx1om/j5nBX+zY8OrvWdPu2xr7LfwCz/YfandX/DbjeKD1tc/1n80tt IsN+iK3r+zfZfDA7xT/vgfM0h+6Q288OrBGyFeJpTgj0VCLuag4EQDgKzfguQIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-14.tower-206.messagelabs.com!1496769950!63306918!1 X-Originating-IP: [209.85.192.182] 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 44283 invoked from network); 6 Jun 2017 17:25:51 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-14.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 6 Jun 2017 17:25:51 -0000 Received: by mail-pf0-f182.google.com with SMTP id x63so2102984pff.3 for ; Tue, 06 Jun 2017 10:25:50 -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:in-reply-to:references; bh=7Y8k5BD7EVf7eZ+CjzIjc9lGlzP8uFPbGxSAN8US9UY=; b=QvTDGzE0d+CiNbToXICC8t/AZXP913VJZRAyQhLM8Jtrp6IEwascvXNt2UA/PJFeWy DJoUGFlD3RzvfoKckUY/bPGMqQ1hA/eQ5/S/vZ4uaieqNekdHT5ucxfg16MGPzZVtwVG RlFf2D4YidL7Fv3XWdrczdoS29dhW/ZY+AriQ= 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:in-reply-to :references; bh=7Y8k5BD7EVf7eZ+CjzIjc9lGlzP8uFPbGxSAN8US9UY=; b=B0Dx8b/SRDEwL+SoG53N4smSX/NmFkP0rn5ZCngEMTSF5ukYr98MdVh/J591gXXUKt DNXsKLRUizUIDEvbkl8WWJKgjIqPWwQVWJjT8VXt3wRct2Bx6kaEzcd3JM3xxl0PlL5+ Ifb3jzREymQGz01rmnVijM9fgQh2lfrS5+IgL2Sz8sFyVyg7d2eCMUnB3c2yRSZp74gB fKeZF8igRLX8m783V8aTOReMzW5W8ISKXqrl9ieSSwAK+S0GfpXSEd8ckhJTkuOQ3yUp xTY0zgqkcUs3Bki1uJa1OWuWp9H/oHEJl2T6RQlFekV+w82tl5IksmAb3+VdmHkv+wmT YCzQ== X-Gm-Message-State: AODbwcCkqDPR93cvjUtfBcTnWFDv35rZm1TBR3TuBWoe/mjAVB+9mg31 D5Twj56W9Zf37Wgt3C3xWQ== X-Received: by 10.98.99.193 with SMTP id x184mr1296226pfb.101.1496769949430; Tue, 06 Jun 2017 10:25:49 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id 62sm6031632pfr.90.2017.06.06.10.25.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jun 2017 10:25:49 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 6 Jun 2017 22:55:20 +0530 Message-Id: <1496769929-23355-6-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496769929-23355-1-git-send-email-bhupinder.thakur@linaro.org> References: <1496769929-23355-1-git-send-email-bhupinder.thakur@linaro.org> 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 Acked-by: Stefano Stabellini Acked-by: Wei Liu --- CC: ij CC: wl CC: ss CC: jg 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 )