From patchwork Sun Sep 13 12:43:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 53530 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 6190722B26 for ; Sun, 13 Sep 2015 12:49:02 +0000 (UTC) Received: by lamp12 with SMTP id p12sf39082236lam.2 for ; Sun, 13 Sep 2015 05:49:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=1apOmVzSRgtd+CFR0tvIkTMQpZl/ebPibP4rnOGsjho=; b=Kk9HkPcGmiKCsLhwXcl2Z8resGMgkG0usHtUJje+08JaV7nz303N58n1rlwaeYpiHH 9mApbP5cFxOoASSv//j49jijNfMVDleEMvBkufo8344BL9ymotBv3K+W3wQNQjykkjFn N641qpJKsS8Ao8T5LPg/lpsJnbry+cbUjWDsovM1qC3VrDiYPLXn/Te8UWUXOOjzfz+c xCjt9n+WvZJY3GG/Ay8wzgoOt+74G6YXM5A9XFIcdsS46XGxIythjF4kJeRPoeJEuPZW EeCbY3XcWjrrZO5oCiMD37Gsl6ChE6sAoFMniwKhlROHvvDLZnmfiIm86yUxIUsPxCx+ +0Rg== X-Gm-Message-State: ALoCoQn0AS/l8NQ+dYshbsZ0AWYB9DE4IKOHOOjgxQO512r6EOEooewFWuP+3zwa5KYR2ntCRjVC X-Received: by 10.112.125.104 with SMTP id mp8mr77231lbb.20.1442148541171; Sun, 13 Sep 2015 05:49:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.202 with SMTP id p10ls524544lae.95.gmail; Sun, 13 Sep 2015 05:49:00 -0700 (PDT) X-Received: by 10.112.160.98 with SMTP id xj2mr8604546lbb.124.1442148540842; Sun, 13 Sep 2015 05:49:00 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id ua1si6447276lbb.29.2015.09.13.05.49.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Sep 2015 05:49:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbpo4 with SMTP id o4so56289391lbp.2 for ; Sun, 13 Sep 2015 05:49:00 -0700 (PDT) X-Received: by 10.112.166.106 with SMTP id zf10mr8444529lbb.36.1442148540417; Sun, 13 Sep 2015 05:49:00 -0700 (PDT) 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.59.35 with SMTP id w3csp702173lbq; Sun, 13 Sep 2015 05:48:59 -0700 (PDT) X-Received: by 10.50.178.145 with SMTP id cy17mr10801305igc.92.1442148539527; Sun, 13 Sep 2015 05:48:59 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k191si6066166iok.29.2015.09.13.05.48.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 13 Sep 2015 05:48:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:35759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6iI-0002xB-9i for patch@linaro.org; Sun, 13 Sep 2015 08:48:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6dk-0003w2-JR for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zb6dj-0000BW-Gp for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53445) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6dj-0000Aw-9t for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:15 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 040E58A171 for ; Sun, 13 Sep 2015 12:44:15 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8DChnP0024712; Sun, 13 Sep 2015 08:44:12 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org Date: Sun, 13 Sep 2015 14:43:42 +0200 Message-Id: <1442148227-17343-9-git-send-email-lersek@redhat.com> In-Reply-To: <1442148227-17343-1-git-send-email-lersek@redhat.com> References: <55F5647C.6030901@redhat.com> <1442148227-17343-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gal Hammer , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov Subject: [Qemu-devel] [PATCH FYI 08/13] hw/i386: build UEFI ACPI Data Table for VMGENID in the dedicated blob (WIP) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lersek@redhat.com 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.179 as permitted sender) smtp.mailfrom=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 Using the tools - acpi_add_table2(), - build_header2() and the blob - ACPI_BUILD_QEMUPARAM_FILE that have been added in the previous patches, we can now implement the UEFI ACPI Data Table (and the related linker/loader commands) that are specified in "docs/vmgenid.txt". At this point the UEFI ACPI Data Table becomes visible to the guest, but it is never used, because we don't reference it yet from the AML in the SSDT. Cc: Paolo Bonzini Cc: Gal Hammer Cc: Igor Mammedov Cc: "Michael S. Tsirkin" Signed-off-by: Laszlo Ersek --- hw/i386/acpi-build.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 045015e..a742f25 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -41,6 +41,7 @@ #include "hw/acpi/memory_hotplug.h" #include "sysemu/tpm.h" #include "hw/acpi/tpm.h" +#include "hw/acpi/vmgenid.h" #include "sysemu/tpm_backend.h" /* Supported chipsets: */ @@ -1658,6 +1659,69 @@ static bool acpi_has_iommu(void) return intel_iommu && !ambiguous; } +static void +build_qemuparam(GArray *qemuparam_blob, GArray *linker) +{ + AcpiQemuParamTable *param_table; + static const uint8_t ident[ACPI_UEFI_IDENT_SIZE] = QEMU_PARAM_TABLE_GUID; + + /* + * The generation ID field -- which lives outside of AcpiQemuParamTable -- + * must fit in the 4KB blob. + */ + QEMU_BUILD_BUG_ON(VM_GENERATION_ID_OFFSET + VM_GENERATION_ID_SIZE > 4096); + + param_table = acpi_data_push(qemuparam_blob, 4096); + + /* set up the UEFI ACPI Data Table Sub-Header */ + memcpy(param_table->identifier, ident, ACPI_UEFI_IDENT_SIZE); + param_table->data_offset = + cpu_to_le16(offsetof(AcpiQemuParamTable, data_offset) + + sizeof param_table->data_offset); + + /* set up the QEMU parameters */ + param_table->vmgenid_addr_base_ptr = cpu_to_le64(sizeof *param_table); + + /* Prepare linker/loader commands. We handle the allocation of the blob and + * the relocation of the "ADDR base pointer" field here. The linking into + * the RSDT has already been queued by acpi_add_table2(), whereas + * @param_table will be checksummed by build_header2() internally. + */ + bios_linker_loader_alloc(linker, + ACPI_BUILD_QEMUPARAM_FILE, + 4096, /* alloc_align */ + false /* ie. it can be in high memory */); + + bios_linker_loader_add_pointer(linker, + /* name of blob containing pointer */ + ACPI_BUILD_QEMUPARAM_FILE, + /* name of blob being pointed to */ + ACPI_BUILD_QEMUPARAM_FILE, + /* blob containing pointer */ + qemuparam_blob, + /* address of pointer */ + ¶m_table->vmgenid_addr_base_ptr, + /* size of pointer */ + sizeof param_table->vmgenid_addr_base_ptr); + + build_header2(/* @linker receives the ADD_CHECKSUM command */ + linker, + /* the blob in which the ACPI table is embedded */ + qemuparam_blob, + /* fw_cfg name of the same */ + ACPI_BUILD_QEMUPARAM_FILE, + /* SDT header of ACPI table, residing in the blob */ + (AcpiTableHeader *)param_table, + /* ACPI Signature */ + "UEFI", + /* ACPI OEM Table ID */ + "QEMUPARM", + /* size of ACPI table */ + sizeof *param_table, + /* ACPI table revision */ + 1); +} + static void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) { @@ -1741,6 +1805,11 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) acpi_add_table(table_offsets, tables_blob); build_dmar_q35(tables_blob, tables->linker); } + if (true /* lersek: misc.vmgenid_iobase */) { + acpi_add_table2(table_offsets, tables->qemuparam_blob, + ACPI_BUILD_QEMUPARAM_FILE); + build_qemuparam(tables->qemuparam_blob, tables->linker); + } /* Add tables supplied by user (if any) */ for (u = acpi_table_first(); u; u = acpi_table_next(u)) {