From patchwork Thu Apr 9 15:09:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 46977 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 501BE21416 for ; Thu, 9 Apr 2015 15:22:54 +0000 (UTC) Received: by wghm4 with SMTP id m4sf27332737wgh.2 for ; Thu, 09 Apr 2015 08:22:53 -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=+20fIx8Aiaf4MAksDdcAS+EVi3JZO3e8Z3l7i41fdXY=; b=CImoJ1R2iqKcxU+8Rm4NEC4UJPBBWZc2uO+mBd1QExUhw0GjW61356kTp9pOVYLU0X pkFgqVABSB+W5deVf82S+K7dmitythnSl2LJqiifwAYwlR8Rl3Tmb9811mI1rQZMxsxO 1SIDNX6vYWfyqv4oD63lE/qr+HPMUMw1QpjqK6TShSOiiyl+SBTXC/3H8x9qiEmJbj9g R4tKQCpXdcZuMiYcxTvx4d+JZ+TZoF8HM3yaHuEDMhw7TQCJKX+XutBVBjk2bzGyLQg8 FMoDbAPO2RRYG2EUBKvskilMdK4okvD1t9cM5G0A1vL2RDCTz93lDKP6O4p0r0bhmesa B9wQ== X-Gm-Message-State: ALoCoQmRwy4MWqKHspAatCvx8g09OyBHYD/fS4AcfoxJYqI9Kfmy9SNK0YC7ZXklLJlLCz88T/wx X-Received: by 10.112.130.71 with SMTP id oc7mr4243126lbb.23.1428592973611; Thu, 09 Apr 2015 08:22:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.199 with SMTP id s7ls281675laj.57.gmail; Thu, 09 Apr 2015 08:22:53 -0700 (PDT) X-Received: by 10.152.205.106 with SMTP id lf10mr5098995lac.89.1428592973389; Thu, 09 Apr 2015 08:22:53 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id q1si9347713lbm.74.2015.04.09.08.22.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 08:22:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lagv1 with SMTP id v1so92190829lag.3 for ; Thu, 09 Apr 2015 08:22:53 -0700 (PDT) X-Received: by 10.152.234.169 with SMTP id uf9mr4935936lac.88.1428592973291; Thu, 09 Apr 2015 08:22:53 -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.67.65 with SMTP id l1csp537907lbt; Thu, 9 Apr 2015 08:22:52 -0700 (PDT) X-Received: by 10.229.54.196 with SMTP id r4mr1947234qcg.15.1428592957094; Thu, 09 Apr 2015 08:22:37 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id o186si14638808qhb.69.2015.04.09.08.22.36 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 09 Apr 2015 08:22:37 -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 1YgEH5-0003Uf-UV; Thu, 09 Apr 2015 15:21:47 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YgEH4-0003S4-7M for xen-devel@lists.xenproject.org; Thu, 09 Apr 2015 15:21:46 +0000 Received: from [85.158.139.211] by server-8.bemta-5.messagelabs.com id F1/AB-19484-90996255; Thu, 09 Apr 2015 15:21:45 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1428592903!14764131!1 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.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3841 invoked from network); 9 Apr 2015 15:21:44 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-2.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 9 Apr 2015 15:21:44 -0000 X-IronPort-AV: E=Sophos;i="5.11,550,1422921600"; d="scan'208";a="253569396" From: Julien Grall To: Date: Thu, 9 Apr 2015 16:09:44 +0100 Message-ID: <1428592185-18581-19-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1428592185-18581-1-git-send-email-julien.grall@citrix.com> References: <1428592185-18581-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Wei Liu , ian.campbell@citrix.com, tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com Subject: [Xen-devel] [PATCH v5 p2 18/19] 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.215.43 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 ad95a9a..8357ebe 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -786,6 +786,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 c2415ba..ed82b6a 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: {