On Thu, Nov 21, 2024 at 05:07:50PM +0100, Gerd Hoffmann wrote:
Allow setting pci_pad_mem64 via fw_cfg. Usage: qemu -fw_cfg name=opt/org.seabios/pci64,string={yes,no}
Signed-off-by: Gerd Hoffmann kraxel@redhat.com
src/util.h | 1 + src/fw/paravirt.c | 13 +++++++++++++ src/fw/pciinit.c | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/util.h b/src/util.h index aff8e888955e..03dcafb83794 100644 --- a/src/util.h +++ b/src/util.h @@ -135,6 +135,7 @@ void multiboot_init(void); extern u64 pcimem_start, pcimem_end; extern u64 pcimem64_start, pcimem64_end; extern const u8 pci_irqs[4]; +extern u32 pci_pad_mem64; void pci_setup(void); void pci_resume(void);
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index e5d4eca0cb5a..6428a70361c4 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -718,6 +718,19 @@ void qemu_cfg_init(void) dprintf(1, "Moving pm_base to 0x%x\n", acpi_pm_base); }
- // 64-bit pci mmio window
- char *hint = romfile_loadfile("opt/org.seabios/pci64", NULL);
- if (hint) {
if (0 == strcmp(hint, "0") ||
0 == strcmp(hint, "no") ||
0 == strcmp(hint, "off"))
pci_pad_mem64 = 0;
if (0 == strcmp(hint, "1") ||
0 == strcmp(hint, "yes") ||
0 == strcmp(hint, "on"))
pci_pad_mem64 = 1;
- }
Thanks. In general it seems fine to me.
For what it is worth, the "filename" and format seems a little odd to me. We've not used the "opt/org.seabios/" scheme prior. We can adopt that scheme going forward I guess. The "pci64" seems very generic to me - if I understand the capability, we're padding space between 64bit memory regions for busses, not enabling 64bit pci. Alas, I'm not sure I have a good suggestion for an alternative.
If we want to support human readable values (eg, "on") perhaps it would be good to add a romfile_readbool() helper to romfile.c (or similar).
Also, any reason to put this in paravirt.c instead of directly in pciinit.c?
Thanks again, -Kevin