From patchwork Tue Jan 13 14:25:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 43013 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8577B20DE8 for ; Tue, 13 Jan 2015 14:28:43 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf1859365lab.3 for ; Tue, 13 Jan 2015 06:28:42 -0800 (PST) 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:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=MMl6rmSYaQ53Makpqj/pDCoAw+K/NLAq18tIPsQJp/o=; b=erBt/TU9XwjE09PcUdoMGANUxUgIbjHuCG262rXSAWOnn15qcFV2wRXWo8vDCzlSEK PxuKVkQX9opZROpWdHrWGm5VTvLsBUefbs7Seecy3Wl/bhs63HiNVsD3Fp06ahpUDQFB ZbMKn1vD7gcNzy50SThVp1xI/naeYM4JsVs0AdteEvfFDU1CHIz52GBEhETIivdDL5dg hvFhegxIXMs06MHGT2RoCWFbjOHWEUyG1FLukZLCcsL8g52HaBV9iunFbXQMxgv9QtAc XJGt1ikPD6UwS7q6lsIKx7EjE0CiR/knR93ogViRkPT0RNKrKg22HOCfCitcV/5WRw0w 6MGA== X-Gm-Message-State: ALoCoQklXAJFR6n720nppB9kUa3uODczq+iqgF4BgY3PEK29bsg7nmGYDB4miMU1jTEje5uR9UyF X-Received: by 10.112.141.232 with SMTP id rr8mr4521798lbb.0.1421159322519; Tue, 13 Jan 2015 06:28:42 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.134 with SMTP id ay6ls789532lab.107.gmail; Tue, 13 Jan 2015 06:28:42 -0800 (PST) X-Received: by 10.152.7.206 with SMTP id l14mr42670758laa.1.1421159322307; Tue, 13 Jan 2015 06:28:42 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id fb6si24353135lbc.117.2015.01.13.06.28.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 06:28:42 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id pv20so2850788lab.13 for ; Tue, 13 Jan 2015 06:28:42 -0800 (PST) X-Received: by 10.152.5.226 with SMTP id v2mr42761754lav.34.1421159322225; Tue, 13 Jan 2015 06:28:42 -0800 (PST) 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.9.200 with SMTP id c8csp1398965lbb; Tue, 13 Jan 2015 06:28:41 -0800 (PST) X-Received: by 10.221.63.198 with SMTP id xf6mr21421792vcb.63.1421159293428; Tue, 13 Jan 2015 06:28:13 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id e19si8059571vcv.70.2015.01.13.06.28.12 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 13 Jan 2015 06:28:13 -0800 (PST) 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 1YB2R0-0001xC-LZ; Tue, 13 Jan 2015 14:27:06 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YB2Qw-0001oT-H0 for xen-devel@lists.xenproject.org; Tue, 13 Jan 2015 14:27:02 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id C2/D5-26652-53B25B45; Tue, 13 Jan 2015 14:27:01 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-16.tower-206.messagelabs.com!1421159220!14910225!1 X-Originating-IP: [209.85.212.173] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25596 invoked from network); 13 Jan 2015 14:27:00 -0000 Received: from mail-wi0-f173.google.com (HELO mail-wi0-f173.google.com) (209.85.212.173) by server-16.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 13 Jan 2015 14:27:00 -0000 Received: by mail-wi0-f173.google.com with SMTP id em10so5840280wid.0 for ; Tue, 13 Jan 2015 06:27:00 -0800 (PST) X-Received: by 10.194.234.2 with SMTP id ua2mr67861825wjc.40.1421159220238; Tue, 13 Jan 2015 06:27:00 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id ni15sm14513482wic.18.2015.01.13.06.26.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jan 2015 06:26:59 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 13 Jan 2015 14:25:33 +0000 Message-Id: <1421159133-31526-25-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421159133-31526-1-git-send-email-julien.grall@linaro.org> References: <1421159133-31526-1-git-send-email-julien.grall@linaro.org> Cc: Wei Liu , ian.campbell@citrix.com, tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com Subject: [Xen-devel] [PATCH v3 24/24] 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: , MIME-Version: 1.0 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: julien.grall@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.215.54 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: The option "dtdev" will be used to passthrough a non-PCI device described in the device tree to a guest. Signed-off-by: Julien Grall Cc: Ian Jackson Cc: Wei Liu --- 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 | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 index 225b782..cfd3d5f 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -721,6 +721,11 @@ More information about Xen gfx_passthru feature is available on the XenVGAPassthrough L wiki page. +=item B + +Specifies the host device node 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 31e89e8..80c9df6 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -986,7 +986,7 @@ static void parse_config_data(const char *config_source, long l; 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; @@ -1746,6 +1746,25 @@ 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 = (libxl_device_dtdev *) xrealloc(d_config->dtdevs, sizeof (libxl_device_dtdev) * (d_config->num_dtdevs + 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: {