From patchwork Tue May 12 14:33:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 48391 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 7C16C214A1 for ; Tue, 12 May 2015 14:35:58 +0000 (UTC) Received: by wgiv13 with SMTP id v13sf2343701wgi.3 for ; Tue, 12 May 2015 07:35:57 -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=wuwZpR1ujVMvwZBqaaQHKcf9uf8yDu6B0LEArRsU/R8=; b=Sv5bXwf3pfqHRzMtFtdch7EQJyNURLBk6ekGZEroSCxrGj+nAh5kgrOW2cusCcOvBV 1FEKLAPzkUpUI1F8CHOoLDSzObUU9YjcSLikIFhaagHIVyj/YTuKYuRUwcFyUhJP+oNT Sa2Ws/fXPGlLDZbnHbK9JX4uWvKQVXYWyZgtGPGvAUGV4rzOCThhZ+R33fPUFol2xYHB C4mb5ldvzcsYw4E2Lvm3b7cTN1xd6rGdqhFy2kUM8Xn/zMBHW+/d0KYJAtmfw28BzxJ5 1EWFarNamDglQTZi7mmIBbj3J4Cac5on27T4r9gn0PbfptPtwHBitNJ15M9e2g4RXj1w I3BQ== X-Gm-Message-State: ALoCoQk2Ap6eCp3ZMyTaZlqFt9kKsyO3sfj+wiTEUETwWtW9/YPGdxXrFSLMcoNQDkeVbqtYYSv7 X-Received: by 10.112.29.39 with SMTP id g7mr10839450lbh.1.1431441357734; Tue, 12 May 2015 07:35:57 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.129 with SMTP id w1ls47917lal.32.gmail; Tue, 12 May 2015 07:35:57 -0700 (PDT) X-Received: by 10.152.164.193 with SMTP id ys1mr2962682lab.23.1431441357626; Tue, 12 May 2015 07:35:57 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id z9si10485582lbu.81.2015.05.12.07.35.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2015 07:35:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbqq2 with SMTP id qq2so7460974lbb.3 for ; Tue, 12 May 2015 07:35:57 -0700 (PDT) X-Received: by 10.112.163.168 with SMTP id yj8mr12284340lbb.36.1431441357466; Tue, 12 May 2015 07:35:57 -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.108.230 with SMTP id hn6csp2129681lbb; Tue, 12 May 2015 07:35:56 -0700 (PDT) X-Received: by 10.140.102.17 with SMTP id v17mr20138386qge.96.1431441351899; Tue, 12 May 2015 07:35:51 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id w134si16257221qha.90.2015.05.12.07.35.51 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 12 May 2015 07:35:51 -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 1YsBFx-0002Hg-D8; Tue, 12 May 2015 14:34:01 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YsBFw-0002GM-30 for xen-devel@lists.xenproject.org; Tue, 12 May 2015 14:34:00 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 7D/94-03219-75F02555; Tue, 12 May 2015 14:33:59 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-11.tower-206.messagelabs.com!1431441232!8699719!5 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.14; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25755 invoked from network); 12 May 2015 14:33:58 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-11.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 12 May 2015 14:33:58 -0000 X-IronPort-AV: E=Sophos;i="5.13,415,1427760000"; d="scan'208";a="264226935" From: Julien Grall To: Date: Tue, 12 May 2015 15:33:11 +0100 Message-ID: <1431441192-27897-6-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431441192-27897-1-git-send-email-julien.grall@citrix.com> References: <1431441192-27897-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Wei Liu , ian.campbell@citrix.com, tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com Subject: [Xen-devel] [PATCH v8 5/6] 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.217.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: 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 fb8721f..a189091 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 19bf103..51ab85a 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: {