REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1272
To have high confidence in usage for platform, add option (BIT2 of
PcdVTdPolicyPropertyMask) to force no IOMMU access attribute request
recording before DMAR table is installed.
Check PcdVTdPolicyPropertyMask BIT2 before RequestAccessAttribute()
and ProcessRequestedAccessAttribute(), then RequestAccessAttribute(),
ProcessRequestedAccessAttribute() and mAccessRequestXXX variables
could be optimized by compiler when PcdVTdPolicyPropertyMask BIT2 = 1.
Test done:
1: Created case that has IOMMU access attribute request before DMAR
table is installed, ASSERT was triggered after setting
PcdVTdPolicyPropertyMask BIT2 to 1.
2. Confirmed RequestAccessAttribute(), ProcessRequestedAccessAttribute()
and mAccessRequestXXX variables were optimized by compiler after
setting PcdVTdPolicyPropertyMask BIT2 to 1.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
\r
ParseDmarAcpiTableRmrr ();\r
\r
\r
ParseDmarAcpiTableRmrr ();\r
\r
- ProcessRequestedAccessAttribute ();\r
+ if ((PcdGet8 (PcdVTdPolicyPropertyMask) & BIT2) == 0) {\r
+ //\r
+ // Support IOMMU access attribute request recording before DMAR table is installed.\r
+ // Here is to process the requests.\r
+ //\r
+ ProcessRequestedAccessAttribute ();\r
+ }\r
\r
for (Index = 0; Index < mVtdUnitNumber; Index++) {\r
DEBUG ((DEBUG_INFO,"VTD Unit %d (Segment: %04x)\n", Index, mVtdUnitInformation[Index].Segment));\r
\r
for (Index = 0; Index < mVtdUnitNumber; Index++) {\r
DEBUG ((DEBUG_INFO,"VTD Unit %d (Segment: %04x)\n", Index, mVtdUnitInformation[Index].Segment));\r
// Record the entry to driver global variable.\r
// As such once VTd is activated, the setting can be adopted.\r
//\r
// Record the entry to driver global variable.\r
// As such once VTd is activated, the setting can be adopted.\r
//\r
+ if ((PcdGet8 (PcdVTdPolicyPropertyMask) & BIT2) != 0) {\r
+ //\r
+ // Force no IOMMU access attribute request recording before DMAR table is installed.\r
+ //\r
+ ASSERT_EFI_ERROR (EFI_NOT_READY);\r
+ return EFI_NOT_READY;\r
+ }\r
Status = RequestAccessAttribute (Segment, SourceId, DeviceAddress, Length, IoMmuAccess);\r
} else {\r
PERF_CODE (\r
Status = RequestAccessAttribute (Segment, SourceId, DeviceAddress, Length, IoMmuAccess);\r
} else {\r
PERF_CODE (\r
## The mask is used to control VTd behavior.<BR><BR>\r
# BIT0: Enable IOMMU during boot (If DMAR table is installed in DXE. If VTD_INFO_PPI is installed in PEI.)\r
# BIT1: Enable IOMMU when transfer control to OS (ExitBootService in normal boot. EndOfPEI in S3)\r
## The mask is used to control VTd behavior.<BR><BR>\r
# BIT0: Enable IOMMU during boot (If DMAR table is installed in DXE. If VTD_INFO_PPI is installed in PEI.)\r
# BIT1: Enable IOMMU when transfer control to OS (ExitBootService in normal boot. EndOfPEI in S3)\r
+ # BIT2: Force no IOMMU access attribute request recording before DMAR table is installed.\r
# @Prompt The policy for VTd driver behavior.\r
gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask|1|UINT8|0x00000002\r
\r
# @Prompt The policy for VTd driver behavior.\r
gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask|1|UINT8|0x00000002\r
\r