From patchwork Wed Sep 10 00:51:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 37170 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8F69720566 for ; Wed, 10 Sep 2014 00:54:32 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f73sf9262664yha.7 for ; Tue, 09 Sep 2014 17:54:32 -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=rH65cUye5DOfcU+2E9SGBiFTflXM8Dm8QPt38SK4u/g=; b=FTUjXgHPnkx4iLR+gXSgw0405mV7Rk1e9lIDfEZ/p1TkU0KZsLNI3CmXCILcXhYZNk hHKjJqAjQdc/NM+toUPki+s/HjnNu11rsWhUlZBYLJbYA6r2+SOa9xhTAEMjB9pqtwUN 4urN3pu055SYdNq4oNuBwl2OONzfUxPSoPvFEFSChNLjK5TIoCM6QlUPWzrQlEHRE4FK CxrXFC1QDAOmvnEOqu7G0uhnbQTlEw8lG5a5tEan7ykAG0LyHiKSuB8yeCGznbQcXJVN 9XdEauK1TFK1I8aXc0vANvqlaV0yelVG6kkgF6GtBvVinAF9/wWwDJTj3bMa23eZk5C/ fWBg== X-Gm-Message-State: ALoCoQnXbH2Es4XtNmhJollVNGB2bYCZ/5oPTTriWIkHv+3Rqvhij2MKSgqw6YY2EK8Dbfzy5cKW X-Received: by 10.236.30.133 with SMTP id k5mr7637444yha.28.1410310472417; Tue, 09 Sep 2014 17:54:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.45 with SMTP id t42ls1175965qga.67.gmail; Tue, 09 Sep 2014 17:54:32 -0700 (PDT) X-Received: by 10.52.156.100 with SMTP id wd4mr14963100vdb.39.1410310472264; Tue, 09 Sep 2014 17:54:32 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id um5si5838568vcb.53.2014.09.09.17.54.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 17:54:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lf12so17780757vcb.6 for ; Tue, 09 Sep 2014 17:54:32 -0700 (PDT) X-Received: by 10.52.185.168 with SMTP id fd8mr4070845vdc.58.1410310472197; Tue, 09 Sep 2014 17:54:32 -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.45.67 with SMTP id uj3csp363883vcb; Tue, 9 Sep 2014 17:54:31 -0700 (PDT) X-Received: by 10.52.51.203 with SMTP id m11mr104672vdo.72.1410310471802; Tue, 09 Sep 2014 17:54:31 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id xe7si5854919vcb.14.2014.09.09.17.54.31 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 09 Sep 2014 17:54:31 -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 1XRW99-0006F8-3W; Wed, 10 Sep 2014 00:52:31 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XRW97-0006EB-FM for xen-devel@lists.xen.org; Wed, 10 Sep 2014 00:52:29 +0000 Received: from [193.109.254.147:34885] by server-1.bemta-14.messagelabs.com id 13/B9-24760-CC0AF045; Wed, 10 Sep 2014 00:52:28 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-5.tower-27.messagelabs.com!1410310346!9890248!1 X-Originating-IP: [209.85.223.182] 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 14355 invoked from network); 10 Sep 2014 00:52:27 -0000 Received: from mail-ie0-f182.google.com (HELO mail-ie0-f182.google.com) (209.85.223.182) by server-5.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 10 Sep 2014 00:52:27 -0000 Received: by mail-ie0-f182.google.com with SMTP id tr6so4382428ieb.27 for ; Tue, 09 Sep 2014 17:52:26 -0700 (PDT) X-Received: by 10.50.7.100 with SMTP id i4mr35993953iga.32.1410310346564; Tue, 09 Sep 2014 17:52:26 -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 dx10sm654825igb.4.2014.09.09.17.52.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Sep 2014 17:52: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: Tue, 9 Sep 2014 17:51:58 -0700 Message-Id: <1410310325-4509-9-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410310325-4509-1-git-send-email-roy.franz@linaro.org> References: <1410310325-4509-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org Subject: [Xen-devel] [PATCH V4 08/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.220.175 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 3fe04fd..9ee3b4a 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -838,34 +838,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(); efi_arch_video(base_video, cols, rows, depth, gop); diff --git a/xen/include/asm-x86/efi-boot.h b/xen/include/asm-x86/efi-boot.h index 900465d..629a4c0 100644 --- a/xen/include/asm-x86/efi-boot.h +++ b/xen/include/asm-x86/efi-boot.h @@ -940,3 +940,38 @@ static void __init efi_arch_video(bool_t base_video, } } } + +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); +}