From patchwork Tue May 12 14:33:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 48393 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 50A3A214A1 for ; Tue, 12 May 2015 14:36:43 +0000 (UTC) Received: by lbbrr5 with SMTP id rr5sf2343314lbb.3 for ; Tue, 12 May 2015 07:36:42 -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=Ld1d34Kjk5gOu6kCe36g5c18oizXyCAZ1XRgdw94W/5yTc+B/FHq05eeSMwJqCot6o ZMY6ttaKR+bDWf6pTEHx4WiojDD1WzIB51k0bggxunOYCraH0VjLRMJjxQJ4TywJSAfR 5cEqX0VPrguAZqjb5qv2SSs2FBm2EbYTK1kJXzt283HdTVgHWx5dDSotQvA7gKK7nFDZ J+MrRJ/CZMQhtdmy3f9B17jAhrFvX0Ir2NegoXRX+NrfG18GQldWR6uhzv0YWoqrHkcv 5jTkRCIl2mcZrp+iJr6zzdKVZIq+4BV/dYFDb9klgxZrR6BuNayYqBVBT2yP046A2Eye B4cQ== X-Gm-Message-State: ALoCoQm9qYkuH2d/VXOIrtPkkQYw2sYkp0Z6jTJuQzoqSTWyURWfytjrDr8dFmhpnnk7Ghsm8VMF X-Received: by 10.194.249.1 with SMTP id yq1mr10878439wjc.2.1431441402208; Tue, 12 May 2015 07:36:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.101 with SMTP id i5ls37309laa.58.gmail; Tue, 12 May 2015 07:36:42 -0700 (PDT) X-Received: by 10.152.19.70 with SMTP id c6mr12369334lae.121.1431441402077; Tue, 12 May 2015 07:36:42 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id lb2si10472523lbc.151.2015.05.12.07.36.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2015 07:36:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbcga7 with SMTP id ga7so7542861lbc.1 for ; Tue, 12 May 2015 07:36:42 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr12366407laj.88.1431441401953; Tue, 12 May 2015 07:36:41 -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 hn6csp2130005lbb; Tue, 12 May 2015 07:36:36 -0700 (PDT) X-Received: by 10.52.143.202 with SMTP id sg10mr11432792vdb.8.1431441396211; Tue, 12 May 2015 07:36:36 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id x2si14485079vdb.53.2015.05.12.07.36.35 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 12 May 2015 07:36:36 -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 1YsBG4-0002Jg-Q5; Tue, 12 May 2015 14:34:08 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YsBG3-0002Ip-AR for xen-devel@lists.xenproject.org; Tue, 12 May 2015 14:34:07 +0000 Received: from [193.109.254.147] by server-11.bemta-14.messagelabs.com id 14/5B-02795-E5F02555; Tue, 12 May 2015 14:34:06 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1431441243!16902682!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 20372 invoked from network); 12 May 2015 14:34:05 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-2.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 12 May 2015 14:34:05 -0000 X-IronPort-AV: E=Sophos;i="5.13,415,1427760000"; d="scan'208";a="261852709" From: Julien Grall To: Date: Tue, 12 May 2015 15:33:12 +0100 Message-ID: <1431441192-27897-7-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: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v8 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.217.170 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" ] + +