The MODESEGMENT condition is backwards, with the effect that mmconfig mode is not used to configure pci bars during POST.
Oops. Fix it.
The only real mode pci config space access seems to come from the ipxe option rom initialiation. Which happens to work via mmconfig because it runs in big real mode so this went unnoticed ...
Fixes: 6a3b59ab9c7d ("pci: add mmconfig support") Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- src/hw/pci.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/hw/pci.c b/src/hw/pci.c index d9dbf313965c..3df1dae41d2b 100644 --- a/src/hw/pci.c +++ b/src/hw/pci.c @@ -28,7 +28,7 @@ static u32 ioconfig_cmd(u16 bdf, u32 addr)
void pci_config_writel(u16 bdf, u32 addr, u32 val) { - if (MODESEGMENT && mmconfig) { + if (!MODESEGMENT && mmconfig) { writel(mmconfig_addr(bdf, addr), val); } else { outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD); @@ -38,7 +38,7 @@ void pci_config_writel(u16 bdf, u32 addr, u32 val)
void pci_config_writew(u16 bdf, u32 addr, u16 val) { - if (MODESEGMENT && mmconfig) { + if (!MODESEGMENT && mmconfig) { writew(mmconfig_addr(bdf, addr), val); } else { outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD); @@ -48,7 +48,7 @@ void pci_config_writew(u16 bdf, u32 addr, u16 val)
void pci_config_writeb(u16 bdf, u32 addr, u8 val) { - if (MODESEGMENT && mmconfig) { + if (!MODESEGMENT && mmconfig) { writeb(mmconfig_addr(bdf, addr), val); } else { outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD); @@ -58,7 +58,7 @@ void pci_config_writeb(u16 bdf, u32 addr, u8 val)
u32 pci_config_readl(u16 bdf, u32 addr) { - if (MODESEGMENT && mmconfig) { + if (!MODESEGMENT && mmconfig) { return readl(mmconfig_addr(bdf, addr)); } else { outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD); @@ -68,7 +68,7 @@ u32 pci_config_readl(u16 bdf, u32 addr)
u16 pci_config_readw(u16 bdf, u32 addr) { - if (MODESEGMENT && mmconfig) { + if (!MODESEGMENT && mmconfig) { return readw(mmconfig_addr(bdf, addr)); } else { outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD); @@ -78,7 +78,7 @@ u16 pci_config_readw(u16 bdf, u32 addr)
u8 pci_config_readb(u16 bdf, u32 addr) { - if (MODESEGMENT && mmconfig) { + if (!MODESEGMENT && mmconfig) { return readb(mmconfig_addr(bdf, addr)); } else { outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD);
Dear Gerd,
Am 25.05.20 um 11:06 schrieb Gerd Hoffmann:
The MODESEGMENT condition is backwards, with the effect that mmconfig mode is not used to configure pci bars during POST.
Oops. Fix it.
The only real mode pci config space access seems to come from the ipxe option rom initialiation. Which happens to work via mmconfig
initialization
because it runs in big real mode so this went unnoticed ...
Fixes: 6a3b59ab9c7d ("pci: add mmconfig support") Signed-off-by: Gerd Hoffmann kraxel@redhat.com
src/hw/pci.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
[…]
Reviewed-by: Paul Menzel pmenzel@molgen.mpg.de
Kind regards,
Paul
On Mon, May 25, 2020 at 11:06:27AM +0200, Gerd Hoffmann wrote:
The MODESEGMENT condition is backwards, with the effect that mmconfig mode is not used to configure pci bars during POST.
Oops. Fix it.
Thanks. I went ahead and committed this patch.
-Kevin