From patchwork Thu Sep 18 22:50:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 37611 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E53D22054E for ; Thu, 18 Sep 2014 22:52:16 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id n12sf1026970wgh.1 for ; Thu, 18 Sep 2014 15:52:16 -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:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=PMKYuNGwcVyteinvjeGUBj3CN1oW1ZMF0Ul/qY6JsZg=; b=Q7iBZ3Zb5gEFKDUz6Z7vFpguAzYWkMYPzZhhMNukxbOmJSBFz0SnFvqhCj7UT0KUfK 8QpsbhQDO4jM1aRcOH0cTclgc/aGgArRASV3Ix6WZkzge4rjZ6Z6dUvvo/qsbWdQrmTH WBZpSogccmGUiO1v1WJAFMs3fYsf05yKJ4w68Z77ItgYEy/qIcy5C59kk5yWGli+s+rq 8VOVFWBHtsaVMt3OngYV3hlJUZACKGFcJRRwhEJjJhxTZykHCWcfA00TotYHGcIP2In4 ifBaedBMElcN46jL4rkRQdHmKhieVOmWdDVg3dMB6AswK/hs6OTl2GORulIp601im0zN nBBA== X-Gm-Message-State: ALoCoQkpYyB0kO16Sq7ZT7m+YwhXirkAgjZTLUqNwiNW8VNHx/HjXd2kNVvGr1Jq2GK2NaP+dDSk X-Received: by 10.180.10.137 with SMTP id i9mr3776001wib.0.1411080736031; Thu, 18 Sep 2014 15:52:16 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.99 with SMTP id x3ls268767laj.90.gmail; Thu, 18 Sep 2014 15:52:15 -0700 (PDT) X-Received: by 10.152.22.137 with SMTP id d9mr2680621laf.29.1411080735797; Thu, 18 Sep 2014 15:52:15 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com [209.85.215.47]) by mx.google.com with ESMTPS id cy2si184714lac.26.2014.09.18.15.52.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Sep 2014 15:52:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id mc6so2075198lab.6 for ; Thu, 18 Sep 2014 15:52:15 -0700 (PDT) X-Received: by 10.112.205.39 with SMTP id ld7mr2691167lbc.40.1411080735430; Thu, 18 Sep 2014 15:52:15 -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.112.130.169 with SMTP id of9csp843126lbb; Thu, 18 Sep 2014 15:52:14 -0700 (PDT) X-Received: by 10.229.229.135 with SMTP id ji7mr4262975qcb.15.1411080734037; Thu, 18 Sep 2014 15:52:14 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id l63si143395qga.74.2014.09.18.15.52.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Sep 2014 15:52:14 -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 1XUkX1-0006Mo-Ed; Thu, 18 Sep 2014 22:50:31 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XUkWz-0006LK-Ks for xen-devel@lists.xen.org; Thu, 18 Sep 2014 22:50:29 +0000 Received: from [85.158.143.35:7203] by server-2.bemta-4.messagelabs.com id 76/B0-04525-5B16B145; Thu, 18 Sep 2014 22:50:29 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-11.tower-21.messagelabs.com!1411080626!14747953!1 X-Originating-IP: [209.85.220.50] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13595 invoked from network); 18 Sep 2014 22:50:28 -0000 Received: from mail-pa0-f50.google.com (HELO mail-pa0-f50.google.com) (209.85.220.50) by server-11.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 18 Sep 2014 22:50:28 -0000 Received: by mail-pa0-f50.google.com with SMTP id eu11so2436793pac.23 for ; Thu, 18 Sep 2014 15:50:26 -0700 (PDT) X-Received: by 10.70.128.137 with SMTP id no9mr11318559pdb.143.1411080626469; Thu, 18 Sep 2014 15:50:26 -0700 (PDT) Received: from rfranz-t520.swisscom.com (70-35-38-154.static.wiline.com. [70.35.38.154]) by mx.google.com with ESMTPSA id ig4sm66332pbb.55.2014.09.18.15.50.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Sep 2014 15:50:25 -0700 (PDT) From: Roy Franz To: xen-devel@lists.xen.org, ian.campbell@citrix.com, stefano.stabellini@citrix.com, tim@xen.org, jbeulich@suse.com, keir@xen.org Date: Thu, 18 Sep 2014 15:50:00 -0700 Message-Id: <1411080607-32365-10-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1411080607-32365-1-git-send-email-roy.franz@linaro.org> References: <1411080607-32365-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org Subject: [Xen-devel] [PATCH V5 09/15] Add efi_arch_memory() for arch specific memory setup 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: , MIME-Version: 1.0 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: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 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 patch adds efi_arch_memory() to allow each architecture a hook to use for do memory setup. x86 uses this for trampoline memory setup and some pagetable setup. Signed-off-by: Roy Franz Acked-by: Jan Beulich --- xen/common/efi/boot.c | 29 +---------------------------- xen/include/asm-x86/efi-boot.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 1917052..38177bf 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -992,34 +992,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) PrintStr(newline); } - /* Allocate space for trampoline (in first Mb). */ - cfg.addr = 0x100000; - cfg.size = trampoline_end - trampoline_start; - status = efi_bs->AllocatePages(AllocateMaxAddress, EfiLoaderData, - PFN_UP(cfg.size), &cfg.addr); - if ( status == EFI_SUCCESS ) - relocate_trampoline(cfg.addr); - else - { - cfg.addr = 0; - PrintStr(L"Trampoline space cannot be allocated; will try fallback.\r\n"); - } - - /* Initialise L2 identity-map and boot-map page table entries (16MB). */ - for ( i = 0; i < 8; ++i ) - { - unsigned int slot = (xen_phys_start >> L2_PAGETABLE_SHIFT) + i; - paddr_t addr = slot << L2_PAGETABLE_SHIFT; - - l2_identmap[slot] = l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_PSE); - slot &= L2_PAGETABLE_ENTRIES - 1; - l2_bootmap[slot] = l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_PSE); - } - /* Initialise L3 boot-map page directory entries. */ - l3_bootmap[l3_table_offset(xen_phys_start)] = - l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR); - l3_bootmap[l3_table_offset(xen_phys_start + (8 << L2_PAGETABLE_SHIFT) - 1)] = - l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR); + efi_arch_memory(); if ( gop ) { diff --git a/xen/include/asm-x86/efi-boot.h b/xen/include/asm-x86/efi-boot.h index 7df04bb..2902970 100644 --- a/xen/include/asm-x86/efi-boot.h +++ b/xen/include/asm-x86/efi-boot.h @@ -540,3 +540,38 @@ static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, (gop->Mode->FrameBufferSize + 0xffff) >> 16; } } + +static void __init efi_arch_memory(void) +{ + int i; + EFI_STATUS status; + + /* Allocate space for trampoline (in first Mb). */ + cfg.addr = 0x100000; + cfg.size = trampoline_end - trampoline_start; + status = efi_bs->AllocatePages(AllocateMaxAddress, EfiLoaderData, + PFN_UP(cfg.size), &cfg.addr); + if ( status == EFI_SUCCESS ) + relocate_trampoline(cfg.addr); + else + { + cfg.addr = 0; + PrintStr(L"Trampoline space cannot be allocated; will try fallback.\r\n"); + } + + /* Initialise L2 identity-map and boot-map page table entries (16MB). */ + for ( i = 0; i < 8; ++i ) + { + unsigned int slot = (xen_phys_start >> L2_PAGETABLE_SHIFT) + i; + paddr_t addr = slot << L2_PAGETABLE_SHIFT; + + l2_identmap[slot] = l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_PSE); + slot &= L2_PAGETABLE_ENTRIES - 1; + l2_bootmap[slot] = l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_PSE); + } + /* Initialise L3 boot-map page directory entries. */ + l3_bootmap[l3_table_offset(xen_phys_start)] = + l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR); + l3_bootmap[l3_table_offset(xen_phys_start + (8 << L2_PAGETABLE_SHIFT) - 1)] = + l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR); +}