From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id B66337803D0 for ; Wed, 14 Feb 2024 10:36:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Cvk3CJbx7aFNELAApgc8Qt127posEvGvEMcBUPxS2XM=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1707907018; v=1; b=ArhMmlGPnY8hCBLUEDsvZWvQVOzIqFPnKzuR+u5xLBKUL4re3TF5SLocn9TBA91pBpwwe4Xh Yu4a4VUKj0p9ILFIFCIrTfcjbFjFmCwTk/L/zrcv4IkvD0YdT6+x0UNU9DGUAau0pz/pdpp09Hm +FogYklGcCXWPqBH6TMsFxgo= X-Received: by 127.0.0.2 with SMTP id vip4YY7687511xneNlxKcBuw; Wed, 14 Feb 2024 02:36:58 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.38545.1707907017678537183 for ; Wed, 14 Feb 2024 02:36:57 -0800 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-60uNVNzMOuOLvWEXNBhsBQ-1; Wed, 14 Feb 2024 05:36:53 -0500 X-MC-Unique: 60uNVNzMOuOLvWEXNBhsBQ-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D90DD381258F; Wed, 14 Feb 2024 10:36:52 +0000 (UTC) X-Received: from [10.39.195.45] (unknown [10.39.195.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 193481121313; Wed, 14 Feb 2024 10:36:50 +0000 (UTC) Message-ID: <15446f23-6014-74b5-abdf-cbebda366f1a@redhat.com> Date: Wed, 14 Feb 2024 11:36:49 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH] ArmVirtPkg/XenAcpiPlatformDxe: Install FACS table from DT To: devel@edk2.groups.io, dwmw2@infradead.org Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Gerd Hoffmann References: <881dd0a2558ecbdfa02c844722d8a1103ab97ab3.camel@infradead.org> From: "Laszlo Ersek" In-Reply-To: <881dd0a2558ecbdfa02c844722d8a1103ab97ab3.camel@infradead.org> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Mh2xb4mDzkFz0QEA0UOaz9TYx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ArhMmlGP; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 2/13/24 11:50, David Woodhouse wrote: > From: David Woodhouse >=20 > The FACS may still exist when the reduced hardware flag is set in FADT; > it is optional. Since it contains the hardware signature field which > indicates that a hibernated system should boot cleanly instead of > attempting to resume, a platform may choose to expose it. Propagate it > correctly. >=20 > Also avoid a NULL pointer dereference if the platform doesn't provide > a DSDT. >=20 > Signed-off-by: David Woodhouse > --- > .../XenAcpiPlatformDxe/XenAcpiPlatformDxe.c | 37 +++++++++++++++---- > 1 file changed, 29 insertions(+), 8 deletions(-) >=20 > diff --git a/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c b/ArmVirt= Pkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c > index 32c8b1e94ed2..3e6e5cb367d4 100644 > --- a/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c > +++ b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c > @@ -128,10 +128,12 @@ InstallXenArmTables ( > EFI_ACPI_DESCRIPTION_HEADER *Xsdt; > EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtTable; > EFI_ACPI_DESCRIPTION_HEADER *DsdtTable; > + EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsTable; > =20 > XenAcpiRsdpStructurePtr =3D NULL; > FadtTable =3D NULL; > DsdtTable =3D NULL; > + FacsTable =3D NULL; > TableHandle =3D 0; > NumberOfTableEntries =3D 0; > =20 > @@ -191,6 +193,8 @@ InstallXenArmTables ( > FadtTable =3D (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) > (UINTN)CurrentTablePointer; > DsdtTable =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)FadtTable->D= sdt; > + FacsTable =3D (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) > + (UINTN) FadtTable->FirmwareCtrl; > } > } > } > @@ -198,14 +202,31 @@ InstallXenArmTables ( > // > // Install DSDT table. > // > - Status =3D AcpiProtocol->InstallAcpiTable ( > - AcpiProtocol, > - DsdtTable, > - DsdtTable->Length, > - &TableHandle > - ); > - if (EFI_ERROR (Status)) { > - return Status; > + if (DsdtTable !=3D NULL) { > + Status =3D AcpiProtocol->InstallAcpiTable ( > + AcpiProtocol, > + DsdtTable, > + DsdtTable->Length, > + &TableHandle > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + } > + > + // > + // Install FACS table. > + // > + if (FacsTable !=3D NULL) { > + Status =3D AcpiProtocol->InstallAcpiTable ( > + AcpiProtocol, > + FacsTable, > + FacsTable->Length, > + &TableHandle > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > } > =20 > return EFI_SUCCESS; I'm not a fan of InstallXenArmTables() not rolling back tables upon a failure, but that wart predates this patch. Reviewed-by: Laszlo Ersek Can you please ping, after the edk2-stable202402 release, so we merge this? Or -- given the NULL ptr deref fix in particular -- does this qualify for merging during the hard feature freeze? Laszlo -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115436): https://edk2.groups.io/g/devel/message/115436 Mute This Topic: https://groups.io/mt/104329932/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-