public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] IntelSiliconPkg IntelVTdDxe: Fix incorrect code to clear VTd error
@ 2018-06-05  8:06 Star Zeng
  2018-06-05 13:21 ` Yao, Jiewen
  0 siblings, 1 reply; 2+ messages in thread
From: Star Zeng @ 2018-06-05  8:06 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Jiewen Yao

According to VTd spec, Software writes the value read from this
field (F) to Clear it. But current code is using 0 to clear the
field, that is incorrect.

And R_FSTS_REG register value clearing should be not in the for loop.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
index 8dbc83fa2d67..e564d373c756 100644
--- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
+++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
@@ -554,11 +554,13 @@ DumpVtdIfError (
       for (Index = 0; Index < (UINTN)CapReg.Bits.NFR + 1; Index++) {
         FrcdReg.Uint64[1] = MmioRead64 (mVtdUnitInformation[Num].VtdUnitBaseAddress + ((CapReg.Bits.FRO * 16) + (Index * 16) + R_FRCD_REG + sizeof(UINT64)));
         if (FrcdReg.Bits.F != 0) {
-          FrcdReg.Bits.F = 0;
+          //
+          // Software writes the value read from this field (F) to Clear it.
+          //
           MmioWrite64 (mVtdUnitInformation[Num].VtdUnitBaseAddress + ((CapReg.Bits.FRO * 16) + (Index * 16) + R_FRCD_REG + sizeof(UINT64)), FrcdReg.Uint64[1]);
         }
-        MmioWrite32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG, MmioRead32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG));
       }
+      MmioWrite32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG, MmioRead32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG));
     }
   }
 }
-- 
2.7.0.windows.1



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

* Re: [PATCH] IntelSiliconPkg IntelVTdDxe: Fix incorrect code to clear VTd error
  2018-06-05  8:06 [PATCH] IntelSiliconPkg IntelVTdDxe: Fix incorrect code to clear VTd error Star Zeng
@ 2018-06-05 13:21 ` Yao, Jiewen
  0 siblings, 0 replies; 2+ messages in thread
From: Yao, Jiewen @ 2018-06-05 13:21 UTC (permalink / raw)
  To: Zeng, Star; +Cc: edk2-devel@lists.01.org

Thanks to fix it.

Reviewed by: jiewen.yao@intel.com

thank you!
Yao, Jiewen


> 在 2018年6月5日,上午1:07,Zeng, Star <star.zeng@intel.com> 写道:
> 
> According to VTd spec, Software writes the value read from this
> field (F) to Clear it. But current code is using 0 to clear the
> field, that is incorrect.
> 
> And R_FSTS_REG register value clearing should be not in the for loop.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
> IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
> index 8dbc83fa2d67..e564d373c756 100644
> --- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
> +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
> @@ -554,11 +554,13 @@ DumpVtdIfError (
>       for (Index = 0; Index < (UINTN)CapReg.Bits.NFR + 1; Index++) {
>         FrcdReg.Uint64[1] = MmioRead64 (mVtdUnitInformation[Num].VtdUnitBaseAddress + ((CapReg.Bits.FRO * 16) + (Index * 16) + R_FRCD_REG + sizeof(UINT64)));
>         if (FrcdReg.Bits.F != 0) {
> -          FrcdReg.Bits.F = 0;
> +          //
> +          // Software writes the value read from this field (F) to Clear it.
> +          //
>           MmioWrite64 (mVtdUnitInformation[Num].VtdUnitBaseAddress + ((CapReg.Bits.FRO * 16) + (Index * 16) + R_FRCD_REG + sizeof(UINT64)), FrcdReg.Uint64[1]);
>         }
> -        MmioWrite32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG, MmioRead32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG));
>       }
> +      MmioWrite32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG, MmioRead32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG));
>     }
>   }
> }
> -- 
> 2.7.0.windows.1
> 


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

end of thread, other threads:[~2018-06-05 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-05  8:06 [PATCH] IntelSiliconPkg IntelVTdDxe: Fix incorrect code to clear VTd error Star Zeng
2018-06-05 13:21 ` Yao, Jiewen

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