From patchwork Wed May 13 18:33:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 48459 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 158DC2121F for ; Wed, 13 May 2015 18:45:49 +0000 (UTC) Received: by wgin8 with SMTP id n8sf11540928wgi.0 for ; Wed, 13 May 2015 11:45:48 -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=7q8aklxRVYzL6bnEh9L4GRoAG7XGpuv/cYuIA0w7uSM=; b=HHqiNLSRE7JbIwjV/3GMQsdDcBV+LrsaP0LljqSEVSC6KO4oxc2dCrDvDWlx09TYCm 2eSMCeDK78tuC46lkSjCVKUpYgJD2r6lIJIhQaxIUWf1RlaXx7F+HrcxHhDQBlPkLCFm C0cdBkOTD+Sz+3KZDvmVyqop7SrdeyVr7ImF7RMtyuV076lPso85M8c3CJu6UHnxeTK0 g3DS4Scq32WyohQ87eAs32y+3SRDob+3ZeJFdX3kGtRSKaoXtIM67Lu0yfuCvOOoAC7I eNABaIMp/BI0DG6WhwJTTiMbmfSF2vFznplKvYFa+lBmQMI7DUUPWlO39xCQ05occdaC 2U5Q== X-Gm-Message-State: ALoCoQlIozapu3u9z1WBWCvwKswHOhHqT44WTw9sVtK59AfVzH0RWJ5j4S2R/9uTHuUgfMn8AhkQ X-Received: by 10.112.171.41 with SMTP id ar9mr196445lbc.24.1431542748284; Wed, 13 May 2015 11:45:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.244.162 with SMTP id xh2ls299393lac.108.gmail; Wed, 13 May 2015 11:45:48 -0700 (PDT) X-Received: by 10.112.167.73 with SMTP id zm9mr197084lbb.89.1431542748168; Wed, 13 May 2015 11:45:48 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id j2si12901985lam.114.2015.05.13.11.45.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2015 11:45:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laat2 with SMTP id t2so36098097laa.1 for ; Wed, 13 May 2015 11:45:48 -0700 (PDT) X-Received: by 10.152.29.161 with SMTP id l1mr238476lah.76.1431542748048; Wed, 13 May 2015 11:45:48 -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 hn6csp704160lbb; Wed, 13 May 2015 11:45:47 -0700 (PDT) X-Received: by 10.55.27.141 with SMTP id m13mr632548qkh.55.1431542746574; Wed, 13 May 2015 11:45:46 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id k199si405240qhc.57.2015.05.13.11.45.45 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 13 May 2015 11:45:46 -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 1YsbdK-0001Jn-Lu; Wed, 13 May 2015 18:43:54 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YsbdJ-0001JV-9g for xen-devel@lists.xenproject.org; Wed, 13 May 2015 18:43:53 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id 84/24-02928-86B93555; Wed, 13 May 2015 18:43:52 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1431542629!12720564!2 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 31644 invoked from network); 13 May 2015 18:43:51 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-14.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 13 May 2015 18:43:51 -0000 X-IronPort-AV: E=Sophos;i="5.13,422,1427760000"; d="scan'208";a="262397491" From: Julien Grall To: Date: Wed, 13 May 2015 19:33:41 +0100 Message-ID: <1431542022-16138-6-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431542022-16138-1-git-send-email-julien.grall@citrix.com> References: <1431542022-16138-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 v9 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.215.41 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 2125a09..8eaf1c7 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: {