public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/1] OvmfPkg/PciHotPlugInitDxe: fix io window size
@ 2023-06-26 10:38 Gerd Hoffmann
  2023-06-26 10:42 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2023-06-26 10:38 UTC (permalink / raw)
  To: devel
  Cc: Jordan Justen, Oliver Steffen, Gerd Hoffmann, Ard Biesheuvel,
	Jiewen Yao

Smallest IO window size for PCI bridges is 0x1000.  Fix default size
accordingly.  Avoids broken resource assignments like this:

    [ ... ]
    PciBus: Resource Map for Root Bridge PciRoot(0x0)
    Type =   Io16; Base = 0x6000;   Length = 0x7000;        Alignment = 0xFFF
    [ ... ]
       Base = 0xC000;       Length = 0x200; Alignment = 0xFFF;      Owner = PPB [00|02|00:**]
       Base = 0xC200;       Length = 0x40;  Alignment = 0x3F;       Owner = PCI [00|1F|03:20]
       Base = 0xC240;       Length = 0x20;  Alignment = 0x1F;       Owner = PCI [00|1F|02:20]
    [ ... ]

... which the linux kernel fixes up later:

    [    0.644657] pci 0000:00:1f.3: BAR 4: assigned [io  0x1000-0x103f]
    [    0.646833] pci 0000:00:1f.2: BAR 4: assigned [io  0x1040-0x105f]

With the patch applied:

    { ... ]
    PciBus: Resource Map for Root Bridge PciRoot(0x0)
    Type =   Io16; Base = 0x6000;   Length = 0x8000;        Alignment = 0xFFF
    [ ... ]
       Base = 0xC000;       Length = 0x1000;        Alignment = 0xFFF;      Owner = PPB [00|02|00:**]
       Base = 0xD000;       Length = 0x40;  Alignment = 0x3F;       Owner = PCI [00|1F|03:20]
       Base = 0xD040;       Length = 0x20;  Alignment = 0x1F;       Owner = PCI [00|1F|02:20]
    [ ... ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c
index 69903a600981..bb2389d16c70 100644
--- a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c
+++ b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c
@@ -741,7 +741,7 @@ GetResourcePadding (
     //
     // Request defaults.
     //
-    SetIoPadding (--FirstResource, (UINTN)HighBitSetRoundUp64 (512));
+    SetIoPadding (--FirstResource, (UINTN)HighBitSetRoundUp64 (0x1000));
   }
 
   if (DefaultMmio) {
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-26 10:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-26 10:38 [PATCH v2 1/1] OvmfPkg/PciHotPlugInitDxe: fix io window size Gerd Hoffmann
2023-06-26 10:42 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox