From patchwork Tue Nov 17 09:40:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 7635041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0B88EBF90C for ; Tue, 17 Nov 2015 10:11:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39A8D2041B for ; Tue, 17 Nov 2015 10:11:04 +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 6431820411 for ; Tue, 17 Nov 2015 10:11:03 +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 1ZydBr-0001rW-Vz; Tue, 17 Nov 2015 10:08:44 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZycsE-000381-A9 for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 09:48:29 +0000 Received: by wmec201 with SMTP id c201so17342770wme.1 for ; Tue, 17 Nov 2015 01:48:05 -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=pz0+/OhjrgeW68ex1sY9LrV0w6++L/DEv7dnORucjw4=; b=1fA+k/PAeasZykePO2QfF9KEnVMHfAgZ9/lbtbEuagehBks/zH09Ol++qDmncl9RSj A3BO27IKP4TijUV/U4sVLN9YEvI9ps3NhGru/rZN+eNvD9g7Uby1GCQHpMMQ31fpgAYA gUbNpw+8cBYL5lG4wASLelUycP0C1a6QSupBVCwLHCoKvmqwdDbN+YZXPU8QZ3zxSXWW JiJj1ooCTeM9KQ00xT+Zxb3GYyDSD4bUkk1hF3qFhboowTwzEJMneo9aZP2hSKNCBy5+ owfrLvAecU/LpzIT98zxdF4ozv6AsAHxdp/BWDKI6pew6gLcOzHEoFBg86xRcQ5qRVGJ Kr9g== 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=pz0+/OhjrgeW68ex1sY9LrV0w6++L/DEv7dnORucjw4=; b=GDoknMGzEY5utpzWOFo2SnE11uTRYcdec4vGR/4TUbtQAAoVZcyq1mWeZiFKScIjkq YgOYRm/0Zv0MQl1vcEDcUr1g9eTrrRhWMzAjvu59r4QLqy/dEvCg9W4z8EkzadkdL+rd tpzq3PKA4LRdnKwCedkw5riiy3AURLK3KezJexJWMVbEZTb+UrlC3FktHzC9QeV/idzn gY/tQTRyD3eJ4hkAlDpMSMkivYUpF+Xz4uwrb+KDAs5oh3N3MhQc/JzZnMaALgSwv+lQ Cy9285oqKpxX1g14v/1V68uycY6Vejh2pgA780Sh02/A+BwCFFzA7qvnWj4R33vAP092 YHnw== X-Gm-Message-State: ALoCoQn0qn0UEjdCYlWkifPKruyevB1QNjwGTPZY2ybrj6j9TWnMMn1hf5B4Y9VRNDocIEpPfkgH X-Received: by 10.28.229.15 with SMTP id c15mr1538729wmh.76.1447753685024; Tue, 17 Nov 2015 01:48:05 -0800 (PST) Received: from localhost ([78.129.251.54]) by smtp.gmail.com with ESMTPSA id q141sm23041535wmg.3.2015.11.17.01.48.03 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:48:04 -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 48/62] arm/acpi: Prepare RSDP table for Dom0 Date: Tue, 17 Nov 2015 17:40:47 +0800 Message-Id: <1447753261-7552-49-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_014826_845789_386C5EB1 X-CRM114-Status: GOOD ( 11.28 ) X-Spam-Score: -2.6 (--) 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 Copy RSDP table and replace rsdp->xsdt_physical_address with new address of XSDT table, so it can point to the right XSDT table. Signed-off-by: Shannon Zhao Acked-by: Stefano Stabellini --- xen/arch/arm/domain_build.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 894328f..6ae5761 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1359,6 +1359,38 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) #ifdef CONFIG_ACPI #define XEN_HYPERVISOR_ID 0x000058656E564D4D /* "XenVMM" */ +static int acpi_create_rsdp(struct domain *d, struct membank tbl_add[]) +{ + + struct acpi_table_rsdp *rsdp = NULL; + u64 addr; + u64 table_size = sizeof(struct acpi_table_rsdp); + u8 *base_ptr; + u8 checksum; + + addr = acpi_os_get_root_pointer(); + if( !addr ) + panic("Unable to get acpi root pointer\n"); + + rsdp = acpi_os_map_memory(addr, table_size); + base_ptr = d->arch.efi_acpi_table + + acpi_get_table_offset(tbl_add, TBL_RSDP); + ACPI_MEMCPY(base_ptr, rsdp, table_size); + acpi_os_unmap_memory(rsdp, table_size); + + rsdp = (struct acpi_table_rsdp *)base_ptr; + /* Replace xsdt_physical_address */ + rsdp->xsdt_physical_address = tbl_add[TBL_XSDT].start; + checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, rsdp), table_size); + rsdp->checksum = rsdp->checksum - checksum; + + tbl_add[TBL_RSDP].start = d->arch.efi_acpi_gpa + + acpi_get_table_offset(tbl_add, TBL_RSDP); + tbl_add[TBL_RSDP].size = table_size; + + return 0; +} + static void acpi_xsdt_modify_entry(u64 entry[], unsigned long entry_count, char *signature, u64 addr) { @@ -1675,6 +1707,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) if ( rc != 0 ) return rc; + rc = acpi_create_rsdp(d, tbl_add); + if ( rc != 0 ) + return rc; + return 0; } #else