From patchwork Tue Nov 17 09:40:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 7635171 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 81F899F1D3 for ; Tue, 17 Nov 2015 10:20:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8BAE5204E0 for ; Tue, 17 Nov 2015 10:20:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97004203C0 for ; Tue, 17 Nov 2015 10:20:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZydKu-000570-7j; Tue, 17 Nov 2015 10:18:04 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zycsj-0003Wz-Lh for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 09:49:16 +0000 Received: by wmec201 with SMTP id c201so218136899wme.0 for ; Tue, 17 Nov 2015 01:48:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=geu455t0YJtqm3BHNBZ3d0YiaoePTHFGT6mckiWVVb4=; b=maith3svYoeXiuzElxkOWspuRZJBIJKHFusvfLZjdRlSoxtRjPz1BJGexBxrw678rV rr0RQ+ONaqolwrdXLh03zoPtQGv6Gq1UzzgoFEZQSihMWpXlqBR0UtriyJpEOkcYTDtv uHfUUDGl0xMTaE20vjzuiZNMXzlYbBz26as5vsiJ6PPi/LTAVpAArde1YbbTcK5o6Jlk T8wtCiHtc0UOnEOqQuVfQpEFXL5yDlIP58wk/aptovaWZFH6e68znRy0rOwyG6lJZg5G 0+lXoug4WvT1S04S0tqycEdTI54dRttibmfQixtu4jDwvkfL5XnrCdPbU4GddyL44y3V cTVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=geu455t0YJtqm3BHNBZ3d0YiaoePTHFGT6mckiWVVb4=; b=Oy11Me0S0Pm9e6hH9FJ8VZXqq41fFcog+V7r1qSfBiywWRDMKcPSmh6uhhokS83JPR aIVdiP8bXaPrbZCndl6T1PHMq1PH6MTGgt83MH+JId/lOM0xIBfMDsi4QyZN4aRzU4qs pDIZdnar7XAyiPtTystgoWQa4EX80sMxSgYHw699gYgCnBFC+1WeiQaN+PiJMkeh42wQ 1oFIF6Qn4OVXSUTAOnQ+GuKUsRy1rv3aAKaENPxxN7a4ySxnPU20DUzs9Vm26b+ltv+j lPgvsWX/4NGKm5yByUdgEwG6gLWUMkJ+XTDfGda+b4OkQ16cFB/22s4SeicC6L4CC41I 8Iew== X-Gm-Message-State: ALoCoQl/2Lz060RhqTbtoz1XdhTDye0ga70Z3ghrcqkRO222DQ5KBLctuCt7n319/PwEClRx8u0e X-Received: by 10.28.141.204 with SMTP id p195mr1491903wmd.40.1447753718568; Tue, 17 Nov 2015 01:48:38 -0800 (PST) Received: from localhost ([78.129.251.54]) by smtp.gmail.com with ESMTPSA id l186sm22970677wmg.19.2015.11.17.01.48.35 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:48:37 -0800 (PST) From: shannon.zhao@linaro.org To: ian.campbell@citrix.com, stefano.stabellini@citrix.com, keir@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com, julien.grall@citrix.com, xen-devel@lists.xen.org Subject: [PATCH v3 52/62] arm/acpi: Prepare EFI memory descriptor for Dom0 Date: Tue, 17 Nov 2015 17:40:51 +0800 Message-Id: <1447753261-7552-53-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> References: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_014858_553210_2A483C7F X-CRM114-Status: GOOD ( 11.73 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, hangaohuai@huawei.com, ard.biesheuvel@linaro.org, shannon.zhao@linaro.org, christoffer.dall@linaro.org, peter.huangpeng@huawei.com, david.vrabel@citrix.com, zhaoshenglong@huawei.com, linux-arm-kernel@lists.infradead.org, roger.pau@citrix.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- xen/arch/arm/domain_build.c | 2 ++ xen/common/efi/boot.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/setup.h | 4 ++++ 3 files changed, 54 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 9d667ea..073c634 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1737,6 +1737,8 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) acpi_map_rest_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_table, + &kinfo->mem, tbl_add); return 0; } diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 75835ae..ff2faed 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -1256,6 +1256,54 @@ 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, void *efi_acpi_table, + const struct meminfo *mem, + struct membank tbl_add[]) +{ + EFI_MEMORY_DESCRIPTOR *memory_map; + int i, offset; + u8 *base_ptr; + + 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 + TBL_MMAX); + 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 = mem->bank[i].size/PAGE_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 = acpi_mem.bank[i].size/PAGE_SIZE; + memory_map[offset].Attribute = EFI_MEMORY_WB; + } + + for( i = 0; i < TBL_EFIT; i++, offset++ ) + { + memory_map[offset].Type = EfiACPIReclaimMemory; + memory_map[offset].PhysicalStart = tbl_add[i].start; + memory_map[offset].NumberOfPages =tbl_add[i].size/PAGE_SIZE; + memory_map[offset].Attribute = EFI_MEMORY_WB; + } + + for( i = TBL_EFIT; i < TBL_MMAX; i++, offset++ ) + { + memory_map[offset].Type = EfiReservedMemoryType; + memory_map[offset].PhysicalStart = tbl_add[i].start; + memory_map[offset].NumberOfPages =tbl_add[i].size/PAGE_SIZE; + memory_map[offset].Attribute = EFI_MEMORY_WB; + } +} #endif #ifndef CONFIG_ARM /* TODO - runtime service support */ diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index 2d65796..35447ee 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -56,6 +56,10 @@ int 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, void *efi_acpi_table, + const struct meminfo *mem, + struct membank tbl_add[]); + int construct_dom0(struct domain *d); void discard_initial_modules(void);