From patchwork Mon Sep 8 03:53:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 36941 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 71D5B20F2E for ; Mon, 8 Sep 2014 03:56:47 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id eb12sf74200612oac.9 for ; Sun, 07 Sep 2014 20:56:47 -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=9kV1HirzB8xVP6bKtnF5m1gK8zfhEnCxlxaeIklygcU=; b=ddTh7x7xVcVBervbWCuqPaMq2i0vkA/Umhnv5v6GKMlBnNAa0MUKzWZa83gYJmRVci uqJ+sSJouz/FHSAlzyol05Delj4F+DW/L099kEpXe36ZW9+AQ3xcpx+B2F6aPqUoZdnt +82pg8ygt4CACktR8n1ovn811uU1EfW3tgB89biXax4wfO8+acT8JUJINJAjv+TuoD6B DdSzCszTsNO4zjQG7CA4CPgKtQPOCz3FqKXURarOr5iYfpSox7GqpH3a/wZrgBmCESbi xioVnex3ODik09DooNoYdNQh6aItZYYhbmsZQNOASE9lX7+ucfdvWhL6R+UFFW8Pw/LP vlhA== X-Gm-Message-State: ALoCoQkuPEALway6uBHd8rPQ0zp9SBikdvF67+F46PWNgKN6ruVQO6eG3x4zOFTQh7Y4SCx5AJHo X-Received: by 10.182.142.5 with SMTP id rs5mr15374542obb.15.1410148607044; Sun, 07 Sep 2014 20:56:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.11 with SMTP id y11ls1532209qgy.23.gmail; Sun, 07 Sep 2014 20:56:46 -0700 (PDT) X-Received: by 10.220.250.142 with SMTP id mo14mr8610314vcb.26.1410148606968; Sun, 07 Sep 2014 20:56:46 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id da2si4068331vdc.89.2014.09.07.20.56.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 07 Sep 2014 20:56:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so14844683vcb.30 for ; Sun, 07 Sep 2014 20:56:46 -0700 (PDT) X-Received: by 10.52.33.1 with SMTP id n1mr12876138vdi.28.1410148606885; Sun, 07 Sep 2014 20:56:46 -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 uj3csp76487vcb; Sun, 7 Sep 2014 20:56:46 -0700 (PDT) X-Received: by 10.140.101.205 with SMTP id u71mr12241370qge.48.1410148605544; Sun, 07 Sep 2014 20:56:45 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id c20si9730676qax.63.2014.09.07.20.56.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 07 Sep 2014 20:56:45 -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 1XQq2B-0006zG-FU; Mon, 08 Sep 2014 03:54:31 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XQq29-0006xR-Q6 for xen-devel@lists.xen.org; Mon, 08 Sep 2014 03:54:30 +0000 Received: from [85.158.139.211:28383] by server-16.bemta-5.messagelabs.com id D1/04-01029-4782D045; Mon, 08 Sep 2014 03:54:28 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-9.tower-206.messagelabs.com!1410148466!13005310!1 X-Originating-IP: [209.85.192.181] 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 19780 invoked from network); 8 Sep 2014 03:54:28 -0000 Received: from mail-pd0-f181.google.com (HELO mail-pd0-f181.google.com) (209.85.192.181) by server-9.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 8 Sep 2014 03:54:28 -0000 Received: by mail-pd0-f181.google.com with SMTP id w10so937442pde.12 for ; Sun, 07 Sep 2014 20:54:26 -0700 (PDT) X-Received: by 10.70.0.201 with SMTP id 9mr43569009pdg.43.1410148466359; Sun, 07 Sep 2014 20:54:26 -0700 (PDT) Received: from rfranz-i7.local (c-24-10-97-91.hsd1.ca.comcast.net. [24.10.97.91]) by mx.google.com with ESMTPSA id qy1sm7524053pbc.27.2014.09.07.20.54.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Sep 2014 20:54: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: Sun, 7 Sep 2014 20:53:54 -0700 Message-Id: <1410148441-18684-9-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410148441-18684-1-git-send-email-roy.franz@linaro.org> References: <1410148441-18684-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org, linaro-uefi@lists.linaro.org Subject: [Xen-devel] [PATCH V3 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.171 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 --- 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 711ab12..e1cbdfc 100644 --- a/xen/include/asm-x86/efi-boot.h +++ b/xen/include/asm-x86/efi-boot.h @@ -937,3 +937,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); +}