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::d42; helo=mail-io1-xd42.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (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 DEB142194D3B3 for ; Thu, 3 Jan 2019 02:36:08 -0800 (PST) Received: by mail-io1-xd42.google.com with SMTP id b23so5752306ios.10 for ; Thu, 03 Jan 2019 02:36:08 -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:content-transfer-encoding; bh=rijTVndUiJAjoLvI/WXWHnfogTKxymMCs46QMwuhwMQ=; b=PbSe9hQszB2pRnamC4hKo9wUl/K/cotV/tk9D1oteyxR/lCM899yvbWsWIGGNMo4q/ 7K+YFUwSSHP2EPwaRGlmnsMDyGITkvS1Mw1ayjiCwrt6FLpu4ZhwiGl4JMdBQpnU5Dyd UOTqj5YqiDFEB7B82cO7RkMn6mhgKvsvnZ21Q= 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:content-transfer-encoding; bh=rijTVndUiJAjoLvI/WXWHnfogTKxymMCs46QMwuhwMQ=; b=ep4bQKHDCZ6mP27/Xn29V6jpd3NfFTMxm6GgG666cJxDVZNHuJ4nEQ5Xd7yQevf5QJ cJh54O/AbX6DDCq0tlWu2uqbIRPRYFGmh9OvOwoWM2fxOAoCwKagiv/ICSXnknVCw8R6 5bBYLaLSNIPu5LUxIw2/D6UJnKnhOqIC+yx/Mi8iM8tHgkqjBZ/0wOvvQFGuxbdaHkCl 2+KTiDlKNJvCEPZGOG6AfhfiGCHto5mbb7l4ej/GCZdGqSFjErhCjqjgHHkVKbowTQ/T CB0rNw2Ih9aTJoOhTERJYPKFdxwpsTGhjLx7RZGXpuk6CHJRMGAY3NxbO6ap0zKYPIn0 4/7Q== X-Gm-Message-State: AJcUukdgJDE992pu0u1gsK/7JQnEK1vJ9p4o+zyzC9nYggx7MpdfaQnJ uWDhuNynQcit3cquT/mXexVFwJARtmCGlmreEG9tdw== X-Google-Smtp-Source: ALg8bN5KJnuFs0zKDGfOHCOkQj6kLWizEh+WxMi9yfdQWlDufgPW52e2esNSCY4cNbtelxWzNABH1pJOfNroCOzLwDI= X-Received: by 2002:a5e:c206:: with SMTP id v6mr16467606iop.60.1546511767179; Thu, 03 Jan 2019 02:36:07 -0800 (PST) MIME-Version: 1.0 References: <1544789607-11316-1-git-send-email-jagadeesh.ujja@arm.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E38D3C3@SHSMSX104.ccr.corp.intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E38DE09@SHSMSX104.ccr.corp.intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E38F557@SHSMSX104.ccr.corp.intel.com> In-Reply-To: From: Ard Biesheuvel Date: Thu, 3 Jan 2019 11:35:55 +0100 Message-ID: To: Jagadeesh Ujja Cc: "Gao, Liming" , "edk2-devel@lists.01.org" , "Zhang, Chao B" Subject: Re: [PATCH 00/13] Extend secure variable service to be usable from Standalone MM 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: Thu, 03 Jan 2019 10:36:09 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 3 Jan 2019 at 10:52, Ard Biesheuvel wro= te: > > On Thu, 3 Jan 2019 at 08:43, Jagadeesh Ujja wrot= e: > > > > hi Ard > > > > On Wed, Jan 2, 2019 at 10:45 PM Ard Biesheuvel > > wrote: > > > > > > On Thu, 20 Dec 2018 at 15:23, Gao, Liming wrot= e: > > > > > > > > Jagadeesh: > > > > MdeModulePkg Variable service/Fault tolerant/Nor Flash driver dep= ends on StandaloneMmServicesTableLib library class header file. This header= file is added into MdePkg. It has two interfaces. One is global gMmst, ano= ther is function InMm(). So, there is no dependency issue here. > > > > And, MdePkg adds one StandaloneMmServicesTableLib library INF with = empty implementation, this library is just for build. It sets gMmst=3DNULL,= and always return FASLE in InMm(). This library can be used in MdeModulePk= g.dsc to make Variable driver pass build. There is also no dependency issue= here. Last, Platform DSC file will refer to the real StandaloneMmServicesT= ableLib library INF from StandaloneMmPkg. > > > > > > > > > > I think we should avoid the need for InMm() altogether for standalone > > > MM. It will always return TRUE for standalone MM modules, and it will > > > always return FALSE for other modules, so the distinction should be > > > made at build time. > > > > > > This means that we need to refactor the SMM 'server' modules and/or > > > libraries so that any code they cannot share (like boot services > > > invocations) are only included in the classic SMM versions. > > > > > > I have pushed my own prototype code here: > > > https://github.com/ardbiesheuvel/edk2/commits/standalone-mm > > > > > > There is some overlap with Jagadeesh's work. I will work with him > > > directly to resolve this before posting any new revisions. > > > > > InMm()=E2=80=9D and =E2=80=9CPcdStandaloneMmVariableEnabled=E2=80=9D a= re defined to reuse the > > existing code as much as possible. > > Initially I have done separate copy of the file to avoid =E2=80=9Cif..e= lse=E2=80=9D > > but had a comment about =E2=80=9Cduplicating code primarily due to the > > maintenance overhead=E2=80=9D > > > > We shouldn't rely on runtime functions and PCDs to make build time decisi= on. > > Lots of the SMM code can be refactored. As Jian suggested, we could > introduce a helper library with implementations for the MM protocol > handling and memory allocation routines exposed via the system table, > so that the users can invoke the abstract library. > Actually, looking at the PI spec, it seems that SMM is deprecated, and so we should port these drivers to the new MM system table entirely.