From patchwork Mon Jun 16 11:45:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 31958 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 78F0F206A0 for ; Mon, 16 Jun 2014 11:47:18 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id eb12sf32181873oac.7 for ; Mon, 16 Jun 2014 04:47:18 -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=LAH4L1lVIiSp1sIGLsa4rXs8mTwgrVmk5Prr0F2GHRI=; b=hqjy2j2wQJ+1wWpD0RTsIOEzMmXoG6FnX15pPKD39/ugp4UQPjjzpHEeBad937vP0B sEkUrLk3VDnU5UZ7ylXFalHf6MTaLz6O7VDY/esDCMD8dHfk+d1b5kY0OB15P3RKki+z bpIkW06LuPl78BjxiDK7/ypi342FVE8aYMskut+e9jwmcVVZmQSkCieYv553dX9UylWt Z79H5PLm2+v3ZajqSyOrz/LWTTaMBk7tat4MTIPKQPo3IQEGQ2s/q1VvwI9s0XMaJzQC nYmw/ylzitTlcGj7sdSeNv9isL0hj9LENZY8CmNf1a5bCce8+BlNaD6qOMgMScDPxB8W kIMQ== X-Gm-Message-State: ALoCoQkHhObqaiGG5tbdkINAyvso2RR1T2FIVocuv4jbIM4lsPFeJ15T37UpLrD+ofETgTDeJvGi X-Received: by 10.50.32.4 with SMTP id e4mr129368igi.7.1402919238066; Mon, 16 Jun 2014 04:47:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.37 with SMTP id g34ls4296188qgd.64.gmail; Mon, 16 Jun 2014 04:47:17 -0700 (PDT) X-Received: by 10.53.12.229 with SMTP id et5mr3772125vdd.32.1402919237938; Mon, 16 Jun 2014 04:47:17 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id dc1si4003169vdc.4.2014.06.16.04.47.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 04:47:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id il7so4831718vcb.12 for ; Mon, 16 Jun 2014 04:47:17 -0700 (PDT) X-Received: by 10.52.138.232 with SMTP id qt8mr626186vdb.44.1402919237845; Mon, 16 Jun 2014 04:47:17 -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.54.6 with SMTP id vs6csp128533vcb; Mon, 16 Jun 2014 04:47:17 -0700 (PDT) X-Received: by 10.52.79.99 with SMTP id i3mr229733vdx.50.1402919237344; Mon, 16 Jun 2014 04:47:17 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id nh6si711356vec.57.2014.06.16.04.47.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Jun 2014 04:47:17 -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 1WwVLb-0003NY-T7; Mon, 16 Jun 2014 11:45:11 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwVLZ-0003M4-Oa for xen-devel@lists.xen.org; Mon, 16 Jun 2014 11:45:10 +0000 Received: from [85.158.139.211:2913] by server-5.bemta-5.messagelabs.com id 29/AC-23588-5C8DE935; Mon, 16 Jun 2014 11:45:09 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1402919104!10179946!3 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4953 invoked from network); 16 Jun 2014 11:45:08 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-6.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 16 Jun 2014 11:45:08 -0000 X-IronPort-AV: E=Sophos;i="5.01,486,1400025600"; d="scan'208";a="143697245" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 16 Jun 2014 11:45:04 +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; Mon, 16 Jun 2014 07:45:04 -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 1WwVLU-000152-27; Mon, 16 Jun 2014 12:45:04 +0100 From: Ian Campbell To: Date: Mon, 16 Jun 2014 12:45:01 +0100 Message-ID: <1402919103-29642-8-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402919079.14907.22.camel@kazak.uk.xensource.com> References: <1402919079.14907.22.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Campbell , stefano.stabellini@eu.citrix.com, Naresh Bhat , julien.grall@linaro.org, tim@xen.org, Roy Franz , Fu Wei Subject: [Xen-devel] [PATCH 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.181 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 --- xen/arch/arm/bootfdt.c | 10 +++++++--- xen/arch/arm/setup.c | 14 ++++++++++++++ xen/include/asm-arm/setup.h | 11 ++++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index e983aa7..a80055c 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 bootmodulekind kind_guess = BOOTMOD_LAST_PRESERVE + 1; const struct fdt_property *prop; const __be32 *cell; bootmodulekind kind; @@ -178,8 +179,10 @@ 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 ( kind_guess < BOOTMOD_UNKNOWN ) + kind = kind_guess++; else - panic("%s not a known xen multiboot type\n", name); + kind = BOOTMOD_UNKNOWN; prop = fdt_get_property(fdt, node, "reg", &len); if ( !prop ) @@ -278,11 +281,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 4c9dd3d..d358d04 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(bootmodulekind kind) return NULL; } +const char * __init boot_module_kind_as_string(bootmodulekind 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 57c98cb..f1a27fb 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -10,12 +10,20 @@ typedef enum { BOOTMOD_XEN, BOOTMOD_FDT, + /* Everything up to here is not freed after start of day */ BOOTMOD_LAST_PRESERVE = BOOTMOD_FDT, + + /* + * Default module types. For modules which are not given an + * explict type these are automatically used, in this order. + */ BOOTMOD_KERNEL, BOOTMOD_RAMDISK, + BOOTMOD_UNKNOWN, + + /* The remaining module types are never automatically assigned. */ BOOTMOD_XSM, - BOOTMOD_UNKNOWN } bootmodulekind; @@ -66,6 +74,7 @@ const char __init *boot_fdt_cmdline(const void *fdt); void add_boot_module(bootmodulekind kind, paddr_t start, paddr_t size, const char *cmdline); struct bootmodule *boot_module_find_by_kind(bootmodulekind kind); +const char * __init boot_module_kind_as_string(bootmodulekind kind); #endif /*