From: Gerd Hoffmann <kraxel@redhat.com>
To: Dave Airlie <airlied@gmail.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] issue with vgabios lfb and virtio vga
Date: Thu, 12 Dec 2013 09:17:20 +0100 [thread overview]
Message-ID: <1386836240.19301.6.camel@nilsson.home.kraxel.org> (raw)
In-Reply-To: <CAPM=9tx+5tpQXPQ7qn5F1mKD0=HbdCM4U1zxzQz6sQGLePW_sQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 546 bytes --]
On Do, 2013-12-12 at 09:51 +1000, Dave Airlie wrote:
> Now the vgabios.c does a check of bar 0 and bar 1 to see if they are
> 0xfff1 masked, this protects against the the i/o bar but fails to
> protect against the LFB one as PCI BARs don't encode the size just the
> base address, and a 4k BAR can be aligned to a larger size.
> Any ideas? I seem to remember vgabios.c had a hack in the past for
> vmware, but I'm not sure.
The fallback to bar #1 *is* the vmware hack ;)
Something like the attached patch should do the trick.
cheers,
Gerd
[-- Attachment #2: fix --]
[-- Type: text/x-patch, Size: 1092 bytes --]
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index 6da9d5d..7325059 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -402,12 +402,17 @@ bochsvga_setup(void)
u32 lfb_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
int bdf = GET_GLOBAL(VgaBDF);
if (CONFIG_VGA_PCI && bdf >= 0) {
+ u16 vendor = pci_config_readw(bdf, PCI_VENDOR_ID);
int barid = 0;
- u32 bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_0);
- if ((bar & PCI_BASE_ADDRESS_SPACE) != PCI_BASE_ADDRESS_SPACE_MEMORY) {
- barid = 1;
- bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_1);
+ switch (vendor) {
+ case 0x15ad: /* qemu vmware vga */
+ int barid = 1;
+ break;
+ case 0xFIXME: /* virtio-vga */
+ int barid = 2;
+ break;
}
+ u32 bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_0);
lfb_addr = bar & PCI_BASE_ADDRESS_MEM_MASK;
dprintf(1, "VBE DISPI: bdf %02x:%02x.%x, bar %d\n", pci_bdf_to_bus(bdf)
, pci_bdf_to_dev(bdf), pci_bdf_to_fn(bdf), barid);
next prev parent reply other threads:[~2013-12-12 8:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-11 23:51 [Qemu-devel] issue with vgabios lfb and virtio vga Dave Airlie
2013-12-12 8:17 ` Gerd Hoffmann [this message]
2013-12-13 1:58 ` Dave Airlie
2013-12-13 7:06 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386836240.19301.6.camel@nilsson.home.kraxel.org \
--to=kraxel@redhat.com \
--cc=airlied@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).