Skip to contentSkip to conversation

pciinit: Enable default VGA device

PATCH RESEND Superseded Alex Williamson 3 participants 8 messages Mar 19, 2013 – Mar 20, 2013

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 pciinit: Enable default VGA device

As QEMU gains PCI bridge and PCIe root port support, we won't always find the VGA device on the root bus. We therefore need to add support to find and enable a VGA device and the path to it through the VGA Enable support in the PCI bridge control register.

---
 src/optionroms.c |    2 +-
 src/pciinit.c    |   45 +++++++++++++++++++++++++++++++++++++++++++++
 src/util.h       |    1 +
 3 files changed, 47 insertions(+), 1 deletion(-)
src/optionroms.c +1 -1
index caa2151..ac92613 100644
@@ -213,7 +213,7 @@ run_file_roms(const char *prefix, int isvga, u64 *sources)
  ****************************************************************/
 
 // Verify device is a vga device with legacy address decoding enabled.
-static int
+int
 is_pci_vga(struct pci_device *pci)
 {
     if (pci->class != PCI_CLASS_DISPLAY_VGA)
src/pciinit.c +45 -0

55 lines not on this page · raw message

src/util.h +1 -0
index af029fc..99aff78 100644
@@ -344,6 +344,7 @@ void vgahook_setup(struct pci_device *pci);
 
 // optionroms.c
 void call_bcv(u16 seg, u16 ip);
+int is_pci_vga(struct pci_device *pci);
 void optionrom_setup(void);
 void vgarom_setup(void);
 void s3_resume_vga(void);
#1 lore raw
Quoted 4 lines · Alex Williamson

As QEMU gains PCI bridge and PCIe root port support, we won't always find the VGA device on the root bus. We therefore need to add support to find and enable a VGA device and the path to it through the VGA Enable support in the PCI bridge control register.

Thanks. I'm okay with the change. It would be nice if someone more familiar with the QEMU side could ack this patch.

As a minor nitpick - there is a pci_config_maskw() that would simplify your code.

-Kevin

#2 lore raw
Quoted 11 lines · Kevin O'Connor
Quoted 4 lines · Alex Williamson

As QEMU gains PCI bridge and PCIe root port support, we won't always find the VGA device on the root bus. We therefore need to add support to find and enable a VGA device and the path to it through the VGA Enable support in the PCI bridge control register.

Thanks. I'm okay with the change. It would be nice if someone more familiar with the QEMU side could ack this patch.

As a minor nitpick - there is a pci_config_maskw() that would simplify your code.

Ah, that does clean it up a bit. Actually, hold off on this patch. I'm getting VGA routing setup as I expect, but guests are not happy with the other apertures on the bridges and I'm not sure if I'm contributing to that problem yet. Thanks,

Alex

#3 lore raw
Quoted 10 lines · Alex Williamson
Quoted 9 lines · Kevin O'Connor
Quoted 4 lines · Alex Williamson

As QEMU gains PCI bridge and PCIe root port support, we won't always find the VGA device on the root bus. We therefore need to add support to find and enable a VGA device and the path to it through the VGA Enable support in the PCI bridge control register.

Thanks. I'm okay with the change. It would be nice if someone more familiar with the QEMU side could ack this patch.

Quoted 7 lines
Quoted 2 lines

As a minor nitpick - there is a pci_config_maskw() that would simplify your code.

Ah, that does clean it up a bit. Actually, hold off on this patch. I'm getting VGA routing setup as I expect, but guests are not happy with the other apertures on the bridges and I'm not sure if I'm contributing to that problem yet. Thanks,

Turns out it's this:

commit 76e58028d28e78431f9de3cee0b3c88d807fa39d

Author: Kevin O'Connor <[email protected]>
Date:   Wed Mar 6 21:50:09 2013 -0500

acpi: Eliminate BDAT parameter passing to DSDT code.

The "BDAT" construct is the only ACPI mechanism that relies on SeaBIOS reserved memory. Replace it with the SSDT based template system.

I'll look at it more tomorrow, I should already be asleep by now. When I boot a linux guest on qemu with a device behind a bridge I see "no compatible bridge window for <range>" messages and the apertures get de-programmed. So I think the VGA patch here still works, but it's kind of useless as only the VGA ranges get routed and we can't even get to VESA modes because of the apertures getting shutdown. Thanks,

Alex

#4 lore raw

Hi,

Quoted 6 lines

Turns out it's this:

commit 76e58028d28e78431f9de3cee0b3c88d807fa39d

Author: Kevin O'Connor <[email protected]>
Date:   Wed Mar 6 21:50:09 2013 -0500
Quoted 6 lines

acpi: Eliminate BDAT parameter passing to DSDT code.

The "BDAT" construct is the only ACPI mechanism that relies on SeaBIOS reserved memory. Replace it with the SSDT based template system.

That is most likely dsdt + bios.bin not being in sync. Simply using 'qemu -bios /path/to/seabios/out/bios.bin' doesn't fly due to qemu using a non-matching dsdt then.

With qemu/master you can just use 'qemu -L /path/to/seabios/out' instead and qemu will pick up both bios.bin and dsdt from the fresh seabios build directory then (and anything else it doesn't find there from the default locations).

HTH,
Gerd

#5 lore raw
Quoted 15 lines · Gerd Hoffmann

Hi,

Quoted 6 lines

Turns out it's this:

commit 76e58028d28e78431f9de3cee0b3c88d807fa39d

Author: Kevin O'Connor <[email protected]>
Date:   Wed Mar 6 21:50:09 2013 -0500
Quoted 6 lines

acpi: Eliminate BDAT parameter passing to DSDT code.

The "BDAT" construct is the only ACPI mechanism that relies on SeaBIOS reserved memory. Replace it with the SSDT based template system.

Quoted 8 lines

That is most likely dsdt + bios.bin not being in sync. Simply using 'qemu -bios /path/to/seabios/out/bios.bin' doesn't fly due to qemu using a non-matching dsdt then.

With qemu/master you can just use 'qemu -L /path/to/seabios/out' instead and qemu will pick up both bios.bin and dsdt from the fresh seabios build directory then (and anything else it doesn't find there from the default locations).

Thanks, yes that's it. QEMU only seems to look in the -L path or the current directory for the missing files, so it's a bit messy but works. I'll just go ahead and roll a v3 of the VGA patch that converts to wmask since I'm muddied the waters on v2 here. Thanks,

Alex

#6 lore raw

Hi,

Quoted 7 lines
Quoted 4 lines

With qemu/master you can just use 'qemu -L /path/to/seabios/out' instead and qemu will pick up both bios.bin and dsdt from the fresh seabios build directory then (and anything else it doesn't find there from the default locations).

Thanks, yes that's it. QEMU only seems to look in the -L path or the current directory for the missing files, so it's a bit messy but works.

You can specify -L multiple times now (master only, not in 1.4.0) and create a search path that way.

HTH,
Gerd

#7 lore raw
Quoted 7 lines · Gerd Hoffmann

Hi,

Quoted 5 lines
Quoted 4 lines

With qemu/master you can just use 'qemu -L /path/to/seabios/out' instead and qemu will pick up both bios.bin and dsdt from the fresh seabios build directory then (and anything else it doesn't find there from the default locations).

Quoted 5 lines
Quoted 2 lines

Thanks, yes that's it. QEMU only seems to look in the -L path or the current directory for the missing files, so it's a bit messy but works.

You can specify -L multiple times now (master only, not in 1.4.0) and create a search path that way.

Awesome. Thanks