From patchwork Wed May 13 18:33:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 48462 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 854EE2121F for ; Wed, 13 May 2015 18:45:59 +0000 (UTC) Received: by layy10 with SMTP id y10sf12278774lay.0 for ; Wed, 13 May 2015 11:45:58 -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=aayYs3ZRyjRZe6W7OvegvZyoSxZH99eq4AJa8uTKDAm0n8YEY5pt4BvAolCSmPr8rc zIqH3H8EyykZS1IEvWSnNvKQGE61KFrC6UUyPlhewC6yOU2u3BYXxwiSryyU4zG4jxfX SeGDMC5HUHelVRFlUV6Y3eyeQiLPw3KJOrDBGBOhmkV95hk6EO4SeJrrJ2JAQqh7lqSV 1uhjAu7VgM+63YZH/8SZBkP3urWquT49AVD6U1WVRwkllLoeRADiJgp9L45rjj35K1m1 DbSk9HBHbT4Qy+9tDKV8vTkyl1i1EdzUOeb0qTYUHPAWIdFtpZxWguQBfSWSq5ACLaQx Li3w== X-Gm-Message-State: ALoCoQlL7/+oWL09aP0PM7b53vyLD4CUMiQl2zyczfqa7XdeYRBQ8lJHeYsU32nyvBcpls2xt1wS X-Received: by 10.180.106.136 with SMTP id gu8mr15594594wib.6.1431542758388; Wed, 13 May 2015 11:45:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.99 with SMTP id lf3ls301581lac.54.gmail; Wed, 13 May 2015 11:45:58 -0700 (PDT) X-Received: by 10.112.63.201 with SMTP id i9mr195387lbs.93.1431542758264; Wed, 13 May 2015 11:45:58 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id pk3si12916612lbb.75.2015.05.13.11.45.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2015 11:45:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbcga7 with SMTP id ga7so36332735lbc.1 for ; Wed, 13 May 2015 11:45:58 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr239207laj.88.1431542758146; Wed, 13 May 2015 11:45:58 -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 hn6csp704247lbb; Wed, 13 May 2015 11:45:56 -0700 (PDT) X-Received: by 10.52.137.112 with SMTP id qh16mr391627vdb.44.1431542747677; Wed, 13 May 2015 11:45:47 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id cc9si18300811vdc.47.2015.05.13.11.45.46 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 13 May 2015 11:45:47 -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-0001Jf-8p; 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 1YsbdI-0001JV-Sn for xen-devel@lists.xenproject.org; Wed, 13 May 2015 18:43:52 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id 43/24-02928-76B93555; Wed, 13 May 2015 18:43:51 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1431542629!12720564!1 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 31631 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="262397483" From: Julien Grall To: Date: Wed, 13 May 2015 19:33:42 +0100 Message-ID: <1431542022-16138-7-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: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v9 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.181 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" ] + +