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: 56750 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1827837lbb; Tue, 17 Nov 2015 01:49:47 -0800 (PST) X-Received: by 10.140.228.10 with SMTP id y10mr42844677qhb.33.1447753787369; Tue, 17 Nov 2015 01:49:47 -0800 (PST) Return-Path: Received: from lists.xen.org (lists.xenproject.org. [50.57.142.19]) by mx.google.com with ESMTPS id d18si29211593qkb.67.2015.11.17.01.49.47 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:49:47 -0800 (PST) Received-SPF: neutral (google.com: 50.57.142.19 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=50.57.142.19; Authentication-Results: mx.google.com; spf=neutral (google.com: 50.57.142.19 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; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZycsT-0007ww-IB; Tue, 17 Nov 2015 09:48:41 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZycsS-0007vV-Cj for xen-devel@lists.xen.org; Tue, 17 Nov 2015 09:48:40 +0000 Received: from [193.109.254.147] by server-11.bemta-14.messagelabs.com id 1F/5C-15765-7F7FA465; Tue, 17 Nov 2015 09:48:39 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-9.tower-27.messagelabs.com!1447753718!3772038!1 X-Originating-IP: [74.125.82.43] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.19.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10376 invoked from network); 17 Nov 2015 09:48:39 -0000 Received: from mail-wm0-f43.google.com (HELO mail-wm0-f43.google.com) (74.125.82.43) by server-9.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Nov 2015 09:48:39 -0000 Received: by wmww144 with SMTP id w144so145758062wmw.1 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=hgod4rs8IGb0k4Mvk50PTnuS3NfrD+5p0Iipn03woiSgvt7nRa5y5oGVmIbApHe/Mp CDWWbo5eEuyZuQ41DrOuXwFGAHhmAfqZi7hOMdgXFATpzDS5ic33ALVkn502AGzg0Ee0 /99ygIr9CYCUjo/m8wlDdnBAxp3VhDxDSgNyx7Xm2NbEiCzGR4Bz2JmLiidUNjh6d58o BUz18k/Yk1toEkeMnxoVjTQeMCCiKacPxgC/uUa2A7bJb5dj28ystVk2LUUtS2Vhmpjh ayaz+tjGvq2CEQjr0YPV1ISg/Mm3nsQld5EXB6l7LryExlW5zWDtEj/N+IJ3N/bNl0Bo P/UQ== X-Gm-Message-State: ALoCoQn+8u7p64SsnHpNYJhX6B9SxmI29HKqx4qdNXy7H6jDSEVduU6gFdMuGb9YWT+8112io3an 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 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> 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 Subject: [Xen-devel] [PATCH v3 52/62] arm/acpi: Prepare EFI memory descriptor for Dom0 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion 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 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(+) -- 2.1.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel 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);