From patchwork Thu Sep 29 01:18:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 77105 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp79886qgf; Wed, 28 Sep 2016 18:22:14 -0700 (PDT) X-Received: by 10.36.67.2 with SMTP id s2mr204492itb.50.1475112134250; Wed, 28 Sep 2016 18:22:14 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id g139si17786035itb.109.2016.09.28.18.22.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Sep 2016 18:22:14 -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; dmarc=fail (p=NONE dis=NONE) header.from=linaro.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 1bpQ0s-0001XI-Qg; Thu, 29 Sep 2016 01:19:50 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpQ0r-0001Uq-34 for xen-devel@lists.xen.org; Thu, 29 Sep 2016 01:19:49 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 11/CB-01833-43C6CE75; Thu, 29 Sep 2016 01:19:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBIsWRWlGSWpSXmKPExsVyMfTANl3jnDf hBttOC1ss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmX/39mLTjMW/Fg4iLGBsb/XF2MXBxCApMY JX5Pvs0K4rAIzGOWuHvuCQuIIyHQzyrRtWE2excjJ5ATI/H13gomCLtK4vbvtYwgtpCAmsSyw wuZIUY1MUmc3r0LLMEmoCPxYtJONhBbREBa4trny4wgRcwCRxglbs0/yQySEBawk9iw4DyYzS KgKnHryx6wZl4BG4nzSyaxQmzTlJg+6zVYDSdQ/EPLL2aIzdYSy75tZpnAKLCAkWEVo0ZxalF ZapGukZFeUlFmekZJbmJmjq6hgbFebmpxcWJ6ak5iUrFecn7uJkZgeNUzMDDuYJx6wu8QoyQH k5IoL6fPm3AhvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErxXsoBygkWp6akVaZk5wECHSUtw8CiJ8 L4CSfMWFyTmFmemQ6ROMRpzbPl9bS0Tx7ap99YyCbHk5eelSonzXgUpFQApzSjNgxsEi8BLjL JSwryMDAwMQjwFqUW5mSWo8q8YxTkYlYR5E7KBpvBk5pXA7XsFdAoT0ClLT7wAOaUkESEl1cC Y01bP0yqtudI1epN+m9npyS8CIwVT/hjs0GR93Px66ykNH5s2hXW9xxtS94R4LfylIXR74YkZ Ibee9Cm52M2QC1m3u+yya0Vt1pQDk5LS+39O+fw6uybiU8iWNQtePL9XPFnn58qIcI9J+fEcy lYbHeueVBQ83zF9327NX4Ym5z5ZuTU8iJ6vxFKckWioxVxUnAgAOEFLF7sCAAA= X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-6.tower-31.messagelabs.com!1475111985!36984859!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.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 59019 invoked from network); 29 Sep 2016 01:19:47 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-6.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 29 Sep 2016 01:19:47 -0000 Received: by mail-pf0-f182.google.com with SMTP id l25so22858834pfb.1 for ; Wed, 28 Sep 2016 18:19:47 -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=en50DDKO9biisqsfCYnGKevSW45I5aS15Af24YQmo0Y=; b=dfMu/bw5B6yxtzBo/cqC38clpUgH+mWQD60z+CtYVpT+AQFdNwNol1IgtYnCWYh5z5 cGqNke0Y/zUERDHb5rgFrtsuPfq+gQKJ0KYCg1N55sJg0ZepQvArAUQA44nSkE03zEZN KCvSG3ZjuzzMejZtvWZwVtqRK7uwA/Kp4lPRg= 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=en50DDKO9biisqsfCYnGKevSW45I5aS15Af24YQmo0Y=; b=cnNRa61NkdO3RQmhM8lYnh1bd0zUp6Mcj2SkD/Ce2KzM9Z5n1o63eP8W4EyQoV+nq1 zBo6pW5oOus5+wqUajgSlnf9VnJvXiVnXtrrGbsyZTD0Uzh1i+b6qbVll8hQX3vzy153 g2SfJALIEAP4R+Gu2lQlhmc056nHHHANnQIPQw5woenQXNE+qAaC7/ZgRkHUCzpnzu3j BbtFPHFjEN6OCkm/Ug4Q/BUSEcYgyUFtTSlPtbkNS4WmjaABeqiixlVtA7XBN86FAxju 7Ggcsl+KWa4+wFmIisUYgjRZ5F4FLMiH0oWHNPYTGKas1Ungk7GgcQNItkzj7Ccb99U1 z2cw== X-Gm-Message-State: AE9vXwOeQQcOuh87NHTdudL43CUqAmnSppQBD4aQFS775rZXsuJh3zi+zRqlN8zuGc9x50oq X-Received: by 10.98.102.148 with SMTP id s20mr63251802pfj.79.1475111985577; Wed, 28 Sep 2016 18:19:45 -0700 (PDT) Received: from HZA160860128-A.china.huawei.com ([67.238.99.186]) by smtp.gmail.com with ESMTPSA id wd7sm15228744pab.2.2016.09.28.18.19.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Sep 2016 18:19:44 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Wed, 28 Sep 2016 18:18:56 -0700 Message-Id: <20160929011902.7784-11-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.10.0.windows.1 In-Reply-To: <20160929011902.7784-1-shannon.zhao@linaro.org> References: <20160929011902.7784-1-shannon.zhao@linaro.org> Cc: sstabellini@kernel.org, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, julien.grall@arm.com, Shannon Zhao , zhaoshenglong@huawei.com, boris.ostrovsky@oracle.com Subject: [Xen-devel] [PATCH v8 10/16] libxl/arm: Construct ACPI FADT table 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" Signed-off-by: Shannon Zhao Acked-by: Julien Grall Acked-by: Wei Liu --- tools/libxl/libxl_arm_acpi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c index f593dab..6530f45 100644 --- a/tools/libxl/libxl_arm_acpi.c +++ b/tools/libxl/libxl_arm_acpi.c @@ -310,6 +310,25 @@ out: return rc; } +static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom, + struct acpitable acpitables[]) +{ + uint64_t offset = acpitables[FADT].addr - GUEST_ACPI_BASE; + struct acpi_table_fadt *fadt = (void *)dom->acpi_modules[0].data + offset; + + /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */ + fadt->flags = ACPI_FADT_HW_REDUCED; + fadt->arm_boot_flags = ACPI_FADT_PSCI_COMPLIANT | ACPI_FADT_PSCI_USE_HVC; + + /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */ + fadt->minor_revision = 0x1; + fadt->dsdt = acpitables[DSDT].addr; + + make_acpi_header(&fadt->header, "FACP", acpitables[FADT].size, 5); + calculate_checksum(fadt, offsetof(struct acpi_table_header, checksum), + acpitables[FADT].size); +} + int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, struct xc_dom_image *dom) { @@ -338,6 +357,10 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, make_acpi_xsdt(gc, dom, acpitables); make_acpi_gtdt(gc, dom, acpitables); rc = make_acpi_madt(gc, dom, info, acpitables); + if (rc) + goto out; + + make_acpi_fadt(gc, dom, acpitables); out: return rc;