From patchwork Thu Sep 9 16:34:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Stefanov X-Patchwork-Id: 12483455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2ED3C433FE for ; Thu, 9 Sep 2021 16:35:16 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F30861051 for ; Thu, 9 Sep 2021 16:35:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9F30861051 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.183372.331505 (Exim 4.92) (envelope-from ) id 1mON0v-00013I-Uf; Thu, 09 Sep 2021 16:35:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 183372.331505; Thu, 09 Sep 2021 16:35:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mON0v-00012U-QK; Thu, 09 Sep 2021 16:35:01 +0000 Received: by outflank-mailman (input) for mailman id 183372; Thu, 09 Sep 2021 16:35:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mON0u-0000zO-WF for xen-devel@lists.xenproject.org; Thu, 09 Sep 2021 16:35:01 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ba95b034-5d64-4cc1-a1cd-3fed2c23f413; Thu, 09 Sep 2021 16:35:00 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ba95b034-5d64-4cc1-a1cd-3fed2c23f413 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1631205299; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XyAZ9tVbkw9oc4UHQy0JFhFEp2DcwLj5o9RUfsQCO+g=; b=VFk6BqzxThNnwtO4gmsA9vgW024qNm7ph8AeUvGJfz2IVPQYxkvG9UyP fdi3LEayfC4k6SPgBJmKOVSCcBlECmJp1hh9hpMUphZc6ZV5xt9DBpzdb pNAHHnG4+tUkGFAHMupxqVvhbvPY5oU9rroDxTJ4qG/KLpyhLAvERtGJE c=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: iE/xgJg82yj680ioyAa0b2lSBDNg2lrMOdcpF/khdp9jdLLxQOmQeCOzQtO7f1GJaOgtEH5PBi R5oof9iLR+Lxsi1f1hR1tlcwVfcNDowsKLHn7LjqJfyXeYbo8rqHhqukWRLUTLBe29vi1QfL88 dbs0kweLe5SxIIrUDlgdsRDLixFc9gQBjUmPyKLWsWTIjHVZaE9/WseJoI0vfUDiEBUtKfMbC4 Pd9lYF+CuxJqqZEnEqitm2CNOc5xUbeo1YVPH761ZYxZ/tdcp3tIcghAWw5XlAPuf/5701V8Ct ROtsKKj1iZuocqYWslQbcSHo X-SBRS: 5.1 X-MesageID: 52390010 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:kN+zQaDblaqxrPvlHelo55DYdb4zR+YMi2TDt3oddfU1SL38qy nKpp4mPHDP5wr5NEtPpTniAtjjfZq/z/5ICOAqVN/PYOCPggCVxepZnOjfKlPbehEX9oRmpN 1dm6oVMqyMMbCt5/yKnDVRELwbsaa6GLjDv5a785/0JzsaE52J6W1Ce2GmO3wzfiZqL7wjGq GR48JWzgDQAkj+PqyAdx84t/GonayzqK7b X-IronPort-AV: E=Sophos;i="5.85,280,1624334400"; d="scan'208";a="52390010" From: Kevin Stefanov To: Xen-devel CC: Kevin Stefanov , Jan Beulich , Andrew Cooper Subject: [PATCH 1/3] tools/libacpi: Use 64-byte alignment for FACS Date: Thu, 9 Sep 2021 17:34:39 +0100 Message-ID: <20210909163441.44418-2-kevin.stefanov@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210909163441.44418-1-kevin.stefanov@citrix.com> References: <20210909163441.44418-1-kevin.stefanov@citrix.com> MIME-Version: 1.0 The spec requires 64-byte alignment, not 16. Signed-off-by: Kevin Stefanov Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Andrew Cooper Note: This does not fix the FACS alignment inside guests yet. See next patch. --- tools/libacpi/build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c index a61dd5583a..fe2db66a62 100644 --- a/tools/libacpi/build.c +++ b/tools/libacpi/build.c @@ -532,7 +532,7 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) * Fill in high-memory data structures, starting at @buf. */ - facs = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_facs), 16); + facs = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_facs), 64); if (!facs) goto oom; memcpy(facs, &Facs, sizeof(struct acpi_20_facs)); From patchwork Thu Sep 9 16:34:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Stefanov X-Patchwork-Id: 12483453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 540DEC433EF for ; Thu, 9 Sep 2021 16:35:16 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1705961051 for ; Thu, 9 Sep 2021 16:35:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1705961051 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.183373.331523 (Exim 4.92) (envelope-from ) id 1mON11-0001YY-7P; Thu, 09 Sep 2021 16:35:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 183373.331523; Thu, 09 Sep 2021 16:35:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mON11-0001YR-3G; Thu, 09 Sep 2021 16:35:07 +0000 Received: by outflank-mailman (input) for mailman id 183373; Thu, 09 Sep 2021 16:35:05 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mON0z-0000zH-AQ for xen-devel@lists.xenproject.org; Thu, 09 Sep 2021 16:35:05 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e0509478-118b-11ec-b1cb-12813bfff9fa; Thu, 09 Sep 2021 16:35:00 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e0509478-118b-11ec-b1cb-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1631205300; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=05ujbDwCHYeB1etSWskRRxGCGEOzl35sXRnTpQwyYyQ=; b=cH07yqkzdQwzzNUANa+GYhsu01sNhjU0VydsHYHzi3h2lMFlqvDI3k2A nsuNzoVRf4fKZnqtzNDdDnxYWAx1t+6N5Mf2sKqTRRe+9N2f3z9j8UYL1 K+IHV4cXSM0N7e0nYff82ZksjU7gI1l2ULYxcAumk/Kxi3Qpub9PRsat+ 8=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: XVrzfeg/RpgzLA8csCHC+Mc3NGz0xP5HCaQGB9gx1e3k6S9orcQfSFmA0+ddQ1jZv1hQpKl7Lt TAx3JpmSlonEk2KEpz5CfKpHdOs22WSLO4F3HgPjwjfKG8+jNgACYVqVHP0zksNEuZc4kNvkJ7 c4rVsOFS01/8Y66KPMfohKkfFtx5CJHo2W2gn7WeNoG/4R+ERdHnRZfVY/+207j7R89HZ8W3Fj gHReyXDEGgvC7jQjXf6rtm3IPMMNE87lh3IIPJy3/QqJcyyskQ6/aC8C/dYAjMA8HGUDye4z8A tsQ4oQ/2Q3tv69Jp0U1HmxZS X-SBRS: 5.1 X-MesageID: 51975738 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:GiRqhKzLr91ncqQjwy5MKrPw2r1zdoMgy1knxilNoHxuH/BwWf rPoB17726TtN91YhsdcL+7V5VoLUmzyXcx2/hyAV7AZniAhILLFvAA0WKK+VSJdxEWtNQtsJ uIG5IUNDSaNykfsS+V2miF+9ZL+qj5zEir792usUuEm2tRGtBdBwQSMHfqLqVvLjM2fKbQjP Cnl7d6TzzLQwVuUu2LQkMrcsLkvNPxmJfvcXc9dmIaAFnnt0LS1FbieSLopCsjbw== X-IronPort-AV: E=Sophos;i="5.85,280,1624334400"; d="scan'208";a="51975738" From: Kevin Stefanov To: Xen-devel CC: Kevin Stefanov , Andrew Cooper , Ian Jackson , Wei Liu , Anthony PERARD Subject: [PATCH 2/3] tools/libxl: Correctly aligned buffer for ACPI tables Date: Thu, 9 Sep 2021 17:34:40 +0100 Message-ID: <20210909163441.44418-3-kevin.stefanov@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210909163441.44418-1-kevin.stefanov@citrix.com> References: <20210909163441.44418-1-kevin.stefanov@citrix.com> MIME-Version: 1.0 The pointer resulting from libxl__malloc() has no explicit alignment. As an implementation detail, it has 16-byte alignment. When this buffer is used by libacpi aligning ACPI tables to greater than 16 does not work correctly. This causes the FACS to not be 64-byte aligned when the ACPI tables are copied into guest memory. Align the ACPI tables buffer to a page, to match the alignment inside guest memory. The buffer is already one page too large, presumably intended for this purpose originally. Fixes: 14c0d328da2b ("libxl/acpi: Build ACPI tables for HVMlite guests") Signed-off-by: Kevin Stefanov --- CC: Andrew Cooper CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD --- tools/libs/light/libxl_x86_acpi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/libs/light/libxl_x86_acpi.c b/tools/libs/light/libxl_x86_acpi.c index 3eca1c7a9f..0a82e7cacd 100644 --- a/tools/libs/light/libxl_x86_acpi.c +++ b/tools/libs/light/libxl_x86_acpi.c @@ -193,6 +193,7 @@ int libxl__dom_load_acpi(libxl__gc *gc, * Set up allocator memory. * Start next to acpi_info page to avoid fracturing e820. */ + acpi_pages = (void *)ROUNDUP((unsigned long)acpi_pages, libxl_ctxt.page_shift); libxl_ctxt.alloc_base_paddr = ACPI_INFO_PHYSICAL_ADDRESS + libxl_ctxt.page_size; libxl_ctxt.alloc_base_vaddr = libxl_ctxt.alloc_currp = From patchwork Thu Sep 9 16:34:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Stefanov X-Patchwork-Id: 12483457 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3508CC433F5 for ; Thu, 9 Sep 2021 16:35:35 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06BD061051 for ; Thu, 9 Sep 2021 16:35:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 06BD061051 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.183381.331534 (Exim 4.92) (envelope-from ) id 1mON1L-0002Ru-G2; Thu, 09 Sep 2021 16:35:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 183381.331534; Thu, 09 Sep 2021 16:35:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mON1L-0002Rn-CO; Thu, 09 Sep 2021 16:35:27 +0000 Received: by outflank-mailman (input) for mailman id 183381; Thu, 09 Sep 2021 16:35:25 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mON1J-0001rN-SV for xen-devel@lists.xenproject.org; Thu, 09 Sep 2021 16:35:25 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 24a98b95-d76e-4665-9e6e-14ec9f6de728; Thu, 09 Sep 2021 16:35:19 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 24a98b95-d76e-4665-9e6e-14ec9f6de728 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1631205319; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=35xQpM/thu7zR5kkv+/e98XVppVGc4tUolZlEnqQblo=; b=gSswPpum84z4Z/owIYBzPDHY6McJ5qQI2EwOAlQsnYk1jR4gpM2wqE1/ YE9Vhkx9n960L7WettWQAKbsuVQdzCEzqQ2+DcKSHq3vUDxB8v+Xn8Qru tEBVbLqqMZSULsF1WuWJQaSxAQE8mbV0XHJNQbDCfmSu3kJKX3LccnvtE A=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: +3BrRwVXpvZbjpR1G8slxnNa4TcWQuzGqFyaK4jzKYmOgVzZAGW7BJak7M4ilt8IuygVnycUPl fdnIS4tL8LlFuebY7o+OLbA0v9e//IBQ9q9kqcvl+nT9Bj8btOFNfmJignX1TnFIYuoY3oRj2G vP9HSz2jG83xwFbpHkTtSD3IXnpT6oi0eQk1TXEQS4LPGIGQxaKK38dpiv5epUWk1S6BMATZyx NOfjkxBxXJRH7Hvela+Gvf2tgq2NlALRjl6zJqfd0K+57+a9Huu2cYNTARp6qfrgAUzQ8x0iRf MibL/Z7zcqxNeFZvLC4eRm1G X-SBRS: 5.1 X-MesageID: 54142780 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:JrjuMKqUL6XpiV/Pgrs0ai8aV5oReYIsimQD101hICG8cqSj9v xG+85rrCMc6QxhI03I9urwW5VoLUmyyXcx2/h0AV7AZniBhILLFvAB0WKK+VSJcEeSmtK1l5 0QFJSWYOeAdWSS5vyb3ODXKbgdKaG8gcWVuds= X-IronPort-AV: E=Sophos;i="5.85,280,1624334400"; d="scan'208";a="54142780" From: Kevin Stefanov To: Xen-devel CC: Kevin Stefanov , Andrew Cooper , Ian Jackson , Wei Liu , Anthony PERARD Subject: [PATCH 3/3] tools/libxl: Only allocate 64 bytes for RSDP Date: Thu, 9 Sep 2021 17:34:41 +0100 Message-ID: <20210909163441.44418-4-kevin.stefanov@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210909163441.44418-1-kevin.stefanov@citrix.com> References: <20210909163441.44418-1-kevin.stefanov@citrix.com> MIME-Version: 1.0 RSDP's size is 64 bytes and later in the function, its buffer is hardcoded to be 64 bytes long. Don't bother to allocate a whole page. Signed-off-by: Kevin Stefanov Reviewed-by: Jan Beulich --- CC: Andrew Cooper CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD --- tools/libs/light/libxl_x86_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libs/light/libxl_x86_acpi.c b/tools/libs/light/libxl_x86_acpi.c index 0a82e7cacd..2aea1eca31 100644 --- a/tools/libs/light/libxl_x86_acpi.c +++ b/tools/libs/light/libxl_x86_acpi.c @@ -183,7 +183,7 @@ int libxl__dom_load_acpi(libxl__gc *gc, goto out; } - config.rsdp = (unsigned long)libxl__malloc(gc, libxl_ctxt.page_size); + config.rsdp = (unsigned long)libxl__malloc(gc, 64); config.infop = (unsigned long)libxl__malloc(gc, libxl_ctxt.page_size); /* Pages to hold ACPI tables */ acpi_pages = libxl__malloc(gc, (NUM_ACPI_PAGES + 1) *