From nobody Fri Mar 29 06:13:06 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1496419444382311.7178610037188; Fri, 2 Jun 2017 09:04:04 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dGp2j-0007jV-OG; Fri, 02 Jun 2017 18:03:17 +0200 Received: from mx1.redhat.com ([209.132.183.28]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dGp2a-0007gy-7B for SeaBIOS@seabios.org; Fri, 02 Jun 2017 18:03:15 +0200 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) 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) 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 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-Spam-Score: -4.5 (----) Subject: [SeaBIOS] [edk2 PATCH 1/3] OvmfPkg/AcpiPlatformDxe: rename BLOB.HostsOnlyTableData to BLOB.Releasable X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , Jordan Justen , "Michael S. Tsirkin" , Leif Lindholm , Dongjiu Geng , Shannon Zhao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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/AcpiPlatform= Dxe/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_c= fg // blob. This is the ordering / se= arch // key. UINTN Size; // The number of bytes in this blo= b. UINT8 *Base; // Pointer to the blob data. - BOOLEAN HostsOnlyTableData; // TRUE iff the blob has been foun= d to - // only contain data that is direc= tly - // part of ACPI tables. + BOOLEAN Releasable; // TRUE iff the blob should be rel= eased + // at the end of processing. } BLOB; =20 =20 /** 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 =3D FwCfgSize; Blob->Base =3D (VOID *)(UINTN)Address; - Blob->HostsOnlyTableData =3D TRUE; + Blob->Releasable =3D TRUE; =20 Status =3D OrderedCollectionInsert (Tracker, NULL, Blob); if (Status =3D=3D 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 PointeeB= lob // as unreleasable, for the case when the whole linker/loader script is // handled successfully. // - PointeeBlob->HostsOnlyTableData =3D FALSE; + PointeeBlob->Releasable =3D FALSE; =20 DEBUG ((DEBUG_VERBOSE, "%a: PointerFile=3D\"%a\" PointeeFile=3D\"%a\" " "PointerOffset=3D0x%x PointeeOffset=3D0x%x PointerSize=3D%d\n", __FUNC= TION__, WritePointer->PointerFile, WritePointer->PointeeFile, WritePointer->PointerOffset, WritePointer->PointeeOffset, @@ -612,12 +611,13 @@ UndoCmdWritePointer ( before, or an ACPI table different from R= SDT and XSDT has been installed (reflected by InstalledKey and NumInstalled), or RSDT or XSDT has been identified but not installe= d, or the fw_cfg blob pointed-into by AddPointe= r has - been marked as hosting something else than - just direct ACPI table contents. + been marked as non-releasable due to host= ing + something else than just direct ACPI table + contents. =20 @return Error codes returned by AcpiProtocol->InstallAcpiTable(). **/ STATIC @@ -740,11 +740,11 @@ Process2ndPassCmdAddPointer ( } } =20 if (TableSize =3D=3D 0) { DEBUG ((EFI_D_VERBOSE, "not found; marking fw_cfg blob as opaque\n")); - Blob2->HostsOnlyTableData =3D FALSE; + Blob2->Releasable =3D FALSE; return EFI_SUCCESS; } =20 if (*NumInstalled =3D=3D INSTALLED_TABLES_MAX) { DEBUG ((EFI_D_ERROR, "%a: can't install more than %d tables\n", @@ -982,23 +982,23 @@ RollbackWritePointersAndFreeTracker: } } =20 // // 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 =3D OrderedCollectionMin (Tracker); TrackerEntry !=3D = NULL; TrackerEntry =3D TrackerEntry2) { VOID *UserStruct; BLOB *Blob; =20 TrackerEntry2 =3D OrderedCollectionNext (TrackerEntry); OrderedCollectionDelete (Tracker, TrackerEntry, &UserStruct); Blob =3D UserStruct; =20 - 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); --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Fri Mar 29 06:13:06 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1496419449340348.19616379226727; Fri, 2 Jun 2017 09:04:09 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dGp2o-0007lM-AM; Fri, 02 Jun 2017 18:03:22 +0200 Received: from mx1.redhat.com ([209.132.183.28]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dGp2f-0007hp-CY for SeaBIOS@seabios.org; Fri, 02 Jun 2017 18:03:20 +0200 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 E85DAC04B93E; Fri, 2 Jun 2017 16:03:48 +0000 (UTC) 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 1A2997A407; Fri, 2 Jun 2017 16:03:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E85DAC04B93E Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E85DAC04B93E From: Laszlo Ersek To: SeaBIOS@seabios.org, qemu-devel@nongnu.org, edk2-devel@lists.01.org Date: Fri, 2 Jun 2017 18:03:31 +0200 Message-Id: <20170602160332.1939-3-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.31]); Fri, 02 Jun 2017 16:03:49 +0000 (UTC) X-Spam-Score: -4.5 (----) Subject: [SeaBIOS] [edk2 PATCH 2/3] OvmfPkg/AcpiPlatformDxe: support NOACPI content hint in ALLOCATE command X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , Jordan Justen , "Michael S. Tsirkin" , Leif Lindholm , Dongjiu Geng , Shannon Zhao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This driver currently relies on a 2nd pass processing of the ADD_POINTER commands to identify potential ACPI tables in the pointed-to blobs. In order to tell apart ACPI tables from other operation region-like areas within pointed-to blobs, we employ a heuristic called "ACPI SDT header probe" at the target locations of the ADD_POINTER commands. While all ACPI tables generated by QEMU satisfy this check (i.e., there are no false negatives), blob content that is *not* an ACPI table has a very slight chance to pass the test as well (i.e., there is a small chance for false positives). In order to suppress this small chance, in QEMU we've historically formatted opregion-like areas in blobs with a fixed size zero prefix (see e.g. "docs/specs/vmgenid.txt"), which guarantees that the probe in OvmfPkg/AcpiPlatformDxe will fail. However, this "suppressor prefix" has had to be taken into account explicitly in generated AML code -- the prefix size has had to be added to the patched integer object in AML, at runtime --, leading to awkwardness. QEMU is introducing a new hint for the ALLOCATE command, as the most significant bit of the UINT8 "Zone" field, for disabling the ACPI SDT header probe in OvmfPkg/AcpiPlatformDxe, for all the pointers that point into the blob downloaded with the ALLOCATE command. When the bit is set, the blob is guaranteed to contain no ACPI tables. When the bit is clear, the behavior is left unchanged. In ProcessCmdAllocate(), save the hint for later. In Process2ndPassCmdAddPointer(), consult the saved hint. If QEMU reported the blob as containing no ACPI table data, then omit the ACPI SDT header probing and mark the pointed-to blob as unreleasable. 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/QemuLoader.h | 9 +++++- OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 29 +++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h b/OvmfPkg/AcpiPlatformDxe= /QemuLoader.h index 437776d86d9a..fa558540e62b 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h +++ b/OvmfPkg/AcpiPlatformDxe/QemuLoader.h @@ -34,19 +34,26 @@ typedef enum { typedef enum { QemuLoaderAllocHigh =3D 1, QemuLoaderAllocFSeg } QEMU_LOADER_ALLOC_ZONE; =20 +typedef enum { + QemuLoaderAllocContentMixed =3D 0x00, + QemuLoaderAllocContentNoAcpi =3D 0x80, +} QEMU_LOADER_ALLOC_CONTENT; + #pragma pack (1) // // QemuLoaderCmdAllocate: download the fw_cfg file named File, to a buffer // allocated in the zone specified by Zone, aligned at a multiple of Align= ment. // typedef struct { UINT8 File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated UINT32 Alignment; // power of two - UINT8 Zone; // QEMU_LOADER_ALLOC_ZONE values + UINT8 Zone; // One QEMU_LOADER_ALLOC_ZONE value + // OR-ed together with one + // QEMU_LOADER_ALLOC_CONTENT value } QEMU_LOADER_ALLOCATE; =20 // // QemuLoaderCmdAddPointer: the bytes at // [PointerOffset..PointerOffset+PointerSize) in the file PointerFile cont= ain a diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatform= Dxe/QemuFwCfgAcpi.c index 4a7b051288bc..23d543ffe361 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -36,10 +36,12 @@ typedef struct { // key. UINTN Size; // The number of bytes in this blo= b. UINT8 *Base; // Pointer to the blob data. BOOLEAN Releasable; // TRUE iff the blob should be rel= eased // at the end of processing. + BOOLEAN AcpiTablesExcluded; // TRUE iff QEMU guarantees that t= he + // blob contains no ACPI tables } BLOB; =20 =20 /** Compare a standalone key against a user structure containing an embedded= key. @@ -167,10 +169,12 @@ ProcessCmdAllocate ( ) { FIRMWARE_CONFIG_ITEM FwCfgItem; UINTN FwCfgSize; EFI_STATUS Status; + UINT32 Zone; + BOOLEAN AcpiTablesExcluded; UINTN NumPages; EFI_PHYSICAL_ADDRESS Address; BLOB *Blob; =20 if (Allocate->File[QEMU_LOADER_FNAME_SIZE - 1] !=3D '\0') { @@ -189,10 +193,18 @@ ProcessCmdAllocate ( DEBUG ((EFI_D_ERROR, "%a: QemuFwCfgFindFile(\"%a\"): %r\n", __FUNCTION= __, Allocate->File, Status)); return Status; } =20 + Zone =3D Allocate->Zone; + if ((Zone & QemuLoaderAllocContentNoAcpi) !=3D 0) { + Zone &=3D ~(UINT32)QemuLoaderAllocContentNoAcpi; + AcpiTablesExcluded =3D TRUE; + } else { + AcpiTablesExcluded =3D FALSE; + } + NumPages =3D EFI_SIZE_TO_PAGES (FwCfgSize); Address =3D 0xFFFFFFFF; Status =3D gBS->AllocatePages (AllocateMaxAddress, EfiACPIMemoryNVS, Num= Pages, &Address); if (EFI_ERROR (Status)) { @@ -206,10 +218,11 @@ ProcessCmdAllocate ( } CopyMem (Blob->File, Allocate->File, QEMU_LOADER_FNAME_SIZE); Blob->Size =3D FwCfgSize; Blob->Base =3D (VOID *)(UINTN)Address; Blob->Releasable =3D TRUE; + Blob->AcpiTablesExcluded =3D AcpiTablesExcluded; =20 Status =3D OrderedCollectionInsert (Tracker, NULL, Blob); if (Status =3D=3D RETURN_ALREADY_STARTED) { DEBUG ((EFI_D_ERROR, "%a: duplicated file \"%a\"\n", __FUNCTION__, Allocate->File)); @@ -595,11 +608,13 @@ UndoCmdWritePointer ( target address is encountered for the first time, and it identifies an ACPI table that = is different from RDST and XSDT, the table is installed. If a target address is seen for = the second or later times, it is skipped without - taking any action. + taking any action. Target addresses that fa= ll + into fw_cfg blobs that QEMU reported in adv= ance + as holding no ACPI content are not even tra= cked. =20 @retval EFI_INVALID_PARAMETER NumInstalled was outside the allowed rang= e on input. =20 @retval EFI_OUT_OF_RESOURCES The AddPointer command identified an ACPI @@ -651,10 +666,22 @@ Process2ndPassCmdAddPointer ( =20 TrackerEntry =3D OrderedCollectionFind (Tracker, AddPointer->PointerFile= ); TrackerEntry2 =3D OrderedCollectionFind (Tracker, AddPointer->PointeeFil= e); Blob =3D OrderedCollectionUserStruct (TrackerEntry); Blob2 =3D OrderedCollectionUserStruct (TrackerEntry2); + + if (Blob2->AcpiTablesExcluded) { + DEBUG (( + DEBUG_VERBOSE, + "%a: marking blob \"%a\" with no ACPI content as unreleasable\n", + __FUNCTION__, + AddPointer->PointeeFile + )); + Blob2->Releasable =3D FALSE; + return EFI_SUCCESS; + } + PointerField =3D Blob->Base + AddPointer->PointerOffset; PointerValue =3D 0; CopyMem (&PointerValue, PointerField, AddPointer->PointerSize); =20 // --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Fri Mar 29 06:13:06 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1496419442035517.7301336797154; Fri, 2 Jun 2017 09:04:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AA33621C8D621; Fri, 2 Jun 2017 09:02:54 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 092F221C93EE4 for ; Fri, 2 Jun 2017 09:02:53 -0700 (PDT) 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 0832C3D959; Fri, 2 Jun 2017 16:03:55 +0000 (UTC) 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 474937A407; Fri, 2 Jun 2017 16:03:49 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0832C3D959 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0832C3D959 From: Laszlo Ersek To: SeaBIOS@seabios.org, qemu-devel@nongnu.org, edk2-devel@lists.01.org Date: Fri, 2 Jun 2017 18:03:32 +0200 Message-Id: <20170602160332.1939-4-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.30]); Fri, 02 Jun 2017 16:03:55 +0000 (UTC) Subject: [edk2] [edk2 PATCH 3/3] OvmfPkg/AcpiPlatformDxe: support 64-bit zone in ALLOCATE command X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Warren , Ard Biesheuvel , Jordan Justen , "Michael S. Tsirkin" , Leif Lindholm , Dongjiu Geng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The QemuLoaderAlloc64Bit (3) Zone value permits the guest firmware to allocate the blob being downloaded anywhere in the 64-bit address space. Set the maximum Address value in ProcessCmdAllocate() accordingly. 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/QemuLoader.h | 3 ++- OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h b/OvmfPkg/AcpiPlatformDxe= /QemuLoader.h index fa558540e62b..1daa918ff9b7 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h +++ b/OvmfPkg/AcpiPlatformDxe/QemuLoader.h @@ -31,11 +31,12 @@ typedef enum { QemuLoaderCmdWritePointer, } QEMU_LOADER_COMMAND_TYPE; =20 typedef enum { QemuLoaderAllocHigh =3D 1, - QemuLoaderAllocFSeg + QemuLoaderAllocFSeg, + QemuLoaderAlloc64Bit, } QEMU_LOADER_ALLOC_ZONE; =20 typedef enum { QemuLoaderAllocContentMixed =3D 0x00, QemuLoaderAllocContentNoAcpi =3D 0x80, diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatform= Dxe/QemuFwCfgAcpi.c index 23d543ffe361..0b0b3f590f2b 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -202,11 +202,11 @@ ProcessCmdAllocate ( } else { AcpiTablesExcluded =3D FALSE; } =20 NumPages =3D EFI_SIZE_TO_PAGES (FwCfgSize); - Address =3D 0xFFFFFFFF; + Address =3D (Zone =3D=3D QemuLoaderAlloc64Bit) ? MAX_UINT64 : MAX_UINT32; Status =3D gBS->AllocatePages (AllocateMaxAddress, EfiACPIMemoryNVS, Num= Pages, &Address); if (EFI_ERROR (Status)) { return Status; } --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel