From patchwork Thu Aug 8 23:12:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11084943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 020801398 for ; Thu, 8 Aug 2019 23:14:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5C3D28826 for ; Thu, 8 Aug 2019 23:14:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA1EE28C04; Thu, 8 Aug 2019 23:14:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7117628826 for ; Thu, 8 Aug 2019 23:14:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraP-000321-WA; Thu, 08 Aug 2019 23:12:45 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraO-00031e-FO for xen-devel@lists.xen.org; Thu, 08 Aug 2019 23:12:44 +0000 X-Inumbo-ID: 06c9864a-ba32-11e9-83ed-cfaf4b1f0b6e Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 06c9864a-ba32-11e9-83ed-cfaf4b1f0b6e; Thu, 08 Aug 2019 23:12:44 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1A4CF216C8; Thu, 8 Aug 2019 23:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565305963; bh=2AfmFi7anX+X2pH4+meFLL4fdAtGDXbUKTLHh7lhCbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdEVdbJC5uFECdN6vYCYDEqeoxemtemaDSsQpYEbDAxL3/Agb7O4yw6EYC6TORHG5 LvDLcDbR9ePV7MLHKBqVldRB9wnTglxxkPPGiBuY/+EEsa/hXwk+1vzJA2rqa6pN5R +fDvI7caPecJ56mwVC/0sBEnSQ0ydKe2JS/wV0+U= From: Stefano Stabellini To: julien.grall@arm.com Date: Thu, 8 Aug 2019 16:12:37 -0700 Message-Id: <20190808231242.26424-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v3 1/6] xen/arm: introduce handle_interrupts X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , sstabellini@kernel.org, andrii_anisov@epam.com, Achin.Gupta@arm.com, xen-devel@lists.xen.org, Volodymyr_Babchuk@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Move the interrupt handling code out of handle_device to a new function so that it can be reused for dom0less VMs later. Signed-off-by: Stefano Stabellini --- Changes in v3: - add patch The diff is hard to read but I just moved the interrupts related code from handle_devices to a new function handle_interrupts, and very little else. --- xen/arch/arm/domain_build.c | 79 +++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 30 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 4c8404155a..00ddb3b05d 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1220,41 +1220,19 @@ static int __init map_device_children(struct domain *d, } /* - * For a given device node: - * - Give permission to the guest to manage IRQ and MMIO range - * - Retrieve the IRQ configuration (i.e edge/level) from device tree - * When the device is not marked for guest passthrough: - * - Assign the device to the guest if it's protected by an IOMMU - * - Map the IRQs and iomem regions to DOM0 + * Return: + * < 0 on error + * 0 on no mapping required + * 1 IRQ mapping done */ -static int __init handle_device(struct domain *d, struct dt_device_node *dev, - p2m_type_t p2mt) +static int __init handle_interrupts(struct domain *d, + struct dt_device_node *dev, + bool need_mapping) { - unsigned int nirq; - unsigned int naddr; - unsigned int i; - int res; + int i, nirq, res; struct dt_raw_irq rirq; - u64 addr, size; - bool need_mapping = !dt_device_for_passthrough(dev); nirq = dt_number_of_irq(dev); - naddr = dt_number_of_address(dev); - - dt_dprintk("%s passthrough = %d nirq = %d naddr = %u\n", - dt_node_full_name(dev), need_mapping, nirq, naddr); - - if ( dt_device_is_protected(dev) && need_mapping ) - { - dt_dprintk("%s setup iommu\n", dt_node_full_name(dev)); - res = iommu_assign_dt_device(d, dev); - if ( res ) - { - printk(XENLOG_ERR "Failed to setup the IOMMU for %s\n", - dt_node_full_name(dev)); - return res; - } - } /* Give permission and map IRQs */ for ( i = 0; i < nirq; i++ ) @@ -1291,6 +1269,47 @@ static int __init handle_device(struct domain *d, struct dt_device_node *dev, return res; } + return !!(need_mapping && res == 0); +} + +/* + * For a given device node: + * - Give permission to the guest to manage IRQ and MMIO range + * - Retrieve the IRQ configuration (i.e edge/level) from device tree + * When the device is not marked for guest passthrough: + * - Assign the device to the guest if it's protected by an IOMMU + * - Map the IRQs and iomem regions to DOM0 + */ +static int __init handle_device(struct domain *d, struct dt_device_node *dev, + p2m_type_t p2mt) +{ + unsigned int naddr; + unsigned int i; + int res; + u64 addr, size; + bool need_mapping = !dt_device_for_passthrough(dev); + + naddr = dt_number_of_address(dev); + + dt_dprintk("%s passthrough = %d naddr = %u\n", + dt_node_full_name(dev), need_mapping, naddr); + + if ( dt_device_is_protected(dev) && need_mapping ) + { + dt_dprintk("%s setup iommu\n", dt_node_full_name(dev)); + res = iommu_assign_dt_device(d, dev); + if ( res ) + { + printk(XENLOG_ERR "Failed to setup the IOMMU for %s\n", + dt_node_full_name(dev)); + return res; + } + } + + res = handle_interrupts(d, dev, need_mapping); + if ( res < 0 ) + return res; + /* Give permission and map MMIOs */ for ( i = 0; i < naddr; i++ ) { From patchwork Thu Aug 8 23:12:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11084953 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 716B81398 for ; Thu, 8 Aug 2019 23:14:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F3A628826 for ; Thu, 8 Aug 2019 23:14:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5285C28C04; Thu, 8 Aug 2019 23:14:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CCBBD28826 for ; Thu, 8 Aug 2019 23:14:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraT-00034b-AU; Thu, 08 Aug 2019 23:12:49 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraQ-00032T-QK for xen-devel@lists.xen.org; Thu, 08 Aug 2019 23:12:46 +0000 X-Inumbo-ID: 0710baa3-ba32-11e9-8980-bc764e045a96 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 0710baa3-ba32-11e9-8980-bc764e045a96; Thu, 08 Aug 2019 23:12:44 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 97FBA21743; Thu, 8 Aug 2019 23:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565305963; bh=kmVqqtFCam4g889Lm7JzMLZpNmNLKy+Cl7Zb+S/MwBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l4r9qwXi5vfBr7vpfgYWDyxjWcHhbzb1jbWfmQAOHU7rh3GLy9NcfOWBThTPa2qLv hD323QI+q8r6FAK5e78yAeopBgygc7zXjbmTsy6F6FRdhOmWSVHtSTD5Z+iDF6quu6 LM9f4rt8o4Y+0ZdWnxalzwWScJlr2r4Adkpb4I3k= From: Stefano Stabellini To: julien.grall@arm.com Date: Thu, 8 Aug 2019 16:12:38 -0700 Message-Id: <20190808231242.26424-2-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v3 2/6] xen/arm: copy dtb fragment to guest dtb X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , sstabellini@kernel.org, andrii_anisov@epam.com, Achin.Gupta@arm.com, xen-devel@lists.xen.org, Volodymyr_Babchuk@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Read the dtb fragment corresponding to a passthrough device from memory at the location referred to by the "multiboot,dtb" compatible node. Copy the fragment to the guest dtb. Add a dtb_bootmodule field to struct kernel_info to find the dtb fragment for a guest. Some of the code below is taken from tools/libxl/libxl_arm.c. Note that it is OK to take LGPL 2.1 code and including it into a GPLv2 code base. The result is GPLv2 code. Signed-off-by: Stefano Stabellini ---- Changes in v3: - switch to using device_tree_for_each_node for the copy Changes in v2: - add a note about the code coming from libxl in the commit message - copy /aliases - code style --- xen/arch/arm/domain_build.c | 103 +++++++++++++++++++++++++++++++++++ xen/include/asm-arm/kernel.h | 2 +- 2 files changed, 104 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 00ddb3b05d..70bcdc449d 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1706,6 +1707,102 @@ static int __init make_vpl011_uart_node(const struct domain *d, void *fdt) } #endif +static int __init handle_properties(struct domain *d, void *fdt, const void *pfdt, int nodeoff, + u32 address_cells, u32 size_cells) +{ + int propoff, nameoff, r; + const struct fdt_property *prop; + + for ( propoff = fdt_first_property_offset(pfdt, nodeoff); + propoff >= 0; + propoff = fdt_next_property_offset(pfdt, propoff) ) + { + + if ( !(prop = fdt_get_property_by_offset(pfdt, propoff, NULL)) ) + return -FDT_ERR_INTERNAL; + + nameoff = fdt32_to_cpu(prop->nameoff); + r = fdt_property(fdt, fdt_string(pfdt, nameoff), + prop->data, fdt32_to_cpu(prop->len)); + if ( r ) + return r; + } + + /* FDT_ERR_NOTFOUND => There is no more properties for this node */ + return ( propoff != -FDT_ERR_NOTFOUND ) ? propoff : 0; +} + +static int __init scan_pt_node(const void *pfdt, + int nodeoff, const char *name, int depth, + u32 address_cells, u32 size_cells, + void *data) +{ + int rc; + int i, num; + struct kernel_info *kinfo = data; + void *fdt = kinfo->fdt; + int depth_next = depth; + int node_next; + + /* no need to parse initial node */ + if ( !depth ) + return 0; + + rc = fdt_begin_node(fdt, fdt_get_name(pfdt, nodeoff, NULL)); + if ( rc ) + return rc; + + rc = handle_properties(kinfo->d, fdt, pfdt, nodeoff, + address_cells, size_cells); + if ( rc ) + return rc; + + node_next = fdt_next_node(pfdt, nodeoff, &depth_next); + + /* + * If the next node is a sibling, then we need to call + * fdt_end_node once. If the next node is one level up, we need to + * call it twice: once for us and the second time for our parent. + * Both these two conditions are expressed together by depth - + * depth_next + 1. + * + * If we reached the end of the device tree fragment, then it is + * easy: we need to call fdt_end_node once for every level of depth + * to close all open nodes. + */ + if ( depth_next < 0 ) + num = depth; + else + num = depth - depth_next + 1; + + for ( i = 0; i < num; i++ ) + { + rc = fdt_end_node(fdt); + if ( rc ) + return rc; + } + + return 0; +} + +static int __init domain_handle_dtb_bootmodule(struct domain *d, + struct kernel_info *kinfo) +{ + void *pfdt; + int res; + + pfdt = ioremap_cache(kinfo->dtb_bootmodule->start, + kinfo->dtb_bootmodule->size); + if ( pfdt == NULL ) + return -EFAULT; + + res = device_tree_for_each_node(pfdt, scan_pt_node, kinfo); + + iounmap(pfdt); + + return res; +} + /* * The max size for DT is 2MB. However, the generated DT is small, 4KB * are enough for now, but we might have to increase it in the future. @@ -1777,6 +1874,12 @@ static int __init prepare_dtb_domU(struct domain *d, struct kernel_info *kinfo) goto err; } + if ( kinfo->dtb_bootmodule ) { + ret = domain_handle_dtb_bootmodule(d, kinfo); + if ( ret ) + return ret; + } + ret = fdt_end_node(kinfo->fdt); if ( ret < 0 ) goto err; diff --git a/xen/include/asm-arm/kernel.h b/xen/include/asm-arm/kernel.h index 33f3e72b11..720dec4071 100644 --- a/xen/include/asm-arm/kernel.h +++ b/xen/include/asm-arm/kernel.h @@ -28,7 +28,7 @@ struct kernel_info { paddr_t gnttab_size; /* boot blob load addresses */ - const struct bootmodule *kernel_bootmodule, *initrd_bootmodule; + const struct bootmodule *kernel_bootmodule, *initrd_bootmodule, *dtb_bootmodule; const char* cmdline; paddr_t dtb_paddr; paddr_t initrd_paddr; From patchwork Thu Aug 8 23:12:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11084949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17D551709 for ; Thu, 8 Aug 2019 23:14:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 061A828826 for ; Thu, 8 Aug 2019 23:14:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC17628C05; Thu, 8 Aug 2019 23:14:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7B79228826 for ; Thu, 8 Aug 2019 23:14:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraS-00033a-JF; Thu, 08 Aug 2019 23:12:48 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraQ-00032R-PQ for xen-devel@lists.xen.org; Thu, 08 Aug 2019 23:12:46 +0000 X-Inumbo-ID: 0760e6ae-ba32-11e9-8980-bc764e045a96 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 0760e6ae-ba32-11e9-8980-bc764e045a96; Thu, 08 Aug 2019 23:12:44 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 207B921773; Thu, 8 Aug 2019 23:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565305964; bh=YA8x0PXoxSsdIBdwhd2S+w6rYBQWneju6ZMINMYxAxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+IJUZiS5sE0KoyEFV5DhACuNoE9oDXihwMNOehsBqSByFOu/7vcrbHPypFPL4237 96gfJXGX5QDkcGp2U+8Qh5YgXBsMggI2sal2tWRxpzB2rS16o1jdA+zdggnpwlEimC ip3boX0WwXXDHCV5l1oUZQHzCqfS8dV7w9I/aI8w= From: Stefano Stabellini To: julien.grall@arm.com Date: Thu, 8 Aug 2019 16:12:39 -0700 Message-Id: <20190808231242.26424-3-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v3 3/6] xen/arm: assign devices to boot domains X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , sstabellini@kernel.org, andrii_anisov@epam.com, Achin.Gupta@arm.com, xen-devel@lists.xen.org, Volodymyr_Babchuk@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Scan the user provided dtb fragment at boot. For each device node, map memory to guests, and route interrupts and setup the iommu. The iommu is setup by passing the node of the device to assign on the host device tree. The path is specified in the device tree fragment as the "xen,path" string property. The memory region to remap is specified by the "xen,reg" property. (Perhaps it might be possible to use "range" instead of "xen,regs". This is something to investigate.) The interrupts are taken from the host device tree corresponding node. To map the interrupt call handle_interrupts, which is shared with the existing dom0 path. Add a interrupt-parent property automatically to the guest device tree when the interrupt-parent should be the GIC. Copy over the interrupt property from the host device tree node. Signed-off-by: Stefano Stabellini --- Changes in v3: - improve commit message - remove superfluous cast - merge code with the copy code - add interrup-parent - demove depth > 2 check - reuse code from handle_interrupts - copy interrupts from host dt Changes in v2: - rename "path" to "xen,path" - grammar fix - use gaddr_to_gfn and maddr_to_mfn - remove depth <= 2 limitation in scanning the dtb fragment - introduce and parse xen,reg - code style - support more than one interrupt per device - specify only the GIC is supported --- xen/arch/arm/domain_build.c | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 70bcdc449d..0057a509d1 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1712,6 +1712,9 @@ static int __init handle_properties(struct domain *d, void *fdt, const void *pfd { int propoff, nameoff, r; const struct fdt_property *prop; + struct dt_device_node *node; + const __be32 *cell; + int i, len; for ( propoff = fdt_first_property_offset(pfdt, nodeoff); propoff >= 0; @@ -1726,6 +1729,69 @@ static int __init handle_properties(struct domain *d, void *fdt, const void *pfd prop->data, fdt32_to_cpu(prop->len)); if ( r ) return r; + + if ( strcmp("xen,reg", fdt_string(pfdt, nameoff)) == 0 ) + { + paddr_t mstart, size, gstart; + cell = (const __be32 *)prop->data; + len = fdt32_to_cpu(prop->len) / + ((address_cells*2 + size_cells) * sizeof (u32)); + + for ( i = 0; i < len; i++ ) + { + mstart = dt_next_cell(address_cells, &cell); + size = dt_next_cell(size_cells, &cell); + gstart = dt_next_cell(address_cells, &cell); + + r = guest_physmap_add_entry(d, gaddr_to_gfn(gstart), + maddr_to_mfn(mstart), + get_order_from_bytes(size), + p2m_mmio_direct_dev); + if ( r < 0 ) + { + dprintk(XENLOG_ERR, + "Failed to map %"PRIpaddr" to the guest at%"PRIpaddr"\n", + mstart, gstart); + return -EFAULT; + } + } + } + + if ( strcmp("xen,path", fdt_string(pfdt, nameoff)) == 0 ) + { + node = dt_find_node_by_path(prop->data); + if ( node != NULL ) + r = iommu_assign_dt_device(d, node); + else + { + dprintk(XENLOG_ERR, "Couldn't find node %s in host_dt!\n", + (char *)prop->data); + return -EINVAL; + } + + r = handle_interrupts(d, node, true); + if ( r < 0 ) + return r; + if ( r > 0 ) + { + unsigned int intlen; + const u32* intspec; + + /* generate interrupt-parent to point to the virtual GIC */ + r = fdt_property_u32(fdt, "interrupt-parent", GUEST_PHANDLE_GIC); + if ( r ) + return r; + + /* copy interrupts/interrupts-extended from the host DT node */ + intspec = dt_get_property(node, "interrupts", &intlen); + if ( intspec == NULL ) + return -EFAULT; + + r = fdt_property(fdt, "interrupts", intspec, intlen); + if ( r ) + return r; + } + } } /* FDT_ERR_NOTFOUND => There is no more properties for this node */ From patchwork Thu Aug 8 23:12:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11084971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B7F514DB for ; Thu, 8 Aug 2019 23:14:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 192DB28826 for ; Thu, 8 Aug 2019 23:14:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D7CF28C02; Thu, 8 Aug 2019 23:14:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9A0D628826 for ; Thu, 8 Aug 2019 23:14:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraR-00032u-9H; Thu, 08 Aug 2019 23:12:47 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraQ-000327-Al for xen-devel@lists.xen.org; Thu, 08 Aug 2019 23:12:46 +0000 X-Inumbo-ID: 07ac3ea4-ba32-11e9-91dd-a35294c6a0bf Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 07ac3ea4-ba32-11e9-91dd-a35294c6a0bf; Thu, 08 Aug 2019 23:12:45 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 98B9D217F4; Thu, 8 Aug 2019 23:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565305964; bh=dyHmSJO3VRjrLVZ7qt/sGVVltlHEXNeHWzaSE6hqB9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xdTB7/tG1NkGO/SP6HxivMxRkOIMTym4tq8LKVhPy5cxdMJVbdKS3d2hGzZI6VjMI 7FAV1a3OJE08hLCnbym/5PKAgRxg/u2WlmDcDqhLyrOou2irF9Dam/Q103rNWvuYbX mfXmAKRnvEQilJcxqIBcjuPcH8m1otXhKmdaqYr8= From: Stefano Stabellini To: julien.grall@arm.com Date: Thu, 8 Aug 2019 16:12:40 -0700 Message-Id: <20190808231242.26424-4-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v3 4/6] xen/arm: handle "multiboot, device-tree" compatible nodes X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , sstabellini@kernel.org, andrii_anisov@epam.com, Achin.Gupta@arm.com, xen-devel@lists.xen.org, Volodymyr_Babchuk@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Detect "multiboot,device-tree" compatible nodes. Add them to the bootmod array as BOOTMOD_GUEST_DTB. In kernel_probe, find the right BOOTMOD_GUEST_DTB and store a pointer to it in dtb_bootmodule. Signed-off-by: Stefano Stabellini --- Changes in v2: - rename BOOTMOD_DTB to BOOTMOD_GUEST_DTB - rename multiboot,dtb to multiboot,device-tree --- xen/arch/arm/bootfdt.c | 2 ++ xen/arch/arm/kernel.c | 12 +++++++++++- xen/arch/arm/setup.c | 1 + xen/include/asm-arm/setup.h | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index 891b4b66ff..4ee1bc314e 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -205,6 +205,8 @@ static void __init process_multiboot_node(const void *fdt, int node, kind = BOOTMOD_RAMDISK; else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 ) kind = BOOTMOD_XSM; + else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree") == 0 ) + kind = BOOTMOD_GUEST_DTB; else kind = BOOTMOD_UNKNOWN; diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index 389bef2afa..997a871f62 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -425,7 +425,7 @@ int __init kernel_probe(struct kernel_info *info, struct bootmodule *mod = NULL; struct bootcmdline *cmd = NULL; struct dt_device_node *node; - u64 kernel_addr, initrd_addr, size; + u64 kernel_addr = 0, initrd_addr = 0, dtb_addr = 0, size; int rc; /* domain is NULL only for the hardware domain */ @@ -469,6 +469,16 @@ int __init kernel_probe(struct kernel_info *info, info->initrd_bootmodule = boot_module_find_by_addr_and_kind( BOOTMOD_RAMDISK, initrd_addr); } + else if ( dt_device_is_compatible(node, "multiboot,device-tree") ) + { + u32 len; + const __be32 *val; + + val = dt_get_property(node, "reg", &len); + dt_get_range(&val, node, &dtb_addr, &size); + info->dtb_bootmodule = boot_module_find_by_addr_and_kind( + BOOTMOD_GUEST_DTB, dtb_addr); + } else continue; } diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 215746a5c3..f93a8bed04 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -347,6 +347,7 @@ const char * __init boot_module_kind_as_string(bootmodule_kind kind) case BOOTMOD_KERNEL: return "Kernel"; case BOOTMOD_RAMDISK: return "Ramdisk"; case BOOTMOD_XSM: return "XSM"; + case BOOTMOD_GUEST_DTB: return "DTB"; case BOOTMOD_UNKNOWN: return "Unknown"; default: BUG(); } diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index 8bf3d5910a..5aaf07bf97 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -16,6 +16,7 @@ typedef enum { BOOTMOD_KERNEL, BOOTMOD_RAMDISK, BOOTMOD_XSM, + BOOTMOD_GUEST_DTB, BOOTMOD_UNKNOWN } bootmodule_kind; From patchwork Thu Aug 8 23:12:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11084973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2FAB81398 for ; Thu, 8 Aug 2019 23:14:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BE3B28826 for ; Thu, 8 Aug 2019 23:14:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 104FD28C02; Thu, 8 Aug 2019 23:14:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B565128826 for ; Thu, 8 Aug 2019 23:14:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraS-00033z-Ui; Thu, 08 Aug 2019 23:12:48 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraQ-00032S-QT for xen-devel@lists.xen.org; Thu, 08 Aug 2019 23:12:46 +0000 X-Inumbo-ID: 07f75751-ba32-11e9-8980-bc764e045a96 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 07f75751-ba32-11e9-8980-bc764e045a96; Thu, 08 Aug 2019 23:12:45 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1A4922184E; Thu, 8 Aug 2019 23:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565305965; bh=o+lOhO4/XOL9cIiB+ezJTpXaJ/h7+Udl/MZxTpDYfw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pML6ErdujTKypteuLsMQ8SEf6Oj922cZAkfjnB17KrSg7rkAiyUtPKmxJbl81oq8N QxocgY7ph6Q6TwhgGvBVg2hqySs9xHareF+fE4p3YQF6h3/0QrNsi7PPfc9jKuStRx bq2BWbBC9UINQMBTpLWNh5wQywI2Y5GC4ynrLi/c= From: Stefano Stabellini To: julien.grall@arm.com Date: Thu, 8 Aug 2019 16:12:41 -0700 Message-Id: <20190808231242.26424-5-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v3 5/6] xen/arm: introduce nr_spis X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , sstabellini@kernel.org, andrii_anisov@epam.com, Achin.Gupta@arm.com, xen-devel@lists.xen.org, Volodymyr_Babchuk@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP We don't have a clear way to know how many virtual SPIs we need for the boot domains. Introduce a new option under xen,domain to specify the number of SPIs to allocate for the domain. The property is optional, when absent, we'll use the physical number of gic lines for dom0less domains, just like for dom0. Given that dom0less VMs are meant for static partitioning scenarios where the number of VMs is very low, increased memory overhead should not be a problem, and it is possible to minimizing it by using "nr_spis". Signed-off-by: Stefano Stabellini Reviewed-by: Volodymyr Babchuk --- Changes in v3: - improve commit message - introduce nr_spis --- xen/arch/arm/domain_build.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 0057a509d1..fc4e5bc4ca 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2270,7 +2270,6 @@ void __init create_domUs(void) struct domain *d; struct xen_domctl_createdomain d_cfg = { .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE, - .arch.nr_spis = 0, .flags = XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap, .max_evtchn_port = -1, .max_grant_frames = 64, @@ -2280,13 +2279,13 @@ void __init create_domUs(void) if ( !dt_device_is_compatible(node, "xen,domain") ) continue; - if ( dt_property_read_bool(node, "vpl011") ) - d_cfg.arch.nr_spis = GUEST_VPL011_SPI - 32 + 1; - if ( !dt_property_read_u32(node, "cpus", &d_cfg.max_vcpus) ) panic("Missing property 'cpus' for domain %s\n", dt_node_name(node)); + if ( !dt_property_read_u32(node, "nr_spis", &d_cfg.arch.nr_spis) ) + d_cfg.arch.nr_spis = gic_number_lines() - 32; + d = domain_create(++max_init_domid, &d_cfg, false); if ( IS_ERR(d) ) panic("Error creating domain %s\n", dt_node_name(node)); From patchwork Thu Aug 8 23:12:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11084975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DCFBD14DB for ; Thu, 8 Aug 2019 23:14:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA14028826 for ; Thu, 8 Aug 2019 23:14:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB88928C02; Thu, 8 Aug 2019 23:14:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3636D28826 for ; Thu, 8 Aug 2019 23:14:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraT-000357-M8; Thu, 08 Aug 2019 23:12:49 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvraR-00032y-Hh for xen-devel@lists.xen.org; Thu, 08 Aug 2019 23:12:47 +0000 X-Inumbo-ID: 08436f40-ba32-11e9-b598-2700aa61cced Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 08436f40-ba32-11e9-b598-2700aa61cced; Thu, 08 Aug 2019 23:12:46 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 94DDA21874; Thu, 8 Aug 2019 23:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565305965; bh=yjuzZM+7LDj++YaZWArvopDCjLW19sEdgc7eaxWMfXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGWjwxOZG9O7dn7hYW8EL4dZ+a7hH9TiXLNJ6Yw77rFPQukcRWomxJq8FxhzCIzsM X3gERZ3/wCZoraaG2m8fSKITv5WDDqIuF42A0le8pUyL6bnhU7xYUxcv91qkQgO3pI DC0sF3Xw3j0lokSzK32uG0c5hUWRrl0CbUQrAja0= From: Stefano Stabellini To: julien.grall@arm.com Date: Thu, 8 Aug 2019 16:12:42 -0700 Message-Id: <20190808231242.26424-6-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v3 6/6] xen/arm: add dom0less device assignment info to docs X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , sstabellini@kernel.org, andrii_anisov@epam.com, Achin.Gupta@arm.com, xen-devel@lists.xen.org, Volodymyr_Babchuk@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Stefano Stabellini --- Changes in v3: - add nr_spis - change description of interrupts and interrupt-parent Changes in v2: - device tree fragment loaded in cacheable memory - rename multiboot,dtb to multiboot,device-tree - rename "path" to "xen,path" - add a note about device memory mapping - introduce xen,reg - specify only the GIC is supported --- docs/misc/arm/device-tree/booting.txt | 117 ++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt index 317a9e962a..ec2f7ba605 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -148,6 +148,12 @@ with the following properties: An empty property to enable/disable a virtual pl011 for the guest to use. +- nr_spis + Optional. A 32-bit integer specifying the number of SPIs (shared + perhiperal interrupts) to allocate for the domain. If nr_spis is + missing, the max number of SPIs supported by the physical GIC is + used. + - #address-cells and #size-cells Both #address-cells and #size-cells need to be specified because @@ -226,3 +232,114 @@ chosen { }; }; }; + + +Device Assignment +================= + +Device Assignment (Passthrough) is supported by adding another module, +alongside the kernel and ramdisk, with the device tree fragment +corresponding to the device node to assign to the guest. + +The dtb sub-node should have the following properties: + +- compatible + + "multiboot,device-tree" + +- reg + + Specifies the physical address of the device tree binary fragment + RAM and its length. + +As an example: + + module@0xc000000 { + compatible = "multiboot,device-tree", "multiboot,module"; + reg = <0x0 0xc000000 0xffffff>; + }; + +The DTB fragment is loaded in cacheable memory, at 0xc000000 in the +example above. It should follow the convention explained in +docs/misc/arm/passthrough.txt. The DTB fragment will be added to the +guest device tree, so that the guest kernel will be able to discover the +device. + +In addition, the following properties for each device node in the device +tree fragment will be used for the device assignment setup: + +- xen,reg + + The xen,reg property is an array of: + + + + They specify the physical address and size of the device memory + ranges together with the corresponding guest address to map them to. + The size of `phys_addr' and `guest_addr' is determined by + #address_cells; the size of `size' is determined by #size_cells. + The memory will be mapped as device memory in the guest + (p2m_mmio_direct_dev). + +- xen,path + + A new string property named "xen,path" holds the path in the host device + tree to the corresponding device node. + +Please note that for GIC interrupts, the interrupts and interrupt-parent +device tree properties should not be present in the device tree +fragment, because they are automatically generated by Xen starting from +the corresponding information on the host device tree node for the +device. For GIC interrupts, only the interrupts property is currently +supported, not the newer interrupts-extended property. + +The following is a real-world example of a device tree fragment for the +network card on Xilinx MPSoC boards: + +/dts-v1/; + +/ { + #address-cells = <0x2>; + #size-cells = <0x1>; + + passthrough { + compatible = "simple-bus"; + ranges; + #address-cells = <0x2>; + #size-cells = <0x1>; + + misc_clk { + #clock-cells = <0x0>; + clock-frequency = <0x7735940>; + compatible = "fixed-clock"; + linux,phandle = <0x1>; + phandle = <0x1>; + }; + + ethernet@ff0e0000 { + compatible = "cdns,zynqmp-gem"; + status = "okay"; + reg = <0x0 0xff0e0000 0x1000>; + clock-names = "pclk", "hclk", "tx_clk", "rx_clk"; + #address-cells = <0x1>; + #size-cells = <0x0>; + clocks = <0x1 0x1 0x1 0x1>; + phy-mode = "rgmii-id"; + xlnx,ptp-enet-clock = <0x0>; + local-mac-address = [00 0a 35 00 22 01]; + phy-handle = <0x2>; + xen,path = "/amba/ethernet@ff0e0000"; + xen,reg = <0x0 0xff0e0000 0x1000 0x0 0xff0e0000>; + + phy@c { + reg = <0xc>; + ti,rx-internal-delay = <0x8>; + ti,tx-internal-delay = <0xa>; + ti,fifo-depth = <0x1>; + ti,rxctrl-strap-worka; + linux,phandle = <0x2>; + phandle = <0x2>; + }; + }; + }; +};