From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: [PATCH v8 6/6] docs/misc: arm: Add documentation about Device Tree passthrough Date: Tue, 12 May 2015 15:33:12 +0100 Message-ID: <1431441192-27897-7-git-send-email-julien.grall@citrix.com> References: <1431441192-27897-1-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: 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 In-Reply-To: <1431441192-27897-1-git-send-email-julien.grall@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org 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" ] + + -- 2.1.4