From patchwork Fri Jul 18 13:08:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 33842 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D2A7A208CF for ; Fri, 18 Jul 2014 13:10:39 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id eu11sf26513662pac.3 for ; Fri, 18 Jul 2014 06:10:31 -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:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=CgFbrtpy7Yt0yQfSQJQfoaAr6y81TouvZV/22cxzvoM=; b=ICur+izMGJLx1t2OcA911mmrL9iDMi/TmDsmae2QhzlllBRXNb/1oa4/yrba0XrnL8 AX2Pf5WwBG63Ei/U5sktFxj/IKe3J4wy0R85ylSLga3cIebyOQyU3tksLCB3jquJkO/9 o/nc3wWJTKvrAYRMYoova2TMgamG4B2sIUbQVHkIv14h5WM7QYDPghRhT4yD6x4ls3xV 1dU0mxNLTz1nQXZ8LLVaDafr4r+KnLmBItUc9vZi34Keua2/Bms/Uj6Dg+kA8bV2i9/b whQmezQozV/VJ3TnRTuDdAphWIuSkGhHOUIxZHzrx6qEdkq3Jc0+kWRnYok4849mbBCN Kpow== X-Gm-Message-State: ALoCoQnnpMt23uw6HXvvBPF87U7SfKGLjw7WdiR9jwJxL13jun1JMZZcVtL1rqG7xWBeV0RPecaG X-Received: by 10.66.151.140 with SMTP id uq12mr2288277pab.23.1405689031134; Fri, 18 Jul 2014 06:10:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.244 with SMTP id p107ls983040qgp.50.gmail; Fri, 18 Jul 2014 06:10:31 -0700 (PDT) X-Received: by 10.52.75.229 with SMTP id f5mr4676552vdw.13.1405689031016; Fri, 18 Jul 2014 06:10:31 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id p7si5585305vda.40.2014.07.18.06.10.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 06:10:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hu12so7433851vcb.28 for ; Fri, 18 Jul 2014 06:10:30 -0700 (PDT) X-Received: by 10.52.37.81 with SMTP id w17mr2957681vdj.95.1405689030591; Fri, 18 Jul 2014 06:10:30 -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.221.37.5 with SMTP id tc5csp9795vcb; Fri, 18 Jul 2014 06:10:30 -0700 (PDT) X-Received: by 10.220.137.145 with SMTP id w17mr5450032vct.47.1405689030109; Fri, 18 Jul 2014 06:10:30 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id g9si5583671vda.41.2014.07.18.06.10.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 18 Jul 2014 06:10: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 1X87tq-0005ZO-1t; Fri, 18 Jul 2014 13:08:34 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X87tp-0005Wm-0W for xen-devel@lists.xen.org; Fri, 18 Jul 2014 13:08:33 +0000 Received: from [193.109.254.147:15560] by server-14.bemta-14.messagelabs.com id B4/9B-02763-05C19C35; Fri, 18 Jul 2014 13:08:32 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1405688910!18165687!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22500 invoked from network); 18 Jul 2014 13:08:31 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-3.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 18 Jul 2014 13:08:31 -0000 X-IronPort-AV: E=Sophos;i="5.01,685,1400025600"; d="scan'208";a="153665178" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 18 Jul 2014 13:08:30 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Fri, 18 Jul 2014 09:08:29 -0400 Received: from marilith-n13-p0.uk.xensource.com ([10.80.229.115] helo=localhost.localdomain) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1X87tk-0001RR-Ah; Fri, 18 Jul 2014 14:08:29 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Fri, 18 Jul 2014 14:08:28 +0100 From: Ian Campbell To: Date: Fri, 18 Jul 2014 14:08:18 +0100 Message-ID: <1405688900-11769-8-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1405688876.491.10.camel@kazak.uk.xensource.com> References: <1405688876.491.10.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v3 08/10] xen: arm: support bootmodule type detection by ordering 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: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 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: Assign modules types based on the order in which they are defined in the FDT. This is supported only for the dom0 kernel and ramdisk when given as the first and second modules respectively, similar to how http://wiki.xen.org/wiki?title=Xen_ARM_with_Virtualization_Extensions/Multiboot&oldid=11824 defined the default types from the bootloader side. This is compatible with how Xen interprets the modules with x86 multiboot and I think simplifies things for bootloaders which now need not contain similar guessing code if they only care about the most basic case. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- v2: Don't rely on enum ordering for guessing --- xen/arch/arm/bootfdt.c | 17 +++++++++++++++-- xen/arch/arm/setup.c | 14 ++++++++++++++ xen/include/asm-arm/setup.h | 1 + 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index ce7fdf2..e100233 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -165,6 +165,7 @@ static void __init process_multiboot_node(const void *fdt, int node, const char *name, u32 address_cells, u32 size_cells) { + static int kind_guess = 0; const struct fdt_property *prop; const __be32 *cell; bootmodule_kind kind; @@ -181,7 +182,18 @@ static void __init process_multiboot_node(const void *fdt, int node, else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 ) kind = BOOTMOD_XSM; else - panic("%s not a known xen multiboot type\n", name); + kind = BOOTMOD_UNKNOWN; + + /* Guess that first two unknown are kernel and ramdisk respectively. */ + if ( kind == BOOTMOD_UNKNOWN ) + { + switch ( kind_guess++ ) + { + case 0: kind = BOOTMOD_KERNEL; break; + case 1: kind = BOOTMOD_RAMDISK; break; + default: break; + } + } prop = fdt_get_property(fdt, node, "reg", &len); if ( !prop ) @@ -281,10 +293,11 @@ static void __init early_print_info(void) mi->bank[i].start + mi->bank[i].size - 1); printk("\n"); for ( i = 0 ; i < mods->nr_mods; i++ ) - printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %s\n", + printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-12s %s\n", i, mods->module[i].start, mods->module[i].start + mods->module[i].size, + boot_module_kind_as_string(mods->module[i].kind), mods->module[i].cmdline); nr_rsvd = fdt_num_mem_rsv(device_tree_flattened); for ( i = 0; i < nr_rsvd; i++ ) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 0cbe552..e53e491 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -223,6 +223,20 @@ struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind) return NULL; } +const char * __init boot_module_kind_as_string(bootmodule_kind kind) +{ + switch ( kind ) + { + case BOOTMOD_XEN: return "Xen"; + case BOOTMOD_FDT: return "Device Tree"; + case BOOTMOD_KERNEL: return "Kernel"; + case BOOTMOD_RAMDISK: return "Ramdisk"; + case BOOTMOD_XSM: return "XSM"; + case BOOTMOD_UNKNOWN: return "Unknown"; + default: BUG(); + } +} + void __init discard_initial_modules(void) { struct bootmodules *mi = &bootinfo.modules; diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index e2e18c3..36e5704 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -64,6 +64,7 @@ struct bootmodule *add_boot_module(bootmodule_kind kind, paddr_t start, paddr_t size, const char *cmdline); struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind); +const char * __init boot_module_kind_as_string(bootmodule_kind kind); #endif /*