From patchwork Fri Jun 2 16:03:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 9762945 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A946E60365 for ; Fri, 2 Jun 2017 16:11:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B3EE28584 for ; Fri, 2 Jun 2017 16:11:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E92D2858A; Fri, 2 Jun 2017 16:11:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7AE1728581 for ; Fri, 2 Jun 2017 16:11:13 +0000 (UTC) Received: from localhost ([::1]:50574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpAO-00076W-B3 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 02 Jun 2017 12:11:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp3C-0001FS-CS for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:03:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp3B-0002Ta-6Y for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:03:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58472) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dGp3A-0002TD-UM for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:03:45 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA3E37F6A1; Fri, 2 Jun 2017 16:03:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BA3E37F6A1 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BA3E37F6A1 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-83.phx2.redhat.com [10.3.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5C537A407; Fri, 2 Jun 2017 16:03:38 +0000 (UTC) From: Laszlo Ersek To: SeaBIOS@seabios.org, qemu-devel@nongnu.org, edk2-devel@lists.01.org Date: Fri, 2 Jun 2017 18:03:30 +0200 Message-Id: <20170602160332.1939-2-lersek@redhat.com> In-Reply-To: <20170602160332.1939-1-lersek@redhat.com> References: <20170602160332.1939-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 02 Jun 2017 16:03:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [edk2 PATCH 1/3] OvmfPkg/AcpiPlatformDxe: rename BLOB.HostsOnlyTableData to BLOB.Releasable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Warren , Ard Biesheuvel , Jordan Justen , "Michael S. Tsirkin" , Leif Lindholm , Dongjiu Geng , Shannon Zhao , Igor Mammedov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The "BLOB.HostsOnlyTableData" field tracks whether the allocated & downloaded fw_cfg blob should be released in the end. The current name "HostsOnlyTableData" reflects only the original determinant for this, namely whether the blob hosts ACPI table data only -- because in that case EFI_ACPI_TABLE_PROTOCOL.InstallAcpiTable() would create deep copies of all referenced parts of the blob. However, in commit 9965cbd424f2 ("OvmfPkg/AcpiPlatformDxe: implement the QEMU_LOADER_WRITE_POINTER command", 2017-02-08) we flipped the field to FALSE in ProcessCmdWritePointer() too, because the blob must also not be released if we send its allocation address back to QEMU. Therefore we should more generally call the field "Releasable". Cc: "Michael S. Tsirkin" Cc: Ard Biesheuvel Cc: Ben Warren Cc: Dongjiu Geng Cc: Igor Mammedov Cc: Jordan Justen Cc: Leif Lindholm Cc: Shannon Zhao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c index 1bc5fe297a96..4a7b051288bc 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -34,13 +34,12 @@ typedef struct { UINT8 File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated name of the fw_cfg // blob. This is the ordering / search // key. UINTN Size; // The number of bytes in this blob. UINT8 *Base; // Pointer to the blob data. - BOOLEAN HostsOnlyTableData; // TRUE iff the blob has been found to - // only contain data that is directly - // part of ACPI tables. + BOOLEAN Releasable; // TRUE iff the blob should be released + // at the end of processing. } BLOB; /** Compare a standalone key against a user structure containing an embedded key. @@ -206,11 +205,11 @@ ProcessCmdAllocate ( goto FreePages; } CopyMem (Blob->File, Allocate->File, QEMU_LOADER_FNAME_SIZE); Blob->Size = FwCfgSize; Blob->Base = (VOID *)(UINTN)Address; - Blob->HostsOnlyTableData = TRUE; + Blob->Releasable = TRUE; Status = OrderedCollectionInsert (Tracker, NULL, Blob); if (Status == RETURN_ALREADY_STARTED) { DEBUG ((EFI_D_ERROR, "%a: duplicated file \"%a\"\n", __FUNCTION__, Allocate->File)); @@ -505,11 +504,11 @@ ProcessCmdWritePointer ( // // Because QEMU has now learned PointeeBlob->Base, we must mark PointeeBlob // as unreleasable, for the case when the whole linker/loader script is // handled successfully. // - PointeeBlob->HostsOnlyTableData = FALSE; + PointeeBlob->Releasable = FALSE; DEBUG ((DEBUG_VERBOSE, "%a: PointerFile=\"%a\" PointeeFile=\"%a\" " "PointerOffset=0x%x PointeeOffset=0x%x PointerSize=%d\n", __FUNCTION__, WritePointer->PointerFile, WritePointer->PointeeFile, WritePointer->PointerOffset, WritePointer->PointeeOffset, @@ -612,12 +611,13 @@ UndoCmdWritePointer ( before, or an ACPI table different from RSDT and XSDT has been installed (reflected by InstalledKey and NumInstalled), or RSDT or XSDT has been identified but not installed, or the fw_cfg blob pointed-into by AddPointer has - been marked as hosting something else than - just direct ACPI table contents. + been marked as non-releasable due to hosting + something else than just direct ACPI table + contents. @return Error codes returned by AcpiProtocol->InstallAcpiTable(). **/ STATIC @@ -740,11 +740,11 @@ Process2ndPassCmdAddPointer ( } } if (TableSize == 0) { DEBUG ((EFI_D_VERBOSE, "not found; marking fw_cfg blob as opaque\n")); - Blob2->HostsOnlyTableData = FALSE; + Blob2->Releasable = FALSE; return EFI_SUCCESS; } if (*NumInstalled == INSTALLED_TABLES_MAX) { DEBUG ((EFI_D_ERROR, "%a: can't install more than %d tables\n", @@ -982,23 +982,23 @@ RollbackWritePointersAndFreeTracker: } } // // Tear down the tracker infrastructure. Each fw_cfg blob will be left in - // place only if we're exiting with success and the blob hosts data that is - // not directly part of some ACPI table. + // place only if we're exiting with success and the blob has been marked + // non-releasable. // for (TrackerEntry = OrderedCollectionMin (Tracker); TrackerEntry != NULL; TrackerEntry = TrackerEntry2) { VOID *UserStruct; BLOB *Blob; TrackerEntry2 = OrderedCollectionNext (TrackerEntry); OrderedCollectionDelete (Tracker, TrackerEntry, &UserStruct); Blob = UserStruct; - if (EFI_ERROR (Status) || Blob->HostsOnlyTableData) { + if (EFI_ERROR (Status) || Blob->Releasable) { DEBUG ((EFI_D_VERBOSE, "%a: freeing \"%a\"\n", __FUNCTION__, Blob->File)); gBS->FreePages ((UINTN)Blob->Base, EFI_SIZE_TO_PAGES (Blob->Size)); } FreePool (Blob);