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 8818BAC0F96 for ; Fri, 24 Nov 2023 11:06:43 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=LHyWtzLduP/YQgYmt1fKM5L95Brl7e0mJfKh+D1v5pY=; 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=1700824002; v=1; b=R5DYca/NsDMZ6/V5OQ7NkcI7Z3aXz3trbGoLKh5vWlNC5CKgRnJ3DXdIz4oLfBSaVL6RBWv4 qUVBH8Rtn1oOImYIul/XLX5awOA64FR/4sqwl1Lnn68yEiy0FiVU3XowhXTvB6uYNs04CZKo7Fr Ba6jM2FD8+xLsbEYdJ7kvj6o= X-Received: by 127.0.0.2 with SMTP id NzRKYY7687511x8KiJku73d2; Fri, 24 Nov 2023 03:06:42 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.133318.1700824001595512355 for ; Fri, 24 Nov 2023 03:06:41 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-316-nWujpWjCPm2HUjcAin9uHQ-1; Fri, 24 Nov 2023 06:06:37 -0500 X-MC-Unique: nWujpWjCPm2HUjcAin9uHQ-1 X-Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 E434E185A784; Fri, 24 Nov 2023 11:06:36 +0000 (UTC) X-Received: from [10.39.192.172] (unknown [10.39.192.172]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8E33492BE7; Fri, 24 Nov 2023 11:06:35 +0000 (UTC) Message-ID: <61293974-6b7d-d11e-94a3-0339d27d7a44@redhat.com> Date: Fri, 24 Nov 2023 12:06:34 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH 1/1] StandaloneMmPkg/Core: Restart dispatcher once MmEntryPoint is registered To: Ard Biesheuvel , devel@edk2.groups.io Cc: wei6.xu@intel.com, Ard Biesheuvel , Sami Mujawar , Ray Ni References: <7614875b-fb11-8b2c-1411-da0b5c1224b3@redhat.com> From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 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: aFXssx5bdKm5JZXpgYOVvwLBx7686176AA= 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="R5DYca/N"; 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 11/22/23 16:11, Ard Biesheuvel wrote: > On Wed, 22 Nov 2023 at 12:45, Laszlo Ersek wrote: >> > ... >> (3) Most importantly, speaking to a larger context, I don't understand >> how this patch can work *at all*. >> >> Namely, I can find no MM IPL inside edk2! >> >> The DXE and MM dispatcher are supposed to work together in the following >> way: >> >> (3.1) Whenever the DXE Core signals the PI-defined event group >> EFI_EVENT_GROUP_DXE_DISPATCH_GUID, the MM IPL takes notice. (The MM IPL >> learns that the DXE Dispatcher has completed one round of dispatching, >> and new DXE/UEFI protocols may have become available.) >> >> (3.2) The MM IPL notifies the MM Core to run one round of MM dispatch. >> This gives another chance to those MM drivers that failed to launch >> previously due to missing DXE/UEFI protocols (which they might want to >> consume in their entry points). The notification happens via an MMI / a >> particular communication buffer carrying >> EFI_EVENT_GROUP_DXE_DISPATCH_GUID in the header. >> >> (3.3) The MM Core runs said one round of dispatch, and then *informs* >> the MM IPL about the result. The result can be one of three cases: >> success, error, and "restart". >> >> (3.4) As long as the result is "restart" (for *whatever* reason), the MM >> IPL doesn't complete the notification function for >> EFI_EVENT_GROUP_DXE_DISPATCH_GUID, but jumps back to step (3.2). >> >> In practice, this is used for handling the situation described in the >> commit message -- namely, if the MM Core notices that the MM Entry Point >> was installed in the last round of MM dispatch, then it exits early back >> to the MM IPL with status "restart". The subsequent MM Dispatch run >> gives a chance to those MM drivers that needed access to Management Mode >> (or perhaps MM RAM). So in effect this is an "inner" re-iteration that >> aims at noticing the MM Entry Point, instead of new DXE/UEFI protocols. >> >=20 > The above describes traditional MM but not standalone MM. I would have > to refer to the PI spec for details, but the primary difference is > that SMM drivers have no access to the DXE protocol database or boot > services at all (hence the name 'standalone'). The standalone MM is a > separate execution context that comes into existence magically (i.e., > in a way not defined by PI/UEFI) and can be invoked only via special > traps or instructions. Notably, the SMM model where the initial > context is unified and only separated later in the boot (at EndOfDxe?) > does not apply here. This also means that dispatching FVs into > standalone MM and retaining other SMM legacy is meaningless, which is > why I removed all that code. Right, this is what I suspected. It didn't seem like your code removal was an incidental simplification; my understanding (or more like: guesswork) of "Standalone" in "StandaloneMmPkg" was that there was *no* MM "IPL" to talk back to. 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 (#111696): https://edk2.groups.io/g/devel/message/111696 Mute This Topic: https://groups.io/mt/102703852/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-