From: Alex Williamson <alex.williamson@redhat.com>
To: deniv@lavabit.com
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] VFIO-VGA Issue
Date: Wed, 10 Apr 2013 09:37:16 -0600 [thread overview]
Message-ID: <1365608236.2918.15.camel@bling.home> (raw)
In-Reply-To: <37001.31.172.30.1.1365552128.squirrel@lavabit.com>
On Tue, 2013-04-09 at 20:02 -0400, deniv@lavabit.com wrote:
> > On Tue, 2013-04-09 at 18:33 -0400, deniv@lavabit.com wrote:
> >> Here's debug output from qemu, the last lines repeat indefinitely:
> >>
> >> vfio: vfio_initfn(0000:01:00.0) group 1
> >> vfio: region_add 0 - 7fffffff [0x7f605fe00000]
> >> vfio: SKIPPING region_add fec00000 - fec00fff
> >> vfio: SKIPPING region_add fed00000 - fed003ff
> >> vfio: SKIPPING region_add fee00000 - feefffff
> >> vfio: SKIPPING region_add fffe0000 - ffffffff
> >> vfio: Device 0000:01:00.0 flags: 3, regions: 9, irgs: 3
> >> vfio: Device 0000:01:00.0 region 0:
> >> vfio: size: 0x10000000, offset: 0x0, flags: 0x7
> >> vfio: Device 0000:01:00.0 region 1:
> >> vfio: size: 0x0, offset: 0x10000000000, flags: 0x0
> >> vfio: Device 0000:01:00.0 region 2:
> >> vfio: size: 0x40000, offset: 0x20000000000, flags: 0x7
> >> vfio: Device 0000:01:00.0 region 3:
> >> vfio: size: 0x0, offset: 0x30000000000, flags: 0x0
> >> vfio: Device 0000:01:00.0 region 4:
> >> vfio: size: 0x100, offset: 0x40000000000, flags: 0x3
> >> vfio: Device 0000:01:00.0 region 5:
> >> vfio: size: 0x0, offset: 0x50000000000, flags: 0x0
> >> vfio: Device 0000:01:00.0 ROM:
> >> vfio: size: 0x20000, offset: 0x60000000000, flags: 0x1
> >> vfio: Device 0000:01:00.0 config:
> >> vfio: size: 0x1000, offset: 0x70000000000, flags: 0x3
> >> vfio: vfio_load_rom(0000:01:00.0)
> >> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x4010, 4)
> >> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0xe000000c
> >> vfio: Enabled ATI/AMD quirk 0x4010 for device 0000:01:00.0
> >> vfio: Enabled ATI/AMD quirk 0x3c3 for device 0000:01:00.0
> > ...
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> >
> > This is a quirk that I haven't fully figured out yet. ATI/AMD cards use
> > VGA register 0x3c3 to read upper byte of the address of the I/O port
> > BAR, but sometimes it reads 0. Try the patch below to have it always
> > return the virtual BAR address and let me know if it works. Thanks,
> >
> > Alex
> >
> > --- a/hw/vfio_pci.c
> > +++ b/hw/vfio_pci.c
> > @@ -1117,7 +1117,7 @@ static uint64_t vfio_ati_3c3_quirk_read(void
> > *opaque,
> > uint64_t data = vfio_vga_read(&vdev->vga.region[QEMU_PCI_VGA_IO_HI],
> > addr + 0x3, size);
> >
> > - if (data == quirk->data) {
> > + if (1 || data == quirk->data) {
> > data = pci_get_byte(pdev->config + PCI_BASE_ADDRESS_4 + 1);
> > DPRINTF("%s(0x3c3, 1) = 0x%"PRIx64"\n", __func__, data);
> > }
> >
> >
>
> Although with this patch I get much further, monitor still doesn't sync. I
> also see some effects on my host GPU (Intel HD4000). Starting qemu ruins
> colors (black turns green, blue turns purple, etc). Though switching to
> linux console and back to Xorg fixes it.
Hmm, seems like that would imply the VGA arbitration isn't working.
When I test, I'm not running anything on the boot graphics device, it's
sitting at a vt login.
> Debug output this time is huge with most of the lines being variations of
> those below. On line 58515 qemu hangs again, and the last two blocks from
> this snip repeat indefinitely:
Was this with or without KVM acceleration? Is it hung or does the code
below repeat indefinitely? It can take a long time to get something
drawn to the screen with all this debug output, but the monitor should
get signal pretty quickly. Check dmesg and look for errors reading the
ROM file, starting qemu w/ a ROM isn't going to get very far.
> ...
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x1730, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x1
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0xbfffb808, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x80
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0xbfffbc08, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x200
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x1730, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x1
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0xbfffbc08, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x200
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0xbfffa008, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x1
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x1730, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x1
> vfio: vfio_vga_write(0x3c4, 0x1, 1)
> vfio: vfio_vga_read(0x3c5, 1) = 0x0
> vfio: vfio_vga_write(0x3c5, 0x20, 1)
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0xbfffa2d4, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x0
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x6e74, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x1
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x6e74, 4)
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x4, 0x1, 4)
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x6e74, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x1
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x6e74, 4)
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x4, 0x101, 4)
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x6e70, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x10410311
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x6e8c, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x10029
> vfio: vfio_vga_read(0x3c3, 1) = 0x0
> vfio: vfio_ati_3c3_quirk_read(0x3c3, 1) = 0xc0
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4c, 4) = 0x0
> vfio: vfio_bar_write(0000:01:00.0:BAR4+0x0, 0x6e8c, 4)
> vfio: vfio_bar_read(0000:01:00.0:BAR4+0x4, 4) = 0x10029
Do you mean the above 5 lines are repeated or the whole sequence? It
seems to be making some progress over the whole log, but I couldn't tell
you what it's doing. Reading 0x3c3 to get the BAR3 address, then using
it to do some kind of access is pretty typical behavior. Things I would
try - If the HD4000 is not the bare metal boot VGA, make it so.
Blacklist the radeon driver in the host so that you give the card to
qemu in a "fresh" state. Thanks,
Alex
next prev parent reply other threads:[~2013-04-10 15:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-09 12:22 [Qemu-devel] VFIO-VGA Issue deniv
2013-04-09 17:18 ` Alex Williamson
2013-04-09 22:17 ` Alex Williamson
2013-04-10 9:01 ` Gleb Natapov
2013-04-10 15:20 ` Alex Williamson
2013-04-10 15:22 ` Gleb Natapov
2013-04-10 17:36 ` Paolo Bonzini
2013-04-09 22:33 ` deniv
2013-04-09 22:53 ` Alex Williamson
2013-04-10 0:02 ` deniv
2013-04-10 15:37 ` Alex Williamson [this message]
2013-04-10 17:11 ` deniv
2013-04-10 18:30 ` Alex Williamson
2013-04-10 20:32 ` deniv
2013-04-10 20:42 ` Alex Williamson
2013-04-11 17:59 ` deniv
2013-04-15 18:48 ` Alex Williamson
2013-04-25 18:15 ` deniv
[not found] ` <517915C5.3020309@lavabit.com>
[not found] ` <1366915789.2918.794.camel@bling.home>
2013-04-26 12:02 ` deniv
-- strict thread matches above, loose matches on Subject: below --
2013-05-16 20:46 Maik Broemme
2013-05-17 10:23 ` Paolo Bonzini
2013-05-20 3:10 ` Alex Williamson
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=1365608236.2918.15.camel@bling.home \
--to=alex.williamson@redhat.com \
--cc=deniv@lavabit.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).