From patchwork Wed Feb 4 14:02:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 44366 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 391F62029F for ; Wed, 4 Feb 2015 14:07:25 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf1484344lab.3 for ; Wed, 04 Feb 2015 06:07:24 -0800 (PST) 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:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=T92qmblxPbYLEgZAd7ny9hAuQ9joiIvdlbdE8LnN1qM=; b=PbDSLSAWpjzmqnowZgzyBLibh12vFda2kQQ9JCE5K6aaafgkthwltxYf3d34jUwoAi bD3yiY8fBVkYet4UDccu/Q8fNLF9iz7sXStO2NSib//5pR4TFnyW1Kjvb4yoERYUvW7L xjWfKqPjKiWCnIcXs25xUIyO9rCaAp6geE53I8HhkC0gHd5HSk7wT6i3ONIYz/I7Kade gVtjYJxfc1nHQTBwQlj3/e8L2rZWlcojzOWAW6DMkkDiaEudNpCHrgC4jl4xxmj/ZpcL w1OVbrQR6ALo5lDkgK9m9OuVWgn0+kskDoBHuQIncS+RENI5B+6HNdveH/4+ybBkTr2g 4S+A== X-Gm-Message-State: ALoCoQmNf7gCIk547KesMafkUWkJZo9Ie+j/hrm+QbKTmgFjgfv8DCaSTxWu5BWbvEArEH101sYL X-Received: by 10.112.131.106 with SMTP id ol10mr499474lbb.20.1423058844160; Wed, 04 Feb 2015 06:07:24 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.195 with SMTP id 3ls33598lao.47.gmail; Wed, 04 Feb 2015 06:07:24 -0800 (PST) X-Received: by 10.112.173.202 with SMTP id bm10mr30517019lbc.24.1423058841876; Wed, 04 Feb 2015 06:07:21 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id k1si1460559laf.21.2015.02.04.06.07.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 06:07:21 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id f15so1682938lbj.0 for ; Wed, 04 Feb 2015 06:07:21 -0800 (PST) X-Received: by 10.152.36.162 with SMTP id r2mr17673408laj.9.1423058841399; Wed, 04 Feb 2015 06:07:21 -0800 (PST) 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.112.35.133 with SMTP id h5csp508350lbj; Wed, 4 Feb 2015 06:07:20 -0800 (PST) X-Received: by 10.140.19.78 with SMTP id 72mr25656940qgg.37.1423058839625; Wed, 04 Feb 2015 06:07:19 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id e9si2042689qgf.109.2015.02.04.06.07.18 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Feb 2015 06:07:19 -0800 (PST) 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 1YJ0b4-0000kP-DD; Wed, 04 Feb 2015 14:06:26 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0b2-0000gv-6J for xen-devel@lists.xen.org; Wed, 04 Feb 2015 14:06:24 +0000 Received: from [85.158.137.68] by server-10.bemta-3.messagelabs.com id DB/14-02745-F5722D45; Wed, 04 Feb 2015 14:06:23 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-11.tower-31.messagelabs.com!1423058781!12005262!1 X-Originating-IP: [209.85.220.47] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6505 invoked from network); 4 Feb 2015 14:06:22 -0000 Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by server-11.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 4 Feb 2015 14:06:22 -0000 Received: by mail-pa0-f47.google.com with SMTP id lj1so2984718pab.6 for ; Wed, 04 Feb 2015 06:06:20 -0800 (PST) X-Received: by 10.66.141.42 with SMTP id rl10mr34668470pab.124.1423058780809; Wed, 04 Feb 2015 06:06:20 -0800 (PST) Received: from parthd-ubunutu.qualcomm.com ([202.46.23.62]) by mx.google.com with ESMTPSA id kg12sm2161881pbb.44.2015.02.04.06.06.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 06:06:19 -0800 (PST) From: parth.dixit@linaro.org To: xen-devel@lists.xen.org Date: Wed, 4 Feb 2015 19:32:14 +0530 Message-Id: <1423058539-26403-31-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> References: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> Cc: ian.campbell@citrix.com, julien.grall@linaro.org, tim@xen.org, stefano.stabellini@citrix.com, jbeulich@suse.com, Parth Dixit , christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH RFC 30/35] arm : acpi map XSDT table to dom0 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: parth.dixit@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.217.169 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: From: Parth Dixit XSDT table cannot be passed as is to dom0 because new tables specific to xen need to be added to its table entries Signed-off-by: Parth Dixit --- xen/arch/arm/arm64/acpi/arm-core.c | 65 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/arm64/acpi/arm-core.c b/xen/arch/arm/arm64/acpi/arm-core.c index 9a26202..a210596 100644 --- a/xen/arch/arm/arm64/acpi/arm-core.c +++ b/xen/arch/arm/arm64/acpi/arm-core.c @@ -256,13 +256,74 @@ static void set_psci_fadt(void) fadt->header.checksum = (u8)( fadt->header.checksum-checksum ); } +#define NR_NEW_XEN_TABLES 2 + +static int map_xsdt_table(struct domain *d, u64 *xsdt) +{ + int res; + u64 size; + u64 addr = *xsdt; + u64 *new_xsdt; + struct acpi_table_header *table; + u64 *table_entry; + u8 checksum; + + /* map xsdt table */ + table = acpi_os_map_memory(addr, sizeof(struct acpi_table_header) ); + size = table->length ; + acpi_os_unmap_memory(table, sizeof(struct acpi_table_header) ); + + table = acpi_os_map_memory(addr, size); + size += ( NR_NEW_XEN_TABLES*sizeof(acpi_native_uint) ); + new_xsdt = ACPI_ALLOCATE_ZEROED(size); + if( new_xsdt == NULL) + return -ENOMEM; + ACPI_MEMCPY(new_xsdt, table,table->length); + acpi_os_unmap_memory(table, table->length); + + table = (struct acpi_table_header *) new_xsdt; + table->length = size; + *xsdt = addr = virt_to_maddr(new_xsdt); + + /* map xsdt region */ + res = map_ram_regions(d, + paddr_to_pfn(addr & PAGE_MASK), + DIV_ROUND_UP(size, PAGE_SIZE), + paddr_to_pfn(addr & PAGE_MASK)); + if ( res ) + { + printk(XENLOG_ERR "Unable to map 0x%"PRIx64 + " - 0x%"PRIx64" in domain \n", + addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1); + return res; + } + + table_entry = ACPI_CAST_PTR(u64, + ( ACPI_CAST_PTR(u8, new_xsdt) + sizeof(struct acpi_table_header) ) ); + table_entry += + ( ( (size - sizeof(struct acpi_table_header) ) / + sizeof(acpi_native_uint) ) ); + + checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, table), table->length); + table->checksum = (u8)( table->checksum - checksum ); + return 0; +} + int acpi_map_tables(struct domain *d) { int i,res; - u64 addr, size; + u64 addr, size, rsdp; + struct acpi_table_rsdp *rsdt; + + addr = rsdp = acpi_os_get_root_pointer(); + rsdt = acpi_os_map_memory(addr, sizeof(struct acpi_table_rsdp) ); + addr = rsdt->xsdt_physical_address; + map_xsdt_table(d, &addr); + rsdt->xsdt_physical_address = addr; + acpi_os_unmap_memory(rsdt, sizeof(struct acpi_table_rsdp) ); /* map rsdp table */ - addr = acpi_os_get_root_pointer(); + addr = rsdp; size = sizeof(struct acpi_table_rsdp); res = map_ram_regions(d,