From patchwork Mon Jun 16 16:18:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 31984 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f72.google.com (mail-pb0-f72.google.com [209.85.160.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7718820E7A for ; Mon, 16 Jun 2014 16:20:07 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id ma3sf21416646pbc.3 for ; Mon, 16 Jun 2014 09:20:06 -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=tbcxTFPKUmSnhOnZODwkroH/RbrGxFpNd71m4qBfU04=; b=RiokJ5Lhf4ABTzi5koRAi30SiYA8ZqjOxT3ZWb2XX/bxZtiWX1g/a9cbu4TgoxUF5Y 4dWVLwgqClcFwC/ntVEBRE7pxVi96RGEikKxk6vOD/dIFI2azbgQzDV273mnZZT/SjeZ X3ly7uUdAes2ZI3kDPI3r0Wu4+Uo+9yde+2HgSQUDiUh1A2zGfVBy4FLzq4UxeUCpZlk Gq0Kz0ajzIc59QmJ7SPgY4YIReC5zy8Ou0xTfZKuSGjrDgiQ3Aya/Tje/725wAO9la18 a0WAak2SzR2PYfwv9c7mZOiX/d9TYQ2oPG1DdxouZyW011iyt5ipyZIwsiesHCDAZo9C TxDQ== X-Gm-Message-State: ALoCoQnhhqzTWsXH1gWKqWeO6GsRy8HHBrUIXW1BG5osEzMBdKt4GddlABmlknhB2rpsZ8XjLTMe X-Received: by 10.66.149.67 with SMTP id ty3mr2729770pab.27.1402935606595; Mon, 16 Jun 2014 09:20:06 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.234 with SMTP id a97ls4578681qgf.51.gmail; Mon, 16 Jun 2014 09:20:06 -0700 (PDT) X-Received: by 10.58.29.198 with SMTP id m6mr16703805veh.15.1402935606465; Mon, 16 Jun 2014 09:20:06 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id gq6si4274765vdc.65.2014.06.16.09.20.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 09:20:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jz11so6349927veb.31 for ; Mon, 16 Jun 2014 09:20:06 -0700 (PDT) X-Received: by 10.58.186.207 with SMTP id fm15mr16859315vec.4.1402935606382; Mon, 16 Jun 2014 09:20:06 -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.54.6 with SMTP id vs6csp146172vcb; Mon, 16 Jun 2014 09:20:06 -0700 (PDT) X-Received: by 10.224.136.4 with SMTP id p4mr27999685qat.83.1402935604987; Mon, 16 Jun 2014 09:20:04 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id t8si13798210qat.98.2014.06.16.09.20.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Jun 2014 09:20:04 -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 1WwZcO-0007D9-UF; Mon, 16 Jun 2014 16:18:48 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwZcK-00070O-Aa for xen-devel@lists.xenproject.org; Mon, 16 Jun 2014 16:18:44 +0000 Received: from [85.158.137.68:63242] by server-16.bemta-3.messagelabs.com id B8/4C-13481-3E81F935; Mon, 16 Jun 2014 16:18:43 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-9.tower-31.messagelabs.com!1402935522!6678039!1 X-Originating-IP: [74.125.82.182] 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 32331 invoked from network); 16 Jun 2014 16:18:42 -0000 Received: from mail-we0-f182.google.com (HELO mail-we0-f182.google.com) (74.125.82.182) by server-9.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 16 Jun 2014 16:18:42 -0000 Received: by mail-we0-f182.google.com with SMTP id q59so6059878wes.27 for ; Mon, 16 Jun 2014 09:18:42 -0700 (PDT) X-Received: by 10.180.210.174 with SMTP id mv14mr28838300wic.47.1402935522619; Mon, 16 Jun 2014 09:18:42 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id l45sm34836161eep.25.2014.06.16.09.18.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jun 2014 09:18:41 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 16 Jun 2014 17:18:06 +0100 Message-Id: <1402935486-29136-20-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> References: <1402935486-29136-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] [RFC 19/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: , 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.128.172 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 --- 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 025df27..fdadbe6 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -601,6 +601,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 f99e6b6..3ecc804 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -702,7 +702,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; int pci_power_mgmt = 0; int pci_msitranslate = 0; @@ -1463,6 +1463,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_dt *dtdev; + + d_config->dtdevs = (libxl_device_dt *) realloc(d_config->dtdevs, sizeof (libxl_device_dt) * (d_config->num_dtdevs + 1)); + dtdev = d_config->dtdevs + d_config->num_dtdevs; + libxl_device_dt_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: {