From patchwork Fri Mar 25 13:48:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 64469 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp183306lbc; Fri, 25 Mar 2016 06:50:57 -0700 (PDT) X-Received: by 10.176.3.17 with SMTP id 17mr6822284uat.3.1458913849164; Fri, 25 Mar 2016 06:50:49 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id b205si3637802vka.146.2016.03.25.06.50.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Mar 2016 06:50:49 -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; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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 1ajS7F-0000zD-NO; Fri, 25 Mar 2016 13:49:29 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajS7E-0000z5-Qp for xen-devel@lists.xen.org; Fri, 25 Mar 2016 13:49:28 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 2E/5E-04060-8E145F65; Fri, 25 Mar 2016 13:49:28 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-7.tower-31.messagelabs.com!1458913766!23923401!1 X-Originating-IP: [209.85.192.182] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50083 invoked from network); 25 Mar 2016 13:49:27 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-7.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Mar 2016 13:49:27 -0000 Received: by mail-pf0-f182.google.com with SMTP id n5so83039117pfn.2 for ; Fri, 25 Mar 2016 06:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=J32540eCly0JXgvyOTJOMPDBwSjcy8UE1v+bD+Pa56g=; b=UKKbTaZ+8yKKjtGi8bmNQdQc1SZpNYMVnOaQhZbWtHMXfCRz++mD77OBxAdSdsVzvD FdXIOcj3iiyoEAlOqDPdvUL/qI8pbhON3RdajqmSDGDc4ctZ98vNTpu1ht3LDiHtAXLH myDHD0zZ5Q3c97tw1/c/fFfbOPrT2B4FN+0VY= 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=J32540eCly0JXgvyOTJOMPDBwSjcy8UE1v+bD+Pa56g=; b=k2uTQENkggV8erCk863Da20PKO9vTGlLJn+9yoh/sZHgDhwK0QkbisM7lpf5X2MzLn MG3wonVx+IkHbht0XzLg2t5CiEI6sAF0oMHTnevcxf6miDFYh0zbNi+l+7cHM6XqM9FM CyzapiKJbyEspt1B77vlqDwk5DhVyhrTj6wgYoCti46bg6AALpkM/Q5gJr+wWudaS9q4 BbaRkQXVCgdV9JiFcb/kUEVdSmm2ocLwRGIHNdPO+v4G0LyKkys9spIGsHF4E7HD0q+a 4OpanwpNxPgmUka917UKjvcA5+TwlCh/+nxuBU3S7Rv7C82OXxEQeWG3GTCtasMjoCi5 5/iw== X-Gm-Message-State: AD7BkJJp1YBNclrO7jzyxGMI+OpPg9Yx5p4cIim+NBlN/Xb15tT7MiR1Pf13VPDWz2M3jSWt X-Received: by 10.98.80.206 with SMTP id g75mr21254088pfj.127.1458913765794; Fri, 25 Mar 2016 06:49:25 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.2]) by smtp.gmail.com with ESMTPSA id w20sm16744178pfi.31.2016.03.25.06.49.21 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Mar 2016 06:49:24 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Fri, 25 Mar 2016 21:48:36 +0800 Message-Id: <1458913735-2678-4-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458913735-2678-1-git-send-email-shannon.zhao@linaro.org> References: <1458913735-2678-1-git-send-email-shannon.zhao@linaro.org> Cc: julien.grall@arm.com, shannon.zhao@linaro.org, stefano.stabellini@citrix.com, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Xen-devel] [PATCH v7 03/22] arm/acpi: Prepare FADT table 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Copy and modify FADT table before passing it to Dom0. Set PSCI_COMPLIANT and PSCI_USE_HVC. Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini Acked-by: Julien Grall --- xen/arch/arm/domain_build.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 13027ea..0e44e10 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1357,6 +1357,44 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) } #ifdef CONFIG_ACPI + +static int acpi_create_fadt(struct domain *d, struct membank tbl_add[]) +{ + struct acpi_table_header *table = NULL; + struct acpi_table_fadt *fadt = NULL; + u64 table_size; + acpi_status status; + u8 *base_ptr; + u8 checksum; + + status = acpi_get_table(ACPI_SIG_FADT, 0, &table); + + if ( ACPI_FAILURE(status) ) + { + const char *msg = acpi_format_exception(status); + + printk("Failed to get FADT table, %s\n", msg); + return -EINVAL; + } + + table_size = table->length; + base_ptr = d->arch.efi_acpi_table + + acpi_get_table_offset(tbl_add, TBL_FADT); + ACPI_MEMCPY(base_ptr, table, table_size); + fadt = (struct acpi_table_fadt *)base_ptr; + + /* Set PSCI_COMPLIANT and PSCI_USE_HVC */ + fadt->arm_boot_flags |= (ACPI_FADT_PSCI_COMPLIANT | ACPI_FADT_PSCI_USE_HVC); + checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, fadt), table_size); + fadt->header.checksum -= checksum; + + tbl_add[TBL_FADT].start = d->arch.efi_acpi_gpa + + acpi_get_table_offset(tbl_add, TBL_FADT); + tbl_add[TBL_FADT].size = table_size; + + return 0; +} + static int estimate_acpi_efi_size(struct domain *d, struct kernel_info *kinfo) { size_t efi_size, acpi_size, madt_size; @@ -1415,6 +1453,7 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) { int rc = 0; int order; + struct membank tbl_add[TBL_MMAX] = {}; rc = estimate_acpi_efi_size(d, kinfo); if ( rc != 0 ) @@ -1441,6 +1480,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) return -EINVAL; } + rc = acpi_create_fadt(d, tbl_add); + if ( rc != 0 ) + return rc; + return 0; } #else