From patchwork Thu Mar 19 19:29:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 46094 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 98E1A21515 for ; Thu, 19 Mar 2015 19:32:15 +0000 (UTC) Received: by wesu56 with SMTP id u56sf14145690wes.2 for ; Thu, 19 Mar 2015 12:32:14 -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: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=z6dMfL3ObSlZu0obVdMMwKMvgPlJTBJ3RkZZvGOXBTo=; b=F9ZX6b4acw1swce9q9POoyY2xa/r61cZjpZnsEdKJN1mH3GvdlyACKv2FC3pup7aoj lX6En8QqHZHtFjnJNBfSI9W7fg4dUrMcbMoGrPbdVo0hqnPA3vGU7TNDfqqoKIxh4gcG zgusawrPNytOMOILGwOec7aTAitKX6o5dQ89w4cVtX+szHsFSTSVT+dGV3dgnNcGWxtF V87N8pzIosMZE15uHRis6232itx4p6xFgyP2SOd47JqkBEzf4jAZzZEnOl7OUannRqw4 6egmfoUtL1a4W8S1BUvxK8COVwfqZcyq03wKt52uim6iq5IpnUxUFccTXFelvx8+lvv9 feBg== X-Gm-Message-State: ALoCoQmMs57vqxp+prkbxj0qPLSJn5JYhkelxA5mAC75ZA1wmcF82S5F9yRk8IPZVPHIp3S/sFp2 X-Received: by 10.112.97.37 with SMTP id dx5mr3650577lbb.15.1426793534958; Thu, 19 Mar 2015 12:32:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.69 with SMTP id kw5ls311109lac.86.gmail; Thu, 19 Mar 2015 12:32:14 -0700 (PDT) X-Received: by 10.152.10.209 with SMTP id k17mr40288750lab.50.1426793534329; Thu, 19 Mar 2015 12:32:14 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id vs2si1652832lac.87.2015.03.19.12.32.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 12:32:14 -0700 (PDT) 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 ladw1 with SMTP id w1so70583749lad.0 for ; Thu, 19 Mar 2015 12:32:14 -0700 (PDT) X-Received: by 10.152.28.5 with SMTP id x5mr68929059lag.112.1426793534236; Thu, 19 Mar 2015 12:32:14 -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.35.133 with SMTP id h5csp597465lbj; Thu, 19 Mar 2015 12:32:13 -0700 (PDT) X-Received: by 10.140.129.65 with SMTP id 62mr100623783qhb.11.1426793528719; Thu, 19 Mar 2015 12:32:08 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id j9si2238786qcf.21.2015.03.19.12.32.08 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 19 Mar 2015 12:32:08 -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 1YYgAF-0005fK-PR; Thu, 19 Mar 2015 19:31:31 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YYgAD-0005Y8-5G for xen-devel@lists.xenproject.org; Thu, 19 Mar 2015 19:31:29 +0000 Received: from [193.109.254.147] by server-11.bemta-14.messagelabs.com id CD/B4-32337-0142B055; Thu, 19 Mar 2015 19:31:28 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-4.tower-27.messagelabs.com!1426793487!14435523!1 X-Originating-IP: [74.125.82.52] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6213 invoked from network); 19 Mar 2015 19:31:27 -0000 Received: from mail-wg0-f52.google.com (HELO mail-wg0-f52.google.com) (74.125.82.52) by server-4.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 19 Mar 2015 19:31:27 -0000 Received: by wggv3 with SMTP id v3so71362031wgg.1 for ; Thu, 19 Mar 2015 12:31:27 -0700 (PDT) X-Received: by 10.194.203.98 with SMTP id kp2mr14984338wjc.47.1426793485727; Thu, 19 Mar 2015 12:31:25 -0700 (PDT) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id hl8sm3203005wjb.38.2015.03.19.12.31.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Mar 2015 12:31:24 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 19 Mar 2015 19:29:58 +0000 Message-Id: <1426793399-6283-33-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426793399-6283-1-git-send-email-julien.grall@linaro.org> References: <1426793399-6283-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 v4 32/33] 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 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 bcbc277..9241000 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -779,6 +779,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: {