From patchwork Fri May 8 16:33:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 48174 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 9C10B2121F for ; Fri, 8 May 2015 16:34:37 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf23237006wgt.1 for ; Fri, 08 May 2015 09:34:37 -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=k83qK5/D8tr6yEckVo6mKreKElW5rMzuOcFR0NvaDWA=; b=ABWyxOmYCYvCTotkG4yjHO/kpL4RYG9z8DGh/v/WD9EG0qiCFxI/jrH1COj/uvhhZg kzlMlG1HAAvpTYJ0ysJ1tWz8ZLPBHeRKynYEhapnuk75tl8cC2L7DcX0KhmEDZY66WvB CkLaMSoEKD6bS2wBUFlIUSOPm7nHNDTtGFHny107brHkp1GkaR+KBfXOEKVTud266pEv oky8HBQEUBAQsLqPfefkMg1THhc/yTl0waIjZ7QEOxor1jQEujs521LsLKNe9Yk2M0T7 sLdvAFn906wtlU3a4Ih3/7g+z3omxtlSYlisoa2kVGDmZ+Q96TYkAnwj3hIzM45dQ2Qq TXEQ== X-Gm-Message-State: ALoCoQn3yD2nI0FepthaowssQQQ3HqFntLCbteXHSJJkmTCX5CKryFjnjC3PqhB+cTXLGz5lDbQ6 X-Received: by 10.112.28.111 with SMTP id a15mr2422105lbh.21.1431102876933; Fri, 08 May 2015 09:34:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.38 with SMTP id jt6ls412454lab.101.gmail; Fri, 08 May 2015 09:34:36 -0700 (PDT) X-Received: by 10.112.157.100 with SMTP id wl4mr3564377lbb.20.1431102876829; Fri, 08 May 2015 09:34:36 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id wg2si3575824lbb.176.2015.05.08.09.34.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 May 2015 09:34:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lagv1 with SMTP id v1so56439282lag.3 for ; Fri, 08 May 2015 09:34:36 -0700 (PDT) X-Received: by 10.152.36.2 with SMTP id m2mr3460726laj.72.1431102876383; Fri, 08 May 2015 09:34:36 -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 hn6csp125247lbb; Fri, 8 May 2015 09:34:35 -0700 (PDT) X-Received: by 10.52.240.45 with SMTP id vx13mr3485266vdc.22.1431102874299; Fri, 08 May 2015 09:34:34 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id sw2si4803319vdc.7.2015.05.08.09.34.33 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 May 2015 09:34:34 -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 1YqlDo-00016t-FR; Fri, 08 May 2015 16:33:56 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YqlDl-00012g-Uu for xen-devel@lists.xenproject.org; Fri, 08 May 2015 16:33:54 +0000 Received: from [193.109.254.147] by server-13.bemta-14.messagelabs.com id 88/FF-02669-175EC455; Fri, 08 May 2015 16:33:53 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1431102829!15910391!3 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 11946 invoked from network); 8 May 2015 16:33:52 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-14.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 8 May 2015 16:33:52 -0000 X-IronPort-AV: E=Sophos;i="5.13,391,1427760000"; d="scan'208";a="263161795" From: Julien Grall To: Date: Fri, 8 May 2015 17:33:14 +0100 Message-ID: <1431102794-21263-7-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431102794-21263-1-git-send-email-julien.grall@citrix.com> References: <1431102794-21263-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v7 6/6] docs/misc: arm: Add documentation about Device Tree passthrough 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.51 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 Note that the example is done on Midway whose SMMU driver is not supported on Xen upstream. Currently, I don't have other platform where I can test Device Tree passthrough. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- Changes in v6: - Typo in the doc - Add a link to http://www.devicetree.org/Device_Tree_Usage - Add Ian's ack Changes in v5: - Drop references to "non-PCI" in favor of "Device Tree" - Typoes and update the docs Changes in v4: - Patch added --- docs/misc/arm/passthrough.txt | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 docs/misc/arm/passthrough.txt diff --git a/docs/misc/arm/passthrough.txt b/docs/misc/arm/passthrough.txt new file mode 100644 index 0000000..4a39649 --- /dev/null +++ b/docs/misc/arm/passthrough.txt @@ -0,0 +1,63 @@ +Passthrough a device described in the Device Tree to a guest +============================================================ + +The example will use the secondary network card for the midway server. + +1) Mark the device to let Xen know the device will be used for passthrough. +This is done in the device tree node describing the device by adding the +property "xen,passthrough". The command to do it in U-Boot is: + + fdt set /soc/ethernet@fff51000 xen,passthrough + +2) Create a partial device tree describing the device. The IRQ are mapped +1:1 to the guest (i.e VIRQ == IRQ). For MMIO, you will have to find a hole +in the guest memory layout (see xen/include/public/arch-arm.h, note that +the layout is not stable and can change between versions of Xen). + +/dts-v1/; + +/ { + /* #*cells are here to keep DTC happy */ + #address-cells = <2>; + #size-cells = <2>; + + aliases { + net = &mac0; + }; + + passthrough { + compatible = "simple-bus"; + ranges; + #address-cells = <2>; + #size-cells = <2>; + mac0: ethernet@10000000 { + compatible = "calxeda,hb-xgmac"; + reg = <0 0x10000000 0 0x1000>; + interrupts = <0 80 4 0 81 4 0 82 4>; + }; + }; +}; + +Note: + * The interrupt-parent property will be added by the toolstack in the + root node; + * The following properties are mandatory with the /passthrough node: + - compatible: It should always contain "simple-bus" + - ranges + - #address-cells + - #size-cells + * See http://www.devicetree.org/Device_Tree_Usage for more + information about device tree. + +3) Compile the partial guest device with dtc (Device Tree Compiler). +For our purpose, the compiled file will be called guest-midway.dtb and +placed in /root in DOM0. + +3) Add the following options in the guest configuration file: + +device_tree = "/root/guest-midway.dtb" +dtdev = [ "/soc/ethernet@fff51000" ] +irqs = [ 112, 113, 114 ] +iomem = [ "0xfff51,1@0x10000" ] + +