* [edk2-devel] The different I/O ports space distribution in Ovmf and seaBIOS , can I change the default I/O space in Ovmf?
@ 2025-01-20 9:45 huaminxu3 via groups.io
0 siblings, 0 replies; only message in thread
From: huaminxu3 via groups.io @ 2025-01-20 9:45 UTC (permalink / raw)
To: devel
[-- Attachment #1.1: Type: text/plain, Size: 3051 bytes --]
In OVMF PCI I/O space address distribution , according to the OvmfPkg/Library/PlatformInitLib/Platform.c
VOID
EFIAPI
PlatformMemMapInitialization (
IN OUT EFI_HOB_PLATFORM_INFO * PlatformInfoHob
)
{
UINT64 PciIoBase ;
UINT64 PciIoSize ;
UINT64 PciExBarBase ;
UINT32 PciBase ;
UINT32 PciSize ;
PciIoBase = 0xC000 ;
PciIoSize = 0x4000 ;
The PciIoBase and PciIoSize determine the I/O address space spare for PCI devices. In Ovmf, the two variables are fixed. The PciIoBase = 0xC000 and the PciIoSize = 0x4000 , which means the I/O space for PCI devices is 0x4000. In some circumstances, for example, when I attach many devices to the virtual machine , the 0x4000 is not enough. When I attach 8 PCI bridges and 100 netcards and 100 virtio disks, many devices are unusable. The I/O address of these devices become all 1, just as the following picture shows:
I compared the ovmf with seaBIOS and found that the virtual machine using seaBIOS can work properly. I looked into the I/O space distribution implement of seaBIOS and found that in qemu\roms\seabios\src\fw\pciinit.c, it says :
/*
* QEMU I/O address space usage:
* 0000 - 0fff legacy isa, pci config, pci root bus, ...
* 1000 - 9fff free
* a000 - afff hotplug (cpu, pci via acpi, i440fx/piix only)
* b000 - bfff power management (PORT_ACPI_PM_BASE)
* [ qemu 1.4+ implements pci config registers
* properly so guests can place the registers
* where they want, on older versions its fixed ]
* c000 - ffff free, traditionally used for pci io
*/
It seems that the 0x1000-0x9fff space can be used for PCI I/O space. In the seaBIOS, it calculates the total I/O space usage by PCI devices, if the total usage exceeds 0x4000, it use 0x1000-0x9fff for PCI I/O space, otherwise it uses 0xC000-0xFFFF:
struct pci_region * r_io = & bus -> r [ PCI_REGION_TYPE_IO ];
u64 sum = pci_region_sum ( r_io );
if ( sum < 0x4000 ) {
/* traditional region is big enougth, use it */
r_io -> base = 0xc000 ;
} else if ( sum < pci_io_low_end - 0x1000 ) {
/* use the larger region at 0x1000 */
r_io -> base = 0x1000 ;
} else {
/* not enouth io address space -> error out */
return - 1 ;
}
Due to the different implement of OVMF and seaBIOS, the OVMF can not know how much PCI I/O space all the devices use. So I am wondering that is it proper to change the default PCI I/O space to 0x1000-0x9FFF to fit more devices (for example , 100 netcards and 100 virtio disks). In that case, the PciIoBase =0x1000 and PciIoSize = 0x9000.
I am hoping that I can get a reply. Thank for you help.
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#121027): https://edk2.groups.io/g/devel/message/121027
Mute This Topic: https://groups.io/mt/110712298/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
[-- Attachment #1.2: Type: text/html, Size: 10939 bytes --]
[-- Attachment #2: image.png --]
[-- Type: image/png, Size: 150527 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-01-20 10:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-20 9:45 [edk2-devel] The different I/O ports space distribution in Ovmf and seaBIOS , can I change the default I/O space in Ovmf? huaminxu3 via groups.io
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox