qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: seabios@seabios.org
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH 3/4] move 64bit pci window to end of address space
Date: Mon, 21 Nov 2022 11:32:12 +0100	[thread overview]
Message-ID: <20221121103213.1675568-4-kraxel@redhat.com> (raw)
In-Reply-To: <20221121103213.1675568-1-kraxel@redhat.com>

When the size of the physical address space is known (PhysBits is not
zero) move the 64bit pci io window to the end of the address space.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 src/fw/pciinit.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
index badf13d3233b..ad6def93633b 100644
--- a/src/fw/pciinit.c
+++ b/src/fw/pciinit.c
@@ -1128,6 +1128,14 @@ static void pci_bios_map_devices(struct pci_bus *busses)
         r64_mem.base = le64_to_cpu(romfile_loadint("etc/reserved-memory-end", 0));
         if (r64_mem.base < 0x100000000LL + RamSizeOver4G)
             r64_mem.base = 0x100000000LL + RamSizeOver4G;
+        if (PhysBits) {
+            u64 top = 1LL << PhysBits;
+            u64 size = (ALIGN(sum_mem, (1LL<<30)) +
+                        ALIGN(sum_pref, (1LL<<30)));
+            if (r64_mem.base < top - size) {
+                r64_mem.base = top - size;
+            }
+        }
         r64_mem.base = ALIGN(r64_mem.base, align_mem);
         r64_mem.base = ALIGN(r64_mem.base, (1LL<<30));    // 1G hugepage
         r64_pref.base = r64_mem.base + sum_mem;
-- 
2.38.1



  parent reply	other threads:[~2022-11-21 10:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 10:32 [PATCH 0/4] misc tweaks for kvm and the 64bit pci window Gerd Hoffmann
2022-11-21 10:32 ` [PATCH 1/4] better kvm detection Gerd Hoffmann
2023-01-20 12:21   ` [SeaBIOS] " David Woodhouse
2022-11-21 10:32 ` [PATCH 2/4] detect physical address space size Gerd Hoffmann
2022-11-21 10:32 ` Gerd Hoffmann [this message]
2022-11-21 10:57   ` [SeaBIOS] [PATCH 3/4] move 64bit pci window to end of address space Paul Menzel
2022-11-23 10:39     ` Gerd Hoffmann
2022-11-21 10:32 ` [PATCH 4/4] be less conservative with the 64bit pci io window Gerd Hoffmann
2022-11-22 18:43   ` Kevin O'Connor
2022-11-23 10:25     ` Gerd Hoffmann
2022-12-08 16:01       ` [SeaBIOS] " Igor Mammedov
2022-12-09 11:51         ` Gerd Hoffmann

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-all 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=20221121103213.1675568-4-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=seabios@seabios.org \
    /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;
as well as URLs for NNTP newsgroup(s).