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;