From patchwork Fri Apr 28 16:01:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 9705017 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 CF01160225 for ; Fri, 28 Apr 2017 16:04:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C05B628688 for ; Fri, 28 Apr 2017 16:04:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B56732868F; Fri, 28 Apr 2017 16:04:01 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, 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 52D8A28688 for ; Fri, 28 Apr 2017 16:04:01 +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 1d48L6-00007N-Sq; Fri, 28 Apr 2017 16:01:48 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d48L6-00006x-0I for xen-devel@lists.xenproject.org; Fri, 28 Apr 2017 16:01:48 +0000 Received: from [85.158.139.211] by server-17.bemta-5.messagelabs.com id 2A/0F-22906-B6763095; Fri, 28 Apr 2017 16:01:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRWlGSWpSXmKPExsVyMfTANt2sdOZ Ig4mbtS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyph9cyFuyQrvi19D9rA+NP0S5GLg4hgZmM Ese6vrCBOCwC85glFr25yQTiSAj0s0r8+tfK3sXIAeTESWw+Gd7FyAlkVkkc7p7DCmILCWhJH D01mxViUjOTxIHjr5lA6tkETCRmdUiA1IgIKEncWzUZbCazwFtGif6Pp8CahQWiJSYdXMkOYr MIqEpsOTqZEcTmFfCWWLnuKAvEMjmJm+c6mUFsTgEfiWv9y9ghFntLdDfMY5nAKLCAkWEVo3p xalFZapGuhV5SUWZ6RkluYmaOrqGBqV5uanFxYnpqTmJSsV5yfu4mRmBgMQDBDsaDzc6HGCU5 mJREeSvdmSOF+JLyUyozEosz4otKc1KLDzHKcHAoSfAKpAHlBItS01Mr0jJzgCEOk5bg4FES4 ZUASfMWFyTmFmemQ6ROMRpzvLj8/j0Tx5OVP94zCbHk5eelSonzdqUClQqAlGaU5sENgsXeJU ZZKWFeRqDThHgKUotyM0tQ5V8xinMwKgnzKoEs5MnMK4Hb9wroFCagU1hcGEBOKUlESEk1MBa WbeRbsOXi1kORdxc8VfJsLti7LTZ/G9PnbXdEbmfUmnPu/8Er9Kmw2Lb3SGWEYeGHnW9jlyoE Wez4wvjvnY7CKZs1EvtXBS1dYygid7GPc6a9e9BF/VVZb44InYyYs+vI9gz3e6uvvGh9pK+zM id667OJWbcvKKmGnOt33lJ41MA86TJvzh8lluKMREMt5qLiRACvJWq3uAIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-4.tower-206.messagelabs.com!1493395304!95568128!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.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20590 invoked from network); 28 Apr 2017 16:01:45 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-4.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Apr 2017 16:01:45 -0000 Received: by mail-pf0-f182.google.com with SMTP id v14so50599049pfd.2 for ; Fri, 28 Apr 2017 09:01:45 -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=J5Hxb4UQMt0y51QQuXFpitTz/GSUyQSdbI8PLgC5wPw=; b=d6WJ+7CICsry/SJJttXt0RtILNLTfckPx5KjB8jzHedLy1gGhC3AgdJUH4QHBo55jX nzZ2uz9oO69Xs1zoxWEF6hDm1c/IVojF7MQuyRnlAcbymJx5baBXmbX9UtaUyJ+yfAL4 vgvnOP4BaCmMa6GMM22rFJxOTrgqiLx918hYo= 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=J5Hxb4UQMt0y51QQuXFpitTz/GSUyQSdbI8PLgC5wPw=; b=VEHNBwvZ0IB907x+qKiimQ0ovdmY+vJylrHOleozmzWLIc/ld3TQtiKq/9AX3CSVQ5 xHswdpmxFrva8ibnsno/WR5sdXpa48N03LKF/6cbk48hkODjqsUZinWDIAwiYdKIzECb GG+Lg8IXiZuU+j6jM1zhD8SKQWgmulcW/8aNqU5LnkFZJZ/UuQFwti01sv9/aVndwD98 yN/o4jnJsEElhQbD4AMkCfv8/K83FlNK5ar2N4cwGeSiNY12U2C3L9q1qkUpgT4X20/3 bhZzzGxakykiWh4ZSbcU3ss9V01oTlKNE9wMt8JONQL10IYwei1I2+zo5p/KyqKoN84m Ju5Q== X-Gm-Message-State: AN3rC/6QI9YPHwMzNHaHwgKtO1f/YQp+L/UHsZ1sMbm/nJOGKH2hDoIP nkz8pRxyrxVfxNb2 X-Received: by 10.98.24.213 with SMTP id 204mr12358509pfy.237.1493395303835; Fri, 28 Apr 2017 09:01:43 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id n65sm9870239pga.8.2017.04.28.09.01.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Apr 2017 09:01:43 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 28 Apr 2017 21:31:17 +0530 Message-Id: <1493395284-18430-4-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493395284-18430-1-git-send-email-bhupinder.thakur@linaro.org> References: <1493395284-18430-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Stefano Stabellini , Wei Liu , Andrew Cooper , Ian Jackson , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH 03/10 v2] xen/arm: vpl011: Enable pl011 emulation for a guest domain in Xen 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 Vpl011 emulation is enabled for a guest domain in Xen only when it is enabled through an option in libxl provided by the user through guest configuration. The pl011 enable/disable knob in libxl is introduced in the following patch: xen/arm: vpl011: Add support for vuart in libxl Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini --- xen/arch/arm/domain.c | 6 ++++++ xen/common/domctl.c | 3 +++ xen/include/public/domctl.h | 2 ++ xen/include/xen/sched.h | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 76310ed..23baa81 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -36,6 +36,7 @@ #include #include "vtimer.h" #include "vuart.h" +#include DEFINE_PER_CPU(struct vcpu *, curr_vcpu); @@ -631,6 +632,9 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, if ( (rc = domain_vtimer_init(d, config)) != 0 ) goto fail; + if ( domcr_flags & DOMCRF_vuart ) + if ( (rc = domain_vpl011_init(d, config)) != 0 ) + goto fail; update_domain_wallclock_time(d); /* @@ -665,6 +669,8 @@ fail: void arch_domain_destroy(struct domain *d) { + domain_vpl011_deinit(d); + /* IOMMU page table is shared with P2M, always call * iommu_domain_destroy() before p2m_teardown(). */ diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 951a5dc..902dd71 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -501,6 +501,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) | XEN_DOMCTL_CDF_hap | XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off + | XEN_DOMCTL_VUART_enable | XEN_DOMCTL_CDF_xs_domain)) ) break; @@ -539,6 +540,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) domcr_flags |= DOMCRF_oos_off; if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_xs_domain ) domcr_flags |= DOMCRF_xs_domain; + if ( op->u.createdomain.flags & XEN_DOMCTL_VUART_enable ) + domcr_flags |= DOMCRF_vuart; d = domain_create(dom, domcr_flags, op->u.createdomain.ssidref, &op->u.createdomain.config); diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index 8bee0c3..c307013 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -63,6 +63,8 @@ struct xen_domctl_createdomain { /* Is this a xenstore domain? */ #define _XEN_DOMCTL_CDF_xs_domain 4 #define XEN_DOMCTL_CDF_xs_domain (1U<<_XEN_DOMCTL_CDF_xs_domain) +#define _XEN_DOMCTL_VUART_enable 6 +#define XEN_DOMCTL_VUART_enable (1U<<_XEN_DOMCTL_VUART_enable) uint32_t flags; struct xen_arch_domainconfig config; }; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 1127ca9..ee7dc7a 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -555,6 +555,10 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags, #define _DOMCRF_xs_domain 5 #define DOMCRF_xs_domain (1U<<_DOMCRF_xs_domain) + /* DOMCRF_vuart: enable virtual uart emulation. Used for Aarch64. */ +#define _DOMCRF_vuart 7 +#define DOMCRF_vuart (1U<<_DOMCRF_vuart) + /* * rcu_lock_domain_by_id() is more efficient than get_domain_by_id(). * This is the preferred function if the returned domain reference