public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2] UefiCpuPkg/SmmCpu: Block access-out only when static paging is used
@ 2018-11-07  8:59 Ruiyu Ni
  2018-11-07  9:13 ` Yao, Jiewen
  2018-11-07 14:46 ` Laszlo Ersek
  0 siblings, 2 replies; 4+ messages in thread
From: Ruiyu Ni @ 2018-11-07  8:59 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jiewen Yao, Eric Dong

From: Jiewen Yao <jiewen.yao@intel.com>

When static paging is disabled, page table for below 4GB is created
and page table for above 4GB is created dynamically in page fault
handler.

Today's implementation only allow SMM access-out to below types of
memory address no matter static paging is enabled or not:
1. Reserved, run time and ACPI NVS type
2. MMIO

But certain platform feature like RAS may need to access other types
of memory from SMM. Today's code blocks these platforms.
This patch simplifies the policy to only block when static paging
is used so that the static paging can be disabled in these platforms
to meet their SMM access-out need.

Setting PcdCpuSmmStaticPageTable to FALSE can disable the static
paging.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 5bb7d57238..117502dafa 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -1,7 +1,7 @@
 /** @file
 Page Fault (#PF) handler for X64 processors
 
-Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
 
 This program and the accompanying materials
@@ -890,7 +890,7 @@ SmiPFHandler (
       CpuDeadLoop ();
     }
 
-    if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
+    if (mCpuSmmStaticPageTable && IsSmmCommBufferForbiddenAddress (PFAddress)) {
       DumpCpuContext (InterruptType, SystemContext);
       DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%lx)!\n", PFAddress));
       DEBUG_CODE (
-- 
2.16.1.windows.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] UefiCpuPkg/SmmCpu: Block access-out only when static paging is used
  2018-11-07  8:59 [PATCH v2] UefiCpuPkg/SmmCpu: Block access-out only when static paging is used Ruiyu Ni
@ 2018-11-07  9:13 ` Yao, Jiewen
  2018-11-07 14:46 ` Laszlo Ersek
  1 sibling, 0 replies; 4+ messages in thread
From: Yao, Jiewen @ 2018-11-07  9:13 UTC (permalink / raw)
  To: Ni, Ruiyu; +Cc: edk2-devel@lists.01.org, Dong, Eric

reviewed-by: jiewen.yao@intel.com

thank you!
Yao, Jiewen


> 在 2018年11月7日,下午4:58,Ni, Ruiyu <ruiyu.ni@intel.com> 写道:
> 
> From: Jiewen Yao <jiewen.yao@intel.com>
> 
> When static paging is disabled, page table for below 4GB is created
> and page table for above 4GB is created dynamically in page fault
> handler.
> 
> Today's implementation only allow SMM access-out to below types of
> memory address no matter static paging is enabled or not:
> 1. Reserved, run time and ACPI NVS type
> 2. MMIO
> 
> But certain platform feature like RAS may need to access other types
> of memory from SMM. Today's code blocks these platforms.
> This patch simplifies the policy to only block when static paging
> is used so that the static paging can be disabled in these platforms
> to meet their SMM access-out need.
> 
> Setting PcdCpuSmmStaticPageTable to FALSE can disable the static
> paging.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> ---
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index 5bb7d57238..117502dafa 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -1,7 +1,7 @@
> /** @file
> Page Fault (#PF) handler for X64 processors
> 
> -Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
> Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
> 
> This program and the accompanying materials
> @@ -890,7 +890,7 @@ SmiPFHandler (
>       CpuDeadLoop ();
>     }
> 
> -    if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
> +    if (mCpuSmmStaticPageTable && IsSmmCommBufferForbiddenAddress (PFAddress)) {
>       DumpCpuContext (InterruptType, SystemContext);
>       DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%lx)!\n", PFAddress));
>       DEBUG_CODE (
> -- 
> 2.16.1.windows.1
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] UefiCpuPkg/SmmCpu: Block access-out only when static paging is used
  2018-11-07  8:59 [PATCH v2] UefiCpuPkg/SmmCpu: Block access-out only when static paging is used Ruiyu Ni
  2018-11-07  9:13 ` Yao, Jiewen
@ 2018-11-07 14:46 ` Laszlo Ersek
  2018-11-07 14:58   ` Ni, Ruiyu
  1 sibling, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2018-11-07 14:46 UTC (permalink / raw)
  To: Ruiyu Ni, edk2-devel; +Cc: Jiewen Yao, Eric Dong

On 11/07/18 09:59, Ruiyu Ni wrote:
> From: Jiewen Yao <jiewen.yao@intel.com>
> 
> When static paging is disabled, page table for below 4GB is created
> and page table for above 4GB is created dynamically in page fault
> handler.
> 
> Today's implementation only allow SMM access-out to below types of
> memory address no matter static paging is enabled or not:
> 1. Reserved, run time and ACPI NVS type
> 2. MMIO
> 
> But certain platform feature like RAS may need to access other types
> of memory from SMM. Today's code blocks these platforms.
> This patch simplifies the policy to only block when static paging
> is used so that the static paging can be disabled in these platforms
> to meet their SMM access-out need.
> 
> Setting PcdCpuSmmStaticPageTable to FALSE can disable the static
> paging.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, this has improved a lot!
Laszlo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] UefiCpuPkg/SmmCpu: Block access-out only when static paging is used
  2018-11-07 14:46 ` Laszlo Ersek
@ 2018-11-07 14:58   ` Ni, Ruiyu
  0 siblings, 0 replies; 4+ messages in thread
From: Ni, Ruiyu @ 2018-11-07 14:58 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel@lists.01.org; +Cc: Yao, Jiewen, Dong, Eric

I agree my 1st version commit message is too general.
Because I don't know if RAS can be mentioned:)

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Wednesday, November 7, 2018 10:46 PM
> To: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Dong, Eric <eric.dong@intel.com>
> Subject: Re: [edk2] [PATCH v2] UefiCpuPkg/SmmCpu: Block access-out only
> when static paging is used
> 
> On 11/07/18 09:59, Ruiyu Ni wrote:
> > From: Jiewen Yao <jiewen.yao@intel.com>
> >
> > When static paging is disabled, page table for below 4GB is created
> > and page table for above 4GB is created dynamically in page fault
> > handler.
> >
> > Today's implementation only allow SMM access-out to below types of
> > memory address no matter static paging is enabled or not:
> > 1. Reserved, run time and ACPI NVS type 2. MMIO
> >
> > But certain platform feature like RAS may need to access other types
> > of memory from SMM. Today's code blocks these platforms.
> > This patch simplifies the policy to only block when static paging is
> > used so that the static paging can be disabled in these platforms to
> > meet their SMM access-out need.
> >
> > Setting PcdCpuSmmStaticPageTable to FALSE can disable the static
> > paging.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
> > Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> > Cc: Eric Dong <eric.dong@intel.com>
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Acked-by: Laszlo Ersek <lersek@redhat.com>
> > ---
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Thanks, this has improved a lot!
> Laszlo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-07 14:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-07  8:59 [PATCH v2] UefiCpuPkg/SmmCpu: Block access-out only when static paging is used Ruiyu Ni
2018-11-07  9:13 ` Yao, Jiewen
2018-11-07 14:46 ` Laszlo Ersek
2018-11-07 14:58   ` Ni, Ruiyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox