From patchwork Thu Mar 17 09:40:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 63951 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp355645lbc; Thu, 17 Mar 2016 02:46:54 -0700 (PDT) X-Received: by 10.31.158.204 with SMTP id h195mr10508676vke.147.1458208014038; Thu, 17 Mar 2016 02:46:54 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id h13si5876195vkf.6.2016.03.17.02.46.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Mar 2016 02:46:54 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agUV1-00068J-6V; Thu, 17 Mar 2016 09:45:47 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agUUz-00066l-4n for xen-devel@lists.xen.org; Thu, 17 Mar 2016 09:45:45 +0000 Received: from [193.109.254.147] by server-1.bemta-14.messagelabs.com id B9/E2-02901-8CC7AE65; Thu, 17 Mar 2016 09:45:44 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1458207942!31839776!1 X-Originating-IP: [119.145.14.66] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NiA9PiA4NTI3\n X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57819 invoked from network); 17 Mar 2016 09:45:43 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-16.tower-27.messagelabs.com with SMTP; 17 Mar 2016 09:45:43 -0000 Received: from 172.24.1.48 (EHLO szxeml432-hub.china.huawei.com) ([172.24.1.48]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BYG52642; Thu, 17 Mar 2016 17:42:17 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.235.1; Thu, 17 Mar 2016 17:41:42 +0800 From: Shannon Zhao To: Date: Thu, 17 Mar 2016 17:40:58 +0800 Message-ID: <1458207668-12012-13-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1458207668-12012-1-git-send-email-zhaoshenglong@huawei.com> References: <1458207668-12012-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.56EA7BFA.0073, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 373360f32feb827fb8f8b9e8c4c39026 Cc: julien.grall@arm.com, zhaoshenglong@huawei.com, stefano.stabellini@citrix.com, shannon.zhao@linaro.org, peter.huangpeng@huawei.com Subject: [Xen-devel] [PATCH v6 12/22] arm/acpi: Prepare EFI memory descriptor for Dom0 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" From: Shannon Zhao Create a few EFI memory descriptors to tell Dom0 the RAM region information, ACPI table regions and EFI tables reserved resions. Signed-off-by: Parth Dixit Signed-off-by: Shannon Zhao --- v6: remove acpi_diabled check --- xen/arch/arm/domain_build.c | 2 ++ xen/arch/arm/efi/efi-dom0.c | 40 ++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/setup.h | 5 +++++ 3 files changed, 47 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 613551c..008fc76 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1688,6 +1688,8 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) acpi_map_other_tables(d); acpi_create_efi_system_table(d->arch.efi_acpi_gpa, d->arch.efi_acpi_table, tbl_add); + acpi_create_efi_mmap_table(d->arch.efi_acpi_gpa, d->arch.efi_acpi_len, + d->arch.efi_acpi_table, &kinfo->mem, tbl_add); return 0; } diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c index b8a062c..3ffde94 100644 --- a/xen/arch/arm/efi/efi-dom0.c +++ b/xen/arch/arm/efi/efi-dom0.c @@ -23,6 +23,7 @@ #include "efi.h" #include "efi-dom0.h" +#include #include #include @@ -92,3 +93,42 @@ void __init acpi_create_efi_system_table(paddr_t paddr, void *efi_acpi_table, tbl_add[TBL_EFIT].start = table_addr; tbl_add[TBL_EFIT].size = table_size; } + +void __init acpi_create_efi_mmap_table(paddr_t paddr, paddr_t size, + void *efi_acpi_table, + const struct meminfo *mem, + struct membank tbl_add[]) +{ + EFI_MEMORY_DESCRIPTOR *memory_map; + unsigned int i, offset; + u8 *base_ptr; + + base_ptr = efi_acpi_table + acpi_get_table_offset(tbl_add, TBL_MMAP); + memory_map = (EFI_MEMORY_DESCRIPTOR *)(base_ptr); + + offset = 0; + for( i = 0; i < mem->nr_banks; i++, offset++ ) + { + memory_map[offset].Type = EfiConventionalMemory; + memory_map[offset].PhysicalStart = mem->bank[i].start; + memory_map[offset].NumberOfPages = PFN_UP(mem->bank[i].size); + memory_map[offset].Attribute = EFI_MEMORY_WB; + } + + for( i = 0; i < acpi_mem.nr_banks; i++, offset++ ) + { + memory_map[offset].Type = EfiACPIReclaimMemory; + memory_map[offset].PhysicalStart = acpi_mem.bank[i].start; + memory_map[offset].NumberOfPages = PFN_UP(acpi_mem.bank[i].size); + memory_map[offset].Attribute = EFI_MEMORY_WB; + } + + memory_map[offset].Type = EfiACPIReclaimMemory; + memory_map[offset].PhysicalStart = paddr; + memory_map[offset].NumberOfPages = PFN_UP(size); + memory_map[offset].Attribute = EFI_MEMORY_WB; + + tbl_add[TBL_MMAP].start = paddr + acpi_get_table_offset(tbl_add, TBL_MMAP); + tbl_add[TBL_MMAP].size = sizeof(EFI_MEMORY_DESCRIPTOR) + * (mem->nr_banks + acpi_mem.nr_banks + 1); +} diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index e423b15..b2899f2 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -56,6 +56,11 @@ size_t estimate_efi_size(int mem_nr_banks); void acpi_create_efi_system_table(paddr_t paddr, void *efi_acpi_table, struct membank tbl_add[]); +void acpi_create_efi_mmap_table(paddr_t paddr, paddr_t size, + void *efi_acpi_table, + const struct meminfo *mem, + struct membank tbl_add[]); + int construct_dom0(struct domain *d); void discard_initial_modules(void);