From patchwork Fri Jul 18 13:08:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 33840 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 87D33208CF for ; Fri, 18 Jul 2014 13:10:28 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id eb12sf14457762oac.9 for ; Fri, 18 Jul 2014 06:10:28 -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=W4CPQaix1JeZQEF6TGHqBsr7qdfpqsxubhDVJdmaAyw=; b=Q33aeC0poRkxn7QrQqTs/CTRJQnOo03IguvekfhgJidc9ZS5NoonO5TS8is3LoyZzG vqOd2NNKticR1XbTYcR/glUL1vDrXyBrqbolulc/JTb5q7NoI96l1fPbrSLiBDYOE0wy 4uZaLH2QJsPpri0qZKqyCEc0xImyAO3y2FIENkJYxfscilVA9aUFc7WtL1e/pct0Ve4I pYoSzIOH1Qu+NxPoPvNX8DeR4VeXkYeT0FtBkj4E5mdJzwtEnb/OK40fKrJ2QX4hwk1Y WVDW3vLvKKjgKUnx0SBu+GH2k6JAuZUlvLrB+dvCHTmnv+iybmWCakBv7TDZiXH5+8dy pQmw== X-Gm-Message-State: ALoCoQl8e+73o/9VOZmiPIIximz+lXnx62M3tgiMphFU9s6CZzKuKlY+0LMvH0Wk7KSxKf86LKEO X-Received: by 10.182.19.138 with SMTP id f10mr2335650obe.25.1405689027959; Fri, 18 Jul 2014 06:10:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.213 with SMTP id n79ls975995qgd.29.gmail; Fri, 18 Jul 2014 06:10:27 -0700 (PDT) X-Received: by 10.220.185.132 with SMTP id co4mr3506202vcb.74.1405689027859; Fri, 18 Jul 2014 06:10:27 -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 t14si5585787vdi.30.2014.07.18.06.10.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 06:10:27 -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 hy10so7222303vcb.4 for ; Fri, 18 Jul 2014 06:10:27 -0700 (PDT) X-Received: by 10.53.5.230 with SMTP id cp6mr4475114vdd.25.1405689027060; Fri, 18 Jul 2014 06:10:27 -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 tc5csp9788vcb; Fri, 18 Jul 2014 06:10:26 -0700 (PDT) X-Received: by 10.42.32.136 with SMTP id e8mr7557454icd.44.1405689025696; Fri, 18 Jul 2014 06:10:25 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id im5si4885893igb.36.2014.07.18.06.10.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 18 Jul 2014 06:10:25 -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 1X87tp-0005XZ-4h; Fri, 18 Jul 2014 13:08:33 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X87tn-0005Uu-2U for xen-devel@lists.xen.org; Fri, 18 Jul 2014 13:08:31 +0000 Received: from [85.158.143.35:60451] by server-1.bemta-4.messagelabs.com id 75/03-30046-E4C19C35; Fri, 18 Jul 2014 13:08:30 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1405688907!18580206!2 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 9655 invoked from network); 18 Jul 2014 13:08:29 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-8.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 18 Jul 2014 13:08:29 -0000 X-IronPort-AV: E=Sophos;i="5.01,685,1400025600"; d="scan'208";a="153665171" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 18 Jul 2014 13:08:29 +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:28 -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 1X87tj-0001RO-9A; Fri, 18 Jul 2014 14:08:28 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Fri, 18 Jul 2014 14:08:27 +0100 From: Ian Campbell To: Date: Fri, 18 Jul 2014 14:08:17 +0100 Message-ID: <1405688900-11769-7-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 07/10] xen: arm: store per-boot module type instead of relying on index 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: This is more natural and better matches how multiboot is actually supposed to work. As part of this we need to modify consider_modules to handle Xen not necessarily being module zero any more. To do this we first register a module for Xen at the original load address and then update after we have relocated. This is also fixing a latent issue which is that get_xen_paddr() would not consider Xen's current physical address when picking the target address which was buggy because the relocation code cannot handle the possiblity of the old and new locations overlapping. All callers of consider_modules now consider the full range instead of some skipping slot 0. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- v3: Handle consider_modules, remove obsolete comment v2: Fix XSM s/bootmodulekind/bootmodule_kind/ Print which module we aren't adding Only (and explictly) preserve Xen in discard_initial_modules --- xen/arch/arm/bootfdt.c | 49 +++++++++++-------------------- xen/arch/arm/domain_build.c | 20 ++++++++----- xen/arch/arm/kernel.c | 15 +++++----- xen/arch/arm/setup.c | 68 ++++++++++++++++++++++++++++++++++++++----- xen/include/asm-arm/setup.h | 29 +++++++++++------- xen/xsm/xsm_policy.c | 19 ++++++++++-- 6 files changed, 134 insertions(+), 66 deletions(-) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index 23aff5a..ce7fdf2 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -167,23 +167,22 @@ static void __init process_multiboot_node(const void *fdt, int node, { const struct fdt_property *prop; const __be32 *cell; - int nr; - struct bootmodule *mod; + bootmodule_kind kind; + paddr_t start, size; + const char *cmdline; int len; if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 || fdt_node_check_compatible(fdt, node, "multiboot,kernel") == 0 ) - nr = MOD_KERNEL; + kind = BOOTMOD_KERNEL; else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0 || fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") == 0 ) - nr = MOD_INITRD; + kind = BOOTMOD_RAMDISK; else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 ) - nr = MOD_XSM; + kind = BOOTMOD_XSM; else panic("%s not a known xen multiboot type\n", name); - mod = &bootinfo.modules.module[nr]; - prop = fdt_get_property(fdt, node, "reg", &len); if ( !prop ) panic("node %s missing `reg' property\n", name); @@ -193,22 +192,19 @@ static void __init process_multiboot_node(const void *fdt, int node, name); cell = (const __be32 *)prop->data; - device_tree_get_reg(&cell, address_cells, size_cells, - &mod->start, &mod->size); + device_tree_get_reg(&cell, address_cells, size_cells, &start, &size); prop = fdt_get_property(fdt, node, "bootargs", &len); if ( prop ) { - if ( len > sizeof(mod->cmdline) ) - panic("module %d command line too long\n", nr); - - safe_strcpy(mod->cmdline, prop->data); + if ( len > BOOTMOD_MAX_CMDLINE ) + panic("module %s command line too long\n", name); + cmdline = prop->data; } else - mod->cmdline[0] = 0; + cmdline = NULL; - if ( nr > bootinfo.modules.nr_mods ) - bootinfo.modules.nr_mods = nr; + add_boot_module(kind, start, size, cmdline); } static void __init process_chosen_node(const void *fdt, int node, @@ -216,7 +212,6 @@ static void __init process_chosen_node(const void *fdt, int node, u32 address_cells, u32 size_cells) { const struct fdt_property *prop; - struct bootmodule *mod = &bootinfo.modules.module[MOD_INITRD]; paddr_t start, end; int len; @@ -255,10 +250,7 @@ static void __init process_chosen_node(const void *fdt, int node, printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end); - mod->start = start; - mod->size = end - start; - - bootinfo.modules.nr_mods = max(MOD_INITRD, bootinfo.modules.nr_mods); + add_boot_module(BOOTMOD_RAMDISK, start, end-start, NULL); } static int __init early_scan_node(const void *fdt, @@ -288,7 +280,7 @@ 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 + 1; i++ ) + for ( i = 0 ; i < mods->nr_mods; i++ ) printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %s\n", i, mods->module[i].start, @@ -316,18 +308,13 @@ static void __init early_print_info(void) */ size_t __init boot_fdt_info(const void *fdt, paddr_t paddr) { - struct bootmodule *mod; int ret; ret = fdt_check_header(fdt); if ( ret < 0 ) panic("No valid device tree\n"); - mod = &bootinfo.modules.module[MOD_FDT]; - mod->start = paddr; - mod->size = fdt_totalsize(fdt); - - bootinfo.modules.nr_mods = max(MOD_FDT, bootinfo.modules.nr_mods); + add_boot_module(BOOTMOD_FDT, paddr, fdt_totalsize(fdt), NULL); device_tree_for_each_node((void *)fdt, early_scan_node, NULL); early_print_info(); @@ -347,10 +334,8 @@ const char *boot_fdt_cmdline(const void *fdt) prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL); if ( prop == NULL ) { - struct bootmodule *dom0_mod = NULL; - - if ( bootinfo.modules.nr_mods >= MOD_KERNEL ) - dom0_mod = &bootinfo.modules.module[MOD_KERNEL]; + struct bootmodule *dom0_mod = + boot_module_find_by_kind(BOOTMOD_KERNEL); if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) || ( dom0_mod && dom0_mod->cmdline[0] ) ) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index a065442..154367e 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -405,9 +405,10 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo, int res = 0; int had_dom0_bootargs = 0; - if ( bootinfo.modules.nr_mods >= MOD_KERNEL && - bootinfo.modules.module[MOD_KERNEL].cmdline[0] ) - bootargs = &bootinfo.modules.module[MOD_KERNEL].cmdline[0]; + struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_KERNEL); + + if ( mod && mod->cmdline[0] ) + bootargs = &mod->cmdline[0]; dt_for_each_property_node (node, prop) { @@ -454,6 +455,8 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo, if ( dt_node_path_is_equal(node, "/chosen") ) { + struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_RAMDISK); + if ( bootargs ) { res = fdt_property(kinfo->fdt, "bootargs", bootargs, @@ -466,7 +469,7 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo, * If the bootloader provides an initrd, we must create a placeholder * for the initrd properties. The values will be replaced later. */ - if ( bootinfo.modules.module[MOD_INITRD].size ) + if ( mod && mod->size ) { u64 a = 0; res = fdt_property(kinfo->fdt, "linux,initrd-start", &a, sizeof(a)); @@ -1221,18 +1224,21 @@ static void dtb_load(struct kernel_info *kinfo) static void initrd_load(struct kernel_info *kinfo) { + struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_RAMDISK); paddr_t load_addr = kinfo->initrd_paddr; - paddr_t paddr = bootinfo.modules.module[MOD_INITRD].start; - paddr_t len = bootinfo.modules.module[MOD_INITRD].size; + paddr_t paddr, len; unsigned long offs; int node; int res; __be32 val[2]; __be32 *cellp; - if ( !len ) + if ( !mod || !mod->size ) return; + paddr = mod->start; + len = mod->size; + printk("Loading dom0 initrd from %"PRIpaddr" to 0x%"PRIpaddr"-0x%"PRIpaddr"\n", paddr, load_addr, load_addr + len); diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index ce5b95a..230ff8f 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -68,8 +68,8 @@ static void place_modules(struct kernel_info *info, paddr_t kernbase, paddr_t kernend) { /* Align DTB and initrd size to 2Mb. Linux only requires 4 byte alignment */ - const paddr_t initrd_len = - ROUNDUP(bootinfo.modules.module[MOD_INITRD].size, MB(2)); + const struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_RAMDISK); + const paddr_t initrd_len = ROUNDUP(mod ? mod->size : 0, MB(2)); const paddr_t dtb_len = ROUNDUP(fdt_totalsize(info->fdt), MB(2)); const paddr_t modsize = initrd_len + dtb_len; @@ -372,20 +372,21 @@ err: int kernel_probe(struct kernel_info *info) { + struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_KERNEL); int rc; paddr_t start, size; - start = bootinfo.modules.module[MOD_KERNEL].start; - size = bootinfo.modules.module[MOD_KERNEL].size; - - if ( !size ) + if ( !mod || !mod->size ) { printk(XENLOG_ERR "Missing kernel boot module?\n"); return -ENOENT; } - printk("Loading kernel from boot module %d\n", MOD_KERNEL); + start = mod->start; + size = mod->size; + + printk("Loading kernel from boot module @ %"PRIpaddr"\n", start); #ifdef CONFIG_ARM_64 rc = kernel_zimage64_probe(info, start, size); diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index eefb610..0cbe552 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -183,17 +183,58 @@ static void dt_unreserved_regions(paddr_t s, paddr_t e, cb(s, e); } +struct bootmodule *add_boot_module(bootmodule_kind kind, + paddr_t start, paddr_t size, + const char *cmdline) +{ + struct bootmodules *mods = &bootinfo.modules; + struct bootmodule *mod; + + if ( mods->nr_mods == MAX_MODULES ) + { + printk("Ignoring %s boot module at %"PRIpaddr"-%"PRIpaddr" (too many)\n", + boot_module_kind_as_string(kind), start, start + size); + return NULL; + } + + mod = &mods->module[mods->nr_mods++]; + mod->kind = kind; + mod->start = start; + mod->size = size; + if ( cmdline ) + safe_strcpy(mod->cmdline, cmdline); + else + mod->cmdline[0] = 0; + + return mod; +} + +struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind) +{ + struct bootmodules *mods = &bootinfo.modules; + struct bootmodule *mod; + int i; + for (i = 0 ; i < mods->nr_mods ; i++ ) + { + mod = &mods->module[i]; + if ( mod->kind == kind ) + return mod; + } + return NULL; +} + void __init discard_initial_modules(void) { struct bootmodules *mi = &bootinfo.modules; int i; - for ( i = MOD_DISCARD_FIRST; i <= mi->nr_mods; i++ ) + for ( i = 0; i <= mi->nr_mods; i++ ) { paddr_t s = mi->module[i].start; paddr_t e = s + PAGE_ALIGN(mi->module[i].size); - dt_unreserved_regions(s, e, init_domheap_pages, 0); + if ( mi->module[i].kind != BOOTMOD_XEN ) + dt_unreserved_regions(s, e, init_domheap_pages, 0); } mi->nr_mods = 0; @@ -335,7 +376,7 @@ static paddr_t __init get_xen_paddr(void) if ( bank->size >= min_size ) { e = consider_modules(bank->start, bank->start + bank->size, - min_size, XEN_PADDR_ALIGN, 1); + min_size, XEN_PADDR_ALIGN, 0); if ( !e ) continue; @@ -360,9 +401,6 @@ static paddr_t __init get_xen_paddr(void) printk("Placing Xen at 0x%"PRIpaddr"-0x%"PRIpaddr"\n", paddr, paddr + min_size); - bootinfo.modules.module[MOD_XEN].start = paddr; - bootinfo.modules.module[MOD_XEN].size = min_size; - return paddr; } @@ -665,7 +703,9 @@ void __init start_xen(unsigned long boot_phys_offset, { size_t fdt_size; int cpus, i; + paddr_t xen_paddr; const char *cmdline; + struct bootmodule *xen_bootmodule; struct domain *dom0; setup_cache(); @@ -690,7 +730,21 @@ void __init start_xen(unsigned long boot_phys_offset, printk("Command line: %s\n", cmdline); cmdline_parse(cmdline); - setup_pagetables(boot_phys_offset, get_xen_paddr()); + /* Register Xen's load address as a boot module. */ + xen_bootmodule = add_boot_module(BOOTMOD_XEN, + (paddr_t)(uintptr_t)(_start + boot_phys_offset), + (paddr_t)(uintptr_t)(_end - _start + 1), NULL); + BUG_ON(!xen_bootmodule); + + xen_paddr = get_xen_paddr(); + setup_pagetables(boot_phys_offset, xen_paddr); + + /* Update Xen's address now that we have relocated. */ + printk("Update BOOTMOD_XEN from %"PRIpaddr"-%"PRIpaddr" => %"PRIpaddr"-%"PRIpaddr"\n", + xen_bootmodule->start, xen_bootmodule->start + xen_bootmodule->size, + xen_paddr, xen_paddr + xen_bootmodule->size); + xen_bootmodule->start = xen_paddr; + setup_mm(fdt_paddr, fdt_size); vm_init(); diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index 85aa866..e2e18c3 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -5,14 +5,17 @@ #define NR_MEM_BANKS 8 -#define MOD_XEN 0 -#define MOD_FDT 1 -#define MOD_KERNEL 2 -#define MOD_INITRD 3 -#define MOD_XSM 4 -#define NR_MODULES 5 +#define MAX_MODULES 5 /* Current maximum useful modules */ + +typedef enum { + BOOTMOD_XEN, + BOOTMOD_FDT, + BOOTMOD_KERNEL, + BOOTMOD_RAMDISK, + BOOTMOD_XSM, + BOOTMOD_UNKNOWN +} bootmodule_kind; -#define MOD_DISCARD_FIRST MOD_FDT struct membank { paddr_t start; @@ -24,16 +27,17 @@ struct meminfo { struct membank bank[NR_MEM_BANKS]; }; +#define BOOTMOD_MAX_CMDLINE 1024 struct bootmodule { + bootmodule_kind kind; paddr_t start; paddr_t size; - char cmdline[1024]; + char cmdline[BOOTMOD_MAX_CMDLINE]; }; struct bootmodules { int nr_mods; - /* Module 0 is Xen itself, followed by the provided modules-proper */ - struct bootmodule module[NR_MODULES]; + struct bootmodule module[MAX_MODULES]; }; struct bootinfo { @@ -56,6 +60,11 @@ void discard_initial_modules(void); size_t __init boot_fdt_info(const void *fdt, paddr_t paddr); const char __init *boot_fdt_cmdline(const void *fdt); +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); + #endif /* * Local variables: diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index a0dee09..6e0bb78 100644 --- a/xen/xsm/xsm_policy.c +++ b/xen/xsm/xsm_policy.c @@ -77,13 +77,16 @@ int __init xsm_multiboot_policy_init(unsigned long *module_map, #ifdef HAS_DEVICE_TREE int __init xsm_dt_policy_init(void) { - paddr_t paddr = early_info.modules.module[MOD_XSM].start; - paddr_t len = early_info.modules.module[MOD_XSM].size; + struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_XSM); + paddr_t paddr, len; xsm_magic_t magic; - if ( !len ) + if ( !mod || !mod->size ) return 0; + paddr = mod->start; + len = mod->size; + copy_from_paddr(&magic, paddr, sizeof(magic)); if ( magic != XSM_MAGIC ) @@ -106,3 +109,13 @@ int __init xsm_dt_policy_init(void) return 0; } #endif + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */