[edk2-devel] [PATCH V3 0/4] Add New Memory Attributes

Oleksiy Yakovlev posted 4 patches 3 years, 9 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Core/Dxe/Gcd/Gcd.c                    | 11 ++---------
MdeModulePkg/Core/Dxe/Mem/Page.c                   |  9 +++------
MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c      |  7 ++-----
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c             | 10 ++--------
MdePkg/Include/Uefi/UefiSpec.h                     | 10 ++++++++--
UefiCpuPkg/CpuDxe/CpuDxe.c                         | 11 ++++-------
UefiCpuPkg/CpuDxe/CpuDxe.h                         | 12 ------------
UefiCpuPkg/CpuDxe/CpuPageTable.c                   |  6 +++---
UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c |  2 +-
9 files changed, 25 insertions(+), 53 deletions(-)
[edk2-devel] [PATCH V3 0/4] Add New Memory Attributes
Posted by Oleksiy Yakovlev 3 years, 9 months ago
This series of patches add usage of new memory
attributes EFI_MEMORY_SP and EFI_MEMORY_CPU_CRYPTO,
introduced in UEFI2.8 (mantis 1919 and 1872).
First patch fix typos in description and introduce two 
bitmasks for all memory type attributes.
Second and fourth patches get rid of multiple memory attributes
bitmasks definitions trough multiple files and headers,
and replace them with new common definitions from MdePkg.
Third patch includes WP attribute into cache type mask in
CpuDexe.h to make next change in this file more clear.

Oleksiy Yakovlev (4):
  MdePkg: Add New Memory Attributes
  MdeModulePkg: Add New Memory Attributes
  UefiCpuPkg: Update EFI_MEMORY_CACHETYPE_MASK definition
  UefiCpuPkg: Add New Memory Attributes

 MdeModulePkg/Core/Dxe/Gcd/Gcd.c                    | 11 ++---------
 MdeModulePkg/Core/Dxe/Mem/Page.c                   |  9 +++------
 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c      |  7 ++-----
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c             | 10 ++--------
 MdePkg/Include/Uefi/UefiSpec.h                     | 10 ++++++++--
 UefiCpuPkg/CpuDxe/CpuDxe.c                         | 11 ++++-------
 UefiCpuPkg/CpuDxe/CpuDxe.h                         | 12 ------------
 UefiCpuPkg/CpuDxe/CpuPageTable.c                   |  6 +++---
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c |  2 +-
 9 files changed, 25 insertions(+), 53 deletions(-)

-- 
2.9.0.windows.1


Please consider the environment before printing this email.

The information contained in this message may be confidential and proprietary to American Megatrends (AMI).  This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited.  Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61992): https://edk2.groups.io/g/devel/message/61992
Mute This Topic: https://groups.io/mt/75267363/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH V3 0/4] Add New Memory Attributes
Posted by Laszlo Ersek 3 years, 9 months ago
On 07/02/20 22:50, Oleksiy Yakovlev wrote:
> This series of patches add usage of new memory
> attributes EFI_MEMORY_SP and EFI_MEMORY_CPU_CRYPTO,
> introduced in UEFI2.8 (mantis 1919 and 1872).
> First patch fix typos in description and introduce two 
> bitmasks for all memory type attributes.
> Second and fourth patches get rid of multiple memory attributes
> bitmasks definitions trough multiple files and headers,
> and replace them with new common definitions from MdePkg.
> Third patch includes WP attribute into cache type mask in
> CpuDexe.h to make next change in this file more clear.
> 
> Oleksiy Yakovlev (4):
>   MdePkg: Add New Memory Attributes
>   MdeModulePkg: Add New Memory Attributes
>   UefiCpuPkg: Update EFI_MEMORY_CACHETYPE_MASK definition
>   UefiCpuPkg: Add New Memory Attributes
> 
>  MdeModulePkg/Core/Dxe/Gcd/Gcd.c                    | 11 ++---------
>  MdeModulePkg/Core/Dxe/Mem/Page.c                   |  9 +++------
>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c      |  7 ++-----
>  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c             | 10 ++--------
>  MdePkg/Include/Uefi/UefiSpec.h                     | 10 ++++++++--
>  UefiCpuPkg/CpuDxe/CpuDxe.c                         | 11 ++++-------
>  UefiCpuPkg/CpuDxe/CpuDxe.h                         | 12 ------------
>  UefiCpuPkg/CpuDxe/CpuPageTable.c                   |  6 +++---
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c |  2 +-
>  9 files changed, 25 insertions(+), 53 deletions(-)
> 

Merged as commit range 5d29e2d020e8..e77966b341b9, via
<https://github.com/tianocore/edk2/pull/796>.

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62613): https://edk2.groups.io/g/devel/message/62613
Mute This Topic: https://groups.io/mt/75267363/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH V3 0/4] Add New Memory Attributes
Posted by Laszlo Ersek 3 years, 9 months ago
On 07/02/20 22:50, Oleksiy Yakovlev wrote:
> This series of patches add usage of new memory
> attributes EFI_MEMORY_SP and EFI_MEMORY_CPU_CRYPTO,
> introduced in UEFI2.8 (mantis 1919 and 1872).
> First patch fix typos in description and introduce two 
> bitmasks for all memory type attributes.
> Second and fourth patches get rid of multiple memory attributes
> bitmasks definitions trough multiple files and headers,
> and replace them with new common definitions from MdePkg.
> Third patch includes WP attribute into cache type mask in
> CpuDexe.h to make next change in this file more clear.
> 
> Oleksiy Yakovlev (4):
>   MdePkg: Add New Memory Attributes
>   MdeModulePkg: Add New Memory Attributes
>   UefiCpuPkg: Update EFI_MEMORY_CACHETYPE_MASK definition
>   UefiCpuPkg: Add New Memory Attributes
> 
>  MdeModulePkg/Core/Dxe/Gcd/Gcd.c                    | 11 ++---------
>  MdeModulePkg/Core/Dxe/Mem/Page.c                   |  9 +++------
>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c      |  7 ++-----
>  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c             | 10 ++--------
>  MdePkg/Include/Uefi/UefiSpec.h                     | 10 ++++++++--
>  UefiCpuPkg/CpuDxe/CpuDxe.c                         | 11 ++++-------
>  UefiCpuPkg/CpuDxe/CpuDxe.h                         | 12 ------------
>  UefiCpuPkg/CpuDxe/CpuPageTable.c                   |  6 +++---
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c |  2 +-
>  9 files changed, 25 insertions(+), 53 deletions(-)
> 

series
Tested-by: Laszlo Ersek <lersek@redhat.com>

Meaning my usual OVMF regression tests, and (due to patch#2) an
ArmVirtQemu boot test on AARCH64 KVM too.

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62095): https://edk2.groups.io/g/devel/message/62095
Mute This Topic: https://groups.io/mt/75267363/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH V3 0/4] Add New Memory Attributes
Posted by Dhaval Sharma 5 months ago
Hi,
I wanted to revisit this thread and I am maintaining the context as there are a lot of details already mentioned here regarding EFI_MEMORY_SP.
Other than what has been addressed here, we also would like to have an option in edk2 to *avoid* using this type of memory for its own purposes. This seems like one of the motivations for original request and is being honored by OS today but not edk2 as it does not have any specific implementation today which takes this attribute into consideration.
I would like to add PCD based implementation which informs edk2 NOT to use this memory for its own purposes and leave it alone (as still available memory to OS).

Specific-purpose memory (SPM). The memory is earmarked for
specific purposes such as for specific device drivers or applications.
The SPM attribute serves as a hint to the OS to avoid allocating this
memory for core OS data or code that can not be relocated.
Prolonged use of this memory for purposes other than the intended
purpose may result in suboptimal platform performance.

Some more context:
https://lwn.net/Articles/784971/


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111337): https://edk2.groups.io/g/devel/message/111337
Mute This Topic: https://groups.io/mt/75267363/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH V3 0/4] Add New Memory Attributes
Posted by Laszlo Ersek 5 months ago
On 11/17/23 09:07, Dhaval Sharma wrote:
> Hi,
> I wanted to revisit this thread and I am maintaining the context as
> there are a lot of details already mentioned here regarding EFI_MEMORY_SP.
> Other than what has been addressed here, we also would like to have an
> option in edk2 to *avoid* using this type of memory for its own
> purposes. This seems like one of the motivations for original request
> and is being honored by OS today but not edk2 as it does not have any
> specific implementation today which takes this attribute into consideration.
> I would like to add PCD based implementation which informs edk2 NOT to
> use this memory for its own purposes and leave it alone (as still
> available memory to OS).
> 
> Specific-purpose memory (SPM). The memory is earmarked for
> specific purposes such as for specific device drivers or applications.
> The SPM attribute serves as a hint to the OS to avoid allocating this
> memory for core OS data or code that can not be relocated.
> Prolonged use of this memory for purposes other than the intended
> purpose may result in suboptimal platform performance.
> 
> Some more context:
> https://lwn.net/Articles/784971/

Why was EFI_MEMORY_SP introduced as a memory attribute, rather than its
own memory type?

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111339): https://edk2.groups.io/g/devel/message/111339
Mute This Topic: https://groups.io/mt/75267363/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH V3 0/4] Add New Memory Attributes
Posted by Dhaval Sharma 5 months ago
Did you mean to add it as a memory type by itself like
EFI_MEMORY_TYPE_INFORMATION?
My interpretation of Memory Type is that it is more of SW usability
construct while Memory Attr is more of HW behavioural construct. Together
they define how a memory region can be used.

On Fri, Nov 17, 2023 at 1:55 PM Laszlo Ersek <lersek@redhat.com> wrote:

> On 11/17/23 09:07, Dhaval Sharma wrote:
> > Hi,
> > I wanted to revisit this thread and I am maintaining the context as
> > there are a lot of details already mentioned here
> regarding EFI_MEMORY_SP.
> > Other than what has been addressed here, we also would like to have an
> > option in edk2 to *avoid* using this type of memory for its own
> > purposes. This seems like one of the motivations for original request
> > and is being honored by OS today but not edk2 as it does not have any
> > specific implementation today which takes this attribute into
> consideration.
> > I would like to add PCD based implementation which informs edk2 NOT to
> > use this memory for its own purposes and leave it alone (as still
> > available memory to OS).
> >
> > Specific-purpose memory (SPM). The memory is earmarked for
> > specific purposes such as for specific device drivers or applications.
> > The SPM attribute serves as a hint to the OS to avoid allocating this
> > memory for core OS data or code that can not be relocated.
> > Prolonged use of this memory for purposes other than the intended
> > purpose may result in suboptimal platform performance.
> >
> > Some more context:
> > https://lwn.net/Articles/784971/
>
> Why was EFI_MEMORY_SP introduced as a memory attribute, rather than its
> own memory type?
>
> Laszlo
>
>

-- 
Thanks!
=D


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111457): https://edk2.groups.io/g/devel/message/111457
Mute This Topic: https://groups.io/mt/75267363/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH V3 0/4] Add New Memory Attributes
Posted by Laszlo Ersek 4 months, 4 weeks ago
On 11/20/23 05:59, Dhaval Sharma wrote:
> Did you mean to add it as a memory type by itself like
> EFI_MEMORY_TYPE_INFORMATION?

Yes, a new enum constant for EFI_MEMORY_TYPE.

(It wasn't a "loaded question", just wanted to understand the reasoning.)

> My interpretation of Memory Type is that it is more of SW usability
> construct while Memory Attr is more of HW behavioural construct.
> Together they define how a memory region can be used.

I guess it's hard to tell apart. The SPM definition (visible in the
context below, from your earlier email) does seem like a software
usability construct ("avoid allocating for ...").

But, I truly don't know. I guess I was only trying to gauge if I could
be a useful reviewer for this series; probably not.

Thanks!
Laszlo

> 
> On Fri, Nov 17, 2023 at 1:55 PM Laszlo Ersek <lersek@redhat.com
> <mailto:lersek@redhat.com>> wrote:
> 
>     On 11/17/23 09:07, Dhaval Sharma wrote:
>     > Hi,
>     > I wanted to revisit this thread and I am maintaining the context as
>     > there are a lot of details already mentioned here
>     regarding EFI_MEMORY_SP.
>     > Other than what has been addressed here, we also would like to have an
>     > option in edk2 to *avoid* using this type of memory for its own
>     > purposes. This seems like one of the motivations for original request
>     > and is being honored by OS today but not edk2 as it does not have any
>     > specific implementation today which takes this attribute into
>     consideration.
>     > I would like to add PCD based implementation which informs edk2 NOT to
>     > use this memory for its own purposes and leave it alone (as still
>     > available memory to OS).
>     >
>     > Specific-purpose memory (SPM). The memory is earmarked for
>     > specific purposes such as for specific device drivers or applications.
>     > The SPM attribute serves as a hint to the OS to avoid allocating this
>     > memory for core OS data or code that can not be relocated.
>     > Prolonged use of this memory for purposes other than the intended
>     > purpose may result in suboptimal platform performance.
>     >
>     > Some more context:
>     > https://lwn.net/Articles/784971/ <https://lwn.net/Articles/784971/>
> 
>     Why was EFI_MEMORY_SP introduced as a memory attribute, rather than its
>     own memory type?
> 
>     Laszlo
> 
> 
> 
> -- 
> Thanks!
> =D



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111553): https://edk2.groups.io/g/devel/message/111553
Mute This Topic: https://groups.io/mt/75267363/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-