From patchwork Thu Jun 26 16:45:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 32585 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 80C35201EF for ; Thu, 26 Jun 2014 16:48:32 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id m1sf21241843oag.9 for ; Thu, 26 Jun 2014 09:48:32 -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=ofLplwLHWXjLmSIM3SCLAGl5xXcnat926aHt0LfBooY=; b=iC4WRyXPlbVnTT0p8e++qVydRHwLgckSsXIdAkJUDl88mrPgkmBx/c6LluvIPoXNJh dYIjT2Qut15TUaNkVv+EWcAp9wK38Ie8+3S7JGR/0I7H02goR/6kqIc+X6gMyrbjhanV fewhioO4h6zd56NEbjq8qzPr9Rbc1JDGFQGd0bhzmCnNby57v3NxcgzHvlSfnvzzDW5x 5xvPeakkvCUiedgD55YtdYomGQ3HJZSUnysWl7wPmfDQVBBvZ0Ljwqkmf065N+VrOYMl ZBWKIUi2JVZtmB96fp9Tonub4j4XQoB77HxqbEgcSq9VJ6S6D6m9Z1VoVA+6XdL6yvUp hRYQ== X-Gm-Message-State: ALoCoQkdHfBCfVxzj9HLg/At58QWpGcv19nHsrmB3an6dPkoFKTFlq3mCMUmjYTd6BpdgOfgjZcO X-Received: by 10.182.28.102 with SMTP id a6mr9211766obh.44.1403801311939; Thu, 26 Jun 2014 09:48:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.17.19 with SMTP id 19ls298099qgc.69.gmail; Thu, 26 Jun 2014 09:48:31 -0700 (PDT) X-Received: by 10.221.56.132 with SMTP id wc4mr3782235vcb.38.1403801311825; Thu, 26 Jun 2014 09:48:31 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id hf3si4892483veb.101.2014.06.26.09.48.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 09:48:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id lf12so3795792vcb.4 for ; Thu, 26 Jun 2014 09:48:31 -0700 (PDT) X-Received: by 10.58.182.234 with SMTP id eh10mr3709364vec.41.1403801311732; Thu, 26 Jun 2014 09:48:31 -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 tc5csp44163vcb; Thu, 26 Jun 2014 09:48:31 -0700 (PDT) X-Received: by 10.42.76.205 with SMTP id f13mr14847829ick.63.1403801311031; Thu, 26 Jun 2014 09:48:31 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id qa8si12177747icb.25.2014.06.26.09.48.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 26 Jun 2014 09:48:31 -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 1X0CoA-0004JZ-Tg; Thu, 26 Jun 2014 16:45:58 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X0Co8-0004Ib-OA for xen-devel@lists.xen.org; Thu, 26 Jun 2014 16:45:57 +0000 Received: from [193.109.254.147:29088] by server-14.bemta-14.messagelabs.com id 20/06-08195-44E4CA35; Thu, 26 Jun 2014 16:45:56 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-9.tower-27.messagelabs.com!1403801153!13922171!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 754 invoked from network); 26 Jun 2014 16:45:55 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-9.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 26 Jun 2014 16:45:55 -0000 X-IronPort-AV: E=Sophos;i="5.01,554,1400025600"; d="scan'208";a="147655578" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 26 Jun 2014 16:45:52 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Thu, 26 Jun 2014 12:45:52 -0400 Received: from marilith-n13-p0.uk.xensource.com ([10.80.229.115] helo=marilith-n13.uk.xensource.com.) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1X0Co4-0002AU-0p; Thu, 26 Jun 2014 17:45:52 +0100 From: Ian Campbell To: Date: Thu, 26 Jun 2014 17:45:50 +0100 Message-ID: <1403801151-11007-8-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1403801130.31742.1.camel@kazak.uk.xensource.com> References: <1403801130.31742.1.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 v2 8/9] 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.173 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 --- v2: Don't rely on enum ordering for guessing --- xen/arch/arm/bootfdt.c | 19 ++++++++++++++++--- xen/arch/arm/setup.c | 14 ++++++++++++++ xen/include/asm-arm/setup.h | 1 + 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index b42a789..7cbf0b0 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -163,6 +163,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; @@ -179,7 +180,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 ) @@ -278,11 +290,12 @@ static void __init early_print_info(void) mi->bank[i].start, mi->bank[i].start + mi->bank[i].size - 1); printk("\n"); - for ( i = 1 ; i < mods->nr_mods; i++ ) - printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %s\n", + for ( i = 0 ; i < mods->nr_mods; i++ ) + printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-8s %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 96ed13b..367ad11 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -221,6 +221,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 "FDT"; + 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 fe4997b..94741cf 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -64,6 +64,7 @@ const char __init *boot_fdt_cmdline(const void *fdt); void 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 /*