public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Zeng, Star" <star.zeng@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH] IntelSiliconPkg VTdDxe: Option to force no early access attr request
Date: Wed, 24 Oct 2018 11:22:34 +0000	[thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AE26320@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1540351913-97208-1-git-send-email-star.zeng@intel.com>

Reviewed-by: jiewen.yao@intel.com


> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Star Zeng
> Sent: Wednesday, October 24, 2018 11:32 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH] IntelSiliconPkg VTdDxe: Option to force no early
> access attr request
> 
> 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>
> ---
>  IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c | 8 +++++++-
>  IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.c   | 7 +++++++
>  IntelSiliconPkg/IntelSiliconPkg.dec                     | 1 +
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c
> b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c
> index 86d50eb6f288..7784545631b3 100644
> --- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c
> +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c
> @@ -515,7 +515,13 @@ SetupVtd (
> 
>    ParseDmarAcpiTableRmrr ();
> 
> -  ProcessRequestedAccessAttribute ();
> +  if ((PcdGet8 (PcdVTdPolicyPropertyMask) & BIT2) == 0) {
> +    //
> +    // Support IOMMU access attribute request recording before DMAR
> table is installed.
> +    // Here is to process the requests.
> +    //
> +    ProcessRequestedAccessAttribute ();
> +  }
> 
>    for (Index = 0; Index < mVtdUnitNumber; Index++) {
>      DEBUG ((DEBUG_INFO,"VTD Unit %d (Segment: %04x)\n", Index,
> mVtdUnitInformation[Index].Segment));
> diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.c
> b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.c
> index 25d7c80af1d4..09948ce50e94 100644
> --- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.c
> +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.c
> @@ -254,6 +254,13 @@ VTdSetAttribute (
>      // Record the entry to driver global variable.
>      // As such once VTd is activated, the setting can be adopted.
>      //
> +    if ((PcdGet8 (PcdVTdPolicyPropertyMask) & BIT2) != 0) {
> +      //
> +      // Force no IOMMU access attribute request recording before
> DMAR table is installed.
> +      //
> +      ASSERT_EFI_ERROR (EFI_NOT_READY);
> +      return EFI_NOT_READY;
> +    }
>      Status = RequestAccessAttribute (Segment, SourceId, DeviceAddress,
> Length, IoMmuAccess);
>    } else {
>      PERF_CODE (
> diff --git a/IntelSiliconPkg/IntelSiliconPkg.dec
> b/IntelSiliconPkg/IntelSiliconPkg.dec
> index b9646d773b95..900e8f63c64d 100644
> --- a/IntelSiliconPkg/IntelSiliconPkg.dec
> +++ b/IntelSiliconPkg/IntelSiliconPkg.dec
> @@ -64,6 +64,7 @@ [PcdsFixedAtBuild, PcdsPatchableInModule,
> PcdsDynamic, PcdsDynamicEx]
>    ## The mask is used to control VTd behavior.<BR><BR>
>    #  BIT0: Enable IOMMU during boot (If DMAR table is installed in DXE. If
> VTD_INFO_PPI is installed in PEI.)
>    #  BIT1: Enable IOMMU when transfer control to OS (ExitBootService in
> normal boot. EndOfPEI in S3)
> +  #  BIT2: Force no IOMMU access attribute request recording before
> DMAR table is installed.
>    # @Prompt The policy for VTd driver behavior.
> 
> gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask|1|UINT8|0x000
> 00002
> 
> --
> 2.7.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


      reply	other threads:[~2018-10-24 11:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24  3:31 [PATCH] IntelSiliconPkg VTdDxe: Option to force no early access attr request Star Zeng
2018-10-24 11:22 ` Yao, Jiewen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74D8A39837DF1E4DA445A8C0B3885C503AE26320@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox