From patchwork Thu Feb 25 14:56:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 8424201 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 370609F314 for ; Thu, 25 Feb 2016 14:59:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 735EB2026F for ; Thu, 25 Feb 2016 14:59:50 +0000 (UTC) Received: from lists.xen.org (unknown [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 858C420204 for ; Thu, 25 Feb 2016 14:59:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aYxLv-0001TR-SO; Thu, 25 Feb 2016 14:57:15 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aYxLu-0001RO-GN for xen-devel@lists.xen.org; Thu, 25 Feb 2016 14:57:14 +0000 Received: from [193.109.254.147] by server-4.bemta-14.messagelabs.com id 02/8A-03301-A461FC65; Thu, 25 Feb 2016 14:57:14 +0000 X-Env-Sender: prvs=85652c963=anthony.perard@citrix.com X-Msg-Ref: server-7.tower-27.messagelabs.com!1456412230!26701674!3 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22683 invoked from network); 25 Feb 2016 14:57:13 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-7.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 25 Feb 2016 14:57:13 -0000 X-IronPort-AV: E=Sophos;i="5.22,498,1449532800"; d="scan'208";a="334491062" From: Anthony PERARD To: Date: Thu, 25 Feb 2016 14:56:04 +0000 Message-ID: <1456412174-20162-7-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1456412174-20162-1-git-send-email-anthony.perard@citrix.com> References: <1456412174-20162-1-git-send-email-anthony.perard@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Anthony PERARD , Wei Liu , Ian Jackson , Stefano Stabellini Subject: [Xen-devel] [PATCH v3 06/16] libxl: Load guest ACPI table from file 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, UNPARSEABLE_RELAY autolearn=no 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 A user can provide a different ACPI tables than the default one by using the existing "acpi_firmware" xl's config option or the field u.hvm.acpi_firmware. libxl will check if the provided table is a DSDT or not. Signed-off-by: Anthony PERARD --- Change in V3: - use existing acpi_firmware option to provide an override for the acpi tables. Will check if it's a DSDT or an extra tables. --- tools/libxl/libxl_dom.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 50abfbc..87853fd 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -905,6 +905,7 @@ static int libxl__domain_firmware(libxl__gc *gc, int datalen = 0; void *data; const char *bios_filename = NULL; + const char *full_acpi_tables_filename = NULL; if (info->u.hvm.firmware) firmware = info->u.hvm.firmware; @@ -964,6 +965,10 @@ static int libxl__domain_firmware(libxl__gc *gc, abort(); } } + + full_acpi_tables_filename = + libxl__abs_path(gc, "dsdt_anycpu_qemu_xen.aml", + libxl__xenfirmwaredir_path()); } if (bios_filename) { @@ -1008,6 +1013,27 @@ static int libxl__domain_firmware(libxl__gc *gc, } } + /* + * Check if the user supplied ACPI tables are the full tables, or if + * there are only extra tables. The full tables start with the DSDT + * table, and the signature is in the first four bytes. + */ + if (!dom->acpi_module.length + || strncmp("DSDT", (char*)dom->acpi_module.data, 4)) { + if (full_acpi_tables_filename) { + rc = libxl__load_hvm_firmware_module(gc, full_acpi_tables_filename, + "ACPI tables", + &dom->full_acpi_module); + if (rc) goto out; + } + } else { + /* Use user supplied DSDT tables. */ + dom->full_acpi_module.data = dom->acpi_module.data; + dom->full_acpi_module.length = dom->acpi_module.length; + dom->acpi_module.length = 0; + dom->acpi_module.data = NULL; + } + return 0; out: assert(rc != 0);