public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ruiyu" <ruiyu.ni@intel.com>
To: Laszlo Ersek <lersek@redhat.com>,
	"Dong, Eric" <eric.dong@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [Patch v3 1/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT saved in Smram.
Date: Mon, 13 Aug 2018 05:42:40 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BDD07B5@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <be2d71f8-540a-9c24-0673-df14fd708ea2@redhat.com>



Thanks/Ray

> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Friday, August 10, 2018 11:40 PM
> To: Dong, Eric <eric.dong@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: Re: [Patch v3 1/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT
> saved in Smram.
> 
> On 08/10/18 06:19, Eric Dong wrote:
> > Current implementation copies GDT/IDT at SmmReadyToLock point from
> > ACPI NVS memory to Smram. Later at S3 resume phase, it restores memory
> > saved in Smram to ACPI NVS. Driver can directly use GDT/IDT saved in
> > Smram instead of restore the original ACPI NVS memory.
> >
> > This patch do this change.
> >
> > Test Done:
> >   Do the OS boot and S3 resume test.
> >
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Eric Dong <eric.dong@intel.com>
> > ---
> >  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 11 ++++-------
> >  1 file changed, 4 insertions(+), 7 deletions(-)
> >
> > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> > b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> > index 0b8ef70359..764d8276d3 100644
> > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> > @@ -448,13 +448,6 @@ PrepareApStartupVector (
> >    CopyMem ((VOID *) (UINTN) &mExchangeInfo->GdtrProfile, (VOID *)
> (UINTN) mAcpiCpuData.GdtrProfile, sizeof (IA32_DESCRIPTOR));
> >    CopyMem ((VOID *) (UINTN) &mExchangeInfo->IdtrProfile, (VOID *)
> > (UINTN) mAcpiCpuData.IdtrProfile, sizeof (IA32_DESCRIPTOR));
> >
> > -  //
> > -  // Copy AP's GDT, IDT and Machine Check handler from SMRAM to ACPI
> > NVS memory
> > -  //
> > -  CopyMem ((VOID *) mExchangeInfo->GdtrProfile.Base, mGdtForAp,
> > mExchangeInfo->GdtrProfile.Limit + 1);
> > -  CopyMem ((VOID *) mExchangeInfo->IdtrProfile.Base, mIdtForAp,
> > mExchangeInfo->IdtrProfile.Limit + 1);
> > -  CopyMem ((VOID *)(UINTN)
> mAcpiCpuData.ApMachineCheckHandlerBase,
> > mMachineCheckHandlerForAp,
> mAcpiCpuData.ApMachineCheckHandlerSize);
> > -
> >    mExchangeInfo->StackStart  = (VOID *) (UINTN)
> mAcpiCpuData.StackAddress;
> >    mExchangeInfo->StackSize   = mAcpiCpuData.StackSize;
> >    mExchangeInfo->BufferStart = (UINT32) StartupVector; @@ -901,6
> > +894,10 @@ GetAcpiCpuData (
> >    CopyMem (mGdtForAp, (VOID *)Gdtr->Base, Gdtr->Limit + 1);
> >    CopyMem (mIdtForAp, (VOID *)Idtr->Base, Idtr->Limit + 1);
> >    CopyMem (mMachineCheckHandlerForAp, (VOID
> > *)(UINTN)mAcpiCpuData.ApMachineCheckHandlerBase,
> > mAcpiCpuData.ApMachineCheckHandlerSize);
> > +
> > +  Gdtr->Base = (UINTN)mGdtForAp;
> > +  Idtr->Base = (UINTN)mIdtForAp;
> > +  mAcpiCpuData.ApMachineCheckHandlerBase =
> > + (EFI_PHYSICAL_ADDRESS)(UINTN)mMachineCheckHandlerForAp;
> >  }
> >
> >  /**
> >
> 
> This patch looks good to me (I'm ready to give R-b), but I think we can
> simplify the code further. Can we replace the mGdtForAp, mIdtForAp and
> mMachineCheckHandlerForAp global variables, with GdtForAp, IdtForAp and
> MachineCheckHandlerForAp local variables, used only in the
> GetAcpiCpuData() function?
Great code cleanup to remove 3 global variables.
> 
> If you prefer to do that as an incremental patch, that's fine too.
> 
> Thanks,
> Laszlo

  parent reply	other threads:[~2018-08-13  5:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10  4:19 [Patch v3 0/5] Change CpuS3Data memory type and address limitation Eric Dong
2018-08-10  4:19 ` [Patch v3 1/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT saved in Smram Eric Dong
2018-08-10 15:40   ` Laszlo Ersek
2018-08-13  1:54     ` Dong, Eric
2018-08-14 12:51       ` Laszlo Ersek
2018-08-13  5:42     ` Ni, Ruiyu [this message]
2018-08-10  4:19 ` [Patch v3 2/5] UefiCpuPkg/AcpiCpuData.h: Remove AcpiNVS and Below 4G limitation Eric Dong
2018-08-10 15:58   ` Laszlo Ersek
2018-08-13  5:42   ` Ni, Ruiyu
2018-08-10  4:19 ` [Patch v3 3/5] UefiCpuPkg/CpuS3DataDxe: Change Memory Type and address limitation Eric Dong
2018-08-10 16:12   ` Laszlo Ersek
2018-08-10 16:15     ` Laszlo Ersek
2018-08-13  1:50       ` Dong, Eric
2018-08-13  5:38         ` Ni, Ruiyu
2018-08-13  5:52           ` Ni, Ruiyu
2018-08-14 12:49             ` Laszlo Ersek
2018-08-10  4:19 ` [Patch v3 4/5] UefiCpuPkg/CpuS3DataDxe: Remove below 4G limitation Eric Dong
2018-08-10 16:22   ` Laszlo Ersek
2018-08-13  5:41   ` Ni, Ruiyu
2018-08-10  4:19 ` [Patch v3 5/5] UefiCpuPkg/RegisterCpuFeaturesLib: Combine implementation Eric Dong
2018-08-10 16:34   ` Laszlo Ersek
2018-08-13  5:41   ` Ni, Ruiyu
2018-08-10 16:39 ` [Patch v3 0/5] Change CpuS3Data memory type and address limitation Laszlo Ersek

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=734D49CCEBEEF84792F5B80ED585239D5BDD07B5@SHSMSX104.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