Gerd Hoffmann (2): add romfile_loadbool() update pci_pad_mem64 handling
src/romfile.h | 1 + src/fw/pciinit.c | 13 ++++++++++--- src/romfile.c | 23 +++++++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-)
Translates strings in fw_cfg files into boolean values.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- src/romfile.h | 1 + src/romfile.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+)
diff --git a/src/romfile.h b/src/romfile.h index 3e0f820047dd..ae2f4ac7e718 100644 --- a/src/romfile.h +++ b/src/romfile.h @@ -15,6 +15,7 @@ struct romfile_s *romfile_findprefix(const char *prefix, struct romfile_s *prev) struct romfile_s *romfile_find(const char *name); void *romfile_loadfile(const char *name, int *psize); u64 romfile_loadint(const char *name, u64 defval); +u32 romfile_loadbool(const char *name, u32 defval);
void const_romfile_add_int(char *name, u32 value);
diff --git a/src/romfile.c b/src/romfile.c index b598274edc09..8072a9150685 100644 --- a/src/romfile.c +++ b/src/romfile.c @@ -99,6 +99,29 @@ romfile_loadint(const char *name, u64 defval) return val; }
+u32 +romfile_loadbool(const char *name, u32 defval) +{ + static const char *true_strings[] = { "1", "on", "yes" }; + static const char *false_strings[] = { "0", "off", "no" }; + char *str = romfile_loadfile(name, NULL); + int i; + + if (!str) + return defval; + + for (i = 0; i < ARRAY_SIZE(true_strings); i++) + if (0 == strcmp(str, true_strings[i])) + return 1; + + for (i = 0; i < ARRAY_SIZE(false_strings); i++) + if (0 == strcmp(str, false_strings[i])) + return 0; + + dprintf(1, "%s: unknown bool string: %s\n", __func__, str); + return defval; +} + struct const_romfile_s { struct romfile_s file; void *data;
Add a new possible state: '-1' means 'use default'. In that case seabios continue to use the current heuristic: In case memory above 4G is present enable 64-bit guest friendly configuration.
This allows forcing the one or the other behavior by setting the pci_pad_mem64 variable beforehand (which is done by another patch).
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- src/fw/pciinit.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index b3e359d7fe62..be76c447cf19 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -55,7 +55,7 @@ u64 pcimem64_end = BUILD_PCIMEM64_END; // Resource allocation limits static u64 pci_io_low_end = 0xa000; static u64 pci_mem64_top = 0; -static u32 pci_pad_mem64 = 0; +static u32 pci_pad_mem64 = -1;
struct pci_region_entry { struct pci_device *dev; @@ -1202,8 +1202,15 @@ pci_setup(void) } }
- if (CPUPhysBits >= 36 && CPULongMode && RamSizeOver4G) - pci_pad_mem64 = 1; + pci_pad_mem64 = romfile_loadbool("opt/org.seabios/pci64", -1); + + if (pci_pad_mem64 == -1) + // when not set enable in case memory over 4G is present + pci_pad_mem64 = RamSizeOver4G ? 1 : 0; + + if (!CPULongMode) + // force off for 32-bit CPUs + pci_pad_mem64 = 0;
dprintf(1, "=== PCI bus & bridge init ===\n"); if (pci_probe_host() != 0) {
Thank you! Works for my 32-bit Debian 12 VM :)
I wanted to briefly ask if a new SeaBIOS release is planned before/for QEMU 10.0?
A colleague told me that commit ec0bc256 ("limit address space used for pci devices, part two") alleviates another issue one of our users faced. Of course we could ship an updated SeaBIOS ROM downstream, but others might benefit from a new release too, so I wanted to ask.
Best Regards, Fiona
Am 22.11.24 um 15:33 schrieb Gerd Hoffmann:
Add a new possible state: '-1' means 'use default'. In that case seabios continue to use the current heuristic: In case memory above 4G is present enable 64-bit guest friendly configuration.
This allows forcing the one or the other behavior by setting the pci_pad_mem64 variable beforehand (which is done by another patch).
Signed-off-by: Gerd Hoffmann kraxel@redhat.com
src/fw/pciinit.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index b3e359d7fe62..be76c447cf19 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -55,7 +55,7 @@ u64 pcimem64_end = BUILD_PCIMEM64_END; // Resource allocation limits static u64 pci_io_low_end = 0xa000; static u64 pci_mem64_top = 0; -static u32 pci_pad_mem64 = 0; +static u32 pci_pad_mem64 = -1;
struct pci_region_entry { struct pci_device *dev; @@ -1202,8 +1202,15 @@ pci_setup(void) } }
- if (CPUPhysBits >= 36 && CPULongMode && RamSizeOver4G)
pci_pad_mem64 = 1;
pci_pad_mem64 = romfile_loadbool("opt/org.seabios/pci64", -1);
if (pci_pad_mem64 == -1)
// when not set enable in case memory over 4G is present
pci_pad_mem64 = RamSizeOver4G ? 1 : 0;
if (!CPULongMode)
// force off for 32-bit CPUs
pci_pad_mem64 = 0;
dprintf(1, "=== PCI bus & bridge init ===\n"); if (pci_probe_host() != 0) {
On Thu, Mar 06, 2025 at 11:44:01AM +0100, Fiona Ebner wrote:
Thank you! Works for my 32-bit Debian 12 VM :)
I wanted to briefly ask if a new SeaBIOS release is planned before/for QEMU 10.0?
Hmm. Kevin? 1.17.0 release was briefly discussed a while back (january IIRC). Doing another 1.16.x feels wrong with the amount of changes we have in master now.
I'm not aware of any pending changes right now. So we could call code freeze now and tag the release in ~ two weeks. I can update seabios in qemu to a snapshot now for some additional test coverage, and to 1.17.0 final by end of march.
comments?
take care, Gerd
On Mon, Mar 10, 2025 at 04:21:30PM +0100, Gerd Hoffmann wrote:
On Thu, Mar 06, 2025 at 11:44:01AM +0100, Fiona Ebner wrote:
Thank you! Works for my 32-bit Debian 12 VM :)
I wanted to briefly ask if a new SeaBIOS release is planned before/for QEMU 10.0?
Hmm. Kevin? 1.17.0 release was briefly discussed a while back (january IIRC). Doing another 1.16.x feels wrong with the amount of changes we have in master now.
I'm not aware of any pending changes right now. So we could call code freeze now and tag the release in ~ two weeks. I can update seabios in qemu to a snapshot now for some additional test coverage, and to 1.17.0 final by end of march.
comments?
I don't see an issue with tagging a new release. Alas, my schedule has been busy recently. How about we target mid-April for the next release?
-Kevin
On Fri, Nov 22, 2024 at 03:33:04PM +0100, Gerd Hoffmann wrote:
Gerd Hoffmann (2): add romfile_loadbool() update pci_pad_mem64 handling
Thanks. It looks fine to me. Feel free to commit when you are ready.
Cheers, -Kevin
src/romfile.h | 1 + src/fw/pciinit.c | 13 ++++++++++--- src/romfile.c | 23 +++++++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-)
-- 2.47.0
SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
On Tue, Dec 24, 2024 at 06:49:35PM -0500, Kevin O'Connor wrote:
On Fri, Nov 22, 2024 at 03:33:04PM +0100, Gerd Hoffmann wrote:
Gerd Hoffmann (2): add romfile_loadbool() update pci_pad_mem64 handling
Thanks. It looks fine to me. Feel free to commit when you are ready.
Pushed now.
take care, Gerd