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: 9769321 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A1B6160352 for ; Tue, 6 Jun 2017 17:27:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 966A720373 for ; Tue, 6 Jun 2017 17:27:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B63D28469; Tue, 6 Jun 2017 17:27:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F23F220373 for ; Tue, 6 Jun 2017 17:27:54 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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 )