From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::143; helo=mail-it1-x143.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it1-x143.google.com (mail-it1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0E9A0211AE8B3 for ; Fri, 4 Jan 2019 03:57:26 -0800 (PST) Received: by mail-it1-x143.google.com with SMTP id a6so1204904itl.4 for ; Fri, 04 Jan 2019 03:57:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eRzZretNa5GbYbrhaQhg+sMPzhQDv9+TowU67n0IATM=; b=gUjXujd8jugy6ffOO+vVdSKxVkOlSn6HggoiR5D+52ZnvOK+WS4ukVv7XXKy45taU8 o2LvLvic+6hD+nr9ct85YcThcJIGiSFNoalXfQWZ9mtQEFWAj8rRTs+3paXeR/3YUEe3 tSinxujCp6DlTuJJpUetHcQhIgVIT8ZmKXSS0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eRzZretNa5GbYbrhaQhg+sMPzhQDv9+TowU67n0IATM=; b=TGewwn29R95BGwVHovp2pLv6EL0jojmhQluzb3ihJbkOuv/IEVsgwVxJbP1hJJbPzn m8/rINtJbL8IyaRhV9UuRowHF4LAKlG3nodbxACwg/iA+53XpsSBeuf4qL4AZkooYl16 I+1GX2TyLfz4/JfYmrr9d11WX8VKarKz+UHqWx5FOQXOgiS6kJJ7J3DVNUpcrrbDPbRJ K6u+GETQMrZxEF+W67RkO2QCV63WybifgegzJ+50zizOFATKVgphIi2My0Qs5FUtaAJl oCCp4NDB9OO74CMeFznCI9ij4qtLZIXYZObrnQ31me4slDg+PbGtTZ9/Xncjpwhcm6kZ BUJQ== X-Gm-Message-State: AJcUukd6BG57kK1pKyFYGhi4EyNdHz5lWSYqeAatv37wbkf3EGBNeIdm 3GWXNvtOvvO9SQ3l7SkZ29/fR4TzmMBl9nmHeK4X2g== X-Google-Smtp-Source: ALg8bN6AqSsqkD3jR151EmE99ps329UL6KQkxVgVj/0ppdWIu+HlNgk6ArmMuaIKt9ssR8venpGLDQDqlaqyEjuzlLI= X-Received: by 2002:a05:660c:4b:: with SMTP id p11mr776454itk.71.1546603045725; Fri, 04 Jan 2019 03:57:25 -0800 (PST) MIME-Version: 1.0 References: <1546434828-24405-1-git-send-email-jagadeesh.ujja@arm.com> <1546434828-24405-5-git-send-email-jagadeesh.ujja@arm.com> <8a6e1c80-5b6e-e337-06af-5992bc38a844@redhat.com> In-Reply-To: <8a6e1c80-5b6e-e337-06af-5992bc38a844@redhat.com> From: Ard Biesheuvel Date: Fri, 4 Jan 2019 12:57:14 +0100 Message-ID: To: Laszlo Ersek Cc: Jagadeesh Ujja , "Gao, Liming" , "Kinney, Michael D" , "edk2-devel@lists.01.org" , "Zhang, Chao B" , Leif Lindholm , Achin Gupta , Supreeth Venkatesh , Jian J Wang Subject: Re: [PATCH v2 04/11] MdePkg/Include: Add StandaloneMmServicesTableLib library X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2019 11:57:27 -0000 Content-Type: text/plain; charset="UTF-8" On Thu, 3 Jan 2019 at 17:14, Laszlo Ersek wrote: > > On 01/03/19 12:03, Ard Biesheuvel wrote: > > On Wed, 2 Jan 2019 at 14:14, Jagadeesh Ujja wrote: > >> > >> Some of the existing DXE drivers can be refactored to execute within > >> the Standalone MM execution environment as well. Allow such drivers to > >> get access to the Standalone MM services tables. > >> > >> Add a mechanism to determine the execution mode is required. > >> i.e, in MM or non-MM > >> > >> Contributed-under: TianoCore Contribution Agreement 1.1 > >> Signed-off-by: Jagadeesh Ujja > >> --- > >> MdePkg/Include/Library/StandaloneMmServicesTableLib.h | 43 ++++++++++++++++++++ > >> MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c | 39 ++++++++++++++++++ > >> MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf | 36 ++++++++++++++++ > >> MdePkg/MdePkg.dec | 4 ++ > >> 4 files changed, 122 insertions(+) > >> > > > > OK, so since the PI spec only refers to MM mode now, this library > > class should be > > > > MmServicesTableLib|Include/Library/MmServicesTableLib.h > > > > with an implementation in MdeModulePkg that exposes the deprecated SMM > > system table as the MM system table. > > > > In StandaloneMmPkg, we can add an implementation that exposes the > > standalone MM system table. > > > > (They are binary compatible, so it is just a matter of casting one > > pointer to the other) > > > > With this in place, we can go ahead and update FaultTolerantWrite and > > Variable SMM driver to switch from SmmServicesTableLib to > > MmServicesTableLib. This will require existing x86 platforms to define > > a new library class resolution for MmServicesTableLib, referring to > > the implementation in MdeModulePkg. This is unfortunate, but it is an > > unavoidable consequence of the PI spec changes. > > It shouldn't be too intrusive or hard to review, I expect. > > > > > Remaining question is what to do with InSmm() ... > > I'm lacking the context on this; on the other hand, I can refer back to > at least one earlier discussion -- there had been multiple -- of the > discrepancy between the PI spec and the edk2 code. See: > > - bullet (9) in > , > - and > . > > Not sure how that can be applied to Arm. > The code I posted yesterday does not use InMm() at all. For standalone MM, it should always return TRUE anyway, and any code that a driver would execute if it returned FALSE needs to be factored out anyway, since it should not end up in standalone MM binaries as dead code.