From patchwork Fri May 8 16:33:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 48173 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 099C82121F for ; Fri, 8 May 2015 16:34:36 +0000 (UTC) Received: by wiun10 with SMTP id n10sf8752186wiu.1 for ; Fri, 08 May 2015 09:34:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=wuwZpR1ujVMvwZBqaaQHKcf9uf8yDu6B0LEArRsU/R8=; b=jJrdwnLzVIPtulfk5uyq2WSrFi18c/eR9RYazl1WZjKpPsDRt1W/O29YOngLpk8pnZ SWEgCAP/9gaDpB+BF2BPUov1sy/oo6XkeXbsw6NXN3/em8IJeZW8SqB+kP2BLqyF/Rik 1fXbjLO3hj955tK3mAfSA6wuGZ3YlyM/hxea5GZadk6SQGBKBQlp2YHcV6M9H631m9Ea P15uMHLnJuIc7LhJqpjlnhSINsUrIKOhym7mDwQkv6HjjUiKp5+mbmxO6Hew4l4+4oDm A+WYPFjAj1bwLRokMjnuzD4NjTCrFuCyYsfcDs4Uu6aIgWR6o0nd9kkK0UVm0o50WwSm bj1A== X-Gm-Message-State: ALoCoQkzLP5U5gmeu3ufix7IyrRj7iLVmeXRDYiM1VQm2z+FBnbuqlK5aD2omsnjqCAddK1XRLX5 X-Received: by 10.152.4.194 with SMTP id m2mr2462320lam.1.1431102875330; Fri, 08 May 2015 09:34:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.66 with SMTP id i2ls381339lah.19.gmail; Fri, 08 May 2015 09:34:35 -0700 (PDT) X-Received: by 10.152.170.136 with SMTP id am8mr3617315lac.102.1431102875226; Fri, 08 May 2015 09:34:35 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id bb9si3578849lab.145.2015.05.08.09.34.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 May 2015 09:34:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbcga7 with SMTP id ga7so57030792lbc.1 for ; Fri, 08 May 2015 09:34:35 -0700 (PDT) X-Received: by 10.153.8.167 with SMTP id dl7mr3517575lad.86.1431102874989; Fri, 08 May 2015 09:34:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp125233lbb; Fri, 8 May 2015 09:34:34 -0700 (PDT) X-Received: by 10.52.240.176 with SMTP id wb16mr2062969vdc.25.1431102873208; Fri, 08 May 2015 09:34:33 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id gy3si4754758vdb.87.2015.05.08.09.34.32 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 May 2015 09:34:33 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YqlDn-00015L-LI; Fri, 08 May 2015 16:33:55 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YqlDl-000128-AQ for xen-devel@lists.xenproject.org; Fri, 08 May 2015 16:33:53 +0000 Received: from [193.109.254.147] by server-12.bemta-14.messagelabs.com id A0/70-02507-075EC455; Fri, 08 May 2015 16:33:52 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1431102829!15910391!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 6.13.14; banners=-,-,- X-VirusChecked: Checked Received: (qmail 11925 invoked from network); 8 May 2015 16:33:51 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-14.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 8 May 2015 16:33:51 -0000 X-IronPort-AV: E=Sophos;i="5.13,391,1427760000"; d="scan'208";a="263161794" From: Julien Grall To: Date: Fri, 8 May 2015 17:33:13 +0100 Message-ID: <1431102794-21263-6-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431102794-21263-1-git-send-email-julien.grall@citrix.com> References: <1431102794-21263-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Wei Liu , ian.campbell@citrix.com, tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com Subject: [Xen-devel] [PATCH v7 5/6] xl: Add new option dtdev X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: From: Julien Grall The option "dtdev" will be used to passthrough a device described in the device tree to a guest. Signed-off-by: Julien Grall Acked-by: Ian Campbell Cc: Ian Jackson Cc: Wei Liu --- Changes in v5: - Drop "non-PCI" in the commit message - Add Ian's ack Changes in v4: - Typoes in the documentation - Wrap the line in xl_cmdimpl.c Changes in v2: - libxl_device_dt has been rename to libxl_device_dtdev - use xrealloc instead of realloc --- docs/man/xl.cfg.pod.5 | 5 +++++ tools/libxl/xl_cmdimpl.c | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 index fb8721f..a189091 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -789,6 +789,11 @@ More information about Xen gfx_passthru feature is available on the XenVGAPassthrough L wiki page. +=item B + +Specifies the host device tree nodes to passthrough to this guest. Each +DTDEV_PATH is the absolute path in the device tree. + =item B Allow guest to access specific legacy I/O ports. Each B diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 19bf103..51ab85a 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1169,7 +1169,7 @@ static void parse_config_data(const char *config_source, long l, vcpus = 0; XLU_Config *config; XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms; - XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian; + XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs; int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian; int pci_power_mgmt = 0; int pci_msitranslate = 0; @@ -1941,6 +1941,26 @@ skip_vfb: libxl_defbool_set(&b_info->u.pv.e820_host, true); } + if (!xlu_cfg_get_list (config, "dtdev", &dtdevs, 0, 0)) { + d_config->num_dtdevs = 0; + d_config->dtdevs = NULL; + for (i = 0; (buf = xlu_cfg_get_listitem(dtdevs, i)) != NULL; i++) { + libxl_device_dtdev *dtdev; + + d_config->dtdevs = xrealloc(d_config->dtdevs, + sizeof (libxl_device_dtdev) * (i + 1)); + dtdev = d_config->dtdevs + d_config->num_dtdevs; + libxl_device_dtdev_init(dtdev); + + dtdev->path = strdup(buf); + if (dtdev->path == NULL) { + fprintf(stderr, "unable to duplicate string for dtdevs\n"); + exit(-1); + } + d_config->num_dtdevs++; + } + } + switch (xlu_cfg_get_list(config, "cpuid", &cpuids, 0, 1)) { case 0: {