From patchwork Thu Sep 25 01:42:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 37875 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f198.google.com (mail-we0-f198.google.com [74.125.82.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DACAA20063 for ; Thu, 25 Sep 2014 01:44:20 +0000 (UTC) Received: by mail-we0-f198.google.com with SMTP id t60sf4110684wes.1 for ; Wed, 24 Sep 2014 18:44:20 -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=QL4zTI47//tiOfTsCdRYrf1pjh4yo9k2RFOpDK9Bn7s=; b=e4FYeD3DyBX9TLsnC2SDdZwBtPXeSq2LdyY6ZwLBzhKpNvkwFi6QinOdYHaSR5qHpk 2LV/6hWGXt+uU7tUJLPeYcRdsX03Iwu0AxP6TVHTu1u7yOd4P3LSTd8GJtfQLf4nAujB YyXbdEgv/EQ0kVRUDawR1xYK3BPAHodgOQZZEXA/h3HT29bTbPJ0pzQTdfzA5v4QDaxZ Zk/RLCw161TVKuMhF5Rtc51hd0ftlLO+qYnNFQZIquw8eLetFpRf+X/D/NFYyra59tg1 0YET+05Sk9Bj6hAxSR3bCbhmaH/NzW5FptcY8CcdC3yo4cwXkHALBBmmpc1rQtGzunfZ n0fA== X-Gm-Message-State: ALoCoQlrIRR4yJWXGHrmuuv6LPJvwVazw7uGzQOkD71OqfVvCI2QUrvqH1uyWvE6wpNACiNzu8tg X-Received: by 10.152.4.4 with SMTP id g4mr1572609lag.2.1411609460119; Wed, 24 Sep 2014 18:44:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.170 with SMTP id l10ls197412lah.18.gmail; Wed, 24 Sep 2014 18:44:19 -0700 (PDT) X-Received: by 10.112.173.134 with SMTP id bk6mr9233878lbc.36.1411609459729; Wed, 24 Sep 2014 18:44:19 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com [209.85.215.52]) by mx.google.com with ESMTPS id x7si962505lbx.64.2014.09.24.18.44.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 18:44:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id gq15so11622723lab.39 for ; Wed, 24 Sep 2014 18:44:19 -0700 (PDT) X-Received: by 10.152.45.42 with SMTP id j10mr11957lam.91.1411609459620; Wed, 24 Sep 2014 18:44:19 -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 of9csp678190lbb; Wed, 24 Sep 2014 18:44:18 -0700 (PDT) X-Received: by 10.220.74.195 with SMTP id v3mr8663360vcj.23.1411609458114; Wed, 24 Sep 2014 18:44:18 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id td10si435990vdc.79.2014.09.24.18.44.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 24 Sep 2014 18:44:18 -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 1XWy5F-00018a-GI; Thu, 25 Sep 2014 01:43:01 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XWy5D-00015T-Kh for xen-devel@lists.xen.org; Thu, 25 Sep 2014 01:42:59 +0000 Received: from [85.158.143.35:12064] by server-1.bemta-4.messagelabs.com id 80/C9-05872-32373245; Thu, 25 Sep 2014 01:42:59 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-10.tower-21.messagelabs.com!1411609377!13053067!1 X-Originating-IP: [209.85.213.177] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13025 invoked from network); 25 Sep 2014 01:42:58 -0000 Received: from mail-ig0-f177.google.com (HELO mail-ig0-f177.google.com) (209.85.213.177) by server-10.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 25 Sep 2014 01:42:58 -0000 Received: by mail-ig0-f177.google.com with SMTP id h3so7583858igd.10 for ; Wed, 24 Sep 2014 18:42:56 -0700 (PDT) X-Received: by 10.50.143.101 with SMTP id sd5mr759343igb.18.1411609376850; Wed, 24 Sep 2014 18:42:56 -0700 (PDT) Received: from rfranz-v430.caveonetworks.com (64.2.3.195.ptr.us.xo.net. [64.2.3.195]) by mx.google.com with ESMTPSA id x9sm5829238igl.10.2014.09.24.18.42.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2014 18:42:56 -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: Wed, 24 Sep 2014 18:42:28 -0700 Message-Id: <1411609352-24549-11-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411609352-24549-1-git-send-email-roy.franz@linaro.org> References: <1411609352-24549-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org Subject: [Xen-devel] [PATCH for-4.5 V7 10/14] 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.52 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/arch/x86/efi/efi-boot.h | 35 +++++++++++++++++++++++++++++++++++ xen/common/efi/boot.c | 29 +---------------------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 5a1346c..2f032e0 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -529,3 +529,38 @@ static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, (gop->Mode->FrameBufferSize + 0xffff) >> 16; } } + +static void __init efi_arch_memory_setup(void) +{ + unsigned 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); +} diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 162e02b..5661aff 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -995,34 +995,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_setup(); if ( gop ) {