From patchwork Tue Apr 28 14:32:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 47679 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 AD5CB2121F for ; Tue, 28 Apr 2015 14:49:26 +0000 (UTC) Received: by wixv7 with SMTP id v7sf6546411wix.0 for ; Tue, 28 Apr 2015 07:49:26 -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=TdsBUnjgRw0qPxIH9bxutrOVXVJ7SK7V5Efhqc7UDrY=; b=S09xmAXvhiYXOAckiGsoPvcHgZKx4BPyP0SL3nDZ5xc4pwLyJZ1dHWoAxa9pJeg7fU 0pxOr9CFWNLoPes/0ZZOoj1iUv4K/nvISir+lVWvoWQ6nQWZzB3oryZaEY5bKmkpMR5v gXJQ1qyDvMU4pozEUrCj20dpG2VmYvDLVyTXEKTK/9MdjeoedquVG3rk86+9tXr6da9J sRWbrleX97QiKjub3PmoULJu+CxCrzap4CfSPlgj66ln1ZBLYW0BiKWaUsZpDuGEyPbJ HitsJiN2zXvgH4706SeOjk9lRnJGG8PCiF3dS1IhCKiLrpnVoLCg1aTDvbhKSicYvvbu hNpw== X-Gm-Message-State: ALoCoQm2uJQe9JkcDk5xdpkYRM3Fn/5s9HHM2wqk8eG3fq67SjbeyyLAIPiSyxOdW0g6XbWHR6Lr X-Received: by 10.112.28.111 with SMTP id a15mr10436220lbh.21.1430232565983; Tue, 28 Apr 2015 07:49:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.239.130 with SMTP id vs2ls73862lac.97.gmail; Tue, 28 Apr 2015 07:49:25 -0700 (PDT) X-Received: by 10.152.88.1 with SMTP id bc1mr14942442lab.79.1430232565821; Tue, 28 Apr 2015 07:49:25 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id kq5si17212617lac.95.2015.04.28.07.49.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2015 07:49:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lagv1 with SMTP id v1so106334098lag.3 for ; Tue, 28 Apr 2015 07:49:25 -0700 (PDT) X-Received: by 10.112.16.196 with SMTP id i4mr4016327lbd.72.1430232565690; Tue, 28 Apr 2015 07:49:25 -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 l1csp1932182lbt; Tue, 28 Apr 2015 07:49:24 -0700 (PDT) X-Received: by 10.52.33.132 with SMTP id r4mr36517363vdi.0.1430232563790; Tue, 28 Apr 2015 07:49:23 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id wv1si35336250vdb.30.2015.04.28.07.49.22 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 28 Apr 2015 07:49:23 -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 1Yn6oB-00013G-5Y; Tue, 28 Apr 2015 14:48:23 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yn6oA-00013A-Cp for xen-devel@lists.xenproject.org; Tue, 28 Apr 2015 14:48:22 +0000 Received: from [193.109.254.147] by server-4.bemta-14.messagelabs.com id F1/00-23180-5BD9F355; Tue, 28 Apr 2015 14:48:21 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1430232499!12833102!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 6.13.14; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10296 invoked from network); 28 Apr 2015 14:48:20 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-3.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 28 Apr 2015 14:48:20 -0000 X-IronPort-AV: E=Sophos;i="5.11,664,1422921600"; d="scan'208";a="257352051" From: Julien Grall To: Date: Tue, 28 Apr 2015 15:32:42 +0100 Message-ID: <1430231563-25648-19-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1430231563-25648-1-git-send-email-julien.grall@citrix.com> References: <1430231563-25648-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 v6 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.45 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 1a9bd52..fca116b 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 a391b06..cf4944a 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: {