From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=j3D2kTPK; spf=pass (domain: linaro.org, ip: 209.85.166.54, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) by groups.io with SMTP; Fri, 19 Apr 2019 10:42:20 -0700 Received: by mail-io1-f54.google.com with SMTP id s7so4905729iom.12 for ; Fri, 19 Apr 2019 10:42:20 -0700 (PDT) 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=WP6SITaTJkmQmVfbRkUUzOehMZOLdVa8Mw5DIcMy+4c=; b=j3D2kTPKgouSMET44ZnnHId+lK7Hy+XjSpGSc9FF0eLF9UM7VKK6DIydUZHKy+ha0v wHMbYbARTPl74W5u78YeM9YCSg/WhEAhL6KxjwiQfkoHlEmEKasr2diaEZ6V+pcMohlb zki/CZO20jACglxbPVyKDwnX9iIfB1JWMqtp43QR0V5OMLKhVbeOfLLAiWWWTcChYbzu J77hSB5Ltr3oaRVl+u/fdZp0DUkmEfob0ROu5wqgRZO5CK8lGlC6z7F6z1317Tw6asOC RQ48lH+FH+gNzve/CkuMgL6wGgCJj8yBjw0d2VyQhZu7hFHulqDNHbtIkiG5VoT2PNsx abrw== 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=WP6SITaTJkmQmVfbRkUUzOehMZOLdVa8Mw5DIcMy+4c=; b=doBw9Itz4+DYod2EExUkl4d9MI5TrqdRh4Z2cD2UuYasUj/jchZO6vNPbc12Gzelxa hBLieAcZ4IGRygT+qKzHH6Y+3cPoD8e4QrXo5T22v1XthgjqUgRaFkxCwwei4JNhc9Uc JRMs/yo2Iiqg+nj/CzwutY3aichxzq40CklsnuERQGlUmsD3dm1PUx/5bsl3ue/2jx3y QFS2PYSlx2tbTbwdgN+iyyiBxFJCErRxFiMzNoTxABLSMFJB5Ocnt5H9vJnHn0s5nrmC XxUjfniXg69BNzpaiphLP3jJ88pgYB9OMrzkv0c268YBaNV7GrT918s3EuBZKCOiYyDj HWuA== X-Gm-Message-State: APjAAAXFcq+66Jg0YMI9/dc7l0JpWWIvsYMI7iBKkMY3wrgMQGyZgdRm dfbWA4H69iknylwPi81jYzooCAVUijeZURP8Nnzw+PwF/t1wBw== X-Google-Smtp-Source: APXvYqxrEBi9NR2RfWCiAXXfNjPNm+IqtSIs1EhdB5Gh3hhIu1mriilq5qPFQ0jW/pqtjzrQyEDBcLcW15a4311j6VY= X-Received: by 2002:a5d:8b41:: with SMTP id c1mr3590884iot.173.1555695739391; Fri, 19 Apr 2019 10:42:19 -0700 (PDT) MIME-Version: 1.0 References: <20190419141319.11084-1-ard.biesheuvel@linaro.org> In-Reply-To: From: "Ard Biesheuvel" Date: Fri, 19 Apr 2019 19:42:07 +0200 Message-ID: Subject: Re: [edk2-devel] [PATCH resend] MdeModulePkg/EsrtDxe: allocate ESRT table from RtServicesData memory To: edk2-devel-groups-io , "Kinney, Michael D" Cc: "ming.huang@linaro.org" , "Wu, Hao A" , "Wang, Jian J" Content-Type: text/plain; charset="UTF-8" On Fri, 19 Apr 2019 at 19:36, Michael D Kinney wrote: > > Hi Ard, > > The UEFI Specification Section 23.3 says: > > "The ESRT shall be stored in memory of type EfiBootServicesData." > > If an RT driver needs ESRT info after ExitBootServices(), then the > RT driver should collect that information before ExitBootServices(). > But that means that before EBS(), we will have to make a copy of the ESRT into runtime services data, and we will end up using twice as much memory - one copy in boot services data for the OS, and one copy in runtime services data for the firmware itself. I understand the reasoning behind preferring boot over runtime, so that the OS is not burdened with it if it does not care. But it this case, the RT services data will be allocated regardless, and so we end up using less memory if we expose that same copy to the OS. > > > -----Original Message----- > > From: devel@edk2.groups.io > > [mailto:devel@edk2.groups.io] On Behalf Of Ard > > Biesheuvel > > Sent: Friday, April 19, 2019 7:13 AM > > To: devel@edk2.groups.io > > Cc: ming.huang@linaro.org; Wu, Hao A > > ; Wang, Jian J > > ; Ard Biesheuvel > > > > Subject: [edk2-devel] [PATCH resend] > > MdeModulePkg/EsrtDxe: allocate ESRT table from > > RtServicesData memory > > > > Given that the firmware itself may access the ESRT > > table when the OS > > invokes the UpdateCapsule () boot service, it requires > > a virtual mapping > > and so it needs to be allocated from RtServicesData > > memory. > > > > Signed-off-by: Ard Biesheuvel > > > > --- > > MdeModulePkg/Universal/EsrtDxe/EsrtDxe.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.c > > b/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.c > > index a386a9770583..1741cbe8f2b5 100644 > > --- a/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.c > > +++ b/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.c > > @@ -571,7 +571,8 @@ EsrtReadyToBootEventNotify ( > > goto EXIT; > > } > > > > - EsrtTable = > > AllocatePool(sizeof(EFI_SYSTEM_RESOURCE_TABLE) + > > NonFmpRepositorySize + FmpRepositorySize); > > + EsrtTable = AllocateRuntimePool > > (sizeof(EFI_SYSTEM_RESOURCE_TABLE) + > > + > > NonFmpRepositorySize + FmpRepositorySize); > > if (EsrtTable == NULL) { > > DEBUG ((EFI_D_ERROR, "Esrt table memory allocation > > failure\n")); > > goto EXIT; > > -- > > 2.20.1 > > > > > > > > > >