public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: Pedro Falcato <pedro.falcato@gmail.com>
Cc: devel@edk2.groups.io, Jordan Justen <jordan.l.justen@intel.com>,
	 Oliver Steffen <osteffen@redhat.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	 Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Jiewen Yao <jiewen.yao@intel.com>
Subject: Re: [edk2-devel] [PATCH 0/3] OvmfPkg: gigabyte page tweaks
Date: Mon, 22 May 2023 11:39:15 +0200	[thread overview]
Message-ID: <iuaw4eo432iotmmhnugzx4yfskroxxptpb7qpfr6md5oeab4tr@73pbwqsjclij> (raw)
In-Reply-To: <CAKbZUD0WE6nRv2bNwGN=LTo2e5qHek3vbE827DAm++g7ZZugjQ@mail.gmail.com>

On Thu, May 18, 2023 at 12:16:21AM +0100, Pedro Falcato wrote:
> On Wed, May 17, 2023 at 11:24 AM Gerd Hoffmann <kraxel@redhat.com> wrote:

> The Intel SDM and AMD manuals both mention possible bad side effects
> for having large pages (2MB/4MB/1GB) spanning multiple MTRRs.

qemu takes care to use gigabyte-alignment for guest RAM for performance
reasons.  Unless you are explicitly creating something unusual the
memory layout below 4G is 2G RAM + 2G MMIO (q35 machine type) or 3G RAM
+ 1G MMIO (pc machine type).

edk2 creates mtrr uncachable entries for the mmio regions (both 32bit
and 64bit window).  On q35 it looks like this:

  reg00: base=0x080000000 ( 2048MB), size= 2048MB, count=1: uncachable
  reg01: base=0x7000000000 (458752MB), size=65536MB, count=1: uncachable

Both are gigabyte-aligned and are a multiple of gigabytes in size, so
you simply can't create gigabyte page table entries crossing mtrr entry
borders.

That's relatively recent change though, q35 used to be different, see
commit e4b3fd905a17 ("OvmfPkg/PlatformInitLib: simplify mtrr setup")

> While I don't expect my comment to be a blocker (particularly as other
> OVMF platforms are already using them), I think it's probably a good
> idea to let you know.

Yes, thanks, sure good to know.  But I don't expect that being a
problem.

take care,
  Gerd


  reply	other threads:[~2023-05-22  9:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 10:24 [PATCH 0/3] OvmfPkg: gigabyte page tweaks Gerd Hoffmann
2023-05-17 10:24 ` [PATCH 1/3] OvmfPkg/PlatformInitLib: check PcdUse1GPageTable Gerd Hoffmann
2023-05-22 10:37   ` Ard Biesheuvel
2023-05-22 11:18     ` Gerd Hoffmann
2023-05-17 10:24 ` [PATCH 2/3] OvmfPkg/OvmfPkgIa32X64: enable 1G pages Gerd Hoffmann
2023-05-17 10:24 ` [PATCH 3/3] OvmfPkg/MicrovmX64: " Gerd Hoffmann
2023-05-17 23:16 ` [edk2-devel] [PATCH 0/3] OvmfPkg: gigabyte page tweaks Pedro Falcato
2023-05-22  9:39   ` Gerd Hoffmann [this message]
2023-05-25 15:48 ` Ard Biesheuvel
2023-05-29 11:41   ` Ard Biesheuvel

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=iuaw4eo432iotmmhnugzx4yfskroxxptpb7qpfr6md5oeab4tr@73pbwqsjclij \
    --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