From nobody Sun Apr 28 11:37:28 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 149641935796392.38463143883598; Fri, 2 Jun 2017 09:02:37 -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 1dGp1O-0007Op-D4; Fri, 02 Jun 2017 18:01:54 +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 1dGp1F-0007M7-1X for SeaBIOS@seabios.org; Fri, 02 Jun 2017 18:01:52 +0200 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7514C81138; Fri, 2 Jun 2017 16:02:20 +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 A7AF183EB7; Fri, 2 Jun 2017 16:02:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7514C81138 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7514C81138 From: Laszlo Ersek To: SeaBIOS@seabios.org, qemu-devel@nongnu.org, edk2-devel@lists.01.org Date: Fri, 2 Jun 2017 18:02:09 +0200 Message-Id: <20170602160210.1868-2-lersek@redhat.com> In-Reply-To: <20170602160210.1868-1-lersek@redhat.com> References: <20170602160210.1868-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 02 Jun 2017 16:02:20 +0000 (UTC) X-Spam-Score: -4.5 (----) Subject: [SeaBIOS] [seabios PATCH 1/2] romfile_loader: alloc: cope with the UEFI-oriented NOACPI content hint 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: Xiao Guangrong , Ard Biesheuvel , "Michael S. Tsirkin" , 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" OvmfPkg/AcpiPlatformDxe, which implements the client for QEMU's linker/loader in the OVMF and ArmVirtQemu virtual UEFI firmwares, currently relies on a 2nd pass processing of the ADD_POINTER commands, to identify potential ACPI tables in the pointed-to blobs. The reason for this is that ACPI tables must be individually passed to EFI_ACPI_TABLE_PROTOCOL.InstallAcpiTable() for installation. In order to tell apart ACPI tables from other operation region-like areas within pointed-to blobs, OvmfPkg/AcpiPlatformDxe employs 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 ALLOC command, as the most significant bit of the uint8_t "zone" field, for disabling the ACPI SDT header probe in OvmfPkg/AcpiPlatformDxe, for all the pointers that point into the blob downloaded with the ALLOC 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. For SeaBIOS, this bit is irrelevant, thus mask it out. Cc: "Kevin O'Connor" Cc: "Michael S. Tsirkin" Cc: Ard Biesheuvel Cc: Ben Warren Cc: Dongjiu Geng Cc: Igor Mammedov Cc: Shannon Zhao Cc: Stefan Berger Cc: Xiao Guangrong Signed-off-by: Laszlo Ersek --- src/fw/romfile_loader.h | 7 +++++++ src/fw/romfile_loader.c | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/fw/romfile_loader.h b/src/fw/romfile_loader.h index fcd4ab236b61..d90c3db24331 100644 --- a/src/fw/romfile_loader.h +++ b/src/fw/romfile_loader.h @@ -12,10 +12,12 @@ struct romfile_loader_entry_s { union { /* * COMMAND_ALLOCATE - allocate a table from @alloc.file * subject to @alloc.align alignment (must be power of 2) * and @alloc.zone (can be HIGH or FSEG) requirements. + * The most significant bit (bit 7) of @alloc.zone is used as a co= ntent + * hint for UEFI guest firmware, see ROMFILE_LOADER_ALLOC_CONTENT_= *. * * Must appear exactly once for each file, and before * this file is referenced by any other command. */ struct { @@ -82,10 +84,15 @@ enum { enum { ROMFILE_LOADER_ALLOC_ZONE_HIGH =3D 0x1, ROMFILE_LOADER_ALLOC_ZONE_FSEG =3D 0x2, }; =20 +enum { + ROMFILE_LOADER_ALLOC_CONTENT_MIXED =3D 0x00, + ROMFILE_LOADER_ALLOC_CONTENT_NOACPI =3D 0x80, +}; + int romfile_loader_execute(const char *name); =20 void romfile_fw_cfg_resume(void); =20 #endif diff --git a/src/fw/romfile_loader.c b/src/fw/romfile_loader.c index 18476e2075e3..6a457902a36a 100644 --- a/src/fw/romfile_loader.c +++ b/src/fw/romfile_loader.c @@ -55,19 +55,22 @@ void romfile_fw_cfg_resume(void) =20 static void romfile_loader_allocate(struct romfile_loader_entry_s *entry, struct romfile_loader_files *files) { struct zone_s *zone; + unsigned zone_req; struct romfile_loader_file *file =3D &files->files[files->nfiles]; void *data; int ret; unsigned alloc_align =3D le32_to_cpu(entry->alloc.align); =20 if (alloc_align & (alloc_align - 1)) goto err; =20 - switch (entry->alloc.zone) { + zone_req =3D entry->alloc.zone; + zone_req &=3D ~(unsigned)ROMFILE_LOADER_ALLOC_CONTENT_NOACPI; + switch (zone_req) { case ROMFILE_LOADER_ALLOC_ZONE_HIGH: zone =3D &ZoneHigh; break; case ROMFILE_LOADER_ALLOC_ZONE_FSEG: zone =3D &ZoneFSeg; --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Sun Apr 28 11:37:28 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 1496419347926192.02386866861036; Fri, 2 Jun 2017 09:02:27 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A5CC021C8D61C; Fri, 2 Jun 2017 09:01:22 -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 6B86721C93EE4 for ; Fri, 2 Jun 2017 09:01:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 79E8174842; Fri, 2 Jun 2017 16:02:23 +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 C97C08443C; Fri, 2 Jun 2017 16:02:20 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 79E8174842 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 79E8174842 From: Laszlo Ersek To: SeaBIOS@seabios.org, qemu-devel@nongnu.org, edk2-devel@lists.01.org Date: Fri, 2 Jun 2017 18:02:10 +0200 Message-Id: <20170602160210.1868-3-lersek@redhat.com> In-Reply-To: <20170602160210.1868-1-lersek@redhat.com> References: <20170602160210.1868-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 02 Jun 2017 16:02:23 +0000 (UTC) Subject: [edk2] [seabios PATCH 2/2] romfile_loader: alloc: cope with the UEFI-oriented 64BIT zone hint 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: Xiao Guangrong , Ben Warren , Ard Biesheuvel , "Michael S. Tsirkin" , Stefan Berger , Dongjiu Geng , Kevin O'Connor 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" ROMFILE_LOADER_ALLOC_ZONE_64BIT permits the guest firmware to allocate the blob being downloaded anywhere in the 64-bit address space. In SeaBIOS, we can simply alias this zone request to ROMFILE_LOADER_ALLOC_ZONE_HIGH (i.e., allocate the blob in 32-bit address space.) Cc: "Kevin O'Connor" Cc: "Michael S. Tsirkin" Cc: Ard Biesheuvel Cc: Ben Warren Cc: Dongjiu Geng Cc: Igor Mammedov Cc: Shannon Zhao Cc: Stefan Berger Cc: Xiao Guangrong Signed-off-by: Laszlo Ersek --- src/fw/romfile_loader.h | 7 ++++--- src/fw/romfile_loader.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/fw/romfile_loader.h b/src/fw/romfile_loader.h index d90c3db24331..9828d4ad1094 100644 --- a/src/fw/romfile_loader.h +++ b/src/fw/romfile_loader.h @@ -11,11 +11,11 @@ struct romfile_loader_entry_s { u32 command; union { /* * COMMAND_ALLOCATE - allocate a table from @alloc.file * subject to @alloc.align alignment (must be power of 2) - * and @alloc.zone (can be HIGH or FSEG) requirements. + * and @alloc.zone (see ROMFILE_LOADER_ALLOC_ZONE_*) requirements. * The most significant bit (bit 7) of @alloc.zone is used as a co= ntent * hint for UEFI guest firmware, see ROMFILE_LOADER_ALLOC_CONTENT_= *. * * Must appear exactly once for each file, and before * this file is referenced by any other command. @@ -80,12 +80,13 @@ enum { ROMFILE_LOADER_COMMAND_ADD_CHECKSUM =3D 0x3, ROMFILE_LOADER_COMMAND_WRITE_POINTER =3D 0x4, }; =20 enum { - ROMFILE_LOADER_ALLOC_ZONE_HIGH =3D 0x1, - ROMFILE_LOADER_ALLOC_ZONE_FSEG =3D 0x2, + ROMFILE_LOADER_ALLOC_ZONE_HIGH =3D 0x1, + ROMFILE_LOADER_ALLOC_ZONE_FSEG =3D 0x2, + ROMFILE_LOADER_ALLOC_ZONE_64BIT =3D 0x3, }; =20 enum { ROMFILE_LOADER_ALLOC_CONTENT_MIXED =3D 0x00, ROMFILE_LOADER_ALLOC_CONTENT_NOACPI =3D 0x80, diff --git a/src/fw/romfile_loader.c b/src/fw/romfile_loader.c index 6a457902a36a..c0c476b58990 100644 --- a/src/fw/romfile_loader.c +++ b/src/fw/romfile_loader.c @@ -68,10 +68,11 @@ static void romfile_loader_allocate(struct romfile_load= er_entry_s *entry, =20 zone_req =3D entry->alloc.zone; zone_req &=3D ~(unsigned)ROMFILE_LOADER_ALLOC_CONTENT_NOACPI; switch (zone_req) { case ROMFILE_LOADER_ALLOC_ZONE_HIGH: + case ROMFILE_LOADER_ALLOC_ZONE_64BIT: zone =3D &ZoneHigh; break; case ROMFILE_LOADER_ALLOC_ZONE_FSEG: zone =3D &ZoneFSeg; break; --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel