From patchwork Tue Apr 9 22:53:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 235257 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D86AB2C00BB for ; Wed, 10 Apr 2013 08:54:13 +1000 (EST) Received: from localhost ([::1]:46353 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPhQZ-00012U-BM for incoming@patchwork.ozlabs.org; Tue, 09 Apr 2013 18:54:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPhQG-00012K-MX for qemu-devel@nongnu.org; Tue, 09 Apr 2013 18:53:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPhQF-0004ma-N4 for qemu-devel@nongnu.org; Tue, 09 Apr 2013 18:53:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPhQF-0004mC-Fl for qemu-devel@nongnu.org; Tue, 09 Apr 2013 18:53:51 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r39MrnS8000797 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 9 Apr 2013 18:53:49 -0400 Received: from [10.3.113.45] (ovpn-113-45.phx2.redhat.com [10.3.113.45]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r39Mrmrs003011; Tue, 9 Apr 2013 18:53:48 -0400 Message-ID: <1365548028.16420.180.camel@bling.home> From: Alex Williamson To: deniv@lavabit.com Date: Tue, 09 Apr 2013 16:53:48 -0600 In-Reply-To: <32071.216.218.134.12.1365546804.squirrel@lavabit.com> References: <29682.93.184.66.138.1365510165.squirrel@lavabit.com> <1365527892.16420.153.camel@bling.home> <32071.216.218.134.12.1365546804.squirrel@lavabit.com> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] VFIO-VGA Issue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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); }