From patchwork Wed Sep 24 05:03:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 37782 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9B49E20792 for ; Wed, 24 Sep 2014 05:05:11 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id mc6sf201332lab.3 for ; Tue, 23 Sep 2014 22:05:10 -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=iO1LQhc9QYbgRaJBtJskFE98Wq0IRaK9+PSYDP4ZgD0=; b=PHOWYQmfnuRM2oviMsCt5uLgWhX2svc4APrFBcwL2a/NWrYBrSyBnES0im9fTXYXdu BGmSL6+TiubL1swBysyolsZuUzlRgR6frg5RAkf+7O0CSYpaePF7ySJhD8A+SQ/J3LmY kPZ8N9Qr9oFiHAPjUv2gYckpcQf4bO+YrgsjMsAN2OSmaw+1Ic7RcqWC6vn4y4cGpt3Z 5ikS3LPkrBdOKBAfmb2ie4JgKKNH+eTj2NEuXx+YhbzNgDNDk2zU3EzennFKlypHxk7M iMPfcfcpCRdUhBwuElcrt2eKfRf8f4KG+ccQvzqrUO5p2IKrT9L4AoxXH4ufagbJ49Oo aaHQ== X-Gm-Message-State: ALoCoQmEpsArpRQltFLtISOA6Ficq6EHWvaM32FDkGpynNwnLzfLvZwyhn8I+LuJc0LqSNbfPagP X-Received: by 10.194.203.40 with SMTP id kn8mr20169wjc.4.1411535110388; Tue, 23 Sep 2014 22:05:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.229 with SMTP id h5ls122541lam.4.gmail; Tue, 23 Sep 2014 22:05:10 -0700 (PDT) X-Received: by 10.112.13.232 with SMTP id k8mr3479196lbc.81.1411535110234; Tue, 23 Sep 2014 22:05:10 -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 dy7si6307858lbc.95.2014.09.23.22.05.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Sep 2014 22:05:10 -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 mc6so9771404lab.6 for ; Tue, 23 Sep 2014 22:05:10 -0700 (PDT) X-Received: by 10.152.179.226 with SMTP id dj2mr3993070lac.40.1411535110172; Tue, 23 Sep 2014 22:05:10 -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 of9csp526214lbb; Tue, 23 Sep 2014 22:05:09 -0700 (PDT) X-Received: by 10.221.55.2 with SMTP id vw2mr3757070vcb.29.1411535103735; Tue, 23 Sep 2014 22:05:03 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id qy3si5278670vdb.45.2014.09.23.22.05.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 23 Sep 2014 22:05:03 -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 1XWejv-0006LJ-Qv; Wed, 24 Sep 2014 05:03:43 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XWeju-0006IV-Gr for xen-devel@lists.xen.org; Wed, 24 Sep 2014 05:03:42 +0000 Received: from [85.158.143.35:34748] by server-1.bemta-4.messagelabs.com id 30/65-05872-CA052245; Wed, 24 Sep 2014 05:03:40 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-10.tower-21.messagelabs.com!1411535018!12814428!1 X-Originating-IP: [209.85.213.174] 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 6313 invoked from network); 24 Sep 2014 05:03:39 -0000 Received: from mail-ig0-f174.google.com (HELO mail-ig0-f174.google.com) (209.85.213.174) by server-10.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 24 Sep 2014 05:03:39 -0000 Received: by mail-ig0-f174.google.com with SMTP id r10so5897486igi.13 for ; Tue, 23 Sep 2014 22:03:38 -0700 (PDT) X-Received: by 10.50.73.67 with SMTP id j3mr9685351igv.22.1411535018102; Tue, 23 Sep 2014 22:03:38 -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 ig9sm3477662igb.13.2014.09.23.22.03.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Sep 2014 22:03:37 -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: Tue, 23 Sep 2014 22:03:07 -0700 Message-Id: <1411534992-27443-10-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411534992-27443-1-git-send-email-roy.franz@linaro.org> References: <1411534992-27443-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org Subject: [Xen-devel] [PATCH for-4.5 V6 09/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.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/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 7f8a603..32fc950 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -532,3 +532,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 3893311..596c16f 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -991,34 +991,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 ) {