From patchwork Thu Jul 31 15:00:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 34675 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F2CF720540 for ; Thu, 31 Jul 2014 15:04:14 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id uq10sf12268773igb.11 for ; Thu, 31 Jul 2014 08:04: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:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=iNkvkGkox9cryU7B1gSyCma9q1c1tn11R4v4HxEQuDQ=; b=gAAurZ7o4xcAspHl47NC8X8PtjB3Iuqp2t7NhLlnNf/6y+OfY9J3GoWeyWcLnTtdnc hcRj9xH1EjQk93rfdqe+DoSEibUVp01yad1jBKstabWB1vt4c+G5WxyaOX4cRLAHYtKB JPNqtCcfXuKKwrSaffgP1ZasBoIQd7a5taKq4ahcy5b+Z9L2WK08P3su55rkKV48ezGS 07JMOci7bkGdBe4ivXJ9zGcGN0l+d97tlUYRJOt9Kaf5uVqjwrji26+CTGiu7W+sIIP4 mW45uUSinjexRjYESiNTDiNPsw/v9pcMNuGXm0S2V2ebrcCfutqVrZbRe/wZILnjT6VJ kwjQ== X-Gm-Message-State: ALoCoQkIwSFq6avVDMetMnje76AMC6hE+8sEmSo5jKBSw7B8h31ZunQ/U15yDZ8LdS3C/3CDwHr4 X-Received: by 10.50.50.130 with SMTP id c2mr5282841igo.4.1406819054501; Thu, 31 Jul 2014 08:04:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.78 with SMTP id t72ls1059927qga.87.gmail; Thu, 31 Jul 2014 08:04:14 -0700 (PDT) X-Received: by 10.221.59.194 with SMTP id wp2mr11741861vcb.59.1406819054393; Thu, 31 Jul 2014 08:04:14 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id dn3si4631245vcb.40.2014.07.31.08.04.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jul 2014 08:04:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so4399687vcb.7 for ; Thu, 31 Jul 2014 08:04:13 -0700 (PDT) X-Received: by 10.221.47.9 with SMTP id uq9mr13510536vcb.48.1406819053537; Thu, 31 Jul 2014 08:04:13 -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.221.37.5 with SMTP id tc5csp25224vcb; Thu, 31 Jul 2014 08:04:13 -0700 (PDT) X-Received: by 10.140.82.113 with SMTP id g104mr18304926qgd.55.1406819052966; Thu, 31 Jul 2014 08:04:12 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id p21si10186078qgd.81.2014.07.31.08.04.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 31 Jul 2014 08:04:12 -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 1XCrrP-0001A1-F4; Thu, 31 Jul 2014 15:01:39 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XCrrH-0000w7-Rx for xen-devel@lists.xenproject.org; Thu, 31 Jul 2014 15:01:31 +0000 Received: from [193.109.254.147:51125] by server-15.bemta-14.messagelabs.com id 8C/CC-30948-B4A5AD35; Thu, 31 Jul 2014 15:01:31 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-16.tower-27.messagelabs.com!1406818890!7565466!1 X-Originating-IP: [209.85.212.175] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2980 invoked from network); 31 Jul 2014 15:01:30 -0000 Received: from mail-wi0-f175.google.com (HELO mail-wi0-f175.google.com) (209.85.212.175) by server-16.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 31 Jul 2014 15:01:30 -0000 Received: by mail-wi0-f175.google.com with SMTP id ho1so9482414wib.14 for ; Thu, 31 Jul 2014 08:01:30 -0700 (PDT) X-Received: by 10.194.110.161 with SMTP id ib1mr17918603wjb.129.1406818889906; Thu, 31 Jul 2014 08:01:29 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id r20sm67128337wik.0.2014.07.31.08.01.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jul 2014 08:01:29 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 31 Jul 2014 16:00:52 +0100 Message-Id: <1406818852-31856-22-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1406818852-31856-1-git-send-email-julien.grall@linaro.org> References: <1406818852-31856-1-git-send-email-julien.grall@linaro.org> Cc: ian.campbell@citrix.com, Stefano Stabellini , tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com Subject: [Xen-devel] [PATCH v2 21/21] 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.220.176 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: Stefano Stabellini Cc: Ian Campbell --- 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 6d184d6..d78f5c4 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -623,6 +623,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 6d9c901..545c2ff 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -775,7 +775,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 *ioports, *irqs, *iomem; + XLU_ConfigList *ioports, *irqs, *iomem, *dtdevs; int num_ioports, num_irqs, num_iomem, num_cpus; int pci_power_mgmt = 0; int pci_msitranslate = 0; @@ -1483,6 +1483,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: {