From patchwork Thu Oct 3 01:35:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11171989 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A11AF13BD for ; Thu, 3 Oct 2019 01:36:56 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D313222BE for ; Thu, 3 Oct 2019 01:36:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="b6ETDssO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D313222BE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFq1v-0003dG-Sm; Thu, 03 Oct 2019 01:35:43 +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 1iFq1u-0003cD-Gr for xen-devel@lists.xen.org; Thu, 03 Oct 2019 01:35:42 +0000 X-Inumbo-ID: 176182c5-e57e-11e9-971d-12813bfff9fa Received: from mail.kernel.org (unknown [198.145.29.99]) by localhost (Halon) with ESMTPS id 176182c5-e57e-11e9-971d-12813bfff9fa; Thu, 03 Oct 2019 01:35:34 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.hsd1.ca.comcast.net (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 AEF86222C6; Thu, 3 Oct 2019 01:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570066534; bh=+QjoqJzXGXB0pbE8aMyDfA+XpIbLg/CESMqysxlGCE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b6ETDssOAL5qnlOb25QOeeaXXklx93zAxjtAtw+tedRi1kSt1WLYIS3yv6dT2naZC s02wO4GauRJRyDLPCd8yQ3cEShCqLZ3JFg5pDZFXuNwd2Z7jqMXZxWquGaSSWN0TP4 xBUTHtPbeSyObD7WlwS6Esc6nHWpUT7BW4dd1q8M= From: Stefano Stabellini To: julien.grall@arm.com Date: Wed, 2 Oct 2019 18:35:24 -0700 Message-Id: <20191003013526.30768-6-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v8 6/8] 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" 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 Acked-by: Julien Grall --- Changes in v4: - use uint32_t - remove useless 0 initialization - add return value check 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 | 14 +++++++++++++- xen/arch/arm/setup.c | 1 + xen/include/asm-arm/setup.h | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index a7810abb15..08fb59f4e7 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -242,6 +242,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..8eff074836 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, initrd_addr, dtb_addr, size; int rc; /* domain is NULL only for the hardware domain */ @@ -469,6 +469,18 @@ 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") ) + { + uint32_t len; + const __be32 *val; + + val = dt_get_property(node, "reg", &len); + if ( val == NULL ) + continue; + 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 790eab94d6..705a917abf 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -369,6 +369,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 fa0a8721b2..2f8f24e286 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;