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 65294AC14C2 for ; Wed, 22 Nov 2023 15:11:55 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=NjWTrHaRLvNAlTqDBlGNItJVoeE5FQxVnY2ZX6Curyo=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1700665914; v=1; b=IIGDCQMmqDjZztBi7dpof1cO4gA5AKtnt7NxUnwMIucYHRz9Zi/VRAl1jApgAnVBrat8LJ5x 3tCaVIJxtIKl/HU+1LupZfpOgTarFxMkjugsk3gteWn41v7kcQryJQEvJE7Y0YA2LcPZLi/VPth sF/ZMAyFhT9v14LoR0dIHMEY= X-Received: by 127.0.0.2 with SMTP id Mp59YY7687511x0JDGU7BiYy; Wed, 22 Nov 2023 07:11:54 -0800 X-Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by mx.groups.io with SMTP id smtpd.web10.21950.1700665913083545161 for ; Wed, 22 Nov 2023 07:11:53 -0800 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id EDE5DCE210A for ; Wed, 22 Nov 2023 15:11:49 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 226C6C433C9 for ; Wed, 22 Nov 2023 15:11:48 +0000 (UTC) X-Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2c72e275d96so1396951fa.2 for ; Wed, 22 Nov 2023 07:11:48 -0800 (PST) X-Gm-Message-State: 0FDCoukZFx758QYqn0DvJtz1x7686176AA= X-Google-Smtp-Source: AGHT+IGrZ7MJiyyx3Y7cz+qt86KBSkOfrEBWfXxpz8IUAmlJZ4c33HbrnYqO42iZkFXJdfUGj2NERhEcqfDFKY+oWKU= X-Received: by 2002:a05:651c:227:b0:2bc:bf29:18d3 with SMTP id z7-20020a05651c022700b002bcbf2918d3mr1883444ljn.31.1700665906347; Wed, 22 Nov 2023 07:11:46 -0800 (PST) MIME-Version: 1.0 References: <7614875b-fb11-8b2c-1411-da0b5c1224b3@redhat.com> In-Reply-To: <7614875b-fb11-8b2c-1411-da0b5c1224b3@redhat.com> From: "Ard Biesheuvel" Date: Wed, 22 Nov 2023 16:11:35 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH 1/1] StandaloneMmPkg/Core: Restart dispatcher once MmEntryPoint is registered To: devel@edk2.groups.io, lersek@redhat.com Cc: wei6.xu@intel.com, Ard Biesheuvel , Sami Mujawar , Ray Ni 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,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=IIGDCQMm; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (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 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. > 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. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111606): https://edk2.groups.io/g/devel/message/111606 Mute This Topic: https://groups.io/mt/102703852/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-