From: "duntan" <dun.tan@intel.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Ni, Ray" <ray.ni@intel.com>, Laszlo Ersek <lersek@redhat.com>,
"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [edk2-devel] [Patch V3] UefiCpuPkg:Limit PhysicalAddressBits in special case
Date: Fri, 12 Jan 2024 01:10:07 +0000 [thread overview]
Message-ID: <BN9PR11MB54837BE3614DD74F31C3A17BE56F2@BN9PR11MB5483.namprd11.prod.outlook.com> (raw)
In-Reply-To: <wnx5k2y4nzh6pqrky6m2cp5hyomhqaeg7iwrtczvrb6xxwf6rv@lyse2c4whsgz>
Hi Gerd,
I explain the reason why 47 here is since virtual addresses are sign-extended in the commit message.
About the technical background, I also mentioned in the commit message " When 5-Level Paging is disabled and the PhysicalAddressBits retrived from CPU HOB or CpuId is bigger than 47". Could you please provide more detailed suggestion about the commit message?
Or can we merge the code firstly? Then I'll raise another PR to make the comments around the code more detailed as we want.
Thanks,
Dun
-----Original Message-----
From: Gerd Hoffmann <kraxel@redhat.com>
Sent: Thursday, January 11, 2024 6:21 PM
To: Tan, Dun <dun.tan@intel.com>
Cc: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>
Subject: Re: [Patch V3] UefiCpuPkg:Limit PhysicalAddressBits in special case
On Thu, Jan 11, 2024 at 04:59:47PM +0800, Dun Tan wrote:
> When creating smm page table, limit maximum supported physical address
> bits returned by
> CalculateMaximumSupportAddress() to 47 if 5-Level Paging is disabled.
> When 5-Level Paging is disabled and the PhysicalAddressBits retrived
> from CPU HOB or CpuId is bigger than 47, and since virtual addresses
> are sign-extended, only [0, 2^47-1] range in 52-bit physical address
> is mapped in page table.
> + //
> + // Only [0, 2^47 -1] in 52-bit physical addresses is mapped in page
> + table // when 5-Level Paging is disabled.
> + //
> + ASSERT (PhysicalAddressBits <= 52); if (!Is5LevelPagingNeeded &&
> + (PhysicalAddressBits > 47)) {
> + PhysicalAddressBits = 47;
> + }
The code change is fine but the comment should be more verbose and explain the why 47 not 48 is used here. The discussion on the patch clearly showed that the technical background is not obvious ...
take care,
Gerd
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113636): https://edk2.groups.io/g/devel/message/113636
Mute This Topic: https://groups.io/mt/103658816/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-01-12 1:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-11 8:59 [edk2-devel] [Patch V3] UefiCpuPkg:Limit PhysicalAddressBits in special case duntan
2024-01-11 10:21 ` Gerd Hoffmann
2024-01-12 1:10 ` duntan [this message]
[not found] <17A93F5DE0125DA4.28944@groups.io>
2024-01-11 9:07 ` duntan
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=BN9PR11MB54837BE3614DD74F31C3A17BE56F2@BN9PR11MB5483.namprd11.prod.outlook.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