From patchwork Mon Sep 27 20:41:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 213372 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8RKfwa4016470 for ; Mon, 27 Sep 2010 20:41:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760187Ab0I0Ule (ORCPT ); Mon, 27 Sep 2010 16:41:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51199 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753328Ab0I0Uld (ORCPT ); Mon, 27 Sep 2010 16:41:33 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8RKfFBR021398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Sep 2010 16:41:15 -0400 Received: from [10.3.113.98] (ovpn-113-98.phx2.redhat.com [10.3.113.98]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8RKfDU9011022; Mon, 27 Sep 2010 16:41:14 -0400 Subject: Re: [PATCH 3/3] VFIO V4: VFIO driver: Non-privileged user level PCI drivers From: Alex Williamson To: Tom Lyon Cc: linux-pci@vger.kernel.org, jbarnes@virtuousgeek.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, randy.dunlap@oracle.com, arnd@arndb.de, joro@8bytes.org, hjk@linutronix.de, avi@redhat.com, gregkh@suse.de, chrisw@sous-sol.org, mst@redhat.com In-Reply-To: <4c9a72a0.u2cnjUB7QZ91tLeo%pugs@cisco.com> References: <4c9a72a0.u2cnjUB7QZ91tLeo%pugs@cisco.com> Date: Mon, 27 Sep 2010 14:41:13 -0600 Message-ID: <1285620073.4951.44.camel@x201> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 27 Sep 2010 20:41:58 +0000 (UTC) diff --git a/drivers/vfio/vfio_pci_config.c b/drivers/vfio/vfio_pci_config.c index b7de0bf..b1ee352 100644 --- a/drivers/vfio/vfio_pci_config.c +++ b/drivers/vfio/vfio_pci_config.c @@ -402,7 +402,7 @@ static void vfio_bar_fixup(struct vfio_dev *vdev) mask = ~(pci_resource_len(pdev, bar) - 1); else mask = 0; - lp = (u32 *)vdev->vconfig + PCI_BASE_ADDRESS_0 + 4*bar; + lp = (u32 *)(vdev->vconfig + PCI_BASE_ADDRESS_0 + 4*bar); *lp &= (u32)mask; if (pci_resource_flags(pdev, bar) & IORESOURCE_IO) @@ -420,11 +420,12 @@ static void vfio_bar_fixup(struct vfio_dev *vdev) } } - if (pci_resource_start(pdev, PCI_ROM_RESOURCE)) + if (pci_resource_start(pdev, PCI_ROM_RESOURCE)) { mask = ~(pci_resource_len(pdev, PCI_ROM_RESOURCE) - 1); - else + mask |= PCI_ROM_ADDRESS_ENABLE; + } else mask = 0; - lp = (u32 *)vdev->vconfig + PCI_ROM_ADDRESS; + lp = (u32 *)(vdev->vconfig + PCI_ROM_ADDRESS); *lp &= (u32)mask; vdev->bardirty = 0;