From patchwork Tue Apr 28 14:32:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 47685 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3FF872121F for ; Tue, 28 Apr 2015 14:49:44 +0000 (UTC) Received: by wghm4 with SMTP id m4sf34266998wgh.2 for ; Tue, 28 Apr 2015 07:49:43 -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=lKsy6eIY5MYj/BDc3y38JBYwKFViWA9I9yMbM9SkbpX0h4+i6JOtr1EEEYlrIFXOi2 sS2giVJWvttKMdkNH+Lqe0dvE8o1Gos2EKcotfN+qnj6dMzExfgvEx4rNJFYgccncO1U VqbsDIZYl56wuriAnpsfKCBg6rq7HeeYQSyqvVptJnft3bEkX+WLrSikvY2/C+NCLcq6 9pcLkd0du5hdRBR8dcJ3Rx/ab8pviEqdOuPd0JmhO2A8lzz3bA2x0pp49RlU5oXQFYsC +zwKfDGPLd7uBvt/jI9fsDTW4b5LvY68dG4UVmLGc9E1G1U7X2dhKGq/Tu4jEI72snYN PsdQ== X-Gm-Message-State: ALoCoQmad0eUa18MeH4xRfv0hWEDkxQqwyd+GvMIeNElxuNxLgBatcg629lRDBQ8NUnFWegPMBbj X-Received: by 10.180.98.130 with SMTP id ei2mr10299304wib.0.1430232583514; Tue, 28 Apr 2015 07:49:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.8.171 with SMTP id dl11ls80041lad.55.gmail; Tue, 28 Apr 2015 07:49:43 -0700 (PDT) X-Received: by 10.112.144.69 with SMTP id sk5mr14762349lbb.6.1430232583385; Tue, 28 Apr 2015 07:49:43 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id j2si17216290lbd.98.2015.04.28.07.49.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2015 07:49:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbuc2 with SMTP id uc2so109124582lbb.2 for ; Tue, 28 Apr 2015 07:49:43 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr4526144laj.88.1430232583281; Tue, 28 Apr 2015 07:49:43 -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.67.65 with SMTP id l1csp1932358lbt; Tue, 28 Apr 2015 07:49:42 -0700 (PDT) X-Received: by 10.52.173.116 with SMTP id bj20mr12586429vdc.85.1430232570191; Tue, 28 Apr 2015 07:49:30 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id vv1si35324951vdb.46.2015.04.28.07.49.29 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 28 Apr 2015 07:49:30 -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 1Yn6oI-00016V-Gn; Tue, 28 Apr 2015 14:48:30 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yn6oG-00014y-Ft for xen-devel@lists.xenproject.org; Tue, 28 Apr 2015 14:48:28 +0000 Received: from [85.158.139.211] by server-8.bemta-5.messagelabs.com id 8D/38-19484-BBD9F355; Tue, 28 Apr 2015 14:48:27 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1430232502!11277468!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 6525 invoked from network); 28 Apr 2015 14:48:27 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-12.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 28 Apr 2015 14:48:27 -0000 X-IronPort-AV: E=Sophos;i="5.11,664,1422921600"; d="scan'208";a="259453157" From: Julien Grall To: Date: Tue, 28 Apr 2015 15:32:43 +0100 Message-ID: <1430231563-25648-20-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1430231563-25648-1-git-send-email-julien.grall@citrix.com> References: <1430231563-25648-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v6 19/19] 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.179 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" ] + +